Browse Source

Merge pull request #83 from DF1E/master

clean code
master
Anthony Restaino 11 years ago
parent
commit
3647f0b424
  1. BIN
      res/drawable-hdpi/action_search.png
  2. BIN
      res/drawable-mdpi/action_search.png
  3. BIN
      res/drawable-xhdpi/action_search.png
  4. BIN
      res/drawable-xhdpi/edit_text_bg.9.png
  5. 5
      res/layout-large/activity_main.xml
  6. 5
      res/layout-xlarge/activity_main.xml
  7. 5
      res/layout/activity_main.xml
  8. 1104
      res/layout/advanced_settings.xml
  9. 4
      res/values-de/strings.xml
  10. 8
      res/values-sw600dp/dimens.xml
  11. 9
      res/values-sw720dp-land/dimens.xml
  12. 6
      res/values/colors.xml
  13. 55
      src/acr/browser/lightning/BrowserActivity.java
  14. 43
      src/acr/browser/lightning/IncognitoActivity.java
  15. 8
      src/acr/browser/lightning/Utils.java

BIN
res/drawable-hdpi/action_search.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

BIN
res/drawable-mdpi/action_search.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

BIN
res/drawable-xhdpi/action_search.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

BIN
res/drawable-xhdpi/edit_text_bg.9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

5
res/layout-large/activity_main.xml

@ -5,7 +5,6 @@
android:id="@+id/main_layout" android:id="@+id/main_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/gray_medium"
android:orientation="vertical" > android:orientation="vertical" >
<LinearLayout <LinearLayout
@ -58,7 +57,7 @@
android:layout_width="300dp" android:layout_width="300dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:background="#e4e4e4" android:background="@color/drawer_background"
android:clickable="true" android:clickable="true"
android:orientation="vertical" > android:orientation="vertical" >
@ -161,7 +160,7 @@
android:layout_width="300dp" android:layout_width="300dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="end" android:layout_gravity="end"
android:background="#e4e4e4" android:background="@color/drawer_background"
android:clickable="true" android:clickable="true"
android:orientation="vertical" > android:orientation="vertical" >

5
res/layout-xlarge/activity_main.xml

@ -5,7 +5,6 @@
android:id="@+id/main_layout" android:id="@+id/main_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/gray_medium"
android:orientation="vertical" > android:orientation="vertical" >
<LinearLayout <LinearLayout
@ -58,7 +57,7 @@
android:layout_width="300dp" android:layout_width="300dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:background="#e4e4e4" android:background="@color/drawer_background"
android:clickable="true" android:clickable="true"
android:orientation="vertical" > android:orientation="vertical" >
@ -161,7 +160,7 @@
android:layout_width="300dp" android:layout_width="300dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="end" android:layout_gravity="end"
android:background="#e4e4e4" android:background="@color/drawer_background"
android:clickable="true" android:clickable="true"
android:orientation="vertical" > android:orientation="vertical" >

5
res/layout/activity_main.xml

@ -5,7 +5,6 @@
android:id="@+id/main_layout" android:id="@+id/main_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/gray_medium"
android:orientation="vertical" > android:orientation="vertical" >
<LinearLayout <LinearLayout
@ -58,7 +57,7 @@
android:layout_width="240dp" android:layout_width="240dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:background="#e4e4e4" android:background="@color/drawer_background"
android:clickable="true" android:clickable="true"
android:orientation="vertical" > android:orientation="vertical" >
@ -161,7 +160,7 @@
android:layout_width="240dp" android:layout_width="240dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="end" android:layout_gravity="end"
android:background="#e4e4e4" android:background="@color/drawer_background"
android:clickable="true" android:clickable="true"
android:orientation="vertical" > android:orientation="vertical" >

1104
res/layout/advanced_settings.xml

File diff suppressed because it is too large Load Diff

4
res/values-de/strings.xml

