Browse Source

Added Dark Theme to browser. Added options to Reading Mode.

master
Anthony Restaino 10 years ago
parent
commit
a4f0c010d1
  1. BIN
      res/drawable-hdpi/ic_action_delete_dark.png
  2. BIN
      res/drawable-hdpi/ic_action_invert_dark.png
  3. BIN
      res/drawable-hdpi/ic_action_invert_light.png
  4. BIN
      res/drawable-hdpi/ic_action_plus_dark.png
  5. BIN
      res/drawable-hdpi/ic_action_star_dark.png
  6. BIN
      res/drawable-hdpi/ic_action_text_size_dark.png
  7. BIN
      res/drawable-hdpi/ic_action_text_size_light.png
  8. BIN
      res/drawable-hdpi/ic_webpage_dark.png
  9. BIN
      res/drawable-xhdpi/ic_action_delete_dark.png
  10. BIN
      res/drawable-xhdpi/ic_action_invert_dark.png
  11. BIN
      res/drawable-xhdpi/ic_action_invert_light.png
  12. BIN
      res/drawable-xhdpi/ic_action_plus_dark.png
  13. BIN
      res/drawable-xhdpi/ic_action_star_dark.png
  14. BIN
      res/drawable-xhdpi/ic_action_text_size_dark.png
  15. BIN
      res/drawable-xhdpi/ic_action_text_size_light.png
  16. BIN
      res/drawable-xhdpi/ic_webpage_dark.png
  17. BIN
      res/drawable-xxhdpi/ic_action_delete_dark.png
  18. BIN
      res/drawable-xxhdpi/ic_action_invert_dark.png
  19. BIN
      res/drawable-xxhdpi/ic_action_invert_light.png
  20. BIN
      res/drawable-xxhdpi/ic_action_plus_dark.png
  21. BIN
      res/drawable-xxhdpi/ic_action_star_dark.png
  22. BIN
      res/drawable-xxhdpi/ic_action_text_size_dark.png
  23. BIN
      res/drawable-xxhdpi/ic_action_text_size_light.png
  24. BIN
      res/drawable-xxhdpi/ic_webpage_dark.png
  25. 19
      res/drawable/toolbar_elevate_dark.xml
  26. 6
      res/layout/about_settings.xml
  27. 12
      res/layout/advanced_settings.xml
  28. 9
      res/layout/bookmark_drawer.xml
  29. 3
      res/layout/bookmark_list_item.xml
  30. 6
      res/layout/bookmark_settings.xml
  31. 47
      res/layout/display_settings.xml
  32. 10
      res/layout/general_settings.xml
  33. 12
      res/layout/license_activity.xml
  34. 20
      res/layout/privacy_settings.xml
  35. 13
      res/layout/seek_layout.xml
  36. 24
      res/layout/settings.xml
  37. 17
      res/layout/tab_drawer.xml
  38. 5
      res/layout/tab_list_item.xml
  39. 18
      res/menu/reading.xml
  40. BIN
      res/mipmap-mdpi/ic_launcher.png
  41. 29
      res/values-v21/styles.xml
  42. 7
      res/values/attr.xml
  43. 9
      res/values/colors.xml
  44. 3
      res/values/strings.xml
  45. 30
      res/values/styles.xml
  46. 5
      src/acr/browser/lightning/AboutSettingsActivity.java
  47. 5
      src/acr/browser/lightning/AdvancedSettingsActivity.java
  48. 6
      src/acr/browser/lightning/BookmarkActivity.java
  49. 30
      src/acr/browser/lightning/BrowserActivity.java
  50. 81
      src/acr/browser/lightning/DisplaySettingsActivity.java
  51. 5
      src/acr/browser/lightning/GeneralSettingsActivity.java
  52. 5
      src/acr/browser/lightning/LicenseActivity.java
  53. 26
      src/acr/browser/lightning/LightningView.java
  54. 17
      src/acr/browser/lightning/MainActivity.java
  55. 5
      src/acr/browser/lightning/PrivacySettingsActivity.java
  56. 113
      src/acr/browser/lightning/ReadingActivity.java
  57. 16
      src/acr/browser/lightning/SearchAdapter.java
  58. 45
      src/acr/browser/lightning/SettingsActivity.java

BIN
res/drawable-hdpi/ic_action_delete_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

BIN
res/drawable-hdpi/ic_action_invert_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

BIN
res/drawable-hdpi/ic_action_invert_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

BIN
res/drawable-hdpi/ic_action_plus_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

BIN
res/drawable-hdpi/ic_action_star_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

BIN
res/drawable-hdpi/ic_action_text_size_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

BIN
res/drawable-hdpi/ic_action_text_size_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

BIN
res/drawable-hdpi/ic_webpage_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

BIN
res/drawable-xhdpi/ic_action_delete_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

BIN
res/drawable-xhdpi/ic_action_invert_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

BIN
res/drawable-xhdpi/ic_action_invert_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

BIN
res/drawable-xhdpi/ic_action_plus_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

BIN
res/drawable-xhdpi/ic_action_star_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

BIN
res/drawable-xhdpi/ic_action_text_size_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

BIN
res/drawable-xhdpi/ic_action_text_size_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

BIN
res/drawable-xhdpi/ic_webpage_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

BIN
res/drawable-xxhdpi/ic_action_delete_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

BIN
res/drawable-xxhdpi/ic_action_invert_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

BIN
res/drawable-xxhdpi/ic_action_invert_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

BIN
res/drawable-xxhdpi/ic_action_plus_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

BIN
res/drawable-xxhdpi/ic_action_star_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
res/drawable-xxhdpi/ic_action_text_size_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

BIN
res/drawable-xxhdpi/ic_action_text_size_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

BIN
res/drawable-xxhdpi/ic_webpage_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

19
res/drawable/toolbar_elevate_dark.xml

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape
android:shape="rectangle" >
<solid android:color="@color/secondary_color_settings_dark" />
</shape>
</item>
<item android:bottom="1dp">
<shape
android:shape="rectangle" >
<solid android:color="@color/primary_color_dark" />
</shape>
</item>
</layer-list>

6
res/layout/about_settings.xml

