Example usage for android.content.res Resources getColor

List of usage examples for android.content.res Resources getColor

Introduction

In this page you can find the example usage for android.content.res Resources getColor.

Prototype

@ColorInt
@Deprecated
public int getColor(@ColorRes int id) throws NotFoundException 

Source Link

Document

Returns a color integer associated with a particular resource ID.

Usage

From source file:com.hrules.darealmvp.sample.presentation.views.fragments.ListFragmentView.java

@SuppressWarnings("deprecation")
public void initializeViews(@NonNull View view) {
    unbinder = ButterKnife.bind(this, view);

    recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
    Resources res = getResources();
    recyclerView.addItemDecoration(new ColorDividerItemDecoration(res.getColor(android.R.color.darker_gray),
            res.getDimension(R.dimen.list_divider_size)));
}

From source file:com.microsoft.rightsmanagement.ui.widget.TemplateDescriptorPickerFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    Logger.ms(TAG, "onCreate");
    super.onCreate(savedInstanceState);
    Resources resources = getActivity().getResources();
    mDisabledButtonColor = resources.getColor(R.color.light_gray);
    mEnabledButtonColor = resources.getColor(R.color.dark_black);
    Logger.me(TAG, "onCreate");
}

From source file:anabolicandroids.chanobol.util.swipebottom.CircleImageView.java

/**
 * Update the background color of the circle image view.
 *//*from w  w w .  jav a  2 s . c  om*/
public void setBackgroundColor(int colorRes) {
    if (getBackground() instanceof ShapeDrawable) {
        final Resources res = getResources();
        ((ShapeDrawable) getBackground()).getPaint().setColor(res.getColor(colorRes));
    }
}

From source file:com.bison.app.ui.refresh.CircleImageView.java

/**
 * Update the background color of the circle image view.
 *//*  w  ww.  j a  va2s  .  com*/
public void setBackgroundColor(@ColorRes int colorRes) {
    if (getBackground() instanceof ShapeDrawable) {
        final Resources res = getResources();
        ((ShapeDrawable) getBackground()).getPaint().setColor(res.getColor(colorRes));
    }
}

From source file:com.mde.potdroid.helpers.ptr.CircleImageView.java

/**
 * Update the background color of the circle image view.
 *//*from  www  . j ava2 s . c o  m*/
@SuppressWarnings("ResourceType")
public void setBackgroundColor(int colorRes) {
    if (getBackground() instanceof ShapeDrawable) {
        final Resources res = getResources();
        ((ShapeDrawable) getBackground()).getPaint().setColor(res.getColor(colorRes));
    }
}

From source file:app.philm.in.view.InsetFrameLayout.java

public void setInsetBackgroundColor(int color) {
    Resources r = getResources();

    setInsetBackgroundColorRaw(Color.argb(Color.alpha(r.getColor(R.color.chrome_custom_background_alpha)),
            Color.red(color), Color.green(color), Color.blue(color)));
}

From source file:com.androidmapsextensions.DefaultClusterOptionsProvider.java

private Paint createTextPaint(Resources resources) {
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(resources.getColor(R.color.ame_default_cluster_text_color));
    shadowBlurRadius = resources.getDimension(R.dimen.ame_default_cluster_text_shadow_blur_radius);
    if (shadowBlurRadius > 0.0f) {
        shadowOffsetX = resources.getDimension(R.dimen.ame_default_cluster_text_shadow_offset_x);
        shadowOffsetY = resources.getDimension(R.dimen.ame_default_cluster_text_shadow_offset_y);
        int shadowColor = resources.getColor(R.color.ame_default_cluster_text_shadow_color);
        paint.setShadowLayer(shadowBlurRadius, shadowOffsetX, shadowOffsetY, shadowColor);
    }/*from  w ww.jav a  2  s.  c o  m*/
    paint.setTextSize(resources.getDimension(R.dimen.ame_default_cluster_text_size));
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    return paint;
}

From source file:com.example.android.animationsdemo.ActivityPlans.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_screen_slide);

    // Instantiate a ViewPager and a PagerAdapter.
    mPager = (ViewPager) findViewById(R.id.pager);
    mPagerAdapter = new ScreenSlidePagerAdapter(getFragmentManager());
    mPager.setAdapter(mPagerAdapter);/*www  . j  av a  2 s. com*/

    mPager.setPageTransformer(true, new ZoomOutPageTransformer());
    mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When changing pages, reset the action bar actions since they are dependent
            // on which page is currently active. An alternative approach is to have each
            // fragment expose actions itself (rather than the activity exposing actions),
            // but for simplicity, the activity provides the actions in this sample.
            invalidateOptionsMenu();
        }
    });

    PagerTabStrip pagerTabStrip = (PagerTabStrip) findViewById(R.id.pager_title_strip);
    pagerTabStrip.setDrawFullUnderline(true);

    Resources res = getResources();
    int rcol = res.getColor(R.color.navygreen);
    pagerTabStrip.setTabIndicatorColor(rcol);
}

From source file:com.aqnote.app.wifianalyzer.wifi.graph.channel.ChannelGraphNavigation.java

private void setSelectedButton(Button button, boolean selected) {
    Resources resources = MainContext.INSTANCE.getResources();
    if (selected) {
        button.setBackgroundColor(resources.getColor(R.color.connected));
        button.setSelected(true);/*from  w  w w  .  ja  v  a 2s. c  om*/
    } else {
        button.setBackgroundColor(resources.getColor(R.color.connected_background));
        button.setSelected(false);
    }
}

From source file:com.google.android.apps.gutenberg.EventSelectionFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Resources resources = getResources();
    mTextColorDefault = resources.getColor(R.color.primary_text);
    mTextColorCurrent = resources.getColor(R.color.primary_dark);
    mTextColorPast = resources.getColor(R.color.tertiary_text);
    mTextColorInverse = resources.getColor(R.color.primary_text_inverse);
}