Example usage for android.content.res ColorStateList valueOf

List of usage examples for android.content.res ColorStateList valueOf

Introduction

In this page you can find the example usage for android.content.res ColorStateList valueOf.

Prototype

@NonNull
public static ColorStateList valueOf(@ColorInt int color) 

Source Link

Usage

From source file:com.shine.demo.viewpager.smartTabLayout.SmartTabLayout.java

public SmartTabLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    // Disable the Scroll Bar
    setHorizontalScrollBarEnabled(false);

    final DisplayMetrics dm = getResources().getDisplayMetrics();
    final float density = dm.density;

    int tabBackgroundResId = NO_ID;
    boolean textAllCaps = TAB_VIEW_TEXT_ALL_CAPS;
    ColorStateList textColors;//from  ww w  .j a v a2  s . co m
    float textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP, dm);
    int textHorizontalPadding = (int) (TAB_VIEW_PADDING_DIPS * density);
    int textMinWidth = (int) (TAB_VIEW_TEXT_MIN_WIDTH * density);
    boolean distributeEvenly = DEFAULT_DISTRIBUTE_EVENLY;
    int customTabLayoutId = NO_ID;
    int customTabTextViewId = NO_ID;
    boolean clickable = TAB_CLICKABLE;
    int titleOffset = (int) (TITLE_OFFSET_DIPS * density);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.stl_SmartTabLayout, defStyle, 0);
    tabBackgroundResId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_defaultTabBackground,
            tabBackgroundResId);
    textAllCaps = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_defaultTabTextAllCaps, textAllCaps);
    textColors = a.getColorStateList(R.styleable.stl_SmartTabLayout_stl_defaultTabTextColor);
    textSize = a.getDimension(R.styleable.stl_SmartTabLayout_stl_defaultTabTextSize, textSize);
    textHorizontalPadding = a.getDimensionPixelSize(
            R.styleable.stl_SmartTabLayout_stl_defaultTabTextHorizontalPadding, textHorizontalPadding);
    textMinWidth = a.getDimensionPixelSize(R.styleable.stl_SmartTabLayout_stl_defaultTabTextMinWidth,
            textMinWidth);
    customTabLayoutId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_customTabTextLayoutId,
            customTabLayoutId);
    customTabTextViewId = a.getResourceId(R.styleable.stl_SmartTabLayout_stl_customTabTextViewId,
            customTabTextViewId);
    distributeEvenly = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_distributeEvenly, distributeEvenly);
    clickable = a.getBoolean(R.styleable.stl_SmartTabLayout_stl_clickable, clickable);
    titleOffset = a.getLayoutDimension(R.styleable.stl_SmartTabLayout_stl_titleOffset, titleOffset);
    a.recycle();

    this.titleOffset = titleOffset;
    this.tabViewBackgroundResId = tabBackgroundResId;
    this.tabViewTextAllCaps = textAllCaps;
    this.tabViewTextColors = (textColors != null) ? textColors : ColorStateList.valueOf(TAB_VIEW_TEXT_COLOR);
    this.tabViewTextSize = textSize;
    this.tabViewTextHorizontalPadding = textHorizontalPadding;
    this.tabViewTextMinWidth = textMinWidth;
    this.internalTabClickListener = clickable ? new InternalTabClickListener() : null;
    this.distributeEvenly = distributeEvenly;

    if (customTabLayoutId != NO_ID) {
        setCustomTabView(customTabLayoutId, customTabTextViewId);
    }

    this.tabStrip = new SmartTabStrip(context, attrs);

    if (distributeEvenly && tabStrip.isIndicatorAlwaysInCenter()) {
        throw new UnsupportedOperationException(
                "'distributeEvenly' and 'indicatorAlwaysInCenter' both use does not support");
    }

    this.tabViewTextColors = new ColorStateList(
            new int[][] { new int[] { android.R.attr.state_pressed },
                    new int[] { android.R.attr.state_selected }, new int[] {} },
            new int[] { Color.rgb(255, 111, 51), Color.rgb(255, 111, 51), Color.parseColor("#222222") });

    // Make sure that the Tab Strips fills this View
    setFillViewport(!tabStrip.isIndicatorAlwaysInCenter());

    addView(tabStrip, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

}