@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutLicense"
@ -89,7 +89,7 @@ @@ -89,7 +89,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutVersion"
@ -130,7 +130,7 @@ @@ -130,7 +130,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
</LinearLayout>
</ScrollView>

12
res/layout/advanced_settings.xml

@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rAllowCookies"
@ -116,7 +116,7 @@ @@ -116,7 +116,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rAllowIncognitoCookies"
@ -157,7 +157,7 @@ @@ -157,7 +157,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rRestoreTabs"
@ -192,7 +192,7 @@ @@ -192,7 +192,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/layoutRendering"
@ -226,7 +226,7 @@ @@ -226,7 +226,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/rUrlBarContents"
@ -260,7 +260,7 @@ @@ -260,7 +260,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
</LinearLayout>
</ScrollView>

9
res/layout/bookmark_drawer.xml

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
android:layout_width="@dimen/navigation_width"
android:layout_height="match_parent"
android:layout_gravity="end"
android:background="@color/drawer_background"
android:background="?attr/drawerBackground"
android:clickable="true"
android:fitsSystemWindows="true"
android:orientation="vertical" >
@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
android:layout_marginRight="16dp"
android:contentDescription="Favicon"
android:gravity="center_vertical"
android:src="@drawable/ic_action_star" >
android:src="?attr/starDrawable" >
</ImageView>
<TextView
@ -41,14 +41,13 @@ @@ -41,14 +41,13 @@
android:maxLines="1"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:text="@string/action_bookmarks"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="@color/black" />
android:textAppearance="?android:attr/textAppearanceListItemSmall" />
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/gray_list_bg" />
android:background="?attr/dividerColor" />
<ListView
android:id="@+id/right_drawer_list"

3
res/layout/bookmark_list_item.xml

@ -27,7 +27,6 @@ @@ -27,7 +27,6 @@
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingRight="16dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="@color/dark_text" />
android:textAppearance="?android:attr/textAppearanceListItemSmall" />
</LinearLayout>

6
res/layout/bookmark_settings.xml

@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/importBackup"
@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/importFromBrowser"
@ -88,6 +88,6 @@ @@ -88,6 +88,6 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
</LinearLayout>

47
res/layout/display_settings.xml

@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rFullScreen"
@ -84,8 +84,43 @@ @@ -84,8 +84,43 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rDarkTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/listChoiceBackgroundIndicator"
android:minHeight="60dp"
android:paddingBottom="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="16dp"
android:paddingRight="30dp"
android:text="@string/dark_theme"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/cbDarkTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rWideViewPort"
android:layout_width="match_parent"
@ -135,7 +170,7 @@ @@ -135,7 +170,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rOverView"
@ -186,7 +221,7 @@ @@ -186,7 +221,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rTextReflow"
@ -221,7 +256,7 @@ @@ -221,7 +256,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rTextSize"
@ -247,7 +282,7 @@ @@ -247,7 +282,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
</LinearLayout>
</ScrollView>

10
res/layout/general_settings.xml

@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutDownload"
@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutHomepage"
@ -140,7 +140,7 @@ @@ -140,7 +140,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutSearch"
@ -181,7 +181,7 @@ @@ -181,7 +181,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rGoogleSuggestions"
@ -231,7 +231,7 @@ @@ -231,7 +231,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
</LinearLayout>
</ScrollView>

12
res/layout/license_activity.xml

@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/licenseAOSP"
@ -67,7 +67,7 @@ @@ -67,7 +67,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/licenseHosts"
@ -99,7 +99,7 @@ @@ -99,7 +99,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/licenseOrbot"
@ -131,7 +131,7 @@ @@ -131,7 +131,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/licenseSnactory"
@ -163,7 +163,7 @@ @@ -163,7 +163,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/licenseJsoup"
@ -195,6 +195,6 @@ @@ -195,6 +195,6 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
</LinearLayout>

20
res/layout/privacy_settings.xml

@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rThirdParty"
@ -85,7 +85,7 @@ @@ -85,7 +85,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rSavePasswords"
@ -137,7 +137,7 @@ @@ -137,7 +137,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rClearCacheExit"
@ -173,7 +173,7 @@ @@ -173,7 +173,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rClearHistoryExit"
@ -208,7 +208,7 @@ @@ -208,7 +208,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rClearCookiesExit"
@ -243,7 +243,7 @@ @@ -243,7 +243,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rBrowserHistory"
@ -293,7 +293,7 @@ @@ -293,7 +293,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rClearCache"
@ -319,7 +319,7 @@ @@ -319,7 +319,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rClearHistory"
@ -345,7 +345,7 @@ @@ -345,7 +345,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/rClearCookies"
@ -371,7 +371,7 @@ @@ -371,7 +371,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
</LinearLayout>
</ScrollView>

13
res/layout/seek_layout.xml

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<SeekBar
android:id="@+id/text_size_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" />
</LinearLayout>

24
res/layout/settings.xml

@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutAdBlock"
@ -85,7 +85,7 @@ @@ -85,7 +85,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutImages"
@ -121,7 +121,7 @@ @@ -121,7 +121,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutEnableJS"
@ -157,7 +157,7 @@ @@ -157,7 +157,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutUseOrbot"
@ -192,7 +192,7 @@ @@ -192,7 +192,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutColorMode"
@ -227,7 +227,7 @@ @@ -227,7 +227,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutGeneral"
@ -254,7 +254,7 @@ @@ -254,7 +254,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutBookmarks"
@ -280,7 +280,7 @@ @@ -280,7 +280,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutDisplay"
@ -307,7 +307,7 @@ @@ -307,7 +307,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutPrivacy"
@ -334,7 +334,7 @@ @@ -334,7 +334,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutAdvanced"
@ -361,7 +361,7 @@ @@ -361,7 +361,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
<RelativeLayout
android:id="@+id/layoutAbout"
@ -403,7 +403,7 @@ @@ -403,7 +403,7 @@
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#cdcdcd" />
android:background="?attr/dividerColor" />
</LinearLayout>
</ScrollView>

