Java 类android.support.annotation.StringRes 实例源码
项目:play-billing-codelab
文件:GamePlayActivity.java
/**
* Show an alert dialog to the user
* @param messageId String id to display inside the alert dialog
* @param optionalParam Optional attribute for the string
*/
@UiThread
void alert(@StringRes int messageId, @Nullable Object optionalParam) {
if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
throw new RuntimeException("Dialog could be shown only from the main thread");
}
AlertDialog.Builder bld = new AlertDialog.Builder(this);
bld.setNeutralButton("OK", null);
if (optionalParam == null) {
bld.setMessage(messageId);
} else {
bld.setMessage(getResources().getString(messageId, optionalParam));
}
bld.create().show();
}
项目:HeadlineNews
文件:ToastUtils.java
/**
* 安全地显示长时吐司
*
* @param resId 资源Id
*/
public static void showLongSafe(@StringRes final int resId) {
sHandler.post(new Runnable() {
@Override
public void run() {
show(resId, Toast.LENGTH_LONG);
}
});
}
项目:AndProx
文件:TextInputDialogFragment.java
public static TextInputDialogFragment newInstance(@StringRes int summary, TextInputDialogListener listener) {
TextInputDialogFragment f = new TextInputDialogFragment();
Bundle args = new Bundle();
args.putInt(SUMMARY_RES, summary);
f.setArguments(args);
f.mListener = listener;
return f;
}
项目:Rx_java2_soussidev
文件:BuilderJoinerAndroid.java
@NonNull @Override
public BuilderJoinerAndroid setPositiveButton(
@StringRes int textId,
@Nullable DialogInterface.OnClickListener listener)
{
return (BuilderJoinerAndroid) super.setPositiveButton(textId, listener);
}
项目:BrotherWeather
文件:ToastUtils.java
/**
* 安全地显示短时吐司
*
* @param resId 资源Id
* @param args 参数
*/
public static void showShortSafe(final @StringRes int resId, final Object... args) {
sHandler.post(new Runnable() {
@Override
public void run() {
show(resId, Toast.LENGTH_SHORT, args);
}
});
}
项目:CleanArchitechture
文件:BaseFragmentMvp.java
public void onLoadingEmpty(@StringRes int error){
if (mTvError != null){
mTvError.setText(error);
mTvError.setVisibility(View.VISIBLE);
mProgressLoading.setVisibility(View.GONE);
mContainSubView.setVisibility(View.GONE);
}
}
项目:SimpleDialogFragments
文件:Input.java
/**
* Provide an array of suggestions to be shown while the user is typing
* This enables the auto-complete behaviour.
*
* @param suggestionStringResArray array of string resources to suggest
*/
public Input suggest(@StringRes int... suggestionStringResArray){
if (suggestionStringResArray != null && suggestionStringResArray.length > 0) {
this.suggestionStringResArray = suggestionStringResArray;
}
return this;
}
项目:espresso-support
文件:AccessibilityViewMatchers.java
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
public static Matcher<? super View> withUsageHintOnLongClick(@StringRes final int resourceId) {
return new TypeSafeMatcher<View>() {
private String resourceName;
private String expectedText;
@Override
protected boolean matchesSafely(View view) {
if (!view.isLongClickable()) {
return false;
}
expectedText = view.getResources().getString(resourceId);
resourceName = view.getResources().getResourceEntryName(resourceId);
if (expectedText == null) {
return false;
}
AccessibilityNodeInfo.AccessibilityAction clickAction = findAction(view, AccessibilityNodeInfo.ACTION_LONG_CLICK);
return expectedText.equals(clickAction.getLabel());
}
@Override
public void describeTo(Description description) {
description.appendText("is long clickable and has custom usage hint for ACTION_LONG_CLICK from resource id: ").appendValue(resourceId);
appendResourceNameAndExpectedTextToDescription(description, resourceName, expectedText);
}
};
}
项目:AndroidDevSamples
文件:ToastUtil.java
@UiThread
public static void showLong(Context context, @StringRes int message) {
Toast toast = getToast(context);
if (toast != null) {
toast.setText(message);
toast.setDuration(Toast.LENGTH_LONG);
toast.show();
}
}
项目:Pocket-Plays-for-Twitch
文件:DialogService.java
private static MaterialSimpleListItem getThemeDialogAdapterItem(@StringRes int title, @DrawableRes int icon, String currentTheme, Activity activity) {
MaterialSimpleListItem.Builder builder = new MaterialSimpleListItem.Builder(activity)
.content(title)
.icon(icon);
return builder.build();
}
项目:Phoenix-for-VK
文件:GifPagerFragment.java
@Override
public void setToolbarSubtitle(@StringRes int titleRes, Object... params) {
ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
if (Objects.nonNull(actionBar)) {
actionBar.setSubtitle(getString(titleRes, params));
}
}
项目:AndroidMuseumBleManager
文件:MyAlertDialog.java
/**
* 单个按钮,显示需要调用show()
*
* @param context
* @param messageResId
* @param postBtResId
* @param postListener
*/
public static AlertDialog getDialog(final Context context, @StringRes int messageResId, @StringRes int postBtResId
, DialogInterface.OnClickListener postListener, boolean cancelable) {
AlertDialog dialog = new AlertDialog.Builder(context)
.setPositiveButton(postBtResId, postListener)
.setCancelable(cancelable)
.setMessage(messageResId)
.create();
return dialog;
}
项目:AndroidDevSamples
文件:ToastUtil.java
@UiThread
public static void showShort(Context context, @StringRes int message) {
Toast toast = getToast(context);
if (toast != null) {
toast.setText(message);
toast.setDuration(Toast.LENGTH_SHORT);
toast.show();
}
}
项目:Android-DialogExperiment
文件:AwesomeDialogFragment.java
public static AwesomeDialogFragment newInstance(@StringRes int message, @StringRes int positive, @StringRes int negative) {
AwesomeDialogFragment fragment = new AwesomeDialogFragment();
Bundle bundle = new Bundle();
bundle.putInt(KEY_MESSAGE, message);
bundle.putInt(KEY_POSITIVE, positive);
bundle.putInt(KEY_NEGATIVE, negative);
fragment.setArguments(bundle);
return fragment;
}
项目:Android-UtilCode
文件:ToastUtils.java
/**
* 安全地显示短时吐司
*
* @param resId 资源Id
*/
public static void showShortSafe(final @StringRes int resId) {
sHandler.post(new Runnable() {
@Override
public void run() {
show(resId, Toast.LENGTH_SHORT);
}
});
}
项目:valifi
文件:ValiFieldText.java
public ValiFieldText addMinLengthValidator(@StringRes int errorResource, int minLength) {
String errorMessage = getString(errorResource, minLength);
return addMinLengthValidator(errorMessage, minLength);
}
项目:AppUpdate
文件:CheckAppUpdate.java
private void setButtonText(@StringRes int buttonText) {
this.buttonText = buttonText;
}
项目:boohee_v5.6
文件:ActionBarDrawerToggle.java
public ActionBarDrawerToggle(Activity activity, DrawerLayout drawerLayout, @DrawableRes int drawerImageRes, @StringRes int openDrawerContentDescRes, @StringRes int closeDrawerContentDescRes) {
this(activity, drawerLayout, !assumeMaterial(activity), drawerImageRes, openDrawerContentDescRes, closeDrawerContentDescRes);
}
项目:disclosure-android-app
文件:LibraryDetailActivity.java
@Override public void notify(@StringRes int id) {
Toast.makeText(this, id, Toast.LENGTH_SHORT).show();
}
项目:javaide
文件:ProgressDialog.java
public ProgressDialog(Context context, @StringRes int titleRes) {
this(context, context.getString(titleRes));
}
项目:DOUSalaries
文件:BaseFragment.java
@Override
public void onError(@StringRes int resId) {
if (baseActivity != null) {
baseActivity.onError(resId);
}
}
项目:EasySP
文件:EasySP.java
public Set<String> getStringSet(@StringRes int key) {
return getStringSet(mContext.getString(key));
}
项目:ReplyMessage
文件:SharedPreferencesUtils.java
public boolean contains(@StringRes int key) {
return contains(mContext.getString(key));
}
项目:LiteReader
文件:Toaster.java
public static void toast(Context context, @StringRes int stringRes) {
toast(context, context.getResources().getString(stringRes), Toast.LENGTH_SHORT);
}
项目:OpenYOLO-Android
文件:RetrieveTestPageFragment.java
private void showSnackbar(@StringRes int messageId) {
Snackbar.make(getView(), messageId, Snackbar.LENGTH_SHORT).show();
}
项目:cortado
文件:Negated.java
@IdeSuggestion
@Override
public final Cortado.And.ViewInteraction withHint(@StringRes int resourceId) {
return super.withHint(resourceId);
}
项目:CurrentActivity
文件:ClipboardUtils.java
public static void copyToClipboard(@NonNull Context context, @StringRes int resId, String text) {
copyToClipboard(context, context.getString(resId), text);
}
项目:GitHub
文件:BaseSubView.java
@Override
public void showMessage(@StringRes int resId) {
if (mParentMvpView != null) {
mParentMvpView.showMessage(resId);
}
}
项目:GitHub
文件:MaterialDialog.java
@UiThread
public final void setContent(@StringRes int newContentRes, @Nullable Object... formatArgs) {
setContent(builder.context.getString(newContentRes, formatArgs));
}
项目:cortado
文件:Negated.java
@IdeSuggestion
@Override
public final Cortado.Or.ViewInteraction withHint(@StringRes int resourceId) {
return super.withHint(resourceId);
}
项目:MultiSelecter
文件:BaseViewHolder.java
public BaseViewHolder setText(@IdRes int viewId, @StringRes int strId) {
TextView view = getView(viewId);
view.setText(strId);
return this;
}
项目:CoachMarks
文件:PopUpCoachMarkPresenter.java
protected void setMessageForCoachMarkText(@StringRes int messageForCoachMarkTextRes) {
mPresentation.setCoachMarkMessage(
mStringResourceProvider.getStringFromResource(messageForCoachMarkTextRes));
}
项目:GitHub
文件:MaterialDialog.java
@UiThread
public final void setTitle(@StringRes int newTitleRes, @Nullable Object... formatArgs) {
setTitle(builder.context.getString(newTitleRes, formatArgs));
}
项目:ImageSaveandShare
文件:BottomDialog.java
public Builder setTitle(@StringRes int titleRes) {
setTitle(this.context.getString(titleRes));
return this;
}
项目:GitHub
文件:BaseViewHolder.java
public BaseViewHolder setText(@IdRes int viewId, @StringRes int strId) {
TextView view = getView(viewId);
view.setText(strId);
return this;
}
项目:memetastic
文件:AppSettingsBase.java
public int getColor(@StringRes int keyResourceId, @ColorRes int defaultColor, final SharedPreferences... pref) {
return gp(pref).getInt(rstr(keyResourceId), rcolor(defaultColor));
}
项目:AIMSICDL
文件:SmsDetector.java
@StringRes
public int getTitle() {
return title;
}
项目:lex
文件:LexList.java
@NonNull
public LexList twoItemSeparator(@StringRes int stringRes) {
return twoItemSeparator(Lex.resources.getString(stringRes));
}
项目:NotificationStyles
文件:BigText.java
public BigText bigContentTitle (@StringRes int title) {
return bigContentTitle(getCenter().getContext().getText(title));
}
项目:Programmers
文件:ContextMenuItem.java
public void setLabel(@StringRes int label) {
this.label = label;
}