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 Project: Tok-Android Author: InsightIM File: StringUtils.java License: 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 #2
Source Project: android-showcase-template Author: aerogear File: LandingFragment.java License: 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 #3
Source Project: PocketEOS-Android Author: OracleChain File: ToastUtils.java License: 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 #4
Source Project: android-showcase-template Author: aerogear File: LandingFragment.java License: 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 #5
Source Project: PocketEOS-Android Author: OracleChain File: ToastUtils.java License: 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 #6
Source Project: fingen Author: YoshiOne File: ActivityEditTransaction.java License: 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 #7
Source Project: SoloPi Author: alipay File: StringUtil.java License: 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 #8
Source Project: AndroidWallet Author: Cocos-BCX File: ToastUtils.java License: 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 #9
Source Project: imsdk-android Author: qunarcorp File: IMBaseActivity.java License: 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 #10
Source Project: MvpRoute Author: TLocation File: BaseViewHolder.java License: 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 #11
Source Project: AndroidWallet Author: Cocos-BCX File: ToastUtils.java License: 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 #12
Source Project: AutoTest Author: AndroidPureLand File: ToastUtils.java License: 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 #13
Source Project: user-interface-samples Author: android File: MainActivityTest.java License: 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 #14
Source Project: AutoTest Author: AndroidPureLand File: ToastUtils.java License: 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 #15
Source Project: AutoTest Author: AndroidPureLand File: ToastUtils.java License: 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 #16
Source Project: decorator-wechat Author: Nevolution File: WeChatDecorator.java License: 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 Project: imsdk-android Author: qunarcorp File: IMBaseActivity.java License: 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 #18
Source Project: Tok-Android Author: InsightIM File: StringUtils.java License: GNU General Public License v3.0 | 4 votes |
public static Spanned formatHtmlTxFromResId(@StringRes int resId, Object... args) { return Html.fromHtml(formatTxFromResId(resId, args)); }
Example #19
Source Project: OmniList Author: Shouheng88 File: BasePreferences.java License: GNU Affero General Public License v3.0 | 4 votes |
protected void putLong(@StringRes int keyResId, long value) { mPreferences.edit().putLong(getKey(keyResId), value).apply(); }
Example #20
Source Project: imsdk-android Author: qunarcorp File: FragmentPagerItems.java License: MIT License | 4 votes |
public Creator add(@StringRes int title, Class<? extends Fragment> clazz, Bundle args) { return add(FragmentPagerItem.of(items.getContext().getString(title), clazz, args)); }
Example #21
Source Project: star-zone-android Author: bootsrc File: MultiSpanUtil.java License: Apache License 2.0 | 4 votes |
public static MultiSpanOption create(@StringRes int strId, Object... objs) { return create(StringUtil.getResourceStringAndFormat(strId, objs)); }
Example #22
Source Project: WheelViewDemo Author: JustinRoom File: BaseAppCompatActivity.java License: Apache License 2.0 | 4 votes |
public final void showToast(@StringRes int resId) { Toast.makeText(this, resId, Toast.LENGTH_SHORT).show(); }
Example #23
Source Project: OmniList Author: Shouheng88 File: BasePreferences.java License: GNU Affero General Public License v3.0 | 4 votes |
protected void putStringSet(@StringRes int keyResId, Set<String> stringSet) { mPreferences.edit().putStringSet(getKey(keyResId), stringSet).apply(); }
Example #24
Source Project: mvp-sample Author: yanzhenjie File: ActivitySource.java License: Apache License 2.0 | 4 votes |
@Override final void setSubTitle(@StringRes int title) { if (mActionBar != null) mActionBar.setSubtitle(title); }
Example #25
Source Project: imsdk-android Author: qunarcorp File: FragmentPagerItems.java License: MIT License | 4 votes |
public Creator add(@StringRes int title, Class<? extends Fragment> clazz) { return add(FragmentPagerItem.of(items.getContext().getString(title), clazz)); }
Example #26
Source Project: relight Author: ittianyu File: ToolbarWidget.java License: Apache License 2.0 | 4 votes |
public ToolbarWidget logoDescription(@StringRes int resId) { view.setLogoDescription(resId); return self(); }
Example #27
Source Project: star-zone-android Author: bootsrc File: MultiSpanUtil.java License: Apache License 2.0 | 4 votes |
public ItemOption append(@StringRes int keyWord) { return appendInternal(null, StringUtil.getResourceString(keyWord)); }
Example #28
Source Project: OmniList Author: Shouheng88 File: BasePreferences.java License: GNU Affero General Public License v3.0 | 4 votes |
protected String getKey(@StringRes int resId) { return PalmApp.getStringCompact(resId); }
Example #29
Source Project: mvp-sample Author: yanzhenjie File: ViewSource.java License: Apache License 2.0 | 4 votes |
@Override final void setTitle(@StringRes int title) { if (mActionBar != null) mActionBar.setTitle(title); }
Example #30
Source Project: decorator-wechat Author: Nevolution File: WeChatDecorator.java License: Apache License 2.0 | 4 votes |
@RequiresApi(O) private NotificationChannel migrate(final String old_id, final String new_id, final @StringRes int new_name, final boolean silent) { final NotificationChannel channel_message = getNotificationChannel(WECHAT_PACKAGE, Process.myUserHandle(), old_id); deleteNotificationChannel(WECHAT_PACKAGE, Process.myUserHandle(), old_id); if (channel_message != null) return cloneChannel(channel_message, new_id, new_name); else return makeChannel(new_id, new_name, silent); }