本文整理汇总了Java中com.readystatesoftware.systembartint.SystemBarTintManager类的典型用法代码示例。如果您正苦于以下问题:Java SystemBarTintManager类的具体用法?Java SystemBarTintManager怎么用?Java SystemBarTintManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SystemBarTintManager类属于com.readystatesoftware.systembartint包,在下文中一共展示了SystemBarTintManager类的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: hasTranslucentNavigation
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入依赖的package包/类
@TargetApi (19)
public boolean hasTranslucentNavigation() {
if (!mTranslucentNavigationSet) {
final SystemBarTintManager.SystemBarConfig config = getSystemBarTint().getConfig();
if (Build.VERSION.SDK_INT >= 19) {
boolean themeConfig =
((getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
== WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
mTranslucentNavigation = themeConfig && config.hasNavigtionBar() && config.isNavigationAtBottom()
&& config.getNavigationBarHeight() > 0;
}
mTranslucentNavigationSet = true;
}
return mTranslucentNavigation;
}
示例5: setupToolbar
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入依赖的package包/类
private int setupToolbar(final Activity activity) {
SystemBarTintManager manager = new SystemBarTintManager(activity);
final SystemBarTintManager.SystemBarConfig config = manager.getConfig();
if (config.getPixelInsetTop(false) > 0) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
params.topMargin = 0;
params.height = config.getActionBarHeight() + config.getStatusBarHeight();
toolbar.setLayoutParams(params);
toolbar.setPadding(
toolbar.getPaddingLeft(),
toolbar.getPaddingTop() + config.getStatusBarHeight(),
toolbar.getPaddingRight(),
toolbar.getPaddingBottom()
);
return params.height;
}
return config.getActionBarHeight();
}
示例6: setStatusBarTranslate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入依赖的package包/类
public static void setStatusBarTranslate(AppCompatActivity mActivity, int resId){
SystemBarTintManager tintManager = new SystemBarTintManager(mActivity);
if (resId== R.color.transparent){
// enable status bar tint
tintManager.setStatusBarTintEnabled(false);
// enable navigation bar tint
tintManager.setNavigationBarTintEnabled(false);
//noinspection deprecation
}else {
// enable status bar tint
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint
tintManager.setNavigationBarTintEnabled(true);
// enable navigation bar tint
}
tintManager.setStatusBarTintColor(mActivity.getResources().getColor(resId));
}
示例7: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// mNewsItemBiz = new NewsItemBiz(this);
//使用tintManager设置状态栏的颜色
mTintManager= new SystemBarTintManager(this);
// enable status bar tint
//mTintManager.setStatusBarTintEnabled(true);
if (isNavBarTransparent()) {
mTintManager.setStatusBarTintEnabled(true);
// 有虚拟按键时
if (isHasNavigationBar()) {
mTintManager.setNavigationBarTintEnabled(true);
}else{
mTintManager.setNavigationBarTintEnabled(false);
}
}
// set a custom tint color for all system bars
mTintManager.setTintColor(getResources().getColor(R.color.dark_primary_color));
// SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
}
示例8: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_three);
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.setStatusBarTintEnabled(true);
// enable navigation bar tint 激活导航栏
tintManager.setNavigationBarTintEnabled(true);
//设置系统栏设置颜色
//tintManager.setTintColor(R.color.red);
//给状态栏设置颜色
tintManager.setStatusBarTintResource(R.color.mask_tags_1);
//Apply the specified drawable or color resource to the system navigation bar.
//给导航栏设置资源
tintManager.setNavigationBarTintResource(R.color.mask_tags_1);
}
}
示例9: 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);
}
}
示例10: 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);
}
}
示例11: 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();
}
});
}
示例12: 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);
}
}
示例13: 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);
}
}
示例14: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_common_listview);
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.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.app_main_theme_color);
}
containerView = (LinearLayout)findViewById(R.id.myLinearLayout);
context = this;
inflater = LayoutInflater.from(context);
listDataLoadWrap = new CommonListRequestWrap<T>(context, this, getBeanType());
pagingListViewWrap = getPagingListViewWrap(this);
loadListDataErrorViewWrap = new LoadListDataErrorViewWrap(this);
}
示例15: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
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.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.app_main_theme_color);
}
fragmentManager = getFragmentManager();
regToWx();
initActionBar();
initUpdate();
initViews();
initViewEvents();
showFragment(1);
}