From source file:org.floens.chan.ui.controller.ThemeSettingsController.java

private void showAccentColorPicker() {
    List<FloatingMenuItem> items = new ArrayList<>();
    FloatingMenuItem selected = null;/*from  w w w  . j  av a  2 s.  c o m*/
    for (ThemeHelper.PrimaryColor color : themeHelper.getColors()) {
        FloatingMenuItem floatingMenuItem = new FloatingMenuItem(new ColorsAdapterItem(color, color.color),
                color.displayName);
        items.add(floatingMenuItem);
        if (color == selectedAccentColor) {
            selected = floatingMenuItem;
        }
    }

    FloatingMenu menu = getColorsMenu(items, selected, textView);
    menu.setCallback(new FloatingMenu.FloatingMenuCallback() {
        @Override
        public void onFloatingMenuItemClicked(FloatingMenu menu, FloatingMenuItem item) {
            ColorsAdapterItem colorItem = (ColorsAdapterItem) item.getId();
            selectedAccentColor = colorItem.color;
            done.setBackgroundTintList(ColorStateList.valueOf(selectedAccentColor.color));
        }

        @Override
        public void onFloatingMenuDismissed(FloatingMenu menu) {

        }
    });
    menu.setPopupWidth(dp(200));
    menu.setPopupHeight(dp(300));
    menu.show();
}

From source file:org.mariotaku.twidere.util.ThemedLayoutInflaterFactory.java

private static void initViewTint(View view, IThemedActivity activity) {
    final int noTintColor, accentColor, backgroundTintColor;
    final boolean isColorTint;
    // View context is not derived from ActionBar, apply color tint directly
    final Resources resources = ((Activity) activity).getResources();
    final Context viewContext = view.getContext();
    final boolean isActionBarContext = isActionBarContext(viewContext,
            getActionBarContext((Activity) activity));
    final int themeResourceId = activity.getCurrentThemeResourceId();
    final boolean isDarkTheme = ThemeUtils.isDarkTheme(themeResourceId);
    final int backgroundColorApprox;
    if (!isActionBarContext) {
        accentColor = activity.getCurrentThemeColor();
        final int[] darkLightColors = new int[2];
        ThemeUtils.getDarkLightForegroundColors((Context) activity, activity.getCurrentThemeResourceId(),
                darkLightColors);/*ww w.ja va  2s.c  o  m*/
        noTintColor = TwidereColorUtils.getContrastYIQ(accentColor, ThemeUtils.ACCENT_COLOR_THRESHOLD,
                darkLightColors[0], darkLightColors[1]);
        backgroundTintColor = accentColor;
        backgroundColorApprox = isDarkTheme ? Color.BLACK : Color.WHITE;
        isColorTint = true;
    } else if (isDarkTheme) {
        // View context is derived from ActionBar but is currently dark theme, so we should show
        // light
        noTintColor = Color.WHITE;
        accentColor = activity.getCurrentThemeColor();
        backgroundTintColor = noTintColor;
        backgroundColorApprox = Color.BLACK;
        isColorTint = true;
    } else {
        // View context is derived from ActionBar and it's light theme, so we use contrast color
        final int actionBarColor = activity.getCurrentThemeColor();
        final int actionBarTheme = ThemeUtils.getActionBarThemeResource(activity.getThemeResourceId(),
                actionBarColor);
        accentColor = ThemeUtils.getColorFromAttribute(viewContext, android.R.attr.colorForeground, 0);
        noTintColor = ThemeUtils.getColorFromAttribute(viewContext, android.R.attr.colorBackground, 0);
        backgroundTintColor = accentColor;
        backgroundColorApprox = Color.WHITE;
        isColorTint = false;
    }
    final boolean isAccentOptimal = Math
            .abs(TwidereColorUtils.getYIQContrast(backgroundColorApprox, accentColor)) > 64;
    if (view instanceof TextView) {
        final TextView textView = (TextView) view;
        if (isAccentOptimal) {
            textView.setLinkTextColor(accentColor);
        }
    }
    if (view instanceof IThemeAccentView) {
        if (isAccentOptimal || !isColorTint) {
            ((IThemeAccentView) view).setAccentTintColor(ColorStateList.valueOf(accentColor));
        } else {
            final int defaultAccentColor = ThemeUtils.getColorFromAttribute(viewContext, R.attr.colorAccent,
                    resources.getColor(R.color.branding_color));
            ((IThemeAccentView) view).setAccentTintColor(ColorStateList.valueOf(defaultAccentColor));
        }
    } else if (view instanceof IThemeBackgroundTintView) {
        if (isAccentOptimal || !isColorTint) {
            ((IThemeBackgroundTintView) view)
                    .setBackgroundTintColor(ColorStateList.valueOf(backgroundTintColor));
        }
    } else if (view instanceof TintableBackgroundView) {
        final TintableBackgroundView tintable = (TintableBackgroundView) view;
        if (isAccentOptimal || !isColorTint) {
            applyTintableBackgroundViewTint(tintable, accentColor, noTintColor, backgroundTintColor,
                    isColorTint);
        }
    } else if (view instanceof TwidereToolbar) {
        final Context context = viewContext;
        if (context instanceof android.support.v7.internal.view.ContextThemeWrapper) {
            ((TwidereToolbar) view).setItemColor(ThemeUtils.getThemeForegroundColor(context,
                    ((ContextThemeWrapper) context).getThemeResId()));
        } else {
            ((TwidereToolbar) view).setItemColor(ThemeUtils.getThemeForegroundColor(context));
        }
    } else if (view instanceof EditText) {
        if (isAccentOptimal || !isColorTint) {
            ViewCompat.setBackgroundTintList(view, ColorStateList.valueOf(backgroundTintColor));
        }
    } else if (view instanceof ProgressBar) {
        if (isAccentOptimal || !isColorTint) {
            ViewSupport.setIndeterminateTintList((ProgressBar) view, ColorStateList.valueOf(accentColor));
            ViewSupport.setProgressTintList((ProgressBar) view, ColorStateList.valueOf(accentColor));
            ViewSupport.setProgressBackgroundTintList((ProgressBar) view, ColorStateList.valueOf(accentColor));
        }
    }
}

