本文整理匯總了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());
}
}