本文整理汇总了Java中com.readystatesoftware.systembartint.SystemBarTintManager.setStatusBarTintEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java SystemBarTintManager.setStatusBarTintEnabled方法的具体用法?Java SystemBarTintManager.setStatusBarTintEnabled怎么用?Java SystemBarTintManager.setStatusBarTintEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.readystatesoftware.systembartint.SystemBarTintManager
的用法示例。
在下文中一共展示了SystemBarTintManager.setStatusBarTintEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
});
}
示例2: 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);
}
}
示例3: 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"));
}
示例4: 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);
}
}
示例5: 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);
}
示例6: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.inject(this);
setSupportActionBar(toolbar);
// create our manager instance after the content view is set
mTintManager = new SystemBarTintManager(this);
// enable status bar tint
mTintManager.setStatusBarTintEnabled(true);
adapter = new MyPagerAdapter(getSupportFragmentManager());
pager.setAdapter(adapter);
tabs.setViewPager(pager);
final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
.getDisplayMetrics());
pager.setPageMargin(pageMargin);
changeColor(getResources().getColor(R.color.green));
tabs.setOnTabReselectedListener(new SpinningTabStrip.OnTabReselectedListener() {
@Override
public void onTabReselected(int position) {
Toast.makeText(MainActivity.this, "Tab reselected: " + position, Toast.LENGTH_SHORT).show();
}
});
}
示例7: 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));
}
}
示例8: initTintManager
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
private void initTintManager() {
// create our manager instance after the content view is set
// SystemBarTintManager tintManager = new SystemBarTintManager(this);
// enable status bar tint
// tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint
// tintManager.setNavigationBarTintEnabled(false);
// set a custom tint color for all system bars
// tintManager.setTintColor(getResources().getColor(R.color.dark_darker));
// set a custom navigation bar resource
// tintManager.setNavigationBarTintResource(R.color.dark_darker);
// set a custom status bar drawable
// tintManager.setStatusBarTintColor(getResources().getColor(R.color.dark_darker));
// Create SystemBarTintManager
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.dark_dark);
mBarTintManager = tintManager;
}
示例9: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_donate);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.statusbar_color);
View mainContainer = findViewById(R.id.main_container);
SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mainContainer.setPadding(0, config.getPixelInsetTop(true), config.getPixelInsetRight(), config.getPixelInsetBottom());
}
donationButton = (Button) findViewById(R.id.button_donate);
githubButton = (Button) findViewById(R.id.button_github);
donationButton.setOnClickListener(this);
githubButton.setOnClickListener(this);
}
示例10: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_environment);
if (savedInstanceState == null) {
placeholderFragment = new PlaceholderFragment();
getFragmentManager().beginTransaction()
.add(R.id.container, placeholderFragment)
.commit();
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
int flags = getWindow().getAttributes().flags | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
getWindow().setFlags(flags,flags);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setTintColor(getResources().getColor(R.color.action_bar_add_environment));
}
}
示例11: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new HipSpiceFragment_())
.commit();
}
setProgressBarVisibility(false);
setProgressBarIndeterminateVisibility(false);
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(R.color.blue);
SpannableString spannableString = new SpannableString(getString(R.string.app_name));
spannableString.setSpan(
new TypefaceSpan(this, "OpenSans-Regular.ttf"),
0,
spannableString.length(),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
);
getSupportActionBar().setTitle(spannableString);
}
示例12: configureActionbar
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
private void configureActionbar(){
ActionBar bar = getActionBar();
bar.setHomeButtonEnabled(true);
bar.setDisplayShowHomeEnabled(false);
tint = new SystemBarTintManager(this);
TypedValue tintColor = new TypedValue();
if(getTheme().resolveAttribute(R.attr.statusBarBackground, tintColor, true)){
tint.setStatusBarTintEnabled(true);
tint.setTintColor(tintColor.data);
defaultActionbarColor = tintColor.data;
currentActionbarColor = tintColor.data;
}else{
tint.setStatusBarTintEnabled(false);
}
TypedValue actionbarBackground = new TypedValue();
if(getTheme().resolveAttribute(R.attr.actionbarBackgroundLayerList, actionbarBackground, false)){
actionbarBackgroundList = (LayerDrawable) getResources().getDrawable(actionbarBackground.data);
actionbarBackgroundList.mutate();
actionbarColor = (ColorDrawable) actionbarBackgroundList.findDrawableByLayerId(R.id.actionbar_background_color);
actionbarColor.mutate();
bar.setBackgroundDrawable(actionbarBackgroundList);
}
}
示例13: onCreate
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// to make the statusbar tinted in API 19 or above, won't make any
// difference in other devices
SystemBarTintManager tintManager = new SystemBarTintManager(this);
// enable status bar tint
tintManager.setStatusBarTintEnabled(true);
// enable navigation bar tint
tintManager.setNavigationBarTintEnabled(true);
tintManager.setTintColor(Color.parseColor("#00796b"));
// Display the fragment as the main content.
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new PrefFragment()).commit();
getActionBar().setDisplayHomeAsUpEnabled(true);
}
示例14: setUpActionBar
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
private void setUpActionBar(){
ActionBar actionBar = getSupportActionBar();
actionBarColor = getResources().getColor(R.color.action_bar_settings);
if(!Utility.checkForNullAndWarn(actionBar, LOG_TAG)){
actionBar.setBackgroundDrawable(new ColorDrawable(actionBarColor));
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setTintColor(actionBarColor);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mPaddingTop = tintManager.getConfig().getPixelInsetTop(true);
if(Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT){
mPaddingTop += 16;
}
mPaddingBottom = tintManager.getConfig().getNavigationBarHeight();
}
}
示例15: updateViews
import com.readystatesoftware.systembartint.SystemBarTintManager; //导入方法依赖的package包/类
/**
* Call this method when you need to update the MainActivity view components' colors based on
* update in the {@link MainActivity#currentTab}
* Warning - All the variables should be initialised before calling this method!
*/
public void updateViews(ColorDrawable colorDrawable) {
// appbar view color
mainActivity.buttonBarFrame.setBackgroundColor(colorDrawable.getColor());
// action bar color
mainActivity.getSupportActionBar().setBackgroundDrawable(colorDrawable);
// drawer status bar I guess
mainActivity.mDrawerLayout.setStatusBarBackgroundColor(colorDrawable.getColor());
// drawer header background
mainActivity.drawerHeaderParent.setBackgroundColor(colorDrawable.getColor());
if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// for lollipop devices, the status bar color
mainActivity.getWindow().setStatusBarColor(colorDrawable.getColor());
if (colourednavigation)
mainActivity.getWindow().setNavigationBarColor(PreferenceUtils
.getStatusColor(colorDrawable.getColor()));
} else if (SDK_INT == Build.VERSION_CODES.KITKAT_WATCH || SDK_INT == Build.VERSION_CODES.KITKAT) {
// for kitkat devices, the status bar color
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(colorDrawable.getColor());
}
}