android.support.annotation.StringRes Java Examples
The following examples show how to use
android.support.annotation.StringRes.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IMBaseActivity.java From imsdk-android with MIT License | 5 votes |
public void setActionBarRightText(@StringRes int str) { if (mNewActionBar == null) { return; } mNewActionBar.getRightLayout().setVisibility(View.VISIBLE); if (str == 0) { mNewActionBar.getRightText().setVisibility(View.GONE); } else { mNewActionBar.getRightText().setVisibility(View.VISIBLE); mNewActionBar.getRightText().setText(str); } }
Example #2
Source File: ToastUtils.java From PocketEOS-Android with GNU Lesser General Public License v3.0 | 5 votes |
/** * 安全地显示短时吐司 * * @param resId 资源Id * @param args 参数 */ public static void showShortToastSafe(final @StringRes int resId, final Object... args) { sHandler.post(new Runnable() { @Override public void run() { showToast(resId, Toast.LENGTH_SHORT, args); } }); }
Example #3
Source File: MainActivityTest.java From user-interface-samples with Apache License 2.0 | 5 votes |
@Test @MediumTest public void allTextsDisplayed() throws Exception { @StringRes final int[] resIds = { R.string.emoji_text_view, R.string.emoji_edit_text, R.string.emoji_button, R.string.regular_text_view, R.string.custom_text_view, }; for (int resId : resIds) { final String text = rule.getActivity().getString(resId, MainActivity.EMOJI); onView(withText(text)).check(matches(isDisplayed())); } }
Example #4
Source File: ToastUtils.java From AndroidWallet with GNU General Public License v3.0 | 5 votes |
/** * Show the sToast for a short period of time. * * @param resId The resource id for text. */ public static void showShort(@StringRes final int resId, int gravity) { if (gravity == Gravity.CENTER) { setGravity(gravity, 0, 0); } show(resId, Toast.LENGTH_SHORT); }
Example #5
Source File: IMBaseActivity.java From imsdk-android with MIT License | 5 votes |
public void setActionBarLeft(@StringRes int iconStr, @StringRes int str, int count) { if (mNewActionBar == null) { return; } setActionBarLeftIcon(iconStr); setActionBarLeftText(str); setActionBarLeftCount(count); }
Example #6
Source File: BaseViewHolder.java From MvpRoute with Apache License 2.0 | 5 votes |
/** * 设置文本 * @param ids * @param stringres */ public void setText(@IdRes int ids, @StringRes int stringres) { View view = findViewById(ids); if (view instanceof TextView) { ((TextView) view).setText(stringres); } }
Example #7
Source File: ToastUtils.java From AutoTest with MIT License | 5 votes |
/** * 安全地显示长时吐司 * * @param resId 资源Id */ public static void showLongToastSafe(final Context context, final @StringRes int resId) { sHandler.post(new Runnable() { @Override public void run() { showToast(context, resId, Toast.LENGTH_LONG); } }); }
Example #8
Source File: StringUtil.java From SoloPi with Apache License 2.0 | 5 votes |
/** * 获取特定Context定义常量 * @param res * @return */ public static String getString(Context context, @StringRes int res) { if (context == null) { return null; } return context.getString(res); }
Example #9
Source File: ToastUtils.java From AndroidWallet with GNU General Public License v3.0 | 5 votes |
/** * Show the sToast for a long period of time. * * @param resId The resource id for text. * @param args The args. */ public static void showLong(@StringRes final int resId, final Object... args) { if (args != null && args.length == 0) { show(resId, Toast.LENGTH_SHORT); } else { show(resId, Toast.LENGTH_LONG, args); } }
Example #10
Source File: LandingFragment.java From android-showcase-template with Apache License 2.0 | 5 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); @StringRes int titleResId = getArguments().getInt(TITLE); mTitle.setText(getString(titleResId)); @ArrayRes int descriptionResId = getArguments().getInt(DESCRIPTION); String[] descriptionArray = getResources().getStringArray(descriptionResId); description.addAll(Arrays.asList(descriptionArray)); }
Example #11
Source File: ActivityEditTransaction.java From fingen with Apache License 2.0 | 5 votes |
private void showRationaleDialog(@StringRes int messageResId, final PermissionRequest request) { new AlertDialog.Builder(this) .setPositiveButton(R.string.act_next, (dialog, which) -> request.proceed()) .setNegativeButton(android.R.string.cancel, (dialog, which) -> request.cancel()) .setCancelable(false) .setMessage(messageResId) .show(); }
Example #12
Source File: StringUtils.java From Tok-Android with GNU General Public License v3.0 | 5 votes |
public static String formatTxFromResId(@StringRes int resId, Object... args) { if (args == null || args.length == 0) { return ""; } String str = TokApplication.getInstance().getString(resId); return String.format(str, args); }
Example #13
Source File: ToastUtils.java From AutoTest with MIT License | 5 votes |
/** * 安全地显示短时吐司 * * @param resId 资源Id */ public static void showShortToastSafe(final Context context, final @StringRes int resId) { sHandler.post(new Runnable() { @Override public void run() { showToast(context, resId, Toast.LENGTH_SHORT); } }); }
Example #14
Source File: ToastUtils.java From AutoTest with MIT License | 5 votes |
/** * 显示短时吐司 * * @param resId 资源Id */ public static void showShortToast(Context context, @StringRes int resId) { if (context == null) { return; } showToast(context, resId, Toast.LENGTH_SHORT); }
Example #15
Source File: ToastUtils.java From PocketEOS-Android with GNU Lesser General Public License v3.0 | 5 votes |
/** * 安全地显示短时吐司 * * @param resId 资源Id */ public static void showShortToastSafe(final @StringRes int resId) { sHandler.post(new Runnable() { @Override public void run() { showToast(resId, Toast.LENGTH_SHORT); } }); }
Example #16
Source File: WeChatDecorator.java From decorator-wechat with Apache License 2.0 | 5 votes |
@RequiresApi(O) private NotificationChannel makeChannel(final String channel_id, final @StringRes int name, final boolean silent) { final NotificationChannel channel = new NotificationChannel(channel_id, getString(name), NotificationManager.IMPORTANCE_HIGH/* Allow heads-up (by default) */); if (silent) channel.setSound(null, null); else channel.setSound(getDefaultSound(), new AudioAttributes.Builder().setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) .setUsage(AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT).build()); channel.enableLights(true); channel.setLightColor(LIGHT_COLOR); return channel; }
Example #17
Source File: LandingFragment.java From android-showcase-template with Apache License 2.0 | 5 votes |
public static LandingFragment newInstance(@StringRes int titleResId, @ArrayRes int descriptionResId) { LandingFragment fragment = new LandingFragment(); Bundle args = new Bundle(); args.putInt(TITLE, titleResId); args.putInt(DESCRIPTION, descriptionResId); fragment.setArguments(args); return fragment; }
Example #18
Source File: ProgressDialog.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
public ProgressDialog(Context context, @StringRes int titleRes) { this(context, context.getString(titleRes)); }
Example #19
Source File: ActivityResourceFinder.java From styT with Apache License 2.0 | 4 votes |
@NonNull @Override public String getString(@StringRes int resId) { return mActivity.getString(resId); }
Example #20
Source File: ContextUtil.java From PowerFileExplorer with GNU General Public License v3.0 | 4 votes |
public static CharSequence getText(@StringRes int stringRes) { return Base.getContext().getText(stringRes); }
Example #21
Source File: CarFragment.java From carstream-android-auto with Apache License 2.0 | 4 votes |
public void setTitle(@StringRes int resId) { this.mTitle = getContext().getString(resId); }
Example #22
Source File: BaseView.java From mvp-sample with Apache License 2.0 | 4 votes |
public final CharSequence getText(@StringRes int id) { return getContext().getText(id); }
Example #23
Source File: BaseView.java From Kalle with Apache License 2.0 | 4 votes |
public void showMessageDialog(@StringRes int title, CharSequence message) { showMessageDialog(getText(title), message); }
Example #24
Source File: FragmentPagerItems.java From imsdk-android with MIT License | 4 votes |
public Creator add(@StringRes int title, float width, Class<? extends Fragment> clazz) { return add(FragmentPagerItem.of(items.getContext().getString(title), width, clazz)); }
Example #25
Source File: ToastUtils.java From Android-utils with Apache License 2.0 | 4 votes |
public static void showLong(@StringRes final int resId, final Object... args) { show(resId, Toast.LENGTH_LONG, args); }
Example #26
Source File: ToastUtil.java From timecat with Apache License 2.0 | 4 votes |
public static void e(@StringRes int message) { Toasty.error(TimeCatApp.getInstance(), TimeCatApp.getInstance().getResources().getString(message), Toast.LENGTH_SHORT).show(); }
Example #27
Source File: ToastUtils.java From Android-utils with Apache License 2.0 | 4 votes |
public static void showShort(@StringRes final int resId, final Object... args) { show(resId, Toast.LENGTH_SHORT, args); }
Example #28
Source File: FinestWebView.java From PowerFileExplorer with GNU General Public License v3.0 | 4 votes |
public void show(@StringRes int urlRes) { show(ResourcesUtil.getString(urlRes)); }
Example #29
Source File: ResUtils.java From Android-utils with Apache License 2.0 | 4 votes |
public static CharSequence getText(@StringRes int id) { return UtilsApp.getApp().getResources().getText(id); }
Example #30
Source File: ActivitySource.java From Kalle with Apache License 2.0 | 4 votes |
@Override final void setTitle(@StringRes int title) { if (mActionBar != null) mActionBar.setTitle(title); }