List of usage examples for android.graphics Color WHITE
int WHITE
To view the source code for android.graphics Color WHITE.
Click Source Link
From source file:com.dycode.jepretstory.mediachooser.activity.BucketHomeFragmentActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_media_chooser); FrameLayout mSelectedImagesContainerFrame = (FrameLayout) findViewById(R.id.selectedPhotosContainerFrame); if (MediaChooserConstants.MAX_MEDIA_LIMIT == 1) { mSelectedImagesContainerFrame.setVisibility(View.GONE); }/*from w w w . j a v a 2s . c o m*/ mSelectedImagesContainer = (LinearLayout) findViewById(R.id.selectedPhotosContainer); mSelectedImageEmptyMessage = (TextView) findViewById(R.id.selectedPhotosEmptyText); mViewPager = (ViewPager) findViewById(R.id.pager); if (MediaChooserConstants.showImage) { mTabTitles.add(getResources().getString(R.string.image)); } if (MediaChooserConstants.showVideo) { mTabTitles.add(getResources().getString(R.string.video)); } mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager.setAdapter(mSectionsPagerAdapter); mSlidingTabLayout = (SlidingTabLayout) findViewById(R.id.slidingTabs); mSlidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1); //mSlidingTabLayout.setSelectedIndicatorColors(getResources().getColor(android.R.color.white)); mSlidingTabLayout.setDistributeEvenly(true); mSlidingTabLayout.setViewPager(mViewPager); final android.app.ActionBar actionBar = getActionBar(); if (actionBar != null) { materialMenu = new MaterialMenuIcon(this, Color.WHITE); materialMenu.setState(IconState.ARROW); materialMenu = new MaterialMenuIcon(this, Color.WHITE); materialMenu.setState(IconState.ARROW); if (mTabTitles.size() > 1) { } else { mSlidingTabLayout.setVisibility(View.GONE); } mSlidingTabLayout.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { ActionBar ab = BucketHomeFragmentActivity.this.getActionBar(); ab.show(); if (position == 0) { setCurrentMode(MediaType.IMAGE); } else { setCurrentMode(MediaType.VIDEO); } } }); } mViewPager.setCurrentItem(0); if (getIntent().getParcelableArrayListExtra("selectedImages") != null) { mSelectedImages = getIntent().getParcelableArrayListExtra("selectedImages"); for (MediaModel selImage : mSelectedImages) { this.onMediaSelected(selImage); } } if (getIntent().getParcelableArrayListExtra("selectedVideos") != null) { mSelectedVideos = getIntent().getParcelableArrayListExtra("selectedVideos"); for (MediaModel selVideo : mSelectedVideos) { this.onMediaSelected(selVideo); } } }
From source file:com.community.yuequ.bottombar.BottomBar.java
private void populateAttributes(Context context, AttributeSet attrs) { primaryColor = MiscUtils.getColor(getContext(), R.attr.colorPrimary); screenWidth = MiscUtils.getScreenWidth(getContext()); tenDp = MiscUtils.dpToPixel(getContext(), 10); maxFixedItemWidth = MiscUtils.dpToPixel(getContext(), 168); TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BottomBar, 0, 0); try {/*ww w . j a v a2s . c o m*/ tabXmlResource = ta.getResourceId(R.styleable.BottomBar_bb_tabXmlResource, 0); isTabletMode = ta.getBoolean(R.styleable.BottomBar_bb_tabletMode, false); behaviors = ta.getInteger(R.styleable.BottomBar_bb_behavior, BEHAVIOR_NONE); inActiveTabAlpha = ta.getFloat(R.styleable.BottomBar_bb_inActiveTabAlpha, isShiftingMode() ? DEFAULT_INACTIVE_SHIFTING_TAB_ALPHA : 1); activeTabAlpha = ta.getFloat(R.styleable.BottomBar_bb_activeTabAlpha, 1); @ColorInt int defaultInActiveColor = isShiftingMode() ? Color.WHITE : ContextCompat.getColor(context, R.color.bb_inActiveBottomBarItemColor); int defaultActiveColor = isShiftingMode() ? Color.WHITE : primaryColor; inActiveTabColor = ta.getColor(R.styleable.BottomBar_bb_inActiveTabColor, defaultInActiveColor); activeTabColor = ta.getColor(R.styleable.BottomBar_bb_activeTabColor, defaultActiveColor); badgeBackgroundColor = ta.getColor(R.styleable.BottomBar_bb_badgeBackgroundColor, Color.RED); titleTextAppearance = ta.getResourceId(R.styleable.BottomBar_bb_titleTextAppearance, 0); titleTypeFace = getTypeFaceFromAsset(ta.getString(R.styleable.BottomBar_bb_titleTypeFace)); showShadow = ta.getBoolean(R.styleable.BottomBar_bb_showShadow, true); } finally { ta.recycle(); } }
From source file:com.cpd.fragments.LibraryFragment.java
private void renewBooks() { final Snackbar snackbar = Snackbar.make(getActivity().findViewById(R.id.library_fragment_recycler), R.string.renewing_items, Snackbar.LENGTH_INDEFINITE); TextView textView = (TextView) snackbar.getView().findViewById(android.support.design.R.id.snackbar_text); textView.setTextColor(Color.WHITE); snackbar.show();/*from w ww . j a v a2 s. c o m*/ mLibraryLoader.renewBooks(new LibraryParser.LibraryRenewReady() { @Override public void onLibraryRenewReady(String response) { snackbar.dismiss(); if (response != null || response.isEmpty()) showDialog(getActivity().getString(R.string.renew), response); updateUserInfo(); } @Override public void onLibraryRenewError(Exception exception) { snackbar.dismiss(); showDialog(getActivity().getString(R.string.error), getActivity().getString(R.string.not_possible_to_renew_books_message)); } }, true); }
From source file:com.amitupadhyay.aboutexample.ui.widget.CollapsingTitleLayout.java
public CollapsingTitleLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); setWillNotDraw(false);//from w w w.j a v a 2s . c om paint = new TextPaint(Paint.ANTI_ALIAS_FLAG); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CollapsingTitleLayout); final boolean isRtl = ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL; // first check if all insets set the same titleInsetStart = titleInsetEnd = titleInsetBottom = a .getDimensionPixelSize(R.styleable.CollapsingTitleLayout_titleInset, 0); titleInsetTop = titleInsetStart; if (a.hasValue(R.styleable.CollapsingTitleLayout_titleInsetStart)) { final int insetStart = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_titleInsetStart, 0); if (isRtl) { titleInsetEnd = insetStart; } else { titleInsetStart = insetStart; } } if (a.hasValue(R.styleable.CollapsingTitleLayout_titleInsetTop)) { titleInsetTop = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_titleInsetTop, 0); } if (a.hasValue(R.styleable.CollapsingTitleLayout_titleInsetEnd)) { final int insetEnd = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_titleInsetEnd, 0); if (isRtl) { titleInsetStart = insetEnd; } else { titleInsetEnd = insetEnd; } } if (a.hasValue(R.styleable.CollapsingTitleLayout_titleInsetBottom)) { titleInsetBottom = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_titleInsetBottom, 0); } final int textAppearance = a.getResourceId(R.styleable.CollapsingTitleLayout_android_textAppearance, android.R.style.TextAppearance); TypedArray atp = getContext().obtainStyledAttributes(textAppearance, R.styleable.CollapsingTextAppearance); paint.setColor(atp.getColor(R.styleable.CollapsingTextAppearance_android_textColor, Color.WHITE)); collapsedTextSize = atp.getDimensionPixelSize(R.styleable.CollapsingTextAppearance_android_textSize, 0); if (atp.hasValue(R.styleable.CollapsingTextAppearance_font)) { paint.setTypeface(FontUtil.get(getContext(), atp.getString(R.styleable.CollapsingTextAppearance_font))); } atp.recycle(); if (a.hasValue(R.styleable.CollapsingTitleLayout_collapsedTextSize)) { collapsedTextSize = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_collapsedTextSize, 0); paint.setTextSize(collapsedTextSize); } maxExpandedTextSize = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_maxExpandedTextSize, Integer.MAX_VALUE); lineHeightHint = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_lineHeightHint, 0); maxLines = a.getInteger(R.styleable.CollapsingTitleLayout_android_maxLines, 5); a.recycle(); }
From source file:cn.com.hgh.view.SlideSwitch.java
@Override protected void onDraw(Canvas canvas) { if (shape == SHAPE_RECT) { // paint.setColor(Color.GRAY); paint.setColor(0xffededed);// canvas.drawRect(backRect, paint); paint.setColor(color_theme);/*from ww w . j av a 2 s . c o m*/ paint.setAlpha(alpha); canvas.drawRect(backRect, paint); frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + getMeasuredWidth() / 2 - RIM_SIZE, getMeasuredHeight() - RIM_SIZE); paint.setColor(Color.WHITE); canvas.drawRect(frontRect, paint); } else { int radius; radius = backRect.height() / 2 - RIM_SIZE; // paint.setColor(Color.GRAY);// paint.setColor(0xffededed);// backCircleRect.set(backRect); canvas.drawRoundRect(backCircleRect, radius, radius, paint); paint.setColor(Color.BLACK); paint.setTextSize(AbViewUtil.sp2px(getContext(), 15)); // paint.setAlpha(alpha); frontRect.set(frontRect_left, RIM_SIZE, frontRect_left + getMeasuredWidth() / 2 - RIM_SIZE, getMeasuredHeight() - RIM_SIZE); frontCircleRect.set(frontRect); paint.setColor(Color.WHITE); canvas.drawRoundRect(frontCircleRect, radius, radius, paint); if (isOpen) { // canvas.drawText("?", radius, radius + 23, paint);// paint.setColor(Color.BLACK); paint.setTextAlign(Paint.Align.CENTER); canvas.drawText("?", width / 4 - RIM_SIZE, radius + 23, paint);// } else { // canvas.drawText("?", getMeasuredWidth() - radius - 40 * 3,radius + 23, paint); paint.setColor(Color.BLACK); paint.setTextAlign(Paint.Align.CENTER); canvas.drawText("?", width - frontCircleRect.width() / 2 - RIM_SIZE, radius + 23, paint); } if (isOpen) { paint.setColor(0xff14c4c4); paint.setTextAlign(Paint.Align.CENTER); paint.getTextBounds("?", 0, "?".length(), frontRect); paint.setTextSize(AbViewUtil.sp2px(getContext(), 15)); // paint.setAlpha(alpha1); // canvas.drawText("?", getMeasuredWidth() - radius - 40 * 3,radius + 23, paint); canvas.drawText("?", frontCircleRect.centerX(), radius + 23, paint); } else { paint.setColor(0xff14c4c4); paint.setTextAlign(Paint.Align.CENTER); paint.getTextBounds("?", 0, "?".length(), frontRect); paint.setTextSize(AbViewUtil.sp2px(getContext(), 15)); // paint.setAlpha(alpha1); // canvas.drawText("?", radius, radius + 23, paint); canvas.drawText("?", frontCircleRect.centerX(), radius + 23, paint); } } }
From source file:com.artemchep.horario.ui.fragments.details.SubjectTaskDetailsFragment.java
private void setupDecorColor(int color) { color |= 0xFF000000; // ignore alpha bits final boolean isColorDark = ColorUtil.isColorDark(color); Drawable overflowIcon;//from w w w . j a v a2 s . c om if (isColorDark) { mToolbar.setTitleTextColor(Color.WHITE); mToolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp); overflowIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_dots_vertical_white_24dp); mSmartTabLayout.setDefaultTabTextColor(Color.WHITE); mSmartTabLayout.setSelectedIndicatorColors(Color.WHITE); } else { mToolbar.setTitleTextColor(Color.BLACK); mToolbar.setNavigationIcon(R.drawable.ic_arrow_left_black_24dp); overflowIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_dots_vertical_black_24dp); mSmartTabLayout.setDefaultTabTextColor(Color.BLACK); mSmartTabLayout.setSelectedIndicatorColors(Color.BLACK); } mAppBar.setBackgroundColor(color); mToolbar.setOverflowIcon(overflowIcon); mSmartTabLayout.setViewPager(mViewPager); }
From source file:com.android.launcher3.dynamicui.ExtractedColors.java
/** * The hotseat's color is defined as follows: * - 12% black for super light wallpaper * - 18% white for super dark/* ww w .j av a 2s. c o m*/ * - 25% white otherwise */ public void updateHotseatPalette(Palette hotseatPalette) { int hotseatColor; if (hotseatPalette != null && ExtractionUtils.isSuperLight(hotseatPalette)) { hotseatColor = ColorUtils.setAlphaComponent(Color.BLACK, (int) (0.12f * 255)); } else if (hotseatPalette != null && ExtractionUtils.isSuperDark(hotseatPalette)) { hotseatColor = ColorUtils.setAlphaComponent(Color.WHITE, (int) (0.18f * 255)); } else { hotseatColor = ColorUtils.setAlphaComponent(Color.WHITE, (int) (0.25f * 255)); } setColorAtIndex(HOTSEAT_INDEX, hotseatColor); }
From source file:com.push.app.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); fragmentStack = new Stack<>(); sharedPreferences = getSharedPreferences("preferences", Activity.MODE_PRIVATE); aq = new AQuery(this); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); isNotification = getIntent().getBooleanExtra("is_notification", false); mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.activity_main_swipe_refresh_layout); mHomeLayout = (FrameLayout) findViewById(R.id.mHomeLayout); mSearchView = (FrameLayout) findViewById(R.id.mSearchView); mToolbarView = (Toolbar) findViewById(R.id.toolbar); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayUseLogoEnabled(true); getSupportActionBar().setLogo(R.mipmap.logo); getSupportActionBar().setTitle(""); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); //Setup the drawer //setUpDrawer(); mListView = (ObservableListView) findViewById(R.id.mList); initViews();// w w w . ja v a 2 s. co m mListView.setBackgroundColor(Color.WHITE); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { checkForNewContent(); } }); if (isNotification) { String extra = getIntent().getExtras() .getString(Notification.DefaultNotificationHandler.INTENT_EXTRAS_KEY); Utils.log("Extras -> " + extra); try { JSONObject extrasObject = new JSONObject(extra); JSONObject extras = extrasObject.getJSONObject("payload").getJSONObject("extras"); JSONObject additionalInfo = extras.getJSONObject("additionalInfo"); Utils.log("Extras payload -> " + extras); if (additionalInfo.has("action") && additionalInfo.getString("action").equalsIgnoreCase("donation")) { Utils.log("Displaying donation page"); displayView(1); return; } else if (additionalInfo.has("article_id")) { mSwipeRefreshLayout.setRefreshing(true); if (restAPI == null) { setUpRestApi(); } restAPI.getArticle(additionalInfo.getString("article_id"), new Callback<ArticlePost>() { @Override public void success(ArticlePost articlePost, Response response) { mSwipeRefreshLayout.setRefreshing(false); Intent i = new Intent(HomeActivity.this, DetailPostActivity.class); PostFragmentAdapter.postItems.clear(); PostFragmentAdapter.postItems.add(articlePost.getResults().get(0)); i.putExtra("postPosition", 0); i.putExtra("postTitle", articlePost.getResults().get(0).getHeadline()); i.putExtra("description", articlePost.getResults().get(0).getDescription()); cachePosts("searchResults", articlePost);//cache these results startActivity(i); } @Override public void failure(RetrofitError error) { mSwipeRefreshLayout.setRefreshing(false); Log.e("ERROR", "Failed to parse JSON ", error); } }); } } catch (JSONException ex) { Utils.log("Error loading post -> " + ex.getMessage()); } } }
From source file:bottombar.BottomBar.java
private void populateAttributes(Context context, AttributeSet attrs) { primaryColor = MiscUtils.getColor(getContext(), R.attr.colorPrimary); screenWidth = MiscUtils.getScreenWidth(getContext()); tenDp = MiscUtils.dpToPixel(getContext(), 10); maxFixedItemWidth = MiscUtils.dpToPixel(getContext(), 168); TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BottomBar, 0, 0); try {//ww w . j av a 2s . c o m tabXmlResource = ta.getResourceId(R.styleable.BottomBar_bb_tabXmlResource, 0); isTabletMode = ta.getBoolean(R.styleable.BottomBar_bb_tabletMode, false); behaviors = ta.getInteger(R.styleable.BottomBar_bb_behavior, BEHAVIOR_NONE); inActiveTabAlpha = ta.getFloat(R.styleable.BottomBar_bb_inActiveTabAlpha, isShiftingMode() ? DEFAULT_INACTIVE_SHIFTING_TAB_ALPHA : 1); activeTabAlpha = ta.getFloat(R.styleable.BottomBar_bb_activeTabAlpha, 1); @ColorInt int defaultInActiveColor = isShiftingMode() ? Color.WHITE : ContextCompat.getColor(context, R.color.bb_inActiveBottomBarItemColor); int defaultActiveColor = isShiftingMode() ? Color.WHITE : primaryColor; inActiveTabColor = ta.getColor(R.styleable.BottomBar_bb_inActiveTabColor, defaultInActiveColor); activeTabColor = ta.getColor(R.styleable.BottomBar_bb_activeTabColor, defaultActiveColor); badgeBackgroundColor = ta.getColor(R.styleable.BottomBar_bb_badgeBackgroundColor, Color.RED); hideBadgeWhenActive = ta.getBoolean(R.styleable.BottomBar_bb_badgesHideWhenActive, true); titleTextAppearance = ta.getResourceId(R.styleable.BottomBar_bb_titleTextAppearance, 0); titleTypeFace = getTypeFaceFromAsset(ta.getString(R.styleable.BottomBar_bb_titleTypeFace)); showShadow = ta.getBoolean(R.styleable.BottomBar_bb_showShadow, true); } finally { ta.recycle(); } }
From source file:com.ryan.ryanreader.reddit.prepared.RedditPreparedComment.java
private void rebuildHeader(final Context context) { final BetterSSB sb = new BetterSSB(); final int pointsCol; int score = src.ups - src.downs; if (Boolean.TRUE.equals(src.likes)) score--;//from w w w .j ava 2 s.co m if (Boolean.FALSE.equals(src.likes)) score++; if (isUpvoted()) { pointsCol = rrPostSubtitleUpvoteCol; score++; } else if (isDownvoted()) { pointsCol = rrPostSubtitleDownvoteCol; score--; } else { pointsCol = rrCommentHeaderBoldCol; } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AUTHOR)) { if (parentPost != null && src.author.equalsIgnoreCase(parentPost.src.author)) { sb.append(" " + src.author + " ", BetterSSB.BACKGROUND_COLOR | BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, Color.WHITE, Color.rgb(0, 126, 168), 1f); // TODO color } else { sb.append(src.author, BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, rrCommentHeaderAuthorCol, 0, 1f); } } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.FLAIR) && flair != null && flair.length() > 0) { if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AUTHOR)) { sb.append(" ", 0); } sb.append(" " + flair + " ", BetterSSB.FOREGROUND_COLOR | BetterSSB.BACKGROUND_COLOR, Color.rgb(30, 30, 30), Color.rgb(230, 230, 230), 1f); // TODO theme properly } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AUTHOR) || headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.FLAIR)) { sb.append(" ", 0); } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.SCORE)) { if (!Boolean.TRUE.equals(src.score_hidden)) { sb.append(String.valueOf(score), BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, pointsCol, 0, 1f); } else { sb.append("??", BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, pointsCol, 0, 1f); } sb.append(" " + context.getString(R.string.subtitle_points) + " ", 0); } if (!Boolean.TRUE.equals(src.score_hidden) && headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.UPS_DOWNS)) { sb.append("(", 0); sb.append(String.valueOf(src.ups), BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, rrPostSubtitleUpvoteCol, 0, 1f); sb.append(" | ", 0); sb.append(String.valueOf(src.downs), BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, rrPostSubtitleDownvoteCol, 0, 1f); sb.append(") ", 0); } if (headerItems.contains(PrefsUtility.AppearanceCommentHeaderItems.AGE)) { sb.append(RRTime.formatDurationMsAgo(context, RRTime.utcCurrentTimeMillis() - src.created_utc * 1000L), BetterSSB.FOREGROUND_COLOR | BetterSSB.BOLD, rrCommentHeaderBoldCol, 0, 1f); } header = sb.get(); }