本文整理汇总了Java中com.readystatesoftware.systembartint.SystemBarTintManager.setStatusBarTintColor方法的典型用法代码示例。如果您正苦于以下问题:Java SystemBarTintManager.setStatusBarTintColor方法的具体用法?Java SystemBarTintManager.setStatusBarTintColor怎么用?Java SystemBarTintManager.setStatusBarTintColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.readystatesoftware.systembartint.SystemBarTintManager
的用法示例。
在下文中一共展示了SystemBarTintManager.setStatusBarTintColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTranslucentStatus
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@TargetApi(19)
private void setTranslucentStatus(boolean on) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
Window win = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintColor(getResources().getColor(R.color.colorPrimary));
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(false);
}
示例2: initWindowFlags
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
/**
* 初始化界面的属性
*/
private void initWindowFlags() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
ActivityComponent activityComponent = getActivityComponent();
SystemBarTintManager systemBarTintManager = activityComponent.getSystemBarTintManager();
systemBarTintManager.setNavigationBarTintEnabled(true);
systemBarTintManager.setStatusBarTintEnabled(true);
final int color = getResources().getColor(R.color.colorSplash);
systemBarTintManager.setStatusBarTintColor(color);
systemBarTintManager.setNavigationBarTintColor(color);
}
}
示例3: init
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void init() {
ButterKnife.bind(this);
m_toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
SystemBarTintManager systemBarTintManager = m_aboutPresenter.getSystemBarTintManager();
systemBarTintManager.setStatusBarTintEnabled(true);
systemBarTintManager.setStatusBarTintColor(getResources().getColor(R.color.about));
}
}
示例4: setTranslucentBar
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
/**
* 设置透明状态栏
*/
@SuppressWarnings("deprecation")
@TargetApi(19)
protected void setTranslucentBar(int color, View paddingView) {
if (paddingView != null) {
paddingView.setPadding(0, PhoneInfoUtils.getStatusBarHeight(this), 0, 0);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintColor(getResources().getColor(color));
tintManager.setStatusBarTintEnabled(true);
}
}
示例5: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
showActivityInAnim();
super.onCreate(savedInstanceState);
setContentView(getContentResId());
// 经测试在代码里直接声明透明状态栏更有效
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
//沉浸式时,对状态栏染色
// create our manager instance after the content view is set
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintColor(getStatusBarColor());
// enable status bar tint
tintManager.setStatusBarTintEnabled(true);
// // enable navigation bar tint
// tintManager.setNavigationBarTintEnabled(true);
}
ButterKnife.bind(this);
if (null != getIPresenter()) {
getIPresenter().onCreate(savedInstanceState);
}
}
示例6: afterCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
public void afterCreate(Bundle savedInstanceState) {
View toolbar = findViewById(R.id.ll_root);
toolbar.setPadding(0, PhoneInfoUtils.getStatusBarHeight(this), 0, 0);//防止遮挡
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintColor(MethodUtils.getColor(toolbar, R.color.main_theme));
tintManager.setStatusBarTintEnabled(true);
}
findViewById(R.id.iv_back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
示例7: setTranslucentStatus
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@TargetApi(19)
public void setTranslucentStatus(Activity activity, boolean on) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(false);
tintManager.setStatusBarTintColor(activity.getResources().getColor(R.color.colorPrimary));
//tintManager.setNavigationBarTintColor(activity.getResources().getColor(R.color.colorPrimary));
// tintManager.setStatusBarTintResource(R.color.colorPrimary);
}
}
示例8: setTranslucentStatus
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@TargetApi(19)
public void setTranslucentStatus(Activity activity, boolean on) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(false);
tintManager.setStatusBarTintColor(activity.getResources().getColor(R.color.colorPrimary));
//tintManager.setNavigationBarTintColor(activity.getResources().getColor(R.color.colorPrimary));
// tintManager.setStatusBarTintResource(R.color.colorPrimary);
}
}
示例9: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
// 透明状态栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// 透明导航栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
setTranslucentStatus(true);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(0xFF01579b);
}
}
示例10: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
BaseApplication.getInstance().addActivity(this);
mHelper = new SwipeBackActivityHelper(this);
mHelper.onActivityCreate();
Log = MyLogger.kLog();
BookTheme.setChangeTheme(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
setTranslucentStatus();
}
tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(BookTheme.THEME_COLOR);// 通知栏所需颜色
}
示例11: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Timber.i("onCreate");
AVAnalytics.trackAppOpened(getIntent());
setContentView(provideContentViewId());
ButterKnife.inject(this);
if(toolbar!=null){
setSupportActionBar(toolbar);
}
if(!TextUtils.isEmpty(NavUtils.getParentActivityName(this))){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
if(Build.VERSION.SDK_INT <= 19){
tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setNavigationBarTintEnabled(true);
tintManager.setStatusBarTintColor(getResources().getColor(R.color.primary_dark));
}
}
示例12: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
initTheme();
super.onCreate(savedInstanceState);
// 这句很关键,注意是调用父类的方法
super.setContentView(R.layout.activity_base);
// 经测试在代码里直接声明透明状态栏更有效
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes();
localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags);
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
//沉浸式时,对状态栏染色
// create our manager instance after the content view is set
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintColor(getStatusBarColor());
// enable status bar tint
tintManager.setStatusBarTintEnabled(true);
// // enable navigation bar tint
// tintManager.setNavigationBarTintEnabled(true);
}
initToolbar();
}
示例13: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
buildMockData();
listView = (ListView) findViewById(R.id.listView);
viewCell = new ViewCell(dataModel);
listView.setAdapter(viewCell);
viewCell.notifyDataSetChanged();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
setTranslucentStatus(true);
setTranslucentNavigation(true);
}
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(Color.parseColor("#00796B"));
}
示例14: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.activity_main);
mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id
.navigation_drawer);
mTitle = getTitle();
mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
SystemBarTintManager systemBarTintManager = new SystemBarTintManager(this);
systemBarTintManager.setStatusBarTintEnabled(true);
systemBarTintManager.setStatusBarTintColor(getResources().getColor(R.color.action_bar_color_end));
if (savedInstanceState == null) {
handleIntent(getIntent());
}
}
示例15: invalidateNavBar
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
public void invalidateNavBar() {
if (SDK_INT == 20 || SDK_INT == 19) {
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(getColorPreference().getColor(ColorUsage.getPrimary(MainActivity.currentTab)));
FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.preferences).getLayoutParams();
SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
p.setMargins(0, config.getStatusBarHeight(), 0, 0);
} else if (SDK_INT >= 21) {
SharedPreferences Sp = PreferenceManager.getDefaultSharedPreferences(this);
boolean colourednavigation = Sp.getBoolean(PreferencesConstants.PREFERENCE_COLORED_NAVIGATION, true);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
int tabStatusColor = PreferenceUtils.getStatusColor(getColorPreference().getColorAsString(ColorUsage.getPrimary(MainActivity.currentTab)));
window.setStatusBarColor(tabStatusColor);
if (colourednavigation) {
window.setNavigationBarColor(tabStatusColor);
} else if(window.getNavigationBarColor() != Color.BLACK){
window.setNavigationBarColor(Color.BLACK);
}
}
if (getAppTheme().equals(AppTheme.BLACK)) getWindow().getDecorView().setBackgroundColor(Utils.getColor(this, android.R.color.black));
}