Browse Source

Change Navigation Drawer layout slightly, fix dark theme for drawer

master
Anthony Restaino 10 years ago
parent
commit
d9e888e8a9
  1. 4
      AndroidManifest.xml
  2. BIN
      res/drawable-hdpi/ic_action_tabs_dark.png
  3. BIN
      res/drawable-hdpi/ic_action_tabs_light.png
  4. BIN
      res/drawable-xhdpi/ic_action_tabs_dark.png
  5. BIN
      res/drawable-xhdpi/ic_action_tabs_light.png
  6. BIN
      res/drawable-xxhdpi/ic_action_tabs_dark.png
  7. BIN
      res/drawable-xxhdpi/ic_action_tabs_light.png
  8. 7
      res/drawable/list_bg_dark.xml
  9. 7
      res/drawable/list_bg_light.xml
  10. 18
      res/layout/bookmark_drawer.xml
  11. 5
      res/layout/bookmark_list_item.xml
  12. 47
      res/layout/tab_drawer.xml
  13. 13
      res/layout/tab_list_item.xml
  14. 4
      res/values-v21/styles.xml
  15. 2
      res/values/attr.xml
  16. 4
      res/values/colors.xml
  17. 1
      res/values/strings.xml
  18. 4
      res/values/styles.xml
  19. 34
      src/acr/browser/lightning/BrowserActivity.java

4
AndroidManifest.xml

@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="acr.browser.lightning"
android:versionCode="72"
android:versionName="4.0.4a" >
android:versionCode="74"
android:versionName="4.0.6a" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />

BIN
res/drawable-hdpi/ic_action_tabs_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

BIN
res/drawable-hdpi/ic_action_tabs_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

BIN
res/drawable-xhdpi/ic_action_tabs_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

BIN
res/drawable-xhdpi/ic_action_tabs_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

BIN
res/drawable-xxhdpi/ic_action_tabs_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

BIN
res/drawable-xxhdpi/ic_action_tabs_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

7
res/drawable/list_bg_dark.xml

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/selected_dark" android:state_pressed="true"/>
<item android:drawable="@color/selected_dark" android:state_activated="true"/>
</selector>

7
res/drawable/list_bg_light.xml

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/selected_light" android:state_pressed="true"/>
<item android:drawable="@color/selected_light" android:state_activated="true"/>
</selector>

18
res/layout/bookmark_drawer.xml

@ -13,35 +13,35 @@ @@ -13,35 +13,35 @@
android:id="@+id/bookmark_title"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/listBackground"
android:clickable="true"
android:background="?attr/dividerColor"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:id="@+id/starIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:contentDescription="Favicon"
android:gravity="center_vertical"
android:src="?attr/starDrawable" >
</ImageView>
<TextView
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_toRightOf="@+id/starIcon"
android:fontFamily="sans-serif-light"
android:gravity="center_vertical"
android:maxLines="1"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:minHeight="?android:attr/listPreferredItemHeight"
android:text="@string/action_bookmarks"
android:textAppearance="?android:attr/textAppearanceListItemSmall" />
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<View

5
res/layout/bookmark_list_item.xml

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@drawable/list_bg"
android:background="?attr/selectedBackground"
android:gravity="center_vertical"
android:orientation="horizontal" >
@ -20,12 +20,13 @@ @@ -20,12 +20,13 @@
android:id="@+id/textBookmark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:ellipsize="end"
android:fontFamily="sans-serif-light"
android:gravity="center_vertical"
android:maxLines="1"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingRight="16dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItemSmall" />

47
res/layout/tab_drawer.xml

@ -10,37 +10,37 @@ @@ -10,37 +10,37 @@
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/new_tab_button"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/listBackground"
android:background="?attr/dividerColor"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:id="@+id/plusIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:contentDescription="@string/action_new_tab"
android:gravity="center_vertical"
android:src="?attr/plusDrawable" >
android:src="?attr/tabDrawable" >
</ImageView>
<TextView
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_toRightOf="@+id/plusIcon"
android:fontFamily="sans-serif-light"
android:gravity="center_vertical"
android:maxLines="1"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:text="@string/action_new_tab"
android:textAppearance="?android:attr/textAppearanceListItemSmall" />
android:minHeight="?android:attr/listPreferredItemHeight"
android:text="@string/tabs"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<View
@ -65,12 +65,12 @@ @@ -65,12 +65,12 @@
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/dividerColor"
android:baselineAligned="false"
android:orientation="horizontal"
android:weightSum="2" >
android:weightSum="3" >
<RelativeLayout
android:id="@+id/action_back"
@ -92,6 +92,27 @@ @@ -92,6 +92,27 @@
android:src="?attr/arrowBackDrawable" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/new_tab_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?attr/listBackground"
android:clickable="true" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:contentDescription="@string/action_new_tab"
android:paddingBottom="4dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingTop="4dp"
android:src="?attr/plusDrawable" >
</ImageView>
</RelativeLayout>
<RelativeLayout
android:id="@+id/action_forward"
android:layout_width="match_parent"

13
res/layout/tab_list_item.xml

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@drawable/list_bg"
android:background="?attr/selectedBackground"
android:gravity="center_vertical"
android:orientation="horizontal" >
@ -23,6 +23,8 @@ @@ -23,6 +23,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_toLeftOf="@+id/deleteButton"
android:layout_toRightOf="@+id/faviconTab"
android:ellipsize="end"
@ -35,16 +37,15 @@ @@ -35,16 +37,15 @@
<ImageView
android:id="@+id/deleteButton"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="13dp"
android:alpha="0.5"
android:layout_marginRight="4dp"
android:background="?attr/actionBarItemBackground"
android:contentDescription="Delete Tab"
android:gravity="center_vertical"
android:padding="3dp"
android:padding="12dp"
android:src="?attr/deleteDrawable" >
</ImageView>

4
res/values-v21/styles.xml

@ -57,6 +57,8 @@ @@ -57,6 +57,8 @@
<item name="deleteDrawable">@drawable/ic_action_delete</item>
<item name="starDrawable">@drawable/ic_action_star</item>
<item name="dividerColor">@color/divider_light</item>
<item name="tabDrawable">@drawable/ic_action_tabs_light</item>
<item name="selectedBackground">@drawable/list_bg_light</item>
</style>
<style name="Theme.DarkTheme" parent="Theme.AppCompat">
@ -83,6 +85,8 @@ @@ -83,6 +85,8 @@
<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>
<item name="tabDrawable">@drawable/ic_action_tabs_dark</item>
<item name="selectedBackground">@drawable/list_bg_dark</item>
</style>
</resources>

2
res/values/attr.xml

@ -16,7 +16,9 @@ @@ -16,7 +16,9 @@
<attr name="plusDrawable" format="reference|color" />
<attr name="deleteDrawable" format="reference|color" />
<attr name="starDrawable" format="reference|color" />
<attr name="tabDrawable" format="reference|color" />
<attr name="dividerColor" format="reference|color" />
<attr name="selectedBackground" format="reference|color" />
<declare-styleable name="AnimatedProgressBar">
<attr name="progressColor" format="color" />

4
res/values/colors.xml

@ -28,4 +28,8 @@ @@ -28,4 +28,8 @@
<color name="divider_dark">#1EFFFFFF</color>
<color name="divider_light">#1E000000</color>
<color name="selected_dark">#0FFFFFFF</color>
<color name="selected_light">#0F000000</color>
</resources>

1
res/values/strings.xml

@ -213,4 +213,5 @@ @@ -213,4 +213,5 @@
<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>
<string name="tabs">Tabs</string>
</resources>

4
res/values/styles.xml

@ -56,7 +56,9 @@ @@ -56,7 +56,9 @@
<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="tabDrawable">@drawable/ic_action_tabs_light</item>
<item name="dividerColor">@color/divider_light</item>
<item name="selectedBackground">@drawable/list_bg_light</item>
</style>
<style name="Theme.DarkTheme" parent="Theme.AppCompat">
@ -82,7 +84,9 @@ @@ -82,7 +84,9 @@
<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="tabDrawable">@drawable/ic_action_tabs_dark</item>
<item name="dividerColor">@color/divider_dark</item>
<item name="selectedBackground">@drawable/list_bg_dark</item>
</style>
<style name="overFlowButtonStyle" parent="@style/Widget.AppCompat.ActionButton.Overflow">

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

@ -125,7 +125,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -125,7 +125,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
@SuppressWarnings("deprecation")
private synchronized void initialize() {
setContentView(R.layout.activity_main);
getWindow().setBackgroundDrawable(null);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
@ -147,7 +147,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -147,7 +147,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
}
mActivity = this;
mClickHandler = new ClickHandler(this);
getWindow().setBackgroundDrawable(null);
mBrowserFrame = (FrameLayout) findViewById(R.id.content_frame);
mToolbarLayout = (LinearLayout) findViewById(R.id.toolbar_layout);
mPageLayout = (LinearLayout) findViewById(R.id.main_layout);
@ -896,7 +895,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -896,7 +895,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mIsNewIntent = false;
selectItem(position);
showTab(mWebViews.get(position));
}
}
@ -1107,18 +1106,10 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -1107,18 +1106,10 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
// don't delete the tab because the browser will close and mess stuff up
}
private void selectItem(final int position) {
// update selected item and title, then close the drawer
showTab(mWebViews.get(position));
}
@SuppressWarnings("deprecation")
@Override
public void onTrimMemory(int level) {
if (level > TRIM_MEMORY_RUNNING_MODERATE
&& Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
if (level > TRIM_MEMORY_MODERATE && Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
Log.d(Constants.TAG, "Low Memory, Free Memory");
for (LightningView view : mWebViews) {
view.getWebView().freeMemory();
@ -1553,8 +1544,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -1553,8 +1544,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
});
mToolbarLayout.setBackgroundColor(finalColor);
mPageLayout.setBackgroundColor(finalColor);
anim.setDuration(300);
anim.start();
}
@ -1778,23 +1767,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -1778,23 +1767,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
@Override
public void updateProgress(int n) {
/*
* if (n > mProgressBar.getProgress()) { ObjectAnimator animator =
* ObjectAnimator.ofInt(mProgressBar, "progress", n);
* animator.setDuration(200); animator.setInterpolator(new
* DecelerateInterpolator()); animator.start(); } else if (n <
* mProgressBar.getProgress()) { ObjectAnimator animator =
* ObjectAnimator.ofInt(mProgressBar, "progress", 0, n);
* animator.setDuration(200); animator.setInterpolator(new
* DecelerateInterpolator()); animator.start(); } if (n >= 100) {
* Handler handler = new Handler(); handler.postDelayed(new Runnable() {
*
* @Override public void run() {
* mProgressBar.setVisibility(View.INVISIBLE); setIsFinishedLoading(); }
* }, 200);
*
* } else { mProgressBar.setVisibility(View.VISIBLE); setIsLoading(); }
*/
if (n >= 100) {
setIsFinishedLoading();
} else {

Loading…
Cancel
Save