From source file:com.softminds.matrixcalculator.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    boolean isDark = preferences.getBoolean("DARK_THEME_KEY", false);

    if (isDark)/*from  ww w  .jav a2 s . c o  m*/
        setTheme(R.style.AppThemeDark_NoActionBar);
    else
        setTheme(R.style.AppTheme_NoActionBar);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    adCard = findViewById(R.id.MainActivity_Advt_Card);

    if (!((GlobalValues) getApplication()).DonationKeyFound()) {
        AdView mAdView = findViewById(R.id.adViewMainActivity);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);
        mAdView.setAdListener(new AdListener() {
            @Override
            public void onAdLoaded() {
                ((GlobalValues) getApplication()).AdLoaded = true;
                adCard.setVisibility(View.VISIBLE);
            }
        });
    } else {
        adCard.setVisibility(View.GONE);
    }

    t = findViewById(R.id.OpeningHint);

    if (isDark)
        t.setTextColor(ContextCompat.getColor(this, R.color.white));

    else
        t.setTextColor(ContextCompat.getColor(this, R.color.colorPrimary));

    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    if (!((GlobalValues) getApplication()).GetCompleteList().isEmpty())
        t.setText(null);

    DrawerLayout drawer = findViewById(R.id.drawer_layout_main);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    toggle.syncState();

    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    View v = navigationView.getHeaderView(0);
    navigationView.setCheckedItem(R.id.Home);
    NavMenuItem = navigationView.getMenu();

    if (((GlobalValues) getApplication()).DonationKeyFound())
        NavMenuItem.findItem(R.id.upgrade).setVisible(false);

    if (v != null) {
        if (isDark) {
            v.setBackground(ContextCompat.getDrawable(this, R.drawable.side_nav_bar_dark));
            navigationView.setItemTextColor(ColorStateList.valueOf(Color.parseColor("#ffffff")));
        } else
            v.setBackground(ContextCompat.getDrawable(this, R.drawable.side_nav_bar));
    }

    FloatingActionButton floatingActionButton = findViewById(R.id.MainFAB);
    floatingActionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (((GlobalValues) getApplication()).CanCreateVariable()) {
                ActivityManager.MemoryInfo memoryInfo = getAvailableMemory();
                if (memoryInfo != null && !memoryInfo.lowMemory) {
                    Log.d("MainActivity", "Available Memory is :" + String.valueOf(memoryInfo.availMem));
                    Intent intent = new Intent(getApplicationContext(), MakeNewMatrix.class);
                    startActivityForResult(intent, RESULT);
                } else {
                    new AlertDialog.Builder(MainActivity.this).setPositiveButton(R.string.proceed_to_create,
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                    Intent intent = new Intent(getApplicationContext(), MakeNewMatrix.class);
                                    startActivityForResult(intent, RESULT);
                                }
                            }).setTitle(R.string.on_low_memory).setMessage(R.string.low_memory_mess).show();
                }
            } else {
                Toast.makeText(getApplicationContext(), R.string.upgrade_needed, Toast.LENGTH_LONG).show();
            }

        }
    });

    if (savedInstanceState == null) {
        MainActivityFragmentList mh = new MainActivityFragmentList();
        getSupportFragmentManager().beginTransaction().add(R.id.MainContent, mh, "MAIN_LIST").commit();
    }

    if (((GlobalValues) getApplication()).Promotion) {
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
        String rated = sharedPreferences.getString("RATED", "no");
        if ((rated.equals("no") || rated.equals("later")) && ((GlobalValues) getApplication()).ThisSession) {
            ((GlobalValues) getApplication()).ThisSession = false;
            PopRateDialog();
        }
    }

}

From source file:com.musenkishi.atelier.Atelier.java

private static void applyColorToView(final FloatingActionButton floatingActionButton, int color,
        boolean fromCache, boolean shouldMask) {
    if (fromCache) {
        if (shouldMask) {
            if (floatingActionButton.getDrawable() != null) {
                floatingActionButton.getDrawable().mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
            } else if (floatingActionButton.getBackground() != null) {
                floatingActionButton.getBackground().mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
            }/*from  w  w w  .  j  ava 2 s.  com*/
        } else {
            ColorStateList colorStateList = ColorStateList.valueOf(color);
            floatingActionButton.setBackgroundTintList(colorStateList);
        }
    } else {
        if (shouldMask) {

            Integer colorFrom;
            ValueAnimator.AnimatorUpdateListener imageAnimatorUpdateListener = new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    if (floatingActionButton.getDrawable() != null) {
                        floatingActionButton.getDrawable().mutate().setColorFilter(
                                (Integer) valueAnimator.getAnimatedValue(), PorterDuff.Mode.MULTIPLY);
                    } else if (floatingActionButton.getBackground() != null) {
                        floatingActionButton.getBackground().mutate().setColorFilter(
                                (Integer) valueAnimator.getAnimatedValue(), PorterDuff.Mode.MULTIPLY);
                    }
                }
            };
            ValueAnimator.AnimatorUpdateListener animatorUpdateListener;

            PaletteTag paletteTag = (PaletteTag) floatingActionButton.getTag(viewTagKey);
            animatorUpdateListener = imageAnimatorUpdateListener;
            colorFrom = paletteTag.getColor();
            floatingActionButton.setTag(viewTagKey, new PaletteTag(paletteTag.getId(), color));

            Integer colorTo = color;
            ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
            colorAnimation.addUpdateListener(animatorUpdateListener);
            colorAnimation.setDuration(300);
            colorAnimation.start();

        } else {

            Integer colorFrom = Color.parseColor("#FFFAFAFA");

            ColorStateList colorStateList = floatingActionButton.getBackgroundTintList();
            if (colorStateList != null) {
                colorFrom = colorStateList.getDefaultColor();
            }

            Integer colorTo = color;
            ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
            colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animator) {
                    int color = (Integer) animator.getAnimatedValue();
                    floatingActionButton.setBackgroundTintList(ColorStateList.valueOf(color));
                }
            });
            colorAnimation.setDuration(300);
            colorAnimation.start();
        }
    }
}

From source file:com.android.tv.guide.ProgramItemView.java

private void initIfNeeded() {
    if (sVisibleThreshold != 0) {
        return;//from  www . ja  v  a2 s .c o m
    }
    Resources res = getContext().getResources();

    sVisibleThreshold = res.getDimensionPixelOffset(R.dimen.program_guide_table_item_visible_threshold);

    sItemPadding = res.getDimensionPixelOffset(R.dimen.program_guide_table_item_padding);

    ColorStateList programTitleColor = ColorStateList
            .valueOf(Utils.getColor(res, R.color.program_guide_table_item_program_title_text_color));
    ColorStateList grayedOutProgramTitleColor = Utils.getColorStateList(res,
            R.color.program_guide_table_item_grayed_out_program_text_color);
    ColorStateList episodeTitleColor = ColorStateList
            .valueOf(Utils.getColor(res, R.color.program_guide_table_item_program_episode_title_text_color));
    ColorStateList grayedOutEpisodeTitleColor = ColorStateList.valueOf(
            Utils.getColor(res, R.color.program_guide_table_item_grayed_out_program_episode_title_text_color));
    int programTitleSize = res.getDimensionPixelSize(R.dimen.program_guide_table_item_program_title_font_size);
    int episodeTitleSize = res
            .getDimensionPixelSize(R.dimen.program_guide_table_item_program_episode_title_font_size);

    sProgramTitleStyle = new TextAppearanceSpan(null, 0, programTitleSize, programTitleColor, null);
    sGrayedOutProgramTitleStyle = new TextAppearanceSpan(null, 0, programTitleSize, grayedOutProgramTitleColor,
            null);
    sEpisodeTitleStyle = new TextAppearanceSpan(null, 0, episodeTitleSize, episodeTitleColor, null);
    sGrayedOutEpisodeTitleStyle = new TextAppearanceSpan(null, 0, episodeTitleSize, grayedOutEpisodeTitleColor,
            null);
}

From source file:com.sociablue.nanodegree_p1.MovieListFragment.java

