List of usage examples for android.content.res Resources getString
@NonNull public String getString(@StringRes int id) throws NotFoundException
From source file:com.crea_si.eviacam.wizard.SetupWizard.java
@Override public WizardFlow onSetup() { /* Labels of the buttons */ Resources r = getResources(); setNextButtonText(r.getString(R.string.next)); setBackButtonText(r.getString(R.string.back)); setFinishButtonText(r.getString(R.string.finish)); /* Label of the activity */ getActivity().setTitle(r.getString(R.string.app_name)); /* Add your steps in the order you want them to appear and eventually * call create() to create the wizard flow. *///from ww w. jav a 2s . c om return new WizardFlow.Builder().addStep(WelcomeWizardStep.class).addStep(WhatsIsWizardStep.class) .addStep(KeyboardWizardStep.class).addStep(PositioningWizardStep.class, true) .addStep(SpeedSettingsWizardStep.class).addStep(SettingsWizardStep.class) .addStep(PreClickWizardStep.class).addStep(ClickWizardStep.class) .addStep(PreScrollButtonsWizardStep.class).addStep(ScrollButtonsWizardStep.class) .addStep(LimitationsWizardStep.class).addStep(DockMenuWizardStep.class) .addStep(NotificationIconWizardStep.class).addStep(FinalWizardStep.class).create(); }
From source file:Main.java
public static Object getResource(Context context, Field field, int value) { Resources resources = context.getResources(); Class type = field.getType(); if (type.isAssignableFrom(Boolean.TYPE) || type.isAssignableFrom(Boolean.class)) return resources.getBoolean(value); else if (type.isAssignableFrom(Integer.TYPE) || type.isAssignableFrom(Integer.class)) { return resources.getInteger(value); } else if (type.isAssignableFrom(ColorStateList.class)) return resources.getColorStateList(value); else if (type.isAssignableFrom(XmlResourceParser.class)) return resources.getXml(value); else if (type.isAssignableFrom(Float.TYPE) || type.isAssignableFrom(Float.class)) return resources.getDimension(value); else if (type.isAssignableFrom(Drawable.class)) return resources.getDrawable(value); else if (type.isAssignableFrom(Animation.class)) return AnimationUtils.loadAnimation(context, value); else if (type.isAssignableFrom(Movie.class)) return resources.getMovie(value); else if (type.isAssignableFrom(String.class)) return resources.getString(value); else if (type.isArray()) { if (type.getName().equals("[I")) { return resources.getIntArray(value); } else if (type.isAssignableFrom(String[].class)) { return resources.getStringArray(value); }/*from w w w. j a va 2 s.co m*/ } return null; }
From source file:com.autburst.picture.FinishedUploadActivity.java
private void sendLink() { String url = createVideoUrl(); if (url == null) { return;//from w ww . j av a 2 s . c o m } Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); Resources res = getResources(); i.putExtra(Intent.EXTRA_SUBJECT, res.getString(R.string.downloadlink)); i.putExtra(Intent.EXTRA_TEXT, url); startActivity(Intent.createChooser(i, res.getString(R.string.sendlink))); }
From source file:com.embeddedlog.LightUpDroid.alarms.AlarmNotifications.java
public static void showAlarmNotification(Context context, AlarmInstance instance) { Log.v("Displaying alarm notification for alarm instance: " + instance.mId); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); // Close dialogs and window shade, so this will display context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); Resources resources = context.getResources(); NotificationCompat.Builder notification = new NotificationCompat.Builder(context) .setContentTitle(instance.getLabelOrDefault(context)) .setContentText(AlarmUtils.getFormattedTime(context, instance.getAlarmTime())) .setSmallIcon(R.drawable.stat_notify_alarm).setOngoing(true).setAutoCancel(false) .setDefaults(NotificationCompat.DEFAULT_LIGHTS).setWhen(0) .setCategory(NotificationCompat.CATEGORY_ALARM); // Setup Snooze Action Intent snoozeIntent = AlarmStateManager.createStateChangeIntent(context, "SNOOZE_TAG", instance, AlarmInstance.SNOOZE_STATE); PendingIntent snoozePendingIntent = PendingIntent.getBroadcast(context, instance.hashCode(), snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT); notification.addAction(R.drawable.stat_notify_alarm, resources.getString(R.string.alarm_alert_snooze_text), snoozePendingIntent);/* w w w .j a va 2s . c o m*/ // Setup Dismiss Action Intent dismissIntent = AlarmStateManager.createStateChangeIntent(context, "DISMISS_TAG", instance, AlarmInstance.DISMISSED_STATE); PendingIntent dismissPendingIntent = PendingIntent.getBroadcast(context, instance.hashCode(), dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT); notification.addAction(android.R.drawable.ic_menu_close_clear_cancel, resources.getString(R.string.alarm_alert_dismiss_text), dismissPendingIntent); // Setup Content Action Intent contentIntent = AlarmInstance.createIntent(context, AlarmActivity.class, instance.mId); notification.setContentIntent(PendingIntent.getActivity(context, instance.hashCode(), contentIntent, PendingIntent.FLAG_UPDATE_CURRENT)); // Setup fullscreen intent Intent fullScreenIntent = AlarmInstance.createIntent(context, AlarmActivity.class, instance.mId); // set action, so we can be different then content pending intent fullScreenIntent.setAction("fullscreen_activity"); fullScreenIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_USER_ACTION); notification.setFullScreenIntent(PendingIntent.getActivity(context, instance.hashCode(), fullScreenIntent, PendingIntent.FLAG_UPDATE_CURRENT), true); notification.setPriority(NotificationCompat.PRIORITY_MAX); nm.cancel(instance.hashCode()); nm.notify(instance.hashCode(), notification.build()); }
From source file:com.dictionary.codebhak.LangTextView.java
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Resources res = getResources(); if (key.equals(res.getString(R.string.pref_typeface_key))) { setTypeface(getContext());/* w ww. j a v a2 s. c o m*/ } else if (key.equals(res.getString(R.string.pref_textSize_key))) { setTextSize(getContext()); } }
From source file:color.kidpaint.com.kidpaintcolor.dialog.DialogTermsOfUseAndService.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override// w ww. ja va2s. c o m public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); AlertDialog.Builder builder = new CustomAlertDialogBuilder(getActivity()); builder.setTitle(R.string.terms_of_use_and_service_title); View view = inflater.inflate(R.layout.dialog_terms_of_use_and_service, null); TextView termsOfUseAndServiceTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Text); termsOfUseAndServiceTextView.setText(R.string.terms_of_use_and_service_content); TextView termsOfUseAndServiceUrlTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Url); termsOfUseAndServiceUrlTextView.setMovementMethod(LinkMovementMethod.getInstance()); Resources resources = getActivity().getResources(); String paintroidTermsOfUseAndService = String.format( resources.getString(R.string.terms_of_use_and_service_link_template), resources.getString(R.string.terms_of_use_and_service_url), resources.getString(R.string.terms_of_use_and_service_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(paintroidTermsOfUseAndService)); termsOfUseAndServiceUrlTextView.append("\n\n"); String aboutCatroid = String.format(resources.getString(R.string.about_link_template), resources.getString(R.string.catroid_url), resources.getString(R.string.about_catroid_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(aboutCatroid)); termsOfUseAndServiceUrlTextView.append("\n"); builder.setView(view); builder.setNeutralButton(R.string.done, this); return builder.create(); }
From source file:com.color.kid.kidpaint.dialog.DialogTermsOfUseAndService.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override//from w ww . j av a2 s . c om public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); AlertDialog.Builder builder = new CustomAlertDialogBuilder(getActivity()); builder.setTitle(R.string.terms_of_use_and_service_title); View view = inflater.inflate(R.layout.dialog_terms_of_use_and_service, null); TextView termsOfUseAndServiceTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Text); termsOfUseAndServiceTextView.setText(R.string.terms_of_use_and_service_content); TextView termsOfUseAndServiceUrlTextView = (TextView) view .findViewById(R.id.terms_of_use_and_service_tview_Url); termsOfUseAndServiceUrlTextView.setMovementMethod(LinkMovementMethod.getInstance()); Resources resources = getActivity().getResources(); String paintroidTermsOfUseAndService = String.format( resources.getString(R.string.terms_of_use_and_service_link_template), resources.getString(R.string.terms_of_use_and_service_url), resources.getString(R.string.terms_of_use_and_service_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(paintroidTermsOfUseAndService)); termsOfUseAndServiceUrlTextView.append("\n\n"); String aboutCatroid = String.format( /*resources.getString(R.string.about_link_template), resources.getString(R.string.catroid_url),*/ resources.getString(R.string.about_catroid_url_text)); termsOfUseAndServiceUrlTextView.append(Html.fromHtml(aboutCatroid)); termsOfUseAndServiceUrlTextView.append("\n"); builder.setView(view); builder.setNeutralButton(R.string.done, this); return builder.create(); }
From source file:com.github.mkjensen.dml.live.SetupFragment.java
@NonNull @Override/*from w ww .j a va2s. c o m*/ public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) { Resources resources = getResources(); String title = resources.getString(R.string.app_name); String description = resources.getString(R.string.live_setup_description); Drawable icon = resources.getDrawable(R.mipmap.ic_launcher, null); return new GuidanceStylist.Guidance(title, description, BREADCRUMB, icon); }
From source file:com.playhaven.android.diagnostic.test.PHTestCase.java
protected SharedPreferences.Editor configurePlayHaven(int tokenResId, int secretResId, int projectNumberResId) throws PlayHavenException { // Get the resources from our own strings.xml Context iCtx = getInstrumentationContext(); Resources res = iCtx.getResources(); String token = res.getString(tokenResId); String secret = res.getString(secretResId); String regNum = res.getString(projectNumberResId); // But do all the work in the target context Context tCtx = getTargetContext(); // Now configure.... PlayHaven.configure(tCtx, token, secret, regNum); return PlayHaven.getPreferences(tCtx).edit(); }
From source file:com.android.mail.browse.SubjectAndFolderView.java
public SubjectAndFolderView(Context context, AttributeSet attrs) { super(context, attrs); final Resources res = getResources(); mNoFolderChipName = res.getString(R.string.add_label); mNoFolderBgColor = res.getColor(R.color.conv_header_add_label_background); mNoFolderFgColor = res.getColor(R.color.conv_header_add_label_text); mImportanceMarkerDrawable = res.getDrawable(R.drawable.ic_email_caret_none_important_unread); mImportanceMarkerDrawable.setBounds(0, 0, mImportanceMarkerDrawable.getIntrinsicWidth(), mImportanceMarkerDrawable.getIntrinsicHeight()); mChipVerticalOffset = res.getDimensionPixelOffset(R.dimen.folder_cv_vertical_offset); mVisibleFolders = false;//from ww w . j ava 2s . c o m mFolderDisplayer = new ConversationFolderDisplayer(getContext()); }