@ -19,7 +19,7 @@
<string name="app_name">Lightning</string> <string name="app_name">Lightning</string>
<string name="drawer_open">Navigation-Drawer öffnen</string> <string name="drawer_open">Navigation-Drawer öffnen</string>
<string name="drawer_close">Navigation-Drawer schliessen</string> <string name="drawer_close">Navigation-Drawer schließen</string>
<string name="action_websearch">Websuche</string> <string name="action_websearch">Websuche</string>
<string name="action_refresh">Aktualisieren</string> <string name="action_refresh">Aktualisieren</string>
<string name="action_new_tab">Neuer Tab</string> <string name="action_new_tab">Neuer Tab</string>
@ -145,7 +145,7 @@
<string name="licenses">Open Source-Lizenzen</string> <string name="licenses">Open Source-Lizenzen</string>
<string name="suggestion">Suche nach</string> <string name="suggestion">Suche nach</string>
<string name="block_ads">Werbung blockieren</string> <string name="block_ads">Werbung blockieren</string>
<string name="message_untrusted_certificate">Das Zertifikat dieser Webseite ist nicht vertrauenswürdig. Trozdem fortsetzen?</string> <string name="message_untrusted_certificate">Das Zertifikat dieser Webseite ist nicht vertrauenswürdig. Trotzdem fortsetzen?</string>
<string name="title_form_resubmission">Formularneuzustellung</string> <string name="title_form_resubmission">Formularneuzustellung</string>
<string name="message_form_resubmission">Daten erneut senden?</string> <string name="message_form_resubmission">Daten erneut senden?</string>
<string name="message_location">\nMeine Position verwenden?</string> <string name="message_location">\nMeine Position verwenden?</string>

8
res/values-sw600dp/dimens.xml