private void initializeFab(View rootView) {
    final RelativeLayout buttonContainer = (RelativeLayout) rootView.findViewById(R.id.menu_button_container);
    final FloatingActionButton Fab = (FloatingActionButton) rootView.findViewById(R.id.fab);
    final ImageView bottomBar = (ImageView) rootView.findViewById(R.id.menu_bottom_bar);
    final ImageView topBar = (ImageView) rootView.findViewById(R.id.menu_top_bar);
    Fab.setOnClickListener(new View.OnClickListener() {
        @TargetApi(Build.VERSION_CODES.LOLLIPOP)
        @Override//from w w w  .ja  va2  s.c  om
        public void onClick(View v) {

            //Menu Button Icon Animation
            //Setting up necessary variables
            long animationDuration = 500;
            float containerHeight = buttonContainer.getHeight();
            float containerCenterY = containerHeight / 2;
            float containerCenterX = buttonContainer.getWidth() / 2;
            float topBarCenter = topBar.getTop() + topBar.getHeight() / 2;
            float widthOfBar = topBar.getWidth();
            float heightOfBar = topBar.getHeight();
            final float distanceBetweenBars = (containerCenterY - topBarCenter);

            /**
             *TODO: Refactor block of code to use Value Property Animator. Should be more efficient to animate multiple properties
             *and objects at the same time. Also, will try to break intialization into smaller functions.
             */

            //Setting up animations of hamburger bars and rotation

            /**
             * Animation For Top Menu Button Icon Bar. Sliding from the top to rest on top of the middle bar.
             * Y Translation is 1/2 the height of the hamburger bar minus the distance.
             * Subtracting the distance from the height because the distance between bars is
             * calculated of the exact center of the button.
             * With out the subtraction the bar would translate slightly below the middle bar.
             */
            float yTranslation = heightOfBar / 2 - distanceBetweenBars;
            float xTranslation = widthOfBar / 2 + heightOfBar / 2;
            TranslateAnimation topBarTranslationAnim = new TranslateAnimation(Animation.ABSOLUTE, 0f,
                    Animation.ABSOLUTE, 0F, Animation.ABSOLUTE, 0f, Animation.ABSOLUTE, distanceBetweenBars);
            topBarTranslationAnim.setDuration((long) (animationDuration * 0.8));
            topBarTranslationAnim.setFillAfter(true);

            //Animation for bottom hamburger bar. Translates and Rotates to create 'X'
            AnimationSet bottomBarAnimation = new AnimationSet(true);
            bottomBarAnimation.setFillAfter(true);

            //Rotate to create cross. (The cross becomes the X after the button rotation completes"
            RotateAnimation bottomBarRotationAnimation = new RotateAnimation(0f, 90f,
                    Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 1f);
            bottomBarRotationAnimation.setDuration(animationDuration);
            bottomBarAnimation.addAnimation(bottomBarRotationAnimation);

            //Translate to correct X alignment
            TranslateAnimation bottomBarTranslationAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0f,
                    Animation.ABSOLUTE, -xTranslation, Animation.ABSOLUTE, 0f, Animation.ABSOLUTE,
                    -yTranslation);
            bottomBarTranslationAnimation.setDuration(animationDuration);
            bottomBarAnimation.addAnimation(bottomBarTranslationAnimation);

            //Button Specific Animations
            //Rotate Button Container
            RotateAnimation containerRotationAnimation = new RotateAnimation(0, 135f,
                    Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
            containerRotationAnimation.setDuration(animationDuration);
            containerRotationAnimation.setFillAfter(true);

            //Animate change of button color between Active and Disabled colors that have been
            //defined in color.xml
            int activeColor = getResources().getColor(R.color.active_button);
            int disabledColor = getResources().getColor(R.color.disabled_button);

            //Need to use ValueAnimator because property animator does not support BackgroundTint
            ValueAnimator buttonColorAnimation = ValueAnimator.ofArgb(activeColor, disabledColor);
            buttonColorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    Fab.setBackgroundTintList(ColorStateList.valueOf((int) animation.getAnimatedValue()));
                }
            });
            buttonColorAnimation.setDuration(animationDuration);

            //Start all the animations
            topBar.startAnimation(topBarTranslationAnim);
            bottomBar.startAnimation(bottomBarAnimation);
            buttonContainer.startAnimation(containerRotationAnimation);
            buttonColorAnimation.start();

            //Toogle mMenu open and closed
            if (mMenu.isOpen()) {
                //If mMenu is open, do the reverse of the animation
                containerRotationAnimation
                        .setInterpolator(new ReverseInterpolator(new AccelerateInterpolator()));
                topBarTranslationAnim.setInterpolator(new ReverseInterpolator(new AccelerateInterpolator()));
                bottomBarAnimation.setInterpolator(new ReverseInterpolator(new AccelerateInterpolator()));
                buttonColorAnimation.setInterpolator(new ReverseInterpolator(new LinearInterpolator()));
                mMenu.close();
            } else {
                bottomBarAnimation.setInterpolator(new AccelerateInterpolator());
                mMenu.open();
            }
        }
    });
}

From source file:com.appeaser.sublimepickerlibrary.utilities.SUtils.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static Drawable createImageViewRippleBg(int colorButtonNormal, int colorControlHighlight) {
    return new RippleDrawable(ColorStateList.valueOf(colorControlHighlight), null,
            createImageViewShape(colorButtonNormal));
}

From source file:arun.com.chromer.util.ColorUtil.java

@NonNull
public static Drawable getRippleDrawableCompat(final @ColorInt int color) {
    if (Utils.isLollipopAbove()) {
        return new RippleDrawable(ColorStateList.valueOf(color), null, null);
    }// ww w  . j  a v a 2 s.c  o  m
    int translucentColor = ColorUtils.setAlphaComponent(color, 0x44);
    StateListDrawable stateListDrawable = new StateListDrawable();
    int[] states = new int[] { android.R.attr.state_pressed };
    stateListDrawable.addState(states, new ColorDrawable(translucentColor));
    return stateListDrawable;
}

From source file:com.fastaccess.ui.modules.repos.RepoPagerView.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle("");
    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction().add(R.id.container, new DummyFragment(), "DummyFragment")
                .commit();/*www  .ja  va 2s  . c  o  m*/
    }
    Typeface myTypeface = TypeFaceHelper.getTypeface();
    bottomNavigation.setDefaultTypeface(myTypeface);
    fab.setImageResource(R.drawable.ic_add);
    fab.setImageTintList(ColorStateList.valueOf(Color.WHITE));
    showHideFab();
}