Detail Activity ActionBar Translucent
This commit is contained in:
1 parent
50dd19222e
commit
807c49eea1
2 files changed
+22
-3
No files matched your search
@@ -37,6 +37,8 @@ import android.app.ActionBar.Tab;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
@@ -126,9 +128,15 @@ public class MangaDetailActivity extends AbstractFragmentActivity
|
||||
|
||||
handleIntent(getIntent());
|
||||
|
||||
int color = getResources().getColor(android.R.color.holo_blue_dark)
|
||||
& 0x00ffffff | 0xdd000000;
|
||||
Drawable drawable = new ColorDrawable(color);
|
||||
Ui.translucent(this, drawable);
|
||||
|
||||
final ActionBar actionBar = getActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
actionBar.setBackgroundDrawable(drawable);
|
||||
|
||||
SectionsPagerAdapter adapter =
|
||||
new SectionsPagerAdapter(getSupportFragmentManager());
|
||||
@@ -151,7 +159,6 @@ public class MangaDetailActivity extends AbstractFragmentActivity
|
||||
Intent it = new Intent(MangaDetailActivity.this, DownloadService.class);
|
||||
bindService(it, mServiceConn, BIND_AUTO_CREATE);
|
||||
|
||||
Ui.translucent(this);
|
||||
setTitle(String.valueOf(mGalleryInfo.gid));
|
||||
}
|
||||
|
||||
|
||||
@@ -272,8 +272,20 @@ public class Ui {
|
||||
}
|
||||
}
|
||||
|
||||
public static SystemBarConfig translucent(
|
||||
Activity activity) {
|
||||
return translucentColor(activity,
|
||||
mResources.getColor(android.R.color.holo_blue_dark));
|
||||
}
|
||||
|
||||
public static SystemBarConfig translucentColor(
|
||||
Activity activity, int color) {
|
||||
return translucent(activity, new ColorDrawable(color));
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.KITKAT)
|
||||
public static SystemBarConfig translucent(Activity activity) {
|
||||
public static SystemBarConfig translucent(
|
||||
Activity activity, Drawable drawable) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Window win = activity.getWindow();
|
||||
WindowManager.LayoutParams winParams = win.getAttributes();
|
||||
@@ -284,7 +296,7 @@ public class Ui {
|
||||
|
||||
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
|
||||
tintManager.setStatusBarTintEnabled(true);
|
||||
tintManager.setStatusBarTintResource(R.color.ab_bg);
|
||||
tintManager.setStatusBarTintDrawable(drawable);
|
||||
tintManager.setNavigationBarTintEnabled(true);
|
||||
tintManager.setNavigationBarAlpha(0.0f);
|
||||
|
||||
|
||||
Reference in new issue
Block a user