List of usage examples for android.content.res Resources getString
@NonNull public String getString(@StringRes int id) throws NotFoundException
From source file:com.doomonafireball.betterpickers.calendardatepicker.SimpleMonthView.java
public SimpleMonthView(Context context) { super(context); Resources res = context.getResources(); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); mDayOfWeekTypeface = res.getString(R.string.day_of_week_label_typeface); mMonthTitleTypeface = res.getString(R.string.sans_serif); mDayTextColor = res.getColor(R.color.date_picker_text_normal); mTodayNumberColor = res.getColor(R.color.blue); // < mMonthTitleColor = res.getColor(android.R.color.white); mMonthTitleBGColor = res.getColor(R.color.circle_background); // < mStringBuilder = new StringBuilder(50); mFormatter = new Formatter(mStringBuilder, Locale.getDefault()); sMiniDayNumberTextSize = res.getDimensionPixelSize(R.dimen.day_number_size); sMonthLabelTextSize = res.getDimensionPixelSize(R.dimen.month_label_size); sMonthDayLabelTextSize = res.getDimensionPixelSize(R.dimen.month_day_label_text_size); sMonthHeaderSize = res.getDimensionPixelOffset(R.dimen.month_list_item_header_height); sDaySelectedCircleSize = res.getDimensionPixelSize(R.dimen.day_number_select_circle_radius); mRowHeight = (res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - sMonthHeaderSize) / MAX_NUM_ROWS;// w ww . ja v a 2 s . c o m // Set up accessibility components. mNodeProvider = new MonthViewNodeProvider(context, this); ViewCompat.setAccessibilityDelegate(this, mNodeProvider.getAccessibilityDelegate()); ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); mLockAccessibilityDelegate = true; // Sets up any standard paints that will be used initView(); }
From source file:at.flack.receiver.SmsReceiver.java
@Override public void onReceive(Context context, Intent intent) { sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); notify = sharedPrefs.getBoolean("notifications", true); vibrate = sharedPrefs.getBoolean("vibration", true); headsup = sharedPrefs.getBoolean("headsup", true); led_color = sharedPrefs.getInt("notification_light", -16776961); boolean all = sharedPrefs.getBoolean("all_sms", true); if (notify == false) return;//w w w.j a v a 2s . co m Bundle bundle = intent.getExtras(); SmsMessage[] msgs = null; String str = ""; if (bundle != null) { Object[] pdus = (Object[]) bundle.get("pdus"); msgs = new SmsMessage[pdus.length]; for (int i = 0; i < msgs.length; i++) { msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]); str += msgs[i].getMessageBody().toString(); str += "\n"; } NotificationCompat.Builder mBuilder; if (main != null) { main.addNewMessage(str); return; } boolean use_profile_picture = false; Bitmap profile_picture = null; String origin_name = null; try { origin_name = getContactName(context, msgs[0].getDisplayOriginatingAddress()); if (origin_name == null) origin_name = msgs[0].getDisplayOriginatingAddress(); } catch (Exception e) { } if (origin_name == null) origin_name = "Unknown"; try { profile_picture = RoundedImageView.getCroppedBitmap(Bitmap.createScaledBitmap( fetchThumbnail(context, msgs[0].getDisplayOriginatingAddress()), 200, 200, false), 300); use_profile_picture = true; } catch (Exception e) { use_profile_picture = false; } Resources res = context.getResources(); int positionOfBase64End = str.lastIndexOf("="); if (positionOfBase64End > 0 && Base64.isBase64(str.substring(0, positionOfBase64End))) { mBuilder = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.raven_notification_icon) .setContentTitle(origin_name).setColor(0xFFB71C1C) .setContentText(res.getString(R.string.sms_receiver_new_encrypted)).setAutoCancel(true); if (use_profile_picture && profile_picture != null) { mBuilder = mBuilder.setLargeIcon(profile_picture); } else { mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name, context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200)); } } else if (str.toString().charAt(0) == '%' && (str.toString().length() == 10 || str.toString().length() == 9)) { int lastIndex = str.toString().lastIndexOf("="); if (lastIndex > 0 && Base64.isBase64(str.toString().substring(1, lastIndex))) { mBuilder = new NotificationCompat.Builder(context).setContentTitle(origin_name) .setColor(0xFFB71C1C) .setContentText(res.getString(R.string.sms_receiver_handshake_received)) .setSmallIcon(R.drawable.raven_notification_icon).setAutoCancel(true); if (use_profile_picture && profile_picture != null) { mBuilder = mBuilder.setLargeIcon(profile_picture); } else { mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name, context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200)); } } else { return; } } else if (str.toString().charAt(0) == '%' && str.toString().length() >= 120 && str.toString().length() < 125) { // DH Handshake int lastIndex = str.toString().lastIndexOf("="); if (lastIndex > 0 && Base64.isBase64(str.toString().substring(1, lastIndex))) { mBuilder = new NotificationCompat.Builder(context).setContentTitle(origin_name) .setColor(0xFFB71C1C) .setContentText(res.getString(R.string.sms_receiver_handshake_received)) .setSmallIcon(R.drawable.raven_notification_icon).setAutoCancel(true); if (use_profile_picture && profile_picture != null) { mBuilder = mBuilder.setLargeIcon(profile_picture); } else { mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name, context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200)); } } else { return; } } else { // unencrypted messages if (all) { mBuilder = new NotificationCompat.Builder(context).setContentTitle(origin_name) .setColor(0xFFB71C1C).setContentText(str).setAutoCancel(true) .setStyle(new NotificationCompat.BigTextStyle().bigText(str)) .setSmallIcon(R.drawable.raven_notification_icon); if (use_profile_picture && profile_picture != null) { mBuilder = mBuilder.setLargeIcon(profile_picture); } else { mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name, context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200)); } } else { return; } } Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); mBuilder.setSound(alarmSound); mBuilder.setLights(led_color, 750, 4000); if (vibrate) { mBuilder.setVibrate(new long[] { 0, 100, 200, 300 }); } Intent resultIntent = new Intent(context, MainActivity.class); resultIntent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); resultIntent.putExtra("CONTACT_NUMBER", msgs[0].getOriginatingAddress()); TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addParentStack(MainActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); if (Build.VERSION.SDK_INT >= 16 && headsup) mBuilder.setPriority(Notification.PRIORITY_HIGH); if (Build.VERSION.SDK_INT >= 21) mBuilder.setCategory(Notification.CATEGORY_MESSAGE); final NotificationManager mNotificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); if (intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED") && !MainActivity.isOnTop) mNotificationManager.notify(7, mBuilder.build()); // Save SMS if default app if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT && Telephony.Sms.getDefaultSmsPackage(context).equals(context.getPackageName())) { ContentValues values = new ContentValues(); values.put("address", msgs[0].getDisplayOriginatingAddress()); values.put("body", str.replace("\n", "").replace("\r", "")); if (intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")) context.getContentResolver().insert(Telephony.Sms.Inbox.CONTENT_URI, values); } } }
From source file:com.ichi2.anki.Feedback.java
/** * Create AlertDialogs used on all the activity *//*from w w w . java2 s . co m*/ private void initAllAlertDialogs() { Resources res = getResources(); StyledDialog.Builder builder = new StyledDialog.Builder(this); // builder.setTitle(res.getString(R.string.connection_error_title)); builder.setIcon(R.drawable.ic_dialog_alert); builder.setMessage(res.getString(R.string.youre_offline)); builder.setPositiveButton(res.getString(R.string.dialog_ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mPostingFeedback = false; refreshInterface(); } }); mNoConnectionAlert = builder.create(); }
From source file:ch.uzh.supersede.feedbacklibrary.FeedbackActivity.java
@Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { switch (requestCode) { case PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { Resources res = getResources(); if (userScreenshotChosenTask .equals(res.getString(R.string.supersede_feedbacklibrary_photo_capture_text))) { } else if (userScreenshotChosenTask .equals(res.getString(R.string.supersede_feedbacklibrary_library_chooser_text))) { galleryIntent();/*from w w w .jav a2 s . c o m*/ } } else { // The user denied the permission onRequestPermissionsResultDenied(requestCode, permissions, grantResults, Manifest.permission.READ_EXTERNAL_STORAGE, R.string.supersede_feedbacklibrary_external_storage_permission_text, getResources().getString( R.string.supersede_feedbacklibrary_external_storage_permission_text_instructions)); } break; case PERMISSIONS_REQUEST_RECORD_AUDIO: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { Toast toast = Toast.makeText(getApplicationContext(), R.string.supersede_feedbacklibrary_record_audio_permission_granted_text, Toast.LENGTH_SHORT); toast.show(); } else { // The user denied the permission onRequestPermissionsResultDenied(requestCode, permissions, grantResults, Manifest.permission.RECORD_AUDIO, R.string.supersede_feedbacklibrary_record_audio_permission_text, getResources().getString( R.string.supersede_feedbacklibrary_record_audio_permission_text_instructions)); } break; } }
From source file:com.andexert.calendarlistview.library.SimpleMonthView.java
public SimpleMonthView(Context context, TypedArray typedArray) { super(context); Resources resources = context.getResources(); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); today = new Time(Time.getCurrentTimezone()); today.setToNow();// ww w. j a v a2s. co m mDayOfWeekTypeface = resources.getString(R.string.sans_serif); mCurrentDayTextColor = typedArray.getColor(R.styleable.DayPickerView_colorCurrentDay, resources.getColor(R.color.to_day)); mMonthTextColor = typedArray.getColor(R.styleable.DayPickerView_colorMonthName, resources.getColor(R.color.normal_day)); mDayTextColor = typedArray.getColor(R.styleable.DayPickerView_colorDayName, resources.getColor(R.color.normal_day)); mDayNumColor = typedArray.getColor(R.styleable.DayPickerView_colorNormalDay, resources.getColor(R.color.normal_day)); mPreviousDayColor = typedArray.getColor(R.styleable.DayPickerView_colorPreviousDay, resources.getColor(R.color.normal_day)); mSelectedDaysColor = typedArray.getColor(R.styleable.DayPickerView_colorSelectedDayBackground, resources.getColor(R.color.selected_day_background)); mMonthTitleBGColor = typedArray.getColor(R.styleable.DayPickerView_colorSelectedDayText, resources.getColor(R.color.selected_day_text)); mIsShowMonthDay = typedArray.getBoolean(R.styleable.DayPickerView_showMonthDay, true); mDrawRect = typedArray.getBoolean(R.styleable.DayPickerView_drawRoundRect, false); mStringBuilder = new StringBuilder(50); MINI_DAY_NUMBER_TEXT_SIZE = typedArray.getDimensionPixelSize(R.styleable.DayPickerView_textSizeDay, resources.getDimensionPixelSize(R.dimen.text_size_day)); MONTH_LABEL_TEXT_SIZE = typedArray.getDimensionPixelSize(R.styleable.DayPickerView_textSizeMonth, resources.getDimensionPixelSize(R.dimen.text_size_month)); MONTH_DAY_LABEL_TEXT_SIZE = typedArray.getDimensionPixelSize(R.styleable.DayPickerView_textSizeDayName, resources.getDimensionPixelSize(R.dimen.text_size_day_name)); MONTH_HEADER_SIZE = typedArray.getDimensionPixelOffset(R.styleable.DayPickerView_headerMonthHeight, resources.getDimensionPixelOffset( mIsShowMonthDay ? R.dimen.header_month_height_showWeek : R.dimen.header_month_height)); DAY_SELECTED_CIRCLE_SIZE = typedArray.getDimensionPixelSize(R.styleable.DayPickerView_selectedDayRadius, resources.getDimensionPixelOffset(R.dimen.selected_day_radius)); mRowHeight = ((typedArray.getDimensionPixelSize(R.styleable.DayPickerView_calendarHeight, resources.getDimensionPixelOffset(R.dimen.calendar_height)) - MONTH_HEADER_SIZE) / 6); isPrevDayEnabled = typedArray.getBoolean(R.styleable.DayPickerView_enablePreviousDay, true); initView(); }
From source file:com.csipsimple.plugins.betamax.CallHandlerWeb.java
@Override public void onReceive(Context context, Intent intent) { if (Utils.ACTION_GET_PHONE_HANDLERS.equals(intent.getAction())) { PendingIntent pendingIntent = null; // Extract infos from intent received String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); // Extract infos from settings SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String user = prefs.getString(CallHandlerConfig.KEY_TW_USER, ""); String pwd = prefs.getString(CallHandlerConfig.KEY_TW_PWD, ""); String nbr = prefs.getString(CallHandlerConfig.KEY_TW_NBR, ""); String provider = prefs.getString(CallHandlerConfig.KEY_TW_PROVIDER, ""); // We must handle that clean way cause when call just to // get the row in account list expect this to reply correctly if (!TextUtils.isEmpty(number) && !TextUtils.isEmpty(user) && !TextUtils.isEmpty(nbr) && !TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(provider)) { // Build pending intent Intent i = new Intent(ACTION_DO_WEB_CALL); i.setClass(context, getClass()); i.putExtra(Intent.EXTRA_PHONE_NUMBER, number); pendingIntent = PendingIntent.getBroadcast(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); }/* w w w. j a v a 2s . c o m*/ // Build icon Bitmap bmp = Utils.getBitmapFromResource(context, R.drawable.icon_web); // Build the result for the row (label, icon, pending intent, and // excluded phone number) Bundle results = getResultExtras(true); if (pendingIntent != null) { results.putParcelable(Utils.EXTRA_REMOTE_INTENT_TOKEN, pendingIntent); } // Text for the row String providerName = ""; Resources r = context.getResources(); if (!TextUtils.isEmpty(provider)) { String[] arr = r.getStringArray(R.array.provider_values); String[] arrEntries = r.getStringArray(R.array.provider_entries); int i = 0; for (String prov : arr) { if (prov.equalsIgnoreCase(provider)) { providerName = arrEntries[i]; break; } i++; } } results.putString(Intent.EXTRA_TITLE, providerName + " " + r.getString(R.string.web_callback)); Log.d(THIS_FILE, "icon is " + bmp); if (bmp != null) { results.putParcelable(Intent.EXTRA_SHORTCUT_ICON, bmp); } // DO *NOT* exclude from next tel: intent cause we use a http method // results.putString(Intent.EXTRA_PHONE_NUMBER, number); } else if (ACTION_DO_WEB_CALL.equals(intent.getAction())) { // Extract infos from intent received String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); // Extract infos from settings SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String user = prefs.getString(CallHandlerConfig.KEY_TW_USER, ""); String pwd = prefs.getString(CallHandlerConfig.KEY_TW_PWD, ""); String nbr = prefs.getString(CallHandlerConfig.KEY_TW_NBR, ""); String provider = prefs.getString(CallHandlerConfig.KEY_TW_PROVIDER, ""); // params List<NameValuePair> params = new LinkedList<NameValuePair>(); params.add(new BasicNameValuePair("username", user)); params.add(new BasicNameValuePair("password", pwd)); params.add(new BasicNameValuePair("from", nbr)); params.add(new BasicNameValuePair("to", number)); String paramString = URLEncodedUtils.format(params, "utf-8"); String requestURL = "https://www." + provider + "/myaccount/makecall.php?" + paramString; HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(requestURL); // Create a response handler HttpResponse httpResponse; try { httpResponse = httpClient.execute(httpGet); Log.d(THIS_FILE, "response code is " + httpResponse.getStatusLine().getStatusCode()); if (httpResponse.getStatusLine().getStatusCode() == 200) { InputStreamReader isr = new InputStreamReader(httpResponse.getEntity().getContent()); BufferedReader br = new BufferedReader(isr); String line; String fullReply = ""; boolean foundSuccess = false; while ((line = br.readLine()) != null) { if (!TextUtils.isEmpty(line) && line.toLowerCase().contains("success")) { showToaster(context, "Success... wait a while you'll called back"); foundSuccess = true; break; } if (!TextUtils.isEmpty(line)) { fullReply = fullReply.concat(line); } } if (!foundSuccess) { showToaster(context, "Error : server error : " + fullReply); } } else { showToaster(context, "Error : invalid request " + httpResponse.getStatusLine().getStatusCode()); } } catch (ClientProtocolException e) { showToaster(context, "Error : " + e.getLocalizedMessage()); } catch (IOException e) { showToaster(context, "Error : " + e.getLocalizedMessage()); } } }
From source file:com.ijsbrandslob.appirater.Appirater.java
private Dialog buildRatingDialog() { final Dialog rateDialog = new Dialog(mContext); final Resources res = mContext.getResources(); CharSequence appname = "unknown"; try {/*from ww w. j av a 2 s . c om*/ appname = mContext.getPackageManager().getApplicationLabel( mContext.getPackageManager().getApplicationInfo(mContext.getPackageName(), 0)); } catch (NameNotFoundException ex) { /* Do nothing */ } rateDialog.setTitle(String.format(res.getString(R.string.APPIRATER_MESSAGE_TITLE), appname)); rateDialog.setContentView(R.layout.appirater); TextView messageArea = (TextView) rateDialog.findViewById(R.id.appirater_message_area); messageArea.setText(String.format(res.getString(R.string.APPIRATER_MESSAGE), appname)); Button rateButton = (Button) rateDialog.findViewById(R.id.appirater_rate_button); Button remindLaterButton = (Button) rateDialog.findViewById(R.id.appirater_rate_later_button); Button cancelButton = (Button) rateDialog.findViewById(R.id.appirater_cancel_button); rateButton.setText(String.format(res.getString(R.string.APPIRATER_RATE_BUTTON), appname)); rateButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { rateDialog.dismiss(); mRatedCurrentVersion = true; saveSettings(); launchPlayStore(); } }); remindLaterButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mReminderRequestDate = new Date(); saveSettings(); rateDialog.dismiss(); } }); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mDeclinedToRate = true; saveSettings(); rateDialog.dismiss(); } }); return rateDialog; }
From source file:com.google.android.apps.muzei.settings.ChooseSourceFragment.java
public void updateSources() { mSelectedSource = null;//from ww w .j a v a2 s. co m Intent queryIntent = new Intent(ACTION_MUZEI_ART_SOURCE); PackageManager pm = getContext().getPackageManager(); mSources.clear(); List<ResolveInfo> resolveInfos = pm.queryIntentServices(queryIntent, PackageManager.GET_META_DATA); for (ResolveInfo ri : resolveInfos) { Source source = new Source(); source.label = ri.loadLabel(pm).toString(); source.icon = new BitmapDrawable(getResources(), generateSourceImage(ri.loadIcon(pm))); source.targetSdkVersion = ri.serviceInfo.applicationInfo.targetSdkVersion; source.componentName = new ComponentName(ri.serviceInfo.packageName, ri.serviceInfo.name); if (ri.serviceInfo.descriptionRes != 0) { try { Context packageContext = getContext() .createPackageContext(source.componentName.getPackageName(), 0); Resources packageRes = packageContext.getResources(); source.description = packageRes.getString(ri.serviceInfo.descriptionRes); } catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) { Log.e(TAG, "Can't read package resources for source " + source.componentName); } } Bundle metaData = ri.serviceInfo.metaData; source.color = Color.WHITE; if (metaData != null) { String settingsActivity = metaData.getString("settingsActivity"); if (!TextUtils.isEmpty(settingsActivity)) { source.settingsActivity = ComponentName .unflattenFromString(ri.serviceInfo.packageName + "/" + settingsActivity); } String setupActivity = metaData.getString("setupActivity"); if (!TextUtils.isEmpty(setupActivity)) { source.setupActivity = ComponentName .unflattenFromString(ri.serviceInfo.packageName + "/" + setupActivity); } source.color = metaData.getInt("color", source.color); try { float[] hsv = new float[3]; Color.colorToHSV(source.color, hsv); boolean adjust = false; if (hsv[2] < 0.8f) { hsv[2] = 0.8f; adjust = true; } if (hsv[1] > 0.4f) { hsv[1] = 0.4f; adjust = true; } if (adjust) { source.color = Color.HSVToColor(hsv); } if (Color.alpha(source.color) != 255) { source.color = Color.argb(255, Color.red(source.color), Color.green(source.color), Color.blue(source.color)); } } catch (IllegalArgumentException ignored) { } } mSources.add(source); } final String appPackage = getContext().getPackageName(); Collections.sort(mSources, new Comparator<Source>() { @Override public int compare(Source s1, Source s2) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { boolean target1IsO = s1.targetSdkVersion >= Build.VERSION_CODES.O; boolean target2IsO = s2.targetSdkVersion >= Build.VERSION_CODES.O; if (target1IsO && !target2IsO) { return 1; } else if (!target1IsO && target2IsO) { return -1; } } String pn1 = s1.componentName.getPackageName(); String pn2 = s2.componentName.getPackageName(); if (!pn1.equals(pn2)) { if (appPackage.equals(pn1)) { return -1; } else if (appPackage.equals(pn2)) { return 1; } } return s1.label.compareTo(s2.label); } }); redrawSources(); }
From source file:com.ichi2.anki.PreferenceContext.java
@Override protected MaterialDialog onCreateDialog(int id) { Resources res = getResources(); MaterialDialog.Builder builder = new MaterialDialog.Builder(this); switch (id) { case DIALOG_HEBREW_FONT: builder.title(res.getString(R.string.fix_hebrew_text)); builder.content(res.getString(R.string.fix_hebrew_instructions, CollectionHelper.getCurrentAnkiDroidDirectory(this))); builder.callback(new MaterialDialog.ButtonCallback() { @Override//from w w w.j ava 2 s. c o m public void onPositive(MaterialDialog dialog) { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(getResources().getString(R.string.link_hebrew_font))); startActivity(intent); } }); builder.positiveText(res.getString(R.string.fix_hebrew_download_font)); builder.negativeText(R.string.dialog_cancel); } return builder.show(); }
From source file:com.androidinspain.deskclock.stopwatch.StopwatchFragment.java
@Override public void onUpdateFabButtons(@NonNull Button left, @NonNull Button right) { final Resources resources = getResources(); left.setClickable(true);// w w w. ja v a 2 s . com left.setText(R.string.sw_reset_button); left.setContentDescription(resources.getString(R.string.sw_reset_button)); switch (getStopwatch().getState()) { case RESET: left.setVisibility(INVISIBLE); right.setClickable(true); right.setVisibility(INVISIBLE); break; case RUNNING: left.setVisibility(VISIBLE); final boolean canRecordLaps = canRecordMoreLaps(); right.setText(R.string.sw_lap_button); right.setContentDescription(resources.getString(R.string.sw_lap_button)); right.setClickable(canRecordLaps); right.setVisibility(canRecordLaps ? VISIBLE : INVISIBLE); break; case PAUSED: left.setVisibility(VISIBLE); right.setClickable(true); right.setVisibility(VISIBLE); right.setText(R.string.sw_share_button); right.setContentDescription(resources.getString(R.string.sw_share_button)); break; } }