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.blestep.sportsbracelet.view.TimelineChartView.java
private void init(Context ctx, AttributeSet attrs, int defStyleAttr) { mUiHandler = new Handler(Looper.getMainLooper(), mMessenger); final Resources res = getResources(); final ViewConfiguration vc = ViewConfiguration.get(ctx); mTouchSlop = vc.getScaledTouchSlop() / 2; mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mScroller = new OverScroller(ctx); int footerLabelColor = ContextCompat.getColor(getContext(), R.color.tlcStepsFooterLabelColor); int barItemBg = ContextCompat.getColor(getContext(), R.color.tlcStepsBarItemBg); int highlightBarItemBg = ContextCompat.getColor(getContext(), R.color.tlcStepsHighlightBarItemBg); mBarItemBgPaint = new Paint(); mBarItemBgPaint.setColor(barItemBg); mHighlightBarItemBgPaint = new Paint(); mHighlightBarItemBgPaint.setColor(highlightBarItemBg); mFooterBarHeight = res.getDimension(R.dimen.tlcDefFooterBarHeight); mViewAreaBgPaint = new Paint(); mGraphAreaBgPaint = new Paint(); mGraphAreaBgPaint.setColor(Color.TRANSPARENT); mFooterAreaBgPaint = new Paint(); mFooterAreaBgPaint.setColor(Color.TRANSPARENT); mGraphBottomLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mGraphBottomLinePaint.setColor(Color.WHITE); mGraphBottomLinePaint.setStrokeWidth(1); // /*from w ww. j a v a 2 s . c om*/ mGraphTargetDashedLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mGraphTargetDashedLinePaint.setStyle(Paint.Style.STROKE); mGraphTargetDashedLinePaint.setColor(Color.WHITE); mGraphTargetDashedLinePaint.setStrokeWidth(1); PathEffect pathEffect = new DashPathEffect(new float[] { 9, 3 }, 1); mGraphTargetDashedLinePaint.setPathEffect(pathEffect); // labelPaint?? mLabelFgPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); mLabelFgPaint.setColor(footerLabelColor); // DisplayMetrics dp = getResources().getDisplayMetrics(); // float labelSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, res.getDimension(R.dimen.tlcDefFooterLabelSize), dp); mLabelFgPaint.setTextSize(res.getDimension(R.dimen.tlcDefFooterLabelSize)); mHighlightLabelFgPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); mHighlightLabelFgPaint.setColor(Color.WHITE); mHighlightLabelFgPaint.setTextSize(res.getDimension(R.dimen.tlcDefFooterLabelSize)); mBarItemWidth = res.getDimension(R.dimen.tlcDefBarItemWidth); mBarItemSpace = res.getDimension(R.dimen.tlcDefBarItemSpace); mTopSpaceHeight = res.getDimension(R.dimen.tlcDefTopSpace); // SurfaceView requires a background if (getBackground() == null) { setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent)); } // Initialize stuff setupBackgroundHandler(); setupTickLabels(); // Initialize the drawing refs (this will be update when we have // the real size of the canvas) computeBoundAreas(); }
From source file:com.dazone.crewchat.libGallery.activity.BucketHomeFragmentActivity.java
@SuppressLint("ResourceAsColor") @Override//from ww w . j av a 2 s. co m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Instance = this; requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_home_media_chooser); headerBarTitle = (TextView) findViewById(R.id.titleTextViewFromMediaChooserHeaderBar); headerBarCamera = (ImageView) findViewById(R.id.cameraImageViewFromMediaChooserHeaderBar); headerBarBack = (ImageView) findViewById(R.id.backArrowImageViewFromMediaChooserHeaderView); headerBarDone = (TextView) findViewById(R.id.doneTextViewViewFromMediaChooserHeaderView); mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost); headerBarTitle.setText(getResources().getString(R.string.app_name)); headerBarCamera.setBackgroundResource(R.drawable.ic_camera_unselect_from_media_chooser_header_bar); headerBarCamera.setTag(getResources().getString(R.string.image)); headerBarBack.setOnClickListener(clickListener); headerBarCamera.setOnClickListener(clickListener); headerBarDone.setOnClickListener(clickListener); if (!MediaChooserConstants.showCameraVideo) { headerBarCamera.setVisibility(View.GONE); } mTabHost.setup(this, getSupportFragmentManager(), R.id.realTabcontent); if (MediaChooserConstants.showVideo) { mTabHost.addTab( mTabHost.newTabSpec("tab2") .setIndicator(getResources().getString(R.string.videos_tab) + " "), BucketVideoFragment.class, null); } if (MediaChooserConstants.showImage) { mTabHost.addTab( mTabHost.newTabSpec("tab1") .setIndicator(getResources().getString(R.string.images_tab) + " "), BucketImageFragment.class, null); } mTabHost.getTabWidget().setBackgroundColor(getResources().getColor(R.color.tabs_color)); mTabHost.getTabWidget().getChildAt(0).setVisibility(View.GONE); for (int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) { View childView = mTabHost.getTabWidget().getChildAt(i); TextView textView = (TextView) childView.findViewById(android.R.id.title); if (textView.getLayoutParams() instanceof RelativeLayout.LayoutParams) { RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) textView.getLayoutParams(); params.addRule(RelativeLayout.CENTER_HORIZONTAL); params.addRule(RelativeLayout.CENTER_VERTICAL); params.height = RelativeLayout.LayoutParams.MATCH_PARENT; params.width = RelativeLayout.LayoutParams.WRAP_CONTENT; textView.setLayoutParams(params); } else if (textView.getLayoutParams() instanceof LinearLayout.LayoutParams) { LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) textView.getLayoutParams(); params.gravity = Gravity.CENTER; textView.setLayoutParams(params); } textView.setTextColor(ContextCompat.getColor(this, R.color.tabs_title_color)); textView.setTextSize(convertDipToPixels(10)); } /* ((TextView)(mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title))).setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color)); ((TextView)(mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title))).setTextColor(Color.WHITE);*/ mTabHost.setOnTabChangedListener(new OnTabChangeListener() { @Override public void onTabChanged(String tabId) { FragmentManager fragmentManager = getSupportFragmentManager(); BucketImageFragment imageFragment = (BucketImageFragment) fragmentManager.findFragmentByTag("tab1"); BucketVideoFragment videoFragment = (BucketVideoFragment) fragmentManager.findFragmentByTag("tab2"); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); if (tabId.equalsIgnoreCase("tab1")) { headerBarTitle.setText(getResources().getString(R.string.image)); headerBarCamera.setBackgroundResource(R.drawable.selector_camera_button); headerBarCamera.setTag(getResources().getString(R.string.image)); if (imageFragment == null) { BucketImageFragment newImageFragment = new BucketImageFragment(); fragmentTransaction.add(R.id.realTabcontent, newImageFragment, "tab1"); } else { if (videoFragment != null) { fragmentTransaction.hide(videoFragment); } fragmentTransaction.show(imageFragment); } ((TextView) (mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title))) .setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color)); ((TextView) (mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title))) .setTextColor(Color.WHITE); } else { headerBarTitle.setText(getResources().getString(R.string.video)); headerBarCamera.setBackgroundResource(R.drawable.selector_video_button); headerBarCamera.setTag(getResources().getString(R.string.video)); if (videoFragment == null) { final BucketVideoFragment newVideoFragment = new BucketVideoFragment(); fragmentTransaction.add(R.id.realTabcontent, newVideoFragment, "tab2"); } else { if (imageFragment != null) { fragmentTransaction.hide(imageFragment); } fragmentTransaction.show(videoFragment); } ((TextView) (mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title))) .setTextColor(Color.WHITE); ((TextView) (mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title))) .setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color)); } fragmentTransaction.commit(); } }); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) headerBarCamera.getLayoutParams(); params.height = convertDipToPixels(40); params.width = convertDipToPixels(40); headerBarCamera.setLayoutParams(params); headerBarCamera.setScaleType(ScaleType.CENTER_INSIDE); headerBarCamera.setPadding(convertDipToPixels(15), convertDipToPixels(15), convertDipToPixels(15), convertDipToPixels(15)); }
From source file:ariana.myapplication.iosched.SlidingTabLayout.java
private void populateTabStrip() { final PagerAdapter adapter = mViewPager.getAdapter(); final View.OnClickListener tabClickListener = new TabClickListener(); for (int i = 0; i < adapter.getCount(); i++) { View tabView = null;/*from w w w .j av a 2s . com*/ TextView tabTitleView = null; if (mTabViewLayoutId != 0) { // If there is a custom tab view layout id set, try and inflate it tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false); tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); } if (tabView == null) { tabView = createDefaultTabView(getContext()); } if (tabTitleView == null && TextView.class.isInstance(tabView)) { tabTitleView = (TextView) tabView; } if (mDistributeEvenly) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); lp.width = 0; lp.weight = 1; } tabTitleView.setText(adapter.getPageTitle(i)); tabTitleView.setTextColor(Color.WHITE); tabView.setOnClickListener(tabClickListener); String desc = mContentDescriptions.get(i, null); if (desc != null) { tabView.setContentDescription(desc); } mTabStrip.addView(tabView); if (i == mViewPager.getCurrentItem()) { tabView.setSelected(true); } } }
From source file:org.openbitcoinwidget.WidgetProvider.java
private static int getColor(ColorMode colorMode, WidgetColor widgetColor) { if (colorMode.equals(ColorMode.Default)) { switch (widgetColor) { case Warning: return Color.parseColor("#ff3030"); case StartValue: return Color.YELLOW; case Normal: return Color.LTGRAY; case Increase: return Color.GREEN; case Decrease: return Color.parseColor("#ff3030"); default:/* w w w. j av a 2 s. com*/ throw new IllegalArgumentException("No color defined for " + widgetColor); } } else if (colorMode.equals(ColorMode.Grayscale)) { switch (widgetColor) { case Warning: return Color.WHITE; case StartValue: return Color.LTGRAY; case Normal: return Color.LTGRAY; case Increase: return Color.WHITE; case Decrease: return Color.GRAY; default: throw new IllegalArgumentException("No color defined for " + widgetColor); } } else { throw new IllegalArgumentException("No color mode defined for " + colorMode); } }
From source file:cn.com.bjnews.thinker.view.MyTabPageIndicator.java
private void addTab(int index, CharSequence text, int iconResId) { final TabView tabView = new TabView(getContext()); tabView.mIndex = index;//from w w w. j ava 2s. c o m tabView.setFocusable(true); tabView.setOnClickListener(mTabClickListener); tabView.setText(text); tabView.setSingleLine(); Log.d("tag", "margin=right->" + rightMargin); tabView.setPadding(leftMargin, 10, rightMargin, 10); tabView.setGravity(Gravity.CENTER_VERTICAL); // tabView.setTextSize(TypedValue.COMPLEX_UNIT_PX,27); tabView.setTextColor(Color.WHITE); tabView.setBackgroundResource(cn.com.bjnews.newsroom.R.drawable.selector_indicator); tabView.setTextAppearance(getContext(), cn.com.bjnews.newsroom.R.style.MediumText27); Log.d("tag", "tabIndicator-->" + tabView.getTextSize()); if (iconResId != 0) { tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0); } mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, MATCH_PARENT, 1)); }
From source file:com.cryart.sabbathschool.view.SSReadingActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.ss_reading_menu, menu); MenuItem menuItem = menu.findItem(R.id.ss_reading_menu_display_options); menuItem.setIcon(//w w w . j a va2 s . c o m new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_text_format).color(Color.WHITE).sizeDp(16)); return true; }
From source file:com.insthub.O2OMobile.Activity.MessageActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.h0_message_list); mMenu = (ImageView) findViewById(R.id.message_menu); mMenu.setImageResource(R.drawable.a2_back_button); mMenu.setOnClickListener(new View.OnClickListener() { @Override// w w w. ja va 2 s . c o m public void onClick(View v) { finish(); } }); mUnreadMessageNum = (TextView) findViewById(R.id.unread_message_num); mMessagePerson = (TextView) findViewById(R.id.message_person); mMessageSystem = (TextView) findViewById(R.id.message_system); mListViewPerson = (XListView) findViewById(R.id.message_listview); mListViewPerson.setXListViewListener(this, 1); mListViewPerson.setPullLoadEnable(true); mListViewPerson.setRefreshTime(); mListViewSystem = (XListView) findViewById(R.id.message_system_listview); mListViewSystem.setXListViewListener(this, 2); mListViewSystem.setPullLoadEnable(true); mListViewSystem.setRefreshTime(); mMessageUnreadCountModel = new MessageUnreadCountModel(this); mMessageUnreadCountModel.addResponseListener(this); mMessageListModel = new MessageListModel(this); mMessageListModel.addResponseListener(this); mMessageListModel.loadCacheMsg(); if (mMessageListModel.publicMessageList != null && mMessageListModel.publicMessageList.size() > 0) { mH0MessageAdapter = new H0_MessageAdapter(this, mMessageListModel.publicMessageList, true); mListViewPerson.setAdapter(mH0MessageAdapter); mListViewPerson.loadMoreHide(); } mListViewPerson.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub MESSAGE message = mMessageListModel.publicMessageList.get(position - 1); mMessageId = message.id; if (message.is_readed == 0) { mMessageListModel.read(mMessageId); } if (message.type == ENUM_MESSAGE_TYPE.ORDER.value()) { if (message.order_id != 0) { Intent intent = new Intent(MessageActivity.this, D1_OrderActivity.class); intent.putExtra(D1_OrderActivity.ORDER_ID, message.order_id); startActivity(intent); MessageActivity.this.overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } else if (!"".equals(message.url)) { Intent intent = new Intent(MessageActivity.this, WebViewActivity.class); intent.putExtra(WebViewActivity.WEBURL, message.url); startActivity(intent); MessageActivity.this.overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } } } }); mListViewSystem.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub MESSAGE message = mMessageListModel.publicMessageSysList.get(position - 1); if (!"".equals(message.url)) { Intent intent = new Intent(MessageActivity.this, WebViewActivity.class); intent.putExtra(WebViewActivity.WEBURL, message.url); startActivity(intent); MessageActivity.this.overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } else { Intent intent = new Intent(MessageActivity.this, MessageDetailActivity.class); intent.putExtra("message_content", message.content); startActivity(intent); MessageActivity.this.overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } } }); mMessagePerson.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub mCurrentState = MSG; mListViewPerson.setVisibility(View.VISIBLE); mListViewSystem.setVisibility(View.GONE); mMessagePerson.setTextColor(Color.WHITE); mMessagePerson.setBackgroundResource(R.drawable.e0_nav_left_selected); mMessageSystem.setTextColor(getResources().getColor(R.color.select_item)); mMessageSystem.setBackgroundResource(R.drawable.e0_nav_right_normal); if (mH0MessageAdapter == null) { mMessageListModel.loadCacheMsg(); if (mMessageListModel.publicMessageList != null && mMessageListModel.publicMessageList.size() > 0) { mH0MessageAdapter = new H0_MessageAdapter(MessageActivity.this, mMessageListModel.publicMessageList, true); mListViewPerson.setAdapter(mH0MessageAdapter); mListViewPerson.loadMoreHide(); } mMessageListModel.getList(); } } }); mMessageSystem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub mCurrentState = SYS_MSG; mListViewSystem.setVisibility(View.VISIBLE); mListViewPerson.setVisibility(View.GONE); mMessagePerson.setTextColor(getResources().getColor(R.color.select_item)); mMessagePerson.setBackgroundResource(R.drawable.e0_nav_left_normal); mMessageSystem.setTextColor(Color.WHITE); mMessageSystem.setBackgroundResource(R.drawable.e0_nav_right_selected); if (mMessageSystemAdapter == null) { mMessageListModel.loadCacheSysMsg(); if (mMessageListModel.publicMessageSysList != null && mMessageListModel.publicMessageSysList.size() > 0) { mMessageSystemAdapter = new H0_MessageAdapter(MessageActivity.this, mMessageListModel.publicMessageSysList, false); mListViewSystem.setAdapter(mMessageSystemAdapter); mListViewSystem.loadMoreHide(); } mMessageListModel.getSysList(); } } }); if (!EventBus.getDefault().isregister(this)) { EventBus.getDefault().register(this); } }
From source file:com.jgraves.achievementunlocked.AchievementsList_Fragment.java
private void addAchievementToList(Long id, String name, int points) { Log.i(ExploraApp.TAG, "Adding achievement image request of id " + id + " with height, " + imageViewHeight); FrameLayout fl = new FrameLayout(getActivity()); touchMap.put(fl, id);/*from ww w . ja va 2s .co m*/ fl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Long id = touchMap.get(v); Log.i(ExploraApp.TAG, "TOUCHED " + id); Intent intent = new Intent(getActivity(), Activity_AchievementInfo.class); intent.putExtra("achievement_id", Long.toString(id)); startActivity(intent); } }); TextView tv_name = new TextView(getActivity()); TextView tv_points = new TextView(getActivity()); ImageView iv = new ImageView(getActivity()); fl.setMinimumHeight(imageViewHeight); fl.setMinimumWidth(ExploraApp.screenWidth); robotoTypeface = Typeface.createFromAsset(getActivity().getAssets(), "Roboto-Thin.ttf"); tv_name.setText(name); tv_name.setTextSize(15f); tv_points.setTextSize(15f); tv_name.setTypeface(robotoTypeface); tv_points.setTypeface(robotoTypeface); tv_points.setText(Integer.toString(points)); tv_points.setGravity(Gravity.RIGHT); tv_points.setTextColor(Color.WHITE); tv_name.setTextColor(Color.WHITE); iv.setMinimumHeight(imageViewHeight); iv.setMinimumWidth(ExploraApp.screenWidth); fl.addView(iv); fl.addView(tv_name); fl.addView(tv_points); ll_images_container.addView(fl); sv_images.bringChildToFront(mQuickReturnView); DefaultImageListener listener = new DefaultImageListener(iv); ImageRequest imageRequest = new ImageRequest( ExploraApp.url_main + "/achievement/" + id + "/photo?y=" + imageViewHeight + "&x=" + ExploraApp.screenWidth, listener, ExploraApp.screenWidth, imageViewHeight, Bitmap.Config.ARGB_8888, listener); ExploraApp.mRequestQueue.add(imageRequest); }
From source file:arun.com.chromer.util.ColorUtil.java
/** * Returns white or black based on color luminance * * @param backgroundColor the color to get foreground for * @return White for darker colors and black for ligher colors *//*from w w w .j a va 2 s.c o m*/ @ColorInt public static int getForegroundWhiteOrBlack(@ColorInt int backgroundColor) { if (shouldUseLightForegroundOnBackground(backgroundColor)) { return Color.WHITE; } else return Color.BLACK; }
From source file:com.arantius.tivocommander.Person.java
private void requestFinished() { if (--mOutstandingRequests > 0) { return;/* ww w . j a va2s . c om*/ } setProgressBarIndeterminateVisibility(false); if (mPerson == null || mCredits == null) { setContentView(R.layout.no_results); return; } setContentView(R.layout.list_person); // Credits. JsonNode[] credits = new JsonNode[mCredits.size()]; int i = 0; for (JsonNode credit : mCredits) { credits[i++] = credit; } ListView lv = getListView(); CreditsAdapter adapter = new CreditsAdapter(Person.this, R.layout.item_person_credits, credits); lv.setAdapter(adapter); lv.setOnItemClickListener(mOnItemClickListener); // Name. ((TextView) findViewById(R.id.person_name)).setText(mName); // Role. JsonNode rolesNode = mPerson.path("roleForPersonId"); String[] roles = new String[rolesNode.size()]; for (i = 0; i < rolesNode.size(); i++) { roles[i] = rolesNode.path(i).asText(); roles[i] = Utils.ucFirst(roles[i]); } ((TextView) findViewById(R.id.person_role)).setText(Utils.join(", ", roles)); // Birth date. TextView birthdateView = ((TextView) findViewById(R.id.person_birthdate)); if (mPerson.has("birthDate")) { Date birthdate = Utils.parseDateStr(mPerson.path("birthDate").asText()); SimpleDateFormat dateFormatter = new SimpleDateFormat("MMMMM d, yyyy", Locale.US); dateFormatter.setTimeZone(TimeZone.getDefault()); Spannable birthdateStr = new SpannableString("Birthdate: " + dateFormatter.format(birthdate)); birthdateStr.setSpan(new ForegroundColorSpan(Color.WHITE), 11, birthdateStr.length(), 0); birthdateView.setText(birthdateStr); } else { birthdateView.setVisibility(View.GONE); } // Birth place. TextView birthplaceView = ((TextView) findViewById(R.id.person_birthplace)); if (mPerson.has("birthPlace")) { Spannable birthplaceStr = new SpannableString("Birthplace: " + mPerson.path("birthPlace").asText()); birthplaceStr.setSpan(new ForegroundColorSpan(Color.WHITE), 12, birthplaceStr.length(), 0); birthplaceView.setText(birthplaceStr); } else { birthplaceView.setVisibility(View.GONE); } ImageView iv = (ImageView) findViewById(R.id.person_image); View pv = findViewById(R.id.person_image_progress); String imgUrl = Utils.findImageUrl(mPerson); new DownloadImageTask(this, iv, pv).execute(imgUrl); }