Colors colors = (Colors) bundle.getSerializable(Libs.BUNDLE_COLORS); if (colors != null) { ab.setBackgroundDrawable(new ColorDrawable(colors.appBarColor)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setStatusBarColor(colors.statusBarColor); ab.setBackgroundDrawable(null);
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); actionBar.setHomeButtonEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setBackgroundDrawable( new ColorDrawable(ContextCompat.getColor(this, android.R.color.transparent))); } mGamesFragment = PlayGamesFragment.getInstance(this, this); mApiClient = new GoogleApiClient.Builder(this).addApi(AppIndex.APP_INDEX_API).build(); // add App Indexing API BASE_APP_URI = Uri.parse( "android-app://" + getApplicationContext().getPackageName() + "/" + getResources() .getString(R.string.santa_tracker_deep_link_prefix)); ImmersiveModeHelper.setImmersiveSticky(getWindow()); ImmersiveModeHelper.installSystemUiVisibilityChangeListener(getWindow()); }
@Override public void run() { Drawable colorDrawable = new ColorDrawable(newColor); actionBar.setBackgroundDrawable(colorDrawable); } });
public LiveThemeManager(Activity activity) { mActivity = activity; if (activity instanceof AppCompatActivity) addColorProperty(R.attr.colorPrimary, (c) -> { ((AppCompatActivity) activity).getSupportActionBar().setBackgroundDrawable( new ColorDrawable(c)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && activity.findViewById(R.id.action_bar_container) != null) activity.findViewById(R.id.action_bar_container).invalidateOutline(); }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) addColorProperty(R.attr.colorPrimaryDark, (c) -> activity.getWindow().setStatusBarColor(c)); addColorProperty(android.R.attr.colorBackground, (c) -> activity.getWindow().setBackgroundDrawable(new ColorDrawable(c))); }
/** * Make the app bar transparent or translucent. * <p>Useful to make it transparent if a backdrop view has been added. * * @param transparent {@code true} to make the app bar transparent. */ public void setAppBarTransparent(boolean transparent) { if (getSupportActionBar() != null) { getSupportActionBar().setBackgroundDrawable( new ColorDrawable(transparent ? Color.TRANSPARENT : DynamicTheme.getInstance().get().getPrimaryColor())); } }
transition.setCrossFadeEnabled(true); transition.startTransition(200); actionBar.setBackgroundDrawable(transition); } else { actionBar.setBackgroundDrawable(newDrawable);