Embolden text when a tab is selected for more contrast, smoothed animation of drawer hide when tab is switched
This commit is contained in:
parent
a9b36df80e
commit
253e6f06fd
@ -36,5 +36,13 @@
|
||||
<style name="LightActionBar" parent="android:Widget.Holo.Light.ActionBar.Solid">
|
||||
<item name="android:background">@color/gray_light</item>
|
||||
</style>
|
||||
|
||||
<style name="boldText" >
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="normalText" >
|
||||
<item name="android:textStyle">normal</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -55,6 +55,7 @@ import android.media.MediaPlayer;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.Browser;
|
||||
import android.support.v4.app.ActionBarDrawerToggle;
|
||||
@ -991,10 +992,11 @@ public class BrowserActivity extends Activity implements BrowserController {
|
||||
return;
|
||||
}
|
||||
if (mCurrentView != null) {
|
||||
mCurrentView.setIsForgroundTab(false);
|
||||
mCurrentView.onPause();
|
||||
}
|
||||
mCurrentView = view;
|
||||
|
||||
mCurrentView.setIsForgroundTab(true);
|
||||
if (view.getWebView() != null) {
|
||||
updateUrl(view.getUrl());
|
||||
updateProgress(view.getProgress());
|
||||
@ -1006,6 +1008,7 @@ public class BrowserActivity extends Activity implements BrowserController {
|
||||
mBrowserFrame.removeAllViews();
|
||||
mCurrentView.onResume();
|
||||
mBrowserFrame.addView(view.getWebView());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1042,13 +1045,23 @@ public class BrowserActivity extends Activity implements BrowserController {
|
||||
}
|
||||
}
|
||||
|
||||
private void selectItem(int position) {
|
||||
private void selectItem(final int position) {
|
||||
// update selected item and title, then close the drawer
|
||||
|
||||
mDrawerList.setItemChecked(position, true);
|
||||
showTab(mWebViews.get(position));
|
||||
|
||||
//Use a delayed handler to make the transition smooth
|
||||
//otherwise it will get caught up with the showTab code
|
||||
//and cause a janky motion
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDrawerLayout.closeDrawer(mDrawer);
|
||||
}
|
||||
}, 150);
|
||||
|
||||
mDrawerLayout.closeDrawer(mDrawer);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1533,6 +1546,12 @@ public class BrowserActivity extends Activity implements BrowserController {
|
||||
|
||||
LightningView web = data.get(position);
|
||||
holder.txtTitle.setText(web.getTitle());
|
||||
if (web.getIsForgroundTab()) {
|
||||
holder.txtTitle.setTextAppearance(context, R.style.boldText);
|
||||
} else {
|
||||
holder.txtTitle.setTextAppearance(context, R.style.normalText);
|
||||
}
|
||||
|
||||
Bitmap favicon = web.getFavicon();
|
||||
holder.favicon.setImageBitmap(favicon);
|
||||
return row;
|
||||
|
@ -75,6 +75,7 @@ public class LightningView {
|
||||
private static boolean mWideViewPort;
|
||||
private static AdBlock mAdBlock;
|
||||
private CookieManager mCookieManager;
|
||||
private boolean isForgroundTab = false;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public LightningView(Activity activity, String url,
|
||||
@ -416,6 +417,15 @@ public class LightningView {
|
||||
mWebView.onResume();
|
||||
}
|
||||
|
||||
public void setIsForgroundTab(boolean isForground) {
|
||||
isForgroundTab = isForground;
|
||||
mBrowserController.update();
|
||||
}
|
||||
|
||||
public boolean getIsForgroundTab() {
|
||||
return isForgroundTab;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
if (mWebView != null) {
|
||||
return mWebView.getProgress();
|
||||
|
Loading…
Reference in New Issue
Block a user