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