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

This commit is contained in:
Anthony Restaino 2015-03-31 11:20:41 -04:00
parent 1d6a445d33
commit a4f0c010d1
58 changed files with 501 additions and 157 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:background="#cdcdcd" /> android:background="?attr/dividerColor" />
<RelativeLayout <RelativeLayout
android:id="@+id/rFullScreen" android:id="@+id/rFullScreen"
@ -84,7 +84,42 @@
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="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 <RelativeLayout
android:id="@+id/rWideViewPort" android:id="@+id/rWideViewPort"
@ -135,7 +170,7 @@
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:background="#cdcdcd" /> android:background="?attr/dividerColor" />
<RelativeLayout <RelativeLayout
android:id="@+id/rOverView" android:id="@+id/rOverView"
@ -186,7 +221,7 @@
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:background="#cdcdcd" /> android:background="?attr/dividerColor" />
<RelativeLayout <RelativeLayout
android:id="@+id/rTextReflow" android:id="@+id/rTextReflow"
@ -221,7 +256,7 @@
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:background="#cdcdcd" /> android:background="?attr/dividerColor" />
<RelativeLayout <RelativeLayout
android:id="@+id/rTextSize" android:id="@+id/rTextSize"
@ -247,7 +282,7 @@
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:background="#cdcdcd" /> android:background="?attr/dividerColor" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

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

View File

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

View File

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

View File

@ -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>

View File

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

View File

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

View File

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

18
res/menu/reading.xml Normal file
View File

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -12,6 +12,25 @@
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="android:windowContentOverlay">@null</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>
<style name="Theme.LightTheme" parent="Theme.AppCompat.Light"> <style name="Theme.LightTheme" parent="Theme.AppCompat.Light">
@ -33,6 +52,11 @@
<item name="arrowBackDrawable">@drawable/ic_action_back</item> <item name="arrowBackDrawable">@drawable/ic_action_back</item>
<item name="arrowForwardDrawable">@drawable/ic_action_forward</item> <item name="arrowForwardDrawable">@drawable/ic_action_forward</item>
<item name="actionOverflowButtonStyle">@style/overFlowButtonStyle</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>
<style name="Theme.DarkTheme" parent="Theme.AppCompat"> <style name="Theme.DarkTheme" parent="Theme.AppCompat">
@ -54,6 +78,11 @@
<item name="arrowBackDrawable">@drawable/ic_action_back_dark</item> <item name="arrowBackDrawable">@drawable/ic_action_back_dark</item>
<item name="arrowForwardDrawable">@drawable/ic_action_forward_dark</item> <item name="arrowForwardDrawable">@drawable/ic_action_forward_dark</item>
<item name="actionOverflowButtonStyle">@style/overFlowButtonStyle</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>
</resources> </resources>

View File

@ -10,6 +10,13 @@
<attr name="progressBackgroundColor" format="color" /> <attr name="progressBackgroundColor" format="color" />
<attr name="searchBackground" format="reference|color" /> <attr name="searchBackground" format="reference|color" />
<attr name="toolbarSettingsBackground" 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"> <declare-styleable name="AnimatedProgressBar">
<attr name="progressColor" format="color" /> <attr name="progressColor" format="color" />

View File

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

View File

@ -210,4 +210,7 @@
<item >URL</item> <item >URL</item>
<item >Title</item> <item >Title</item>
</string-array> </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> </resources>

View File

@ -12,6 +12,25 @@
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="android:windowContentOverlay">@null</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>
<style name="Theme.LightTheme" parent="Theme.AppCompat.Light"> <style name="Theme.LightTheme" parent="Theme.AppCompat.Light">
@ -33,6 +52,11 @@
<item name="arrowBackDrawable">@drawable/ic_action_back</item> <item name="arrowBackDrawable">@drawable/ic_action_back</item>
<item name="arrowForwardDrawable">@drawable/ic_action_forward</item> <item name="arrowForwardDrawable">@drawable/ic_action_forward</item>
<item name="actionOverflowButtonStyle">@style/overFlowButtonStyle</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>
<style name="Theme.DarkTheme" parent="Theme.AppCompat"> <style name="Theme.DarkTheme" parent="Theme.AppCompat">
@ -54,6 +78,11 @@
<item name="arrowBackDrawable">@drawable/ic_action_back_dark</item> <item name="arrowBackDrawable">@drawable/ic_action_back_dark</item>
<item name="arrowForwardDrawable">@drawable/ic_action_forward_dark</item> <item name="arrowForwardDrawable">@drawable/ic_action_forward_dark</item>
<item name="actionOverflowButtonStyle">@style/overFlowButtonStyle</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>
<style name="overFlowButtonStyle" parent="@style/Widget.AppCompat.ActionButton.Overflow"> <style name="overFlowButtonStyle" parent="@style/Widget.AppCompat.ActionButton.Overflow">
@ -70,5 +99,4 @@
<item name="android:fontFamily">sans-serif-light</item> <item name="android:fontFamily">sans-serif-light</item>
</style> </style>
</resources> </resources>

View File

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

View File

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

View File

@ -31,6 +31,10 @@ public class BookmarkActivity extends ActionBarActivity implements OnClickListen
@Override @Override
public void onCreate(Bundle savedInstanceState) { 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); super.onCreate(savedInstanceState);
setContentView(R.layout.bookmark_settings); setContentView(R.layout.bookmark_settings);
@ -48,8 +52,6 @@ public class BookmarkActivity extends ActionBarActivity implements OnClickListen
mBookmarkManager = new BookmarkManager(this); mBookmarkManager = new BookmarkManager(this);
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
mSystemBrowser = mPreferences.getBoolean(PreferenceConstants.SYSTEM_BROWSER_PRESENT, false); mSystemBrowser = mPreferences.getBoolean(PreferenceConstants.SYSTEM_BROWSER_PRESENT, false);
exportBackup.setOnClickListener(this); exportBackup.setOnClickListener(this);

View File

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

View File

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

View File

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

View File

@ -4,6 +4,7 @@
package acr.browser.lightning; package acr.browser.lightning;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
@ -20,6 +21,10 @@ public class LicenseActivity extends ActionBarActivity implements View.OnClickLi
@Override @Override
protected void onCreate(Bundle savedInstanceState) { 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); super.onCreate(savedInstanceState);
setContentView(R.layout.license_activity); setContentView(R.layout.license_activity);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

View File

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

View File

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

View File

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

View File

@ -6,27 +6,50 @@ import java.util.List;
import acr.browser.lightning.reading.HtmlFetcher; import acr.browser.lightning.reading.HtmlFetcher;
import acr.browser.lightning.reading.JResult; import acr.browser.lightning.reading.JResult;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView; import android.widget.TextView;
public class ReadingActivity extends ActionBarActivity { public class ReadingActivity extends ActionBarActivity {
private TextView mTitle; private TextView mTitle;
private TextView mBody; 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 @Override
protected void onCreate(Bundle savedInstanceState) { 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); super.onCreate(savedInstanceState);
setContentView(R.layout.reading_view); setContentView(R.layout.reading_view);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
@ -35,6 +58,8 @@ public class ReadingActivity extends ActionBarActivity {
mTitle = (TextView) findViewById(R.id.textViewTitle); mTitle = (TextView) findViewById(R.id.textViewTitle);
mBody = (TextView) findViewById(R.id.textViewBody); mBody = (TextView) findViewById(R.id.textViewBody);
mTextSize = mPreferences.getInt(PreferenceConstants.READING_TEXT_SIZE, 2);
mBody.setTextSize(getTextSize(mTextSize));
mTitle.setText(getString(R.string.untitled)); mTitle.setText(getString(R.string.untitled));
mBody.setText(getString(R.string.loading)); mBody.setText(getString(R.string.loading));
@ -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) { protected boolean loadPage(Intent intent) {
if (intent == null) { if (intent == null) {
return false; return false;
} }
String url = intent.getStringExtra(Constants.LOAD_READING_URL); mUrl = intent.getStringExtra(Constants.LOAD_READING_URL);
if (url == null) { if (mUrl == null) {
return false; return false;
} }
getSupportActionBar().setTitle(Utils.getDomainName(url)); getSupportActionBar().setTitle(Utils.getDomainName(mUrl));
new PageLoader(this).execute(url); new PageLoader(this).execute(mUrl);
return true; return true;
} }
@ -146,8 +196,57 @@ public class ReadingActivity extends ActionBarActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { 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); return super.onOptionsItemSelected(item);
} }
} }

View File

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

View File

@ -35,11 +35,17 @@ public class SettingsActivity extends ActionBarActivity {
private SharedPreferences mPreferences; private SharedPreferences mPreferences;
private Context mContext; private Context mContext;
private Activity mActivity; private Activity mActivity;
private boolean mDark;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { 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); super.onCreate(savedInstanceState);
setContentView(R.layout.settings); setContentView(R.layout.settings);
mDark = mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false);
mContext = this; mContext = this;
mActivity = this; mActivity = this;
init(); init();
@ -51,16 +57,24 @@ public class SettingsActivity extends ActionBarActivity {
return true; return true;
} }
@Override
protected void onResume() {
super.onResume();
if (mPreferences != null
&& mPreferences.getBoolean(PreferenceConstants.DARK_THEME, false) != mDark) {
this.recreate();
}
}
@SuppressLint("NewApi") @SuppressLint("NewApi")
public void init() { public void init() {
// set up ActionBar // set up ActionBar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// mPreferences storage // mPreferences storage
mPreferences = getSharedPreferences(PreferenceConstants.PREFERENCES, 0);
if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) { if (mPreferences.getBoolean(PreferenceConstants.HIDE_STATUS_BAR, false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); WindowManager.LayoutParams.FLAG_FULLSCREEN);
@ -77,7 +91,7 @@ public class SettingsActivity extends ActionBarActivity {
RelativeLayout layoutColor = (RelativeLayout) findViewById(R.id.layoutColorMode); RelativeLayout layoutColor = (RelativeLayout) findViewById(R.id.layoutColorMode);
RelativeLayout layoutBookmarks = (RelativeLayout) findViewById(R.id.layoutBookmarks); RelativeLayout layoutBookmarks = (RelativeLayout) findViewById(R.id.layoutBookmarks);
layoutBookmarks.setOnClickListener(new OnClickListener(){ layoutBookmarks.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -129,10 +143,11 @@ public class SettingsActivity extends ActionBarActivity {
about(about); about(about);
} }
public void clickListenerForCheckBoxes(RelativeLayout layoutFlash, RelativeLayout layoutBlockAds, public void clickListenerForCheckBoxes(RelativeLayout layoutFlash,
RelativeLayout layoutImages, RelativeLayout layoutEnableJS, RelativeLayout layoutOrbot, RelativeLayout layoutColor, RelativeLayout layoutBlockAds, RelativeLayout layoutImages,
final CheckBox flash, final CheckBox adblock, final CheckBox images, final CheckBox enablejs, RelativeLayout layoutEnableJS, RelativeLayout layoutOrbot, RelativeLayout layoutColor,
final CheckBox orbot, final CheckBox color) { final CheckBox flash, final CheckBox adblock, final CheckBox images,
final CheckBox enablejs, final CheckBox orbot, final CheckBox color) {
layoutFlash.setOnClickListener(new OnClickListener() { layoutFlash.setOnClickListener(new OnClickListener() {
@Override @Override
@ -183,7 +198,7 @@ public class SettingsActivity extends ActionBarActivity {
} }
}); });
layoutColor.setOnClickListener(new OnClickListener(){ layoutColor.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {