当前位置: 首页>>代码示例>>Java>>正文


Java StringRes类代码示例

本文整理汇总了Java中android.support.annotation.StringRes的典型用法代码示例。如果您正苦于以下问题:Java StringRes类的具体用法?Java StringRes怎么用?Java StringRes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StringRes类属于android.support.annotation包,在下文中一共展示了StringRes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: alert

import android.support.annotation.StringRes; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:googlecodelabs,项目名称:play-billing-codelab,代码行数:23,代码来源:GamePlayActivity.java

示例2: showLongSafe

import android.support.annotation.StringRes; //导入依赖的package包/类
/**
 * 安全地显示长时吐司
 *
 * @param resId 资源Id
 */
public static void showLongSafe(@StringRes final int resId) {
    sHandler.post(new Runnable() {
        @Override
        public void run() {
            show(resId, Toast.LENGTH_LONG);
        }
    });
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:14,代码来源:ToastUtils.java

示例3: newInstance

import android.support.annotation.StringRes; //导入依赖的package包/类
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;
}
 
开发者ID:AndProx,项目名称:AndProx,代码行数:11,代码来源:TextInputDialogFragment.java

示例4: setPositiveButton

import android.support.annotation.StringRes; //导入依赖的package包/类
@NonNull @Override
public BuilderJoinerAndroid setPositiveButton(
        @StringRes int textId,
        @Nullable DialogInterface.OnClickListener listener)
{
    return (BuilderJoinerAndroid) super.setPositiveButton(textId, listener);
}
 
开发者ID:datalink747,项目名称:Rx_java2_soussidev,代码行数:8,代码来源:BuilderJoinerAndroid.java

示例5: showShortSafe

import android.support.annotation.StringRes; //导入依赖的package包/类
/**
 * 安全地显示短时吐司
 *
 * @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);
        }
    });
}
 
开发者ID:Lingzh0ng,项目名称:BrotherWeather,代码行数:15,代码来源:ToastUtils.java

示例6: onLoadingEmpty

import android.support.annotation.StringRes; //导入依赖的package包/类
public void onLoadingEmpty(@StringRes int error){
    if (mTvError != null){
        mTvError.setText(error);
        mTvError.setVisibility(View.VISIBLE);
        mProgressLoading.setVisibility(View.GONE);
        mContainSubView.setVisibility(View.GONE);
    }
}
 
开发者ID:NamTranDev,项目名称:CleanArchitechture,代码行数:9,代码来源:BaseFragmentMvp.java

示例7: suggest

import android.support.annotation.StringRes; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:eltos,项目名称:SimpleDialogFragments,代码行数:13,代码来源:Input.java

示例8: withUsageHintOnLongClick

import android.support.annotation.StringRes; //导入依赖的package包/类
@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);
        }
    };
}
 
开发者ID:novoda,项目名称:espresso-support,代码行数:32,代码来源:AccessibilityViewMatchers.java

示例9: showLong

import android.support.annotation.StringRes; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:jiajieshen,项目名称:AndroidDevSamples,代码行数:10,代码来源:ToastUtil.java

示例10: getThemeDialogAdapterItem

import android.support.annotation.StringRes; //导入依赖的package包/类
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();
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:8,代码来源:DialogService.java

示例11: setToolbarSubtitle

import android.support.annotation.StringRes; //导入依赖的package包/类
@Override
public void setToolbarSubtitle(@StringRes int titleRes, Object... params) {
    ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
    if (Objects.nonNull(actionBar)) {
        actionBar.setSubtitle(getString(titleRes, params));
    }
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:8,代码来源:GifPagerFragment.java

示例12: getDialog

import android.support.annotation.StringRes; //导入依赖的package包/类
/**
 * 单个按钮,显示需要调用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;
}
 
开发者ID:Twelvelines,项目名称:AndroidMuseumBleManager,代码行数:18,代码来源:MyAlertDialog.java

示例13: showShort

import android.support.annotation.StringRes; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:jiajieshen,项目名称:AndroidDevSamples,代码行数:10,代码来源:ToastUtil.java

示例14: newInstance

import android.support.annotation.StringRes; //导入依赖的package包/类
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;
}
 
开发者ID:akexorcist,项目名称:Android-DialogExperiment,代码行数:10,代码来源:AwesomeDialogFragment.java

示例15: showShortSafe

import android.support.annotation.StringRes; //导入依赖的package包/类
/**
 * 安全地显示短时吐司
 *
 * @param resId 资源Id
 */
public static void showShortSafe(final @StringRes int resId) {
    sHandler.post(new Runnable() {
        @Override
        public void run() {
            show(resId, Toast.LENGTH_SHORT);
        }
    });
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:14,代码来源:ToastUtils.java


注:本文中的android.support.annotation.StringRes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。