@ -1,8 +0,0 @@
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw600dp devices (e.g. 7" tablets) here.
-->
</resources>

9
res/values-sw720dp-land/dimens.xml

@ -1,9 +0,0 @@
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-->
<dimen name="activity_horizontal_margin">128dp</dimen>
</resources>

6
res/values/colors.xml

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="clear">#00000000</color>
<color name="blue">#b433b5e5</color> <color name="drawer_background">#e4e4e4</color>
<color name="press">#3333b5e5</color>
<color name="black">#ff000000</color> <color name="black">#ff000000</color>
<color name="dark">#ff3f3f3f</color>
<color name="light">#ffa0a0a0</color> <color name="light">#ffa0a0a0</color>
<color name="gray_dark">#222222</color> <color name="gray_dark">#222222</color>
<color name="gray_light">#dddddd</color> <color name="gray_light">#dddddd</color>

55
src/acr/browser/lightning/BrowserActivity.java

@ -422,12 +422,6 @@ public class BrowserActivity extends Activity implements BrowserController {
} }
} }
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerSlide(drawerView, slideOffset);
}
}; };
mNewTab.setOnClickListener(new OnClickListener() { mNewTab.setOnClickListener(new OnClickListener() {
@ -456,18 +450,15 @@ public class BrowserActivity extends Activity implements BrowserController {
else else
checkForTor(); checkForTor();
} }
/* /*
* If Orbot/Tor is installed, prompt the user if they want to enable proxying for this session * If Orbot/Tor is installed, prompt the user if they want to enable proxying for this session
*/ */
public boolean checkForTor () public boolean checkForTor () {
{
OrbotHelper oh = new OrbotHelper(this); OrbotHelper oh = new OrbotHelper(this);
if (oh.isOrbotInstalled()) if (oh.isOrbotInstalled()) {
{
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
@ -501,8 +492,7 @@ public class BrowserActivity extends Activity implements BrowserController {
/* /*
* Initialize WebKit Proxying for Tor * Initialize WebKit Proxying for Tor
*/ */
public void initializeTor () public void initializeTor() {
{
OrbotHelper oh = new OrbotHelper(this); OrbotHelper oh = new OrbotHelper(this);
if (!oh.isOrbotRunning()) if (!oh.isOrbotRunning())
@ -539,7 +529,7 @@ public class BrowserActivity extends Activity implements BrowserController {
String mem = mPreferences.getString(PreferenceConstants.URL_MEMORY, String mem = mPreferences.getString(PreferenceConstants.URL_MEMORY,
""); "");
mEditPrefs.putString(PreferenceConstants.URL_MEMORY, ""); mEditPrefs.putString(PreferenceConstants.URL_MEMORY, "");
String[] array = getArray(mem); String[] array = Utils.getArray(mem);
int count = 0; int count = 0;
for (int n = 0; n < array.length; n++) { for (int n = 0; n < array.length; n++) {
if (array[n].length() > 0) { if (array[n].length() > 0) {
@ -558,10 +548,6 @@ public class BrowserActivity extends Activity implements BrowserController {
} }
public static String[] getArray(String input) {
return input.split("\\|\\$\\|SEPARATOR\\|\\$\\|");
}
public void initializePreferences() { public void initializePreferences() {
if (mPreferences == null) { if (mPreferences == null) {
mPreferences = getSharedPreferences( mPreferences = getSharedPreferences(
@ -640,15 +626,6 @@ public class BrowserActivity extends Activity implements BrowserController {
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }
/* Called whenever we call invalidateOptionsMenu() */
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// If the nav drawer is open, hide action items related to the content
// view
return super.onPrepareOptionsMenu(menu);
}
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
// The action bar home/up action should open or close the drawer. // The action bar home/up action should open or close the drawer.
@ -1190,30 +1167,6 @@ public class BrowserActivity extends Activity implements BrowserController {
super.onDestroy(); super.onDestroy();
} }
@Override
protected void onPostResume() {
Log.i("Lightning", "onPostResume");
super.onPostResume();
}
@Override
protected void onRestart() {
Log.i("Lightning", "onRestart");
super.onRestart();
}
@Override
protected void onStart() {
Log.i("Lightning", "onStart");
super.onStart();
}
@Override
protected void onStop() {
Log.i("Lightning", "onStop");
super.onStop();
}
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();

43
src/acr/browser/lightning/IncognitoActivity.java

@ -417,12 +417,6 @@ public class IncognitoActivity extends Activity implements BrowserController {
} }
} }
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerSlide(drawerView, slideOffset);
}
}; };
mNewTab.setOnClickListener(new OnClickListener() { mNewTab.setOnClickListener(new OnClickListener() {
@ -454,10 +448,6 @@ public class IncognitoActivity extends Activity implements BrowserController {
} }
public static String[] getArray(String input) {
return input.split("\\|\\$\\|SEPARATOR\\|\\$\\|");
}
public void initializePreferences() { public void initializePreferences() {
if (mPreferences == null) { if (mPreferences == null) {
mPreferences = getSharedPreferences( mPreferences = getSharedPreferences(
@ -536,15 +526,6 @@ public class IncognitoActivity extends Activity implements BrowserController {
return super.onCreateOptionsMenu(menu); return super.onCreateOptionsMenu(menu);
} }
/* Called whenever we call invalidateOptionsMenu() */
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// If the nav drawer is open, hide action items related to the content
// view
return super.onPrepareOptionsMenu(menu);
}
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
// The action bar home/up action should open or close the drawer. // The action bar home/up action should open or close the drawer.
@ -1071,30 +1052,6 @@ public class IncognitoActivity extends Activity implements BrowserController {
super.onDestroy(); super.onDestroy();
} }
@Override
protected void onPostResume() {
Log.i("Lightning", "onPostResume");
super.onPostResume();
}
@Override
protected void onRestart() {
Log.i("Lightning", "onRestart");
super.onRestart();
}
@Override
protected void onStart() {
Log.i("Lightning", "onStart");
super.onStart();
}
@Override
protected void onStop() {
Log.i("Lightning", "onStop");
super.onStop();
}
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();

8
src/acr/browser/lightning/Utils.java

@ -26,10 +26,6 @@ import android.widget.Toast;
public class Utils { public class Utils {
public Utils() {
// TODO Auto-generated constructor stub
}
public static void downloadFile(final Activity activity, final String url, final String userAgent, final String contentDisposition, final boolean privateBrowsing){ public static void downloadFile(final Activity activity, final String url, final String userAgent, final String contentDisposition, final boolean privateBrowsing){
String fileName = URLUtil.guessFileName(url, null, String fileName = URLUtil.guessFileName(url, null,
null); null);
@ -146,4 +142,8 @@ public class Utils {
} }
return bookmarks; return bookmarks;
} }
public static String[] getArray(String input) {
return input.split("\\|\\$\\|SEPARATOR\\|\\$\\|");
}
} }

Loading…
Cancel
Save