List of usage examples for android.content.res Resources getColor
@ColorInt @Deprecated public int getColor(@ColorRes int id) throws NotFoundException
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static void wrapMenuIcon(ActionMenuView view, int... excludeGroups) { final int itemBackgroundColor = ThemeUtils.getThemeBackgroundColor(view.getContext()); final int popupItemBackgroundColor = ThemeUtils.getThemeBackgroundColor(view.getContext(), view.getPopupTheme());// w ww . j a v a 2s. c o m final Resources resources = view.getResources(); final int colorDark = resources.getColor(R.color.action_icon_dark); final int colorLight = resources.getColor(R.color.action_icon_light); final int itemColor = ColorUtils.getContrastYIQ(itemBackgroundColor, colorDark, colorLight); final int popupItemColor = ColorUtils.getContrastYIQ(popupItemBackgroundColor, colorDark, colorLight); final Menu menu = view.getMenu(); final int childCount = view.getChildCount(); for (int i = 0, j = menu.size(), k = 0; i < j; i++) { final MenuItem item = menu.getItem(i); wrapMenuItemIcon(item, itemColor, excludeGroups); if (item.hasSubMenu()) { wrapMenuIcon(menu, popupItemColor, popupItemColor, excludeGroups); } if (item.isVisible()) { k++; } } }
From source file:com.codetroopers.betterpickers.radialtimepicker.CircleView.java
public CircleView(Context context) { super(context); Resources res = context.getResources(); mCircleColor = res.getColor(R.color.bpWhite); mCentralDotColor = res.getColor(R.color.numbers_text_color); mPaint.setAntiAlias(true);/*from w w w . ja va2s .c om*/ mIsInitialized = false; }
From source file:ca.zadrox.dota2esportticker.ui.TeamActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_team); mViewPager = (ViewPager) findViewById(R.id.view_pager); mTeamPagerAdapter = new TeamPagerAdapter(getFragmentManager()); mViewPager.setAdapter(mTeamPagerAdapter); mSlidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs); mSlidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1); Resources res = getResources(); mSlidingTabLayout.setSelectedIndicatorColors(res.getColor(R.color.tab_selected_strip)); mSlidingTabLayout.setDistributeEvenly(true); mSlidingTabLayout.setViewPager(mViewPager); }
From source file:com.androidmapsextensions.DefaultClusterOptionsProvider.java
public DefaultClusterOptionsProvider(Resources resources) { colors = new int[] { resources.getColor(R.color.ame_default_cluster_circle_color_small), resources.getColor(R.color.ame_default_cluster_circle_color_medium), resources.getColor(R.color.ame_default_cluster_circle_color_large), resources.getColor(R.color.ame_default_cluster_circle_color_extra_large), }; circlePaint = createCirclePaint(resources); circleShadowPaint = createCircleShadowPaint(resources); textPaint = createTextPaint(resources); textPadding = resources.getDimension(R.dimen.ame_default_cluster_text_padding); }
From source file:com.zns.comicdroid.adapter.AggregateAdapter.java
public AggregateAdapter(Context context, String imagePath) { super(context, R.layout.list_comicrow, null, new String[] { "Title" }, null, 0); mLayout = R.layout.list_comicrow;/*from ww w. ja va 2 s. com*/ mLayoutInflater = LayoutInflater.from(context); Resources res = context.getResources(); mColorDefault = res.getColor(R.color.contentBg); mColorIsBorrowed = res.getColor(R.color.listViewBorrowed); mImagePath = "file://".concat(imagePath); }
From source file:com.zns.comicdroid.adapter.ComicAdapter.java
public ComicAdapter(Context context, String imagePath) { super(context, R.layout.list_comicrow, null, new String[] { "Title" }, null, 0); mLayout = R.layout.list_comicrow;/* ww w .ja v a 2 s .c o m*/ mLayoutInflater = LayoutInflater.from(context); Resources res = context.getResources(); mColorDefault = res.getColor(R.color.contentBg); mColorIsBorrowed = res.getColor(R.color.listViewBorrowed); mImagePath = "file://".concat(imagePath); }
From source file:com.example.android.mobileperf.render.ChatsFragment.java
private void populateChats(ArrayList<Chat> chats) { Resources res = getResources(); Droid alex = new Droid("alex", res.getColor(R.color.alex_color)); Droid joanna = new Droid("joanna", res.getColor(R.color.joanna_color), R.drawable.joanna); Droid shailen = new Droid("shailen", res.getColor(R.color.shailen_color), R.drawable.shailen); chats.add(new Chat(alex, "Lorem ipsum dolor sit amet, orci nullam cra", getTimeInPast(15))); chats.add(/*from ww w . j av a 2 s .c om*/ new Chat(joanna, "Omnis aptent magnis suspendisse ipsum, semper egestas " + "magna auctor maecenas", getTimeInPast(11))); chats.add(new Chat(shailen, "eu nibh, rhoncus wisi posuere lacus, ad erat egestas " + "quam, magna ante ultricies sem", getTimeInPast(9))); chats.add(new Chat(alex, "rhoncus wisi posuere lacus, ad erat egestas quam, magna " + "ante ultricies sem lacus", getTimeInPast(8))); chats.add(new Chat(shailen, "Enim justo nisl sit proin, quis vestibulum vivamus " + "suscipit penatibus et id, tempus mauris a lacus blandit, aenean praesent " + "arcu scelerisque sociosqu. Nonummy at ut ullamcorper nulla, ligula id, " + "nullam donec nisl ante turpis duis mauris, dolor imperdiet a inceptos aliquam", getTimeInPast(8))); chats.add(new Chat(joanna, "Omnis aptent magnis.", getTimeInPast(7))); chats.add(new Chat(alex, "Metus tincidunt sit in urna.", getTimeInPast(6))); chats.add(new Chat(shailen, "Non blandit nulla dapibus, vitae quisque sed cras mi " + "leo condimentum sociosqu quis sed pharetra", getTimeInPast(4))); chats.add(new Chat(joanna, "Enim justo nisl sit proin, quis vestibulum vivamus " + "suscipit penatibus et id, tempus mauris a lacus blandit, aenean praesent " + "arcu scelerisque sociosqu. Nonummy at ut ullamcorper nulla, ligula id, " + "nullam donec nisl ante turpis duis mauris, dolor imperdiet a inceptos.", getTimeInPast(3))); }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static int getUserAccentColor(final Context context) { if (context == null) return Color.TRANSPARENT; final Resources res = getResources(context); final SharedPreferencesWrapper pref = getSharedPreferencesWrapper(context); final int def = res.getColor(R.color.material_light_blue); return pref.getInt(KEY_THEME_COLOR, def); }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static int getActionBarColor(final Context context) { if (context == null) return MATERIAL_DARK; final Resources res = getResources(context); final SharedPreferencesWrapper pref = getSharedPreferencesWrapper(context); final int def = res.getColor(R.color.twittnuker_material_dark); return pref.getInt(KEY_ACTION_BAR_COLOR, def); }
From source file:com.dwdesign.tweetings.activity.SetColorActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.set_color);/* w w w . ja va 2s.c o m*/ mColorsGrid = (GridView) findViewById(R.id.colors_grid); final Bundle bundle = savedInstanceState != null ? savedInstanceState : getIntent().getExtras(); mCustomizedColor = bundle != null ? bundle.getInt(Accounts.USER_COLOR, Color.WHITE) : Color.WHITE; final Resources res = getResources(); mColors.add(res.getColor(R.color.holo_red_dark)); mColors.add(res.getColor(R.color.holo_red_light)); mColors.add(res.getColor(R.color.holo_orange_dark)); mColors.add(res.getColor(R.color.holo_orange_light)); mColors.add(res.getColor(R.color.holo_green_light)); mColors.add(res.getColor(R.color.holo_green_dark)); mColors.add(res.getColor(R.color.holo_blue_bright)); mColors.add(res.getColor(R.color.holo_blue_light)); mColors.add(res.getColor(R.color.holo_blue_dark)); mColors.add(res.getColor(R.color.holo_purple)); mColors.add(res.getColor(android.R.color.white)); mColors.add(Color.TRANSPARENT); if (mColors.contains(mCustomizedColor)) { } mColorsGrid.setAdapter(new ColorsAdapter(this, mColors)); mColorsGrid.setOnItemClickListener(this); }