17
res/layout/tab_drawer.xml

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
android:layout_width="@dimen/navigation_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/drawer_background"
android:background="?drawerBackground"
android:clickable="true"
android:fitsSystemWindows="true"
android:orientation="vertical" >
@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
android:layout_marginRight="16dp"
android:contentDescription="@string/action_new_tab"
android:gravity="center_vertical"
android:src="@drawable/ic_action_plus" >
android:src="?attr/plusDrawable" >
</ImageView>
<TextView
@ -40,15 +40,14 @@ @@ -40,15 +40,14 @@
android:maxLines="1"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:text="@string/action_new_tab"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="@color/black" />
android:textAppearance="?android:attr/textAppearanceListItemSmall" />
</RelativeLayout>
<View
android:id="@+id/view"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/gray_list_bg" />
android:background="?attr/dividerColor" />
<ListView
android:id="@+id/left_drawer_list"
@ -63,12 +62,12 @@ @@ -63,12 +62,12 @@
android:id="@+id/lineView"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/gray_list_bg" />
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="?attr/actionBarSize"
android:baselineAligned="false"
android:orientation="horizontal"
android:weightSum="2" >
@ -90,7 +89,7 @@ @@ -90,7 +89,7 @@
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingTop="4dp"
android:src="@drawable/ic_action_back" />
android:src="?attr/arrowBackDrawable" />
</RelativeLayout>
<RelativeLayout
@ -110,7 +109,7 @@ @@ -110,7 +109,7 @@
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingTop="4dp"
android:src="@drawable/ic_action_forward" />
android:src="?attr/arrowForwardDrawable" />
</RelativeLayout>
</LinearLayout>

5
res/layout/tab_list_item.xml

@ -31,8 +31,7 @@ @@ -31,8 +31,7 @@
android:maxLines="1"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="@color/dark_text" />
android:textAppearance="?android:attr/textAppearanceListItemSmall" />
<ImageView
android:id="@+id/deleteButton"
@ -46,7 +45,7 @@ @@ -46,7 +45,7 @@
android:contentDescription="Delete Tab"
android:gravity="center_vertical"
android:padding="3dp"
android:src="@drawable/ic_action_delete" >
android:src="?attr/deleteDrawable" >
</ImageView>
</RelativeLayout>

18
res/menu/reading.xml

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/invert_item"
android:icon="?attr/invertColorDrawable"
android:title="@string/invert_color"
app:showAsAction="ifRoom">
</item>
<item
android:id="@+id/text_size_item"
android:icon="?attr/textSizeDrawable"
android:title="@string/size"
app:showAsAction="ifRoom">
</item>
</menu>

BIN
res/mipmap-mdpi/ic_launcher.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

29
res/values-v21/styles.xml

@ -12,6 +12,25 @@ @@ -12,6 +12,25 @@
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="invertColorDrawable">@drawable/ic_action_invert_light</item>
<item name="textSizeDrawable">@drawable/ic_action_text_size_light</item>
<item name="dividerColor">@color/divider_light</item>
</style>
<style name="Theme.SettingsTheme.Dark" parent="Theme.AppCompat">
<!-- customize the color palette -->
<item name="toolbarSettingsBackground">@color/primary_color_dark</item>
<item name="listBackground">@drawable/list_bg</item>
<item name="colorPrimary">@color/primary_color_dark</item>
<item name="colorPrimaryDark">@color/secondary_color_settings_dark</item>
<item name="colorAccent">@color/accent_color</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="invertColorDrawable">@drawable/ic_action_invert_dark</item>
<item name="textSizeDrawable">@drawable/ic_action_text_size_dark</item>
<item name="dividerColor">@color/divider_dark</item>
</style>
<style name="Theme.LightTheme" parent="Theme.AppCompat.Light">
@ -33,6 +52,11 @@ @@ -33,6 +52,11 @@
<item name="arrowBackDrawable">@drawable/ic_action_back</item>
<item name="arrowForwardDrawable">@drawable/ic_action_forward</item>
<item name="actionOverflowButtonStyle">@style/overFlowButtonStyle</item>
<item name="drawerBackground">@color/drawer_background</item>
<item name="plusDrawable">@drawable/ic_action_plus</item>
<item name="deleteDrawable">@drawable/ic_action_delete</item>
<item name="starDrawable">@drawable/ic_action_star</item>
<item name="dividerColor">@color/divider_light</item>
</style>
<style name="Theme.DarkTheme" parent="Theme.AppCompat">
@ -54,6 +78,11 @@ @@ -54,6 +78,11 @@
<item name="arrowBackDrawable">@drawable/ic_action_back_dark</item>
<item name="arrowForwardDrawable">@drawable/ic_action_forward_dark</item>
<item name="actionOverflowButtonStyle">@style/overFlowButtonStyle</item>
<item name="drawerBackground">@color/drawer_background_dark</item>
<item name="plusDrawable">@drawable/ic_action_plus_dark</item>
<item name="deleteDrawable">@drawable/ic_action_delete_dark</item>
<item name="starDrawable">@drawable/ic_action_star_dark</item>
<item name="dividerColor">@color/divider_dark</item>
</style>
</resources>

7
res/values/attr.xml

@ -10,6 +10,13 @@ @@ -10,6 +10,13 @@
<attr name="progressBackgroundColor" format="color" />
<attr name="searchBackground" format="reference|color" />
<attr name="toolbarSettingsBackground" format="reference|color" />
<attr name="invertColorDrawable" format="integer" />
<attr name="textSizeDrawable" format="integer" />
<attr name="drawerBackground" format="reference|color" />
<attr name="plusDrawable" format="reference|color" />
<attr name="deleteDrawable" format="reference|color" />
<attr name="starDrawable" format="reference|color" />
<attr name="dividerColor" format="reference|color" />
<declare-styleable name="AnimatedProgressBar">
<attr name="progressColor" format="color" />

9
res/values/colors.xml

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="drawer_background">#ffffff</color>
<color name="black">#ff000000</color>
<color name="light">#ffa0a0a0</color>
<color name="gray_dark">#222222</color>
@ -16,9 +15,17 @@ @@ -16,9 +15,17 @@
<color name="secondary_color">#4D000000</color>
<color name="accent_color">#0073EF</color>
<color name="drawer_background">#ffffff</color>
<color name="drawer_background_dark">#424242</color>
<color name="secondary_color_settings">#9C9C9C</color>
<color name="secondary_color_settings_dark">#2E2E2E</color>
<color name="hint_text">#BDBDBD</color>
<color name="primary_color_dark">#424242</color>
<color name="divider_dark">#1EFFFFFF</color>
<color name="divider_light">#1E000000</color>
</resources>

3
res/values/strings.xml

@ -210,4 +210,7 @@ @@ -210,4 +210,7 @@
<item >URL</item>
<item >Title</item>
</string-array>
<string name="invert_color">Invert color</string>
<string name="dark_theme">Use Dark Theme</string>
<string name="change_after_restart">The theme change will take effect after you restart the browser.</string>
</resources>

30
res/values/styles.xml

@ -12,6 +12,25 @@ @@ -12,6 +12,25 @@
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="invertColorDrawable">@drawable/ic_action_invert_light</item>
<item name="textSizeDrawable">@drawable/ic_action_text_size_light</item>
<item name="dividerColor">@color/divider_light</item>
</style>
<style name="Theme.SettingsTheme.Dark" parent="Theme.AppCompat">
<!-- customize the color palette -->
<item name="toolbarSettingsBackground">@drawable/toolbar_elevate_dark</item>
<item name="listBackground">@drawable/list_bg</item>
<item name="colorPrimary">@color/primary_color_dark</item>
<item name="colorPrimaryDark">@color/secondary_color_settings_dark</item>
<item name="colorAccent">@color/accent_color</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="invertColorDrawable">@drawable/ic_action_invert_dark</item>
<item name="textSizeDrawable">@drawable/ic_action_text_size_dark</item>
<item name="dividerColor">@color/divider_dark</item>
</style>
<style name="Theme.LightTheme" parent="Theme.AppCompat.Light">
@ -33,6 +52,11 @@ @@ -33,6 +52,11 @@
<item name="arrowBackDrawable">@drawable/ic_action_back</item>
<item name="arrowForwardDrawable">@drawable/ic_action_forward</item>
<item name="actionOverflowButtonStyle">@style/overFlowButtonStyle</item>
<item name="drawerBackground">@color/drawer_background</item>
<item name="plusDrawable">@drawable/ic_action_plus</item>
<item name="deleteDrawable">@drawable/ic_action_delete</item>
<item name="starDrawable">@drawable/ic_action_star</item>
<item name="dividerColor">@color/divider_light</item>
</style>
<style name="Theme.DarkTheme" parent="Theme.AppCompat">
@ -54,6 +78,11 @@ @@ -54,6 +78,11 @@
<item name="arrowBackDrawable">@drawable/ic_action_back_dark</item>
<item name="arrowForwardDrawable">@drawable/ic_action_forward_dark</item>
<item name="actionOverflowButtonStyle">@style/overFlowButtonStyle</item>
<item name="drawerBackground">@color/drawer_background_dark</item>
<item name="plusDrawable">@drawable/ic_action_plus_dark</item>
<item name="deleteDrawable">@drawable/ic_action_delete_dark</item>
<item name="starDrawable">@drawable/ic_action_star_dark</item>
<item name="dividerColor">@color/divider_dark</item>
</style>
<style name="overFlowButtonStyle" parent="@style/Widget.AppCompat.ActionButton.Overflow">
@ -70,5 +99,4 @@ @@ -70,5 +99,4 @@
<item name="android:fontFamily">sans-serif-light</item>
</style>
</resources>

5
src/acr/browser/lightning/AboutSettingsActivity.java

@ -28,6 +28,10 @@ public class AboutSettingsActivity extends ActionBarActivity { @@ -28,6 +28,10 @@ public class AboutSettingsActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false)) {
this.setTheme(R.style.Theme_SettingsTheme_Dark);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.about_settings);
@ -37,7 +41,6 @@ public class AboutSettingsActivity extends ActionBarActivity { @@ -37,7 +41,6 @@ public class AboutSettingsActivity extends ActionBarActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

5
src/acr/browser/lightning/AdvancedSettingsActivity.java

@ -34,6 +34,10 @@ public class AdvancedSettingsActivity extends ActionBarActivity { @@ -34,6 +34,10 @@ public class AdvancedSettingsActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false)) {
this.setTheme(R.style.Theme_SettingsTheme_Dark);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.advanced_settings);
@ -43,7 +47,6 @@ public class AdvancedSettingsActivity extends ActionBarActivity { @@ -43,7 +47,6 @@ public class AdvancedSettingsActivity extends ActionBarActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

6
src/acr/browser/lightning/BookmarkActivity.java

@ -31,6 +31,10 @@ public class BookmarkActivity extends ActionBarActivity implements OnClickListen @@ -31,6 +31,10 @@ public class BookmarkActivity extends ActionBarActivity implements OnClickListen
@Override
public void onCreate(Bundle savedInstanceState) {
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false)) {
this.setTheme(R.style.Theme_SettingsTheme_Dark);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.bookmark_settings);
@ -48,8 +52,6 @@ public class BookmarkActivity extends ActionBarActivity implements OnClickListen @@ -48,8 +52,6 @@ public class BookmarkActivity extends ActionBarActivity implements OnClickListen
mBookmarkManager = new BookmarkManager(this);
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
mSystemBrowser = mPreferences.getBoolean(PreferenceConstants.SYSTEM_BROWSER_PRESENT, false);
exportBackup.setOnClickListener(this);

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

@ -129,6 +129,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -129,6 +129,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
private static LayoutParams mMatchParent = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
private BookmarkManager mBookmarkManager;
private boolean mDarkTheme;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -145,6 +146,8 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -145,6 +146,8 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
setSupportActionBar(mToolbar);
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
mDarkTheme = mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false)
|| isIncognito();
mContext = this;
if (mWebViews != null) {
mWebViews.clear();
@ -184,7 +187,12 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -184,7 +187,12 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
setNavigationDrawerWidth();
mDrawerLayout.setDrawerListener(new DrawerLocker());
mWebpageBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_webpage);
if (mDarkTheme) {
mWebpageBitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.ic_webpage_dark);
} else {
mWebpageBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_webpage);
}
mActionBar = getSupportActionBar();
mHomepage = mPreferences.getString(PreferenceConstants.HOMEPAGE, Constants.HOMEPAGE);
@ -218,15 +226,10 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -218,15 +226,10 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
lp.width = LayoutParams.MATCH_PARENT;
v.setLayoutParams(lp);
// TODO
mArrowDrawable = new DrawerArrowDrawable(this);
mArrowImage = (ImageView) mActionBar.getCustomView().findViewById(R.id.arrow);
mArrowImage.setLayerType(View.LAYER_TYPE_HARDWARE, null); // Use a
// hardware
// layer for
// the
// animation
// Use hardware acceleration for the animation
mArrowImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mArrowImage.setImageDrawable(mArrowDrawable);
LinearLayout arrowButton = (LinearLayout) mActionBar.getCustomView().findViewById(
R.id.arrow_button);
@ -771,11 +774,14 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -771,11 +774,14 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
}
mFullScreen = mPreferences.getBoolean(PreferenceConstants.FULL_SCREEN, false);
mColorMode = mPreferences.getBoolean(PreferenceConstants.ENABLE_COLOR_MODE, true);
mColorMode &= !mDarkTheme;
if (!isIncognito() && !mColorMode && mWebpageBitmap != null)
if (!isIncognito() && !mColorMode && !mDarkTheme && mWebpageBitmap != null) {
changeToolbarBackground(mWebpageBitmap);
else if (!isIncognito() && mCurrentView != null && mCurrentView.getFavicon() != null)
} else if (!isIncognito() && mCurrentView != null && !mDarkTheme
&& mCurrentView.getFavicon() != null) {
changeToolbarBackground(mCurrentView.getFavicon());
}
if (mFullScreen && mBrowserFrame.findViewById(R.id.toolbar_layout) == null) {
mUiLayout.removeView(mToolbarLayout);
@ -1287,7 +1293,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -1287,7 +1293,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
protected synchronized boolean newTab(String url, boolean show) {
mIsNewIntent = false;
LightningView startingTab = new LightningView(mActivity, url);
LightningView startingTab = new LightningView(mActivity, url, mDarkTheme);
if (mIdGenerator == 0) {
startingTab.resumeTimers();
}
@ -2064,7 +2070,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl @@ -2064,7 +2070,7 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
});
getUrl.setSelectAllOnFocus(true);
mSearchAdapter = new SearchAdapter(mContext, isIncognito());
mSearchAdapter = new SearchAdapter(mContext, isIncognito() || mDarkTheme);
getUrl.setAdapter(mSearchAdapter);
}

81
src/acr/browser/lightning/DisplaySettingsActivity.java

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
*/
package acr.browser.lightning;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
@ -22,30 +23,31 @@ public class DisplaySettingsActivity extends ActionBarActivity { @@ -22,30 +23,31 @@ public class DisplaySettingsActivity extends ActionBarActivity {
// mPreferences variables
private SharedPreferences mPreferences;
private SharedPreferences.Editor mEditPrefs;
private CheckBox cbHideStatusBar, cbFullScreen, cbWideViewPort, cbOverView, cbTextReflow;
private CheckBox cbHideStatusBar, cbFullScreen, cbWideViewPort, cbOverView, cbTextReflow,
cbDarkTheme;
private Activity mActivity;
@Override
protected void onCreate(Bundle savedInstanceState) {
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false)) {
this.setTheme(R.style.Theme_SettingsTheme_Dark);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.display_settings);
mActivity = this;
// set up ActionBar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
// TODO WARNING: SharedPreferences.edit() without a corresponding
// commit() or apply() call
mEditPrefs = mPreferences.edit();
initialize();
}
@ -57,7 +59,7 @@ public class DisplaySettingsActivity extends ActionBarActivity { @@ -57,7 +59,7 @@ public class DisplaySettingsActivity extends ActionBarActivity {
private void initialize() {
RelativeLayout rHideStatusBar, rFullScreen, rWideViewPort, rOverView, rTextReflow, rTextSize;
RelativeLayout rHideStatusBar, rFullScreen, rWideViewPort, rOverView, rTextReflow, rTextSize, rDarkTheme;
rHideStatusBar = (RelativeLayout) findViewById(R.id.rHideStatusBar);
rFullScreen = (RelativeLayout) findViewById(R.id.rFullScreen);
@ -65,18 +67,23 @@ public class DisplaySettingsActivity extends ActionBarActivity { @@ -65,18 +67,23 @@ public class DisplaySettingsActivity extends ActionBarActivity {
rOverView = (RelativeLayout) findViewById(R.id.rOverView);
rTextReflow = (RelativeLayout) findViewById(R.id.rTextReflow);
rTextSize = (RelativeLayout) findViewById(R.id.rTextSize);
rDarkTheme = (RelativeLayout) findViewById(R.id.rDarkTheme);
cbHideStatusBar = (CheckBox) findViewById(R.id.cbHideStatusBar);
cbFullScreen = (CheckBox) findViewById(R.id.cbFullScreen);
cbWideViewPort = (CheckBox) findViewById(R.id.cbWideViewPort);
cbOverView = (CheckBox) findViewById(R.id.cbOverView);
cbTextReflow = (CheckBox) findViewById(R.id.cbTextReflow);
cbDarkTheme = (CheckBox) findViewById(R.id.cbDarkTheme);
cbHideStatusBar.setChecked(mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false));
cbHideStatusBar.setChecked(mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR,
false));
cbFullScreen.setChecked(mPreferences.getBoolean(PreferenceConstants.FULL_SCREEN, false));
cbWideViewPort.setChecked(mPreferences.getBoolean(PreferenceConstants.USE_WIDE_VIEWPORT, true));
cbWideViewPort.setChecked(mPreferences.getBoolean(PreferenceConstants.USE_WIDE_VIEWPORT,
true));
cbOverView.setChecked(mPreferences.getBoolean(PreferenceConstants.OVERVIEW_MODE, true));
cbTextReflow.setChecked(mPreferences.getBoolean(PreferenceConstants.TEXT_REFLOW, false));
cbDarkTheme.setChecked(mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false));
rHideStatusBar(rHideStatusBar);
rFullScreen(rFullScreen);
@ -84,11 +91,13 @@ public class DisplaySettingsActivity extends ActionBarActivity { @@ -84,11 +91,13 @@ public class DisplaySettingsActivity extends ActionBarActivity {
rOverView(rOverView);
rTextReflow(rTextReflow);
rTextSize(rTextSize);
rDarkTheme(rDarkTheme);
cbHideStatusBar(cbHideStatusBar);
cbFullScreen(cbFullScreen);
cbWideViewPort(cbWideViewPort);
cbOverView(cbOverView);
cbTextReflow(cbTextReflow);
cbDarkTheme(cbDarkTheme);
}
private void cbHideStatusBar(CheckBox view) {
@ -96,8 +105,8 @@ public class DisplaySettingsActivity extends ActionBarActivity { @@ -96,8 +105,8 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.HIDE_STATUS_BAR, isChecked);
mEditPrefs.apply();
mPreferences.edit().putBoolean(PreferenceConstants.HIDE_STATUS_BAR, isChecked)
.apply();
}
});
@ -108,21 +117,31 @@ public class DisplaySettingsActivity extends ActionBarActivity { @@ -108,21 +117,31 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.FULL_SCREEN, isChecked);
mEditPrefs.apply();
mPreferences.edit().putBoolean(PreferenceConstants.FULL_SCREEN, isChecked).apply();
}
});
}
private void cbDarkTheme(CheckBox view) {
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPreferences.edit().putBoolean(PreferenceConstants.DARK_THEME, isChecked).apply();
mActivity.recreate();
}
});
}
private void cbWideViewPort(CheckBox view) {
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.USE_WIDE_VIEWPORT, isChecked);
mEditPrefs.apply();
mPreferences.edit().putBoolean(PreferenceConstants.USE_WIDE_VIEWPORT, isChecked)
.apply();
}
});
@ -133,8 +152,8 @@ public class DisplaySettingsActivity extends ActionBarActivity { @@ -133,8 +152,8 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.OVERVIEW_MODE, isChecked);
mEditPrefs.apply();
mPreferences.edit().putBoolean(PreferenceConstants.OVERVIEW_MODE, isChecked)
.apply();
}
});
@ -145,8 +164,7 @@ public class DisplaySettingsActivity extends ActionBarActivity { @@ -145,8 +164,7 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditPrefs.putBoolean(PreferenceConstants.TEXT_REFLOW, isChecked);
mEditPrefs.apply();
mPreferences.edit().putBoolean(PreferenceConstants.TEXT_REFLOW, isChecked).apply();
}
});
}
@ -173,6 +191,17 @@ public class DisplaySettingsActivity extends ActionBarActivity { @@ -173,6 +191,17 @@ public class DisplaySettingsActivity extends ActionBarActivity {
});
}
private void rDarkTheme(RelativeLayout view) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
cbDarkTheme.setChecked(!cbDarkTheme.isChecked());
}
});
}
private void rWideViewPort(RelativeLayout view) {
view.setOnClickListener(new OnClickListener() {
@ -224,8 +253,8 @@ public class DisplaySettingsActivity extends ActionBarActivity { @@ -224,8 +253,8 @@ public class DisplaySettingsActivity extends ActionBarActivity {
@Override
public void onClick(DialogInterface dialog, int which) {
mEditPrefs.putInt(PreferenceConstants.TEXT_SIZE, which + 1);
mEditPrefs.apply();
mPreferences.edit()
.putInt(PreferenceConstants.TEXT_SIZE, which + 1).apply();
}
});

5
src/acr/browser/lightning/GeneralSettingsActivity.java

@ -44,6 +44,10 @@ public class GeneralSettingsActivity extends ActionBarActivity { @@ -44,6 +44,10 @@ public class GeneralSettingsActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false)) {
this.setTheme(R.style.Theme_SettingsTheme_Dark);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.general_settings);
@ -53,7 +57,6 @@ public class GeneralSettingsActivity extends ActionBarActivity { @@ -53,7 +57,6 @@ public class GeneralSettingsActivity extends ActionBarActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

5
src/acr/browser/lightning/LicenseActivity.java

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
package acr.browser.lightning;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
@ -20,6 +21,10 @@ public class LicenseActivity extends ActionBarActivity implements View.OnClickLi @@ -20,6 +21,10 @@ public class LicenseActivity extends ActionBarActivity implements View.OnClickLi
@Override
protected void onCreate(Bundle savedInstanceState) {
SharedPreferences preferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (preferences.getBoolean(PreferenceConstants.DARK_THEME, false)) {
this.setTheme(R.style.Theme_SettingsTheme_Dark);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.license_activity);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

26
src/acr/browser/lightning/LightningView.java

@ -81,15 +81,20 @@ public class LightningView { @@ -81,15 +81,20 @@ public class LightningView {
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
public LightningView(Activity activity, String url) {
public LightningView(Activity activity, String url, boolean darkTheme) {
mActivity = activity;
mWebView = new WebView(activity);
mTitle = new Title(activity);
mTitle = new Title(activity, darkTheme);
mAdBlock = new AdBlock(activity);
mWebpageBitmap = BitmapFactory.decodeResource(activity.getResources(),
R.drawable.ic_webpage);
if (darkTheme) {
mWebpageBitmap = BitmapFactory.decodeResource(activity.getResources(),
R.drawable.ic_webpage_dark);
} else {
mWebpageBitmap = BitmapFactory.decodeResource(activity.getResources(),
R.drawable.ic_webpage);
}
try {
mBrowserController = (BrowserController) activity;
@ -1007,14 +1012,17 @@ public class LightningView { @@ -1007,14 +1012,17 @@ public class LightningView {
public class Title {
private Bitmap mFavicon;
private String mTitle;
private Bitmap mDefaultIcon;
public Title(Context context) {
mDefaultIcon = BitmapFactory.decodeResource(context.getResources(),
R.drawable.ic_webpage);
public Title(Context context, boolean darkTheme) {
if (darkTheme) {
mDefaultIcon = BitmapFactory.decodeResource(context.getResources(),
R.drawable.ic_webpage_dark);
} else {
mDefaultIcon = BitmapFactory.decodeResource(context.getResources(),
R.drawable.ic_webpage);
}
mFavicon = mDefaultIcon;
mTitle = mActivity.getString(R.string.action_new_tab);
}

17
src/acr/browser/lightning/MainActivity.java

@ -12,13 +12,17 @@ import android.webkit.CookieSyncManager; @@ -12,13 +12,17 @@ import android.webkit.CookieSyncManager;
public class MainActivity extends BrowserActivity {
SharedPreferences mPreferences;
CookieManager mCookieManager;
private boolean mDark;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
mDark = mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false);
if (mDark) {
this.setTheme(R.style.Theme_DarkTheme);
}
super.onCreate(savedInstanceState);
}
@Override
@ -58,6 +62,15 @@ public class MainActivity extends BrowserActivity { @@ -58,6 +62,15 @@ public class MainActivity extends BrowserActivity {
saveOpenTabs();
}
@Override
protected void onResume() {
super.onResume();
if (mPreferences != null
&& mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false) != mDark) {
this.recreate();
}
}
@Override
public void updateHistory(String title, String url) {
super.updateHistory(title, url);

5
src/acr/browser/lightning/PrivacySettingsActivity.java

@ -39,6 +39,10 @@ public class PrivacySettingsActivity extends ActionBarActivity { @@ -39,6 +39,10 @@ public class PrivacySettingsActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false)) {
this.setTheme(R.style.Theme_SettingsTheme_Dark);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.privacy_settings);
@ -48,7 +52,6 @@ public class PrivacySettingsActivity extends ActionBarActivity { @@ -48,7 +52,6 @@ public class PrivacySettingsActivity extends ActionBarActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

113
src/acr/browser/lightning/ReadingActivity.java

@ -6,27 +6,50 @@ import java.util.List; @@ -6,27 +6,50 @@ import java.util.List;
import acr.browser.lightning.reading.HtmlFetcher;
import acr.browser.lightning.reading.JResult;
import android.animation.ObjectAnimator;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
public class ReadingActivity extends ActionBarActivity {
private TextView mTitle;
private TextView mBody;
private boolean mInvert;
private String mUrl = null;
private SharedPreferences mPreferences;
private int mTextSize;
private static final float XXLARGE = 30.0f;
private static final float XLARGE = 26.0f;
private static final float LARGE = 22.0f;
private static final float MEDIUM = 18.0f;
private static final float SMALL = 14.0f;
private static final float XSMALL = 10.0f;
@Override
protected void onCreate(Bundle savedInstanceState) {
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
boolean initInvert = mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false);
mInvert = mPreferences.getBoolean(PreferenceConstants.INVERT_COLORS, initInvert);
if (mInvert) {
this.setTheme(R.style.Theme_SettingsTheme_Dark);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.reading_view);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
@ -35,6 +58,8 @@ public class ReadingActivity extends ActionBarActivity { @@ -35,6 +58,8 @@ public class ReadingActivity extends ActionBarActivity {
mTitle = (TextView) findViewById(R.id.textViewTitle);
mBody = (TextView) findViewById(R.id.textViewBody);
mTextSize = mPreferences.getInt(PreferenceConstants.READING_TEXT_SIZE, 2);
mBody.setTextSize(getTextSize(mTextSize));
mTitle.setText(getString(R.string.untitled));
mBody.setText(getString(R.string.loading));
@ -47,16 +72,41 @@ public class ReadingActivity extends ActionBarActivity { @@ -47,16 +72,41 @@ public class ReadingActivity extends ActionBarActivity {
}
}
private float getTextSize(int size) {
switch (size) {
case 0:
return XSMALL;
case 1:
return SMALL;
case 2:
return MEDIUM;
case 3:
return LARGE;
case 4:
return XLARGE;
case 5:
return XXLARGE;
default:
return MEDIUM;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.reading, menu);
return super.onCreateOptionsMenu(menu);
}
protected boolean loadPage(Intent intent) {
if (intent == null) {
return false;
}
String url = intent.getStringExtra(Constants.LOAD_READING_URL);
if (url == null) {
mUrl = intent.getStringExtra(Constants.LOAD_READING_URL);
if (mUrl == null) {
return false;
}
getSupportActionBar().setTitle(Utils.getDomainName(url));
new PageLoader(this).execute(url);
getSupportActionBar().setTitle(Utils.getDomainName(mUrl));
new PageLoader(this).execute(mUrl);
return true;
}
@ -146,8 +196,57 @@ public class ReadingActivity extends ActionBarActivity { @@ -146,8 +196,57 @@ public class ReadingActivity extends ActionBarActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
finish();
switch (item.getItemId()) {
case R.id.invert_item:
mPreferences.edit().putBoolean(PreferenceConstants.INVERT_COLORS, !mInvert).apply();
Intent read = new Intent(this, ReadingActivity.class);
read.putExtra(Constants.LOAD_READING_URL, mUrl);
startActivity(read);
finish();
break;
case R.id.text_size_item:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
LayoutInflater inflater = this.getLayoutInflater();
View view = inflater.inflate(R.layout.seek_layout, null);
final SeekBar bar = (SeekBar) view.findViewById(R.id.text_size_seekbar);
bar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar view, int size, boolean user) {
mBody.setTextSize(getTextSize(size));
}
@Override
public void onStartTrackingTouch(SeekBar arg0) {
}
@Override
public void onStopTrackingTouch(SeekBar arg0) {
}
});
bar.setMax(5);
bar.setProgress(mTextSize);
builder.setView(view);
builder.setTitle(R.string.size);
builder.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
mTextSize = bar.getProgress();
mBody.setTextSize(getTextSize(mTextSize));
mPreferences.edit()
.putInt(PreferenceConstants.READING_TEXT_SIZE, bar.getProgress())
.apply();
}
});
builder.show();
break;
default:
finish();
break;
}
return super.onOptionsItemSelected(item);
}
}

16
src/acr/browser/lightning/SearchAdapter.java

@ -49,7 +49,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable { @@ -49,7 +49,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
private Context mContext;
private boolean mUseGoogle = true;
private boolean mIsExecuting = false;
private boolean mIncognito;
private boolean mDarkTheme;
private BookmarkManager mBookmarkManager;
private static final String ENCODING = "ISO-8859-1";
private static final long INTERVAL_DAY = 86400000;
@ -59,7 +59,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable { @@ -59,7 +59,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
private static final int API = Build.VERSION.SDK_INT;
private Theme mTheme;
public SearchAdapter(Context context, boolean incognito) {
public SearchAdapter(Context context, boolean dark) {
mDatabaseHandler = HistoryDatabase.getInstance(context);
mTheme = context.getTheme();
mFilteredList = new ArrayList<HistoryItem>();
@ -72,7 +72,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable { @@ -72,7 +72,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
mUseGoogle = mPreferences.getBoolean(PreferenceConstants.GOOGLE_SEARCH_SUGGESTIONS, true);
mContext = context;
mSearchSubtitle = mContext.getString(R.string.suggestion);
mIncognito = incognito;
mDarkTheme = dark;
Thread delete = new Thread(new Runnable() {
@Override
@ -164,7 +164,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable { @@ -164,7 +164,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
int imageId = R.drawable.ic_bookmark;
switch (web.getImageId()) {
case R.drawable.ic_bookmark: {
if (!mIncognito) {
if (!mDarkTheme) {
imageId = R.drawable.ic_bookmark;
} else {
holder.mTitle.setTextColor(Color.WHITE);
@ -173,7 +173,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable { @@ -173,7 +173,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
break;
}
case R.drawable.ic_search: {
if (!mIncognito) {
if (!mDarkTheme) {
imageId = R.drawable.ic_search;
} else {
holder.mTitle.setTextColor(Color.WHITE);
@ -182,7 +182,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable { @@ -182,7 +182,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
break;
}
case R.drawable.ic_history: {
if (!mIncognito) {
if (!mDarkTheme) {
imageId = R.drawable.ic_history;
} else {
holder.mTitle.setTextColor(Color.WHITE);
@ -225,7 +225,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable { @@ -225,7 +225,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
return results;
}
String query = constraint.toString().toLowerCase(Locale.getDefault());
if (mUseGoogle && !mIncognito && !mIsExecuting) {
if (mUseGoogle && !mDarkTheme && !mIsExecuting) {
new RetrieveSearchSuggestions().execute(query);
}
@ -403,7 +403,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable { @@ -403,7 +403,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
int maxBookmarks = (suggestionsSize + historySize < 3) ? (5 - suggestionsSize - historySize)
: 2;
if (!mUseGoogle || mIncognito) {
if (!mUseGoogle || mDarkTheme) {
maxHistory++;
maxBookmarks++;
}

45
src/acr/browser/lightning/SettingsActivity.java

@ -35,32 +35,46 @@ public class SettingsActivity extends ActionBarActivity { @@ -35,32 +35,46 @@ public class SettingsActivity extends ActionBarActivity {
private SharedPreferences mPreferences;
private Context mContext;
private Activity mActivity;
private boolean mDark;
@Override
protected void onCreate(Bundle savedInstanceState) {
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false)) {
this.setTheme(R.style.Theme_SettingsTheme_Dark);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
mDark = mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false);
mContext = this;
mActivity = this;
init();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
finish();
return true;
}
@Override
protected void onResume() {
super.onResume();
if (mPreferences != null
&& mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false) != mDark) {
this.recreate();
}
}
@SuppressLint("NewApi")
public void init() {
// set up ActionBar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// mPreferences storage
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
@ -76,14 +90,14 @@ public class SettingsActivity extends ActionBarActivity { @@ -76,14 +90,14 @@ public class SettingsActivity extends ActionBarActivity {
RelativeLayout layoutOrbot = (RelativeLayout) findViewById(R.id.layoutUseOrbot);
RelativeLayout layoutColor = (RelativeLayout) findViewById(R.id.layoutColorMode);
RelativeLayout layoutBookmarks = (RelativeLayout) findViewById(R.id.layoutBookmarks);
layoutBookmarks.setOnClickListener(new OnClickListener(){
layoutBookmarks.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(mContext, BookmarkActivity.class));
}
});
if (API >= 19) {
@ -113,7 +127,7 @@ public class SettingsActivity extends ActionBarActivity { @@ -113,7 +127,7 @@ public class SettingsActivity extends ActionBarActivity {
color.setChecked(mPreferences.getBoolean(PreferenceConstants.ENABLE_COLOR_MODE, true));
initCheckBox(flash, adblock, images, enablejs, orbot, color);
clickListenerForCheckBoxes(layoutFlash, layoutBlockAds, layoutImages, layoutEnableJS,
clickListenerForCheckBoxes(layoutFlash, layoutBlockAds, layoutImages, layoutEnableJS,
layoutOrbot, layoutColor, flash, adblock, images, enablejs, orbot, color);
RelativeLayout general = (RelativeLayout) findViewById(R.id.layoutGeneral);
@ -129,10 +143,11 @@ public class SettingsActivity extends ActionBarActivity { @@ -129,10 +143,11 @@ public class SettingsActivity extends ActionBarActivity {
about(about);
}
public void clickListenerForCheckBoxes(RelativeLayout layoutFlash, RelativeLayout layoutBlockAds,
RelativeLayout layoutImages, RelativeLayout layoutEnableJS, RelativeLayout layoutOrbot, RelativeLayout layoutColor,
final CheckBox flash, final CheckBox adblock, final CheckBox images, final CheckBox enablejs,
final CheckBox orbot, final CheckBox color) {
public void clickListenerForCheckBoxes(RelativeLayout layoutFlash,
RelativeLayout layoutBlockAds, RelativeLayout layoutImages,
RelativeLayout layoutEnableJS, RelativeLayout layoutOrbot, RelativeLayout layoutColor,
final CheckBox flash, final CheckBox adblock, final CheckBox images,
final CheckBox enablejs, final CheckBox orbot, final CheckBox color) {
layoutFlash.setOnClickListener(new OnClickListener() {
@Override
@ -183,13 +198,13 @@ public class SettingsActivity extends ActionBarActivity { @@ -183,13 +198,13 @@ public class SettingsActivity extends ActionBarActivity {
}
});
layoutColor.setOnClickListener(new OnClickListener(){
layoutColor.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
color.setChecked(!color.isChecked());
}
});
}

Loading…
Cancel
Save