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