List of usage examples for android.widget TextView setTextColor
@android.view.RemotableViewMethod public void setTextColor(ColorStateList colors)
From source file:cn.mailchat.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { RelativeLayout tabLayout = (RelativeLayout) tabsContainer.getChildAt(i); View v = tabLayout.getChildAt(0); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); ////from ww w . j a v a2 s . c o m // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build // if (textAllCaps) { // if (Build.VERSION.SDK_INT >= // Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // tab.setAllCaps(true); // } else { // tab.setText(tab.getText().toString().toUpperCase(locale)); // } // } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
From source file:fr.shywim.antoinedaniel.ui.MainActivity.java
private void formatNavDrawerItem(View view, int itemId, boolean selected) { if (isSeparator(itemId)) { return;/* w w w . j a v a 2 s . c o m*/ } ImageView iconView = (ImageView) view.findViewById(R.id.icon); TextView titleView = (TextView) view.findViewById(R.id.title); titleView.setTextColor(selected ? getResources().getColor(R.color.navdrawer_text_color_selected) : getResources().getColor(R.color.navdrawer_text_color)); iconView.setColorFilter(selected ? getResources().getColor(R.color.navdrawer_icon_tint_selected) : getResources().getColor(R.color.navdrawer_icon_tint)); }
From source file:net.olejon.mdapp.MedicationActivity.java
private void favorite() { SQLiteDatabase sqLiteDatabase = new MedicationsFavoritesSQLiteHelper(mContext).getWritableDatabase(); String snackbarString;/*www. ja va 2 s . c o m*/ if (isFavorite()) { sqLiteDatabase.delete(MedicationsFavoritesSQLiteHelper.TABLE, MedicationsFavoritesSQLiteHelper.COLUMN_NAME + " = " + mTools.sqe(medicationName) + " AND " + MedicationsFavoritesSQLiteHelper.COLUMN_MANUFACTURER + " = " + mTools.sqe(medicationManufacturer), null); mFavoriteMenuItem.setIcon(R.drawable.ic_star_outline_white_24dp) .setTitle(getString(R.string.medication_menu_add_favorite)); snackbarString = getString(R.string.medication_favorite_removed); } else { ContentValues contentValues = new ContentValues(); contentValues.put(MedicationsFavoritesSQLiteHelper.COLUMN_PRESCRIPTION_GROUP, medicationPrescriptionGroup); contentValues.put(MedicationsFavoritesSQLiteHelper.COLUMN_NAME, medicationName); contentValues.put(MedicationsFavoritesSQLiteHelper.COLUMN_SUBSTANCE, medicationSubstance); contentValues.put(MedicationsFavoritesSQLiteHelper.COLUMN_MANUFACTURER, medicationManufacturer); sqLiteDatabase.insert(MedicationsFavoritesSQLiteHelper.TABLE, null, contentValues); Intent intent = new Intent(); intent.setAction("update"); mContext.sendBroadcast(intent); mFavoriteMenuItem.setIcon(R.drawable.ic_star_white_24dp) .setTitle(getString(R.string.medication_menu_remove_favorite)); snackbarString = getString(R.string.medication_favorite_saved); } Snackbar snackbar = Snackbar.make(mRelativeLayout, snackbarString, Snackbar.LENGTH_LONG) .setAction(R.string.snackbar_undo, new View.OnClickListener() { @Override public void onClick(View view) { favorite(); } }).setActionTextColor(ContextCompat.getColor(mContext, R.color.orange)); View snackbarView = snackbar.getView(); TextView snackbarTextView = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text); snackbarTextView.setTextColor(ContextCompat.getColor(mContext, R.color.white)); snackbar.show(); mTools.updateWidget(); sqLiteDatabase.close(); }
From source file:com.aero2.android.DefaultActivities.SmogMapActivity.java
public void hideNoInternetScreen() { hideLoadingScreen();//from w w w .j a v a2s.c o m TextView ConnectionTV = (TextView) findViewById(R.id.loading_tv); ConnectionTV.setText("Loading smog data"); ConnectionTV.setTextColor(Color.parseColor("#FF00BEED")); ConnectionTV.setPadding(0, 30, 0, 30); }
From source file:com.android.inputmethod.latin.suggestions.SuggestionStripLayoutHelper.java
public void layoutImportantNotice(final View importantNoticeStrip, final String importantNoticeTitle) { final TextView titleView = (TextView) importantNoticeStrip.findViewById(R.id.important_notice_title); final int width = titleView.getWidth() - titleView.getPaddingLeft() - titleView.getPaddingRight(); titleView.setTextColor(mColorAutoCorrect); titleView.setText(importantNoticeTitle); titleView.setTextScaleX(1.0f); // Reset textScaleX. final float titleScaleX = getTextScaleX(importantNoticeTitle, width, titleView.getPaint()); titleView.setTextScaleX(titleScaleX); }
From source file:com.baseutil.strip.PagerSlidingTabStrip.java
private void updateTabTextColorStyles(int pos, int color, int unselectedcolor) { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); if (pos == i) { tab.setTextColor(color); } else { tab.setTextColor(unselectedcolor); }//www .j av a2 s . c om if (tabResources != null) { tab.setCompoundDrawablesWithIntrinsicBounds(tabResources[i], 0, 0, 0); } // setAllCaps() is only available from API 14, so the upper case // is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.cc.custom.uikit.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); if (tabSelectedBackgroundResId > 0) { v.setBackgroundResource(tabBackgroundResId); }/*from w w w . j a v a2s . co m*/ if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.common.view.tab.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); if (i == currentPosition) { tab.setTextColor(tabScrollTextColor); } else { tab.setTextColor(tabTextColor); }// w w w.j a v a 2 s .co m // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.app.viaje.viaje.MapsActivity.java
/** * @description :: Comment a certain post. * @param commentText/*ww w. j av a 2s. com*/ * @param key */ private void postComment(final String commentText, Object key) { Snackbar snackbar = Snackbar.make(relativeLayout, "Thanks for the comment...", Snackbar.LENGTH_LONG); View sbView = snackbar.getView(); TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); textView.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.app_color)); snackbar.show(); final Motorist user = new Motorist(); //Get timestamp long millis = new Date().getTime(); SharedPreferences sharedPreferences = getSharedPreferences("motoristInfo", Context.MODE_PRIVATE); //Store the data from SharedPreference to Motorist object. user.setAddress(sharedPreferences.getString("address", "")); user.setContact_number(sharedPreferences.getString("contact_number", "")); user.setUsername(sharedPreferences.getString("username", "")); user.setEmail_address(sharedPreferences.getString("email", "")); user.setFamily_name(sharedPreferences.getString("family_name", "")); user.setGiven_name(sharedPreferences.getString("given_name", "")); user.setLicense_number(sharedPreferences.getString("license_number", "")); user.setType(sharedPreferences.getString("type", "")); user.setUsername(sharedPreferences.getString("username", "")); user.setVehicle_information_model_year(sharedPreferences.getString("vehicle_information_model_year", "")); user.setVehicle_information_vehicle_type(sharedPreferences.getString("vehicle_information_model_type", "")); user.setVehicle_information_plate_number( sharedPreferences.getString("vehicle_information_plate_number", "")); Post.Comment postComment = new Post.Comment(); postComment.setText(commentText); postComment.setTimestamp(millis); postComment.setUser(user); dbRef.child(ViajeConstants.POSTS_KEY + "/" + key + "/comments").push().setValue(postComment); }
From source file:com.TakeTaxi.jy.OnrouteScreen.java
public void pingpicked(JSONObject json) { try {//w w w . ja v a 2 s . co m int driverpicked = json.getInt("picked"); int drivercancelled = json.getInt("dcancel"); int starttime = json.getInt("datetime"); // /////////////////////////////// DRIVER CANCEL //////// if (drivercancelled == 1) { // //// DRIVER CANCEL LATE ///// if (starttime + 300 <= Query.getServerTime()) { handlerboolean = false; handler.removeCallbacks(r); AlertDialog dcancelbuilder = new AlertDialog.Builder(OnrouteScreen.this).create(); dcancelbuilder .setMessage("Job has been cancelled.\nWould you like to report a late cancellation?."); // //// DRIVER CANCEL LATE - NO REPORT LATE///// button_cancelJob_noquery(dcancelbuilder); // //// DRIVER CANCEL LATE - REPORT LATE ///// button_drivercancel_reportlate(dcancelbuilder); dcancelbuilder.show(); } else { // /////////////////////////////// DRIVER CANCEL NO ALERTS - // WITHIN TIME LIMIT/////////////// handlerboolean = false; handler.removeCallbacks(r); alertdialog_drivercancelintime(); } } if (driverpicked == 1) { // /////////////////////////////// CONFIRM PICK UP // /////////////////////////////////////////// handlerboolean = false; handler.removeCallbacks(r); AlertDialog.Builder alert = new AlertDialog.Builder(OnrouteScreen.this); final Drawable thumbsup = getResources().getDrawable(R.drawable.thumbsup); final Drawable thumbsupwhite = getResources().getDrawable(R.drawable.thumbsupwhite); final Drawable thumbsdown = getResources().getDrawable(R.drawable.thumbsdown); final Drawable thumbsdownwhite = getResources().getDrawable(R.drawable.thumbsdownwhite); LinearLayout layout = new LinearLayout(OnrouteScreen.this); layout.setOrientation(1); layout.setGravity(17); TextView tx1 = new TextView(OnrouteScreen.this); tx1.setText("Driver says you have been picked up"); tx1.setGravity(17); tx1.setTextSize(20); tx1.setTextColor(Color.WHITE); tx1.setPadding(10, 10, 10, 10); TextView tx2 = new TextView(OnrouteScreen.this); tx2.setText("Please rate your driver"); tx2.setGravity(17); tx2.setTextSize(16); LinearLayout imglayout = new LinearLayout(OnrouteScreen.this); imglayout.setOrientation(0); imglayout.setGravity(17); final ImageView ivup = new ImageView(OnrouteScreen.this); ivup.setImageDrawable(thumbsupwhite); ivup.setClickable(true); ivup.setPadding(0, 5, 30, 5); final ImageView ivdown = new ImageView(OnrouteScreen.this); ivdown.setImageDrawable(thumbsdownwhite); ivdown.setClickable(true); ivup.setPadding(30, 5, 0, 5); imglayout.addView(ivup); imglayout.addView(ivdown); layout.addView(tx1); layout.addView(tx2); layout.addView(imglayout); // /////////////////////////////// CONFIRM PICK UP - RATINGS // /////////////////////////////////////////// ivup.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (thumbsupboolean == false) { thumbsupboolean = true; thumbsdownboolean = false; ivup.setImageDrawable(thumbsup); ivdown.setImageDrawable(thumbsdownwhite); rating = 1; } else { thumbsupboolean = false; ivup.setImageDrawable(thumbsupwhite); rating = 0; } } }); ivdown.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (thumbsdownboolean == false) { thumbsdownboolean = true; thumbsupboolean = false; ivdown.setImageDrawable(thumbsdown); ivup.setImageDrawable(thumbsupwhite); AlertDialog alert = new AlertDialog.Builder(OnrouteScreen.this).create(); alert.setMessage("Please pick one"); alert.setButton("No show", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { rating = -1; } }); alert.setButton2("Driver late", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { rating = -2; } }); alert.setButton3("Poor service", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { rating = -3; } }); alert.show(); } else { thumbsupboolean = false; ivdown.setImageDrawable(thumbsdownwhite); rating = 0; } } }); button_completed_finish(alert); alert.setView(layout); alert.create(); alert.show(); } else { } } catch (JSONException e) { } }