Change Navigation Drawer layout slightly, fix dark theme for drawer
This commit is contained in:
parent
5dafd6f815
commit
d9e888e8a9
@ -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
Normal file
BIN
res/drawable-hdpi/ic_action_tabs_dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 165 B |
BIN
res/drawable-hdpi/ic_action_tabs_light.png
Normal file
BIN
res/drawable-hdpi/ic_action_tabs_light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 178 B |
BIN
res/drawable-xhdpi/ic_action_tabs_dark.png
Normal file
BIN
res/drawable-xhdpi/ic_action_tabs_dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 177 B |
BIN
res/drawable-xhdpi/ic_action_tabs_light.png
Normal file
BIN
res/drawable-xhdpi/ic_action_tabs_light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 193 B |
BIN
res/drawable-xxhdpi/ic_action_tabs_dark.png
Normal file
BIN
res/drawable-xxhdpi/ic_action_tabs_dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 235 B |
BIN
res/drawable-xxhdpi/ic_action_tabs_light.png
Normal file
BIN
res/drawable-xxhdpi/ic_action_tabs_light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 252 B |
7
res/drawable/list_bg_dark.xml
Normal file
7
res/drawable/list_bg_dark.xml
Normal file
@ -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
Normal file
7
res/drawable/list_bg_light.xml
Normal file
@ -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>
|
@ -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
|
||||
|
@ -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 @@
|
||||
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" />
|
||||
|
||||
|
@ -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 @@
|
||||
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 @@
|
||||
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"
|
||||
|
@ -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 @@
|
||||
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 @@
|
||||
|
||||
<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>
|
||||
|
||||
|
@ -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 @@
|
||||
<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>
|
@ -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" />
|
||||
|
@ -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>
|
@ -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>
|
||||
|
@ -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 @@
|
||||
<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">
|
||||
|
@ -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
|
||||
}
|
||||
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
|
||||
@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
|
||||
// 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();
|
||||
@ -1380,7 +1371,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
supportInvalidateOptionsMenu();
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@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 {
|
||||
@ -2534,42 +2506,42 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.action_back:
|
||||
if (mCurrentView != null) {
|
||||
if (mCurrentView.canGoBack()) {
|
||||
mCurrentView.goBack();
|
||||
case R.id.action_back:
|
||||
if (mCurrentView != null) {
|
||||
if (mCurrentView.canGoBack()) {
|
||||
mCurrentView.goBack();
|
||||
} else {
|
||||
deleteTab(mDrawerListLeft.getCheckedItemPosition());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case R.id.action_forward:
|
||||
if (mCurrentView != null) {
|
||||
if (mCurrentView.canGoForward()) {
|
||||
mCurrentView.goForward();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case R.id.arrow_button:
|
||||
if (mSearch != null && mSearch.hasFocus()) {
|
||||
mCurrentView.requestFocus();
|
||||
} else {
|
||||
deleteTab(mDrawerListLeft.getCheckedItemPosition());
|
||||
mDrawerLayout.openDrawer(mDrawerLeft);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case R.id.action_forward:
|
||||
if (mCurrentView != null) {
|
||||
if (mCurrentView.canGoForward()) {
|
||||
mCurrentView.goForward();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case R.id.arrow_button:
|
||||
if (mSearch != null && mSearch.hasFocus()) {
|
||||
mCurrentView.requestFocus();
|
||||
} else {
|
||||
mDrawerLayout.openDrawer(mDrawerLeft);
|
||||
}
|
||||
break;
|
||||
case R.id.new_tab_button:
|
||||
newTab(null, true);
|
||||
break;
|
||||
case R.id.button_next:
|
||||
mCurrentView.getWebView().findNext(false);
|
||||
break;
|
||||
case R.id.button_back:
|
||||
mCurrentView.getWebView().findNext(true);
|
||||
break;
|
||||
case R.id.button_quit:
|
||||
mCurrentView.getWebView().clearMatches();
|
||||
mSearchBar.setVisibility(View.GONE);
|
||||
break;
|
||||
break;
|
||||
case R.id.new_tab_button:
|
||||
newTab(null, true);
|
||||
break;
|
||||
case R.id.button_next:
|
||||
mCurrentView.getWebView().findNext(false);
|
||||
break;
|
||||
case R.id.button_back:
|
||||
mCurrentView.getWebView().findNext(true);
|
||||
break;
|
||||
case R.id.button_quit:
|
||||
mCurrentView.getWebView().clearMatches();
|
||||
mSearchBar.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user