use of android.support.annotation.StringRes in project edx-app-android by edx.
the class ErrorNotification method showError.
/**
* Show the error notification with the message appropriate for the provided error.
*
* @param context The Context, to be used for checking connectivity status.
* @param error The error that occurred while attempting to retrieve from or deliver to the
* remote server. This may be an {@link IOException} if the request failed due to a
* network failure, an {HttpResponseStatusException} if the failure was due to
* receiving an error code, or any {@link Throwable} implementation if one was
* thrown unexpectedly while creating the request or processing the response.
* @param actionTextResId The resource ID of the action button text.
* @param actionListener The callback to be invoked when the action button is clicked.
*/
public void showError(@NonNull final Context context, @NonNull final Throwable error, @StringRes int actionTextResId, @Nullable View.OnClickListener actionListener) {
@StringRes final int errorResId = ErrorUtils.getErrorMessageRes(context, error, this);
final Icon icon = ErrorUtils.getErrorIcon(error);
if (errorResId == R.string.app_version_unsupported) {
actionTextResId = R.string.label_update;
actionListener = AppStoreUtils.OPEN_APP_IN_APP_STORE_CLICK_LISTENER;
}
showError(errorResId, icon, actionTextResId, actionListener);
}
use of android.support.annotation.StringRes in project edx-app-android by edx.
the class BulkDownloadFragment method setSwitchAccessibility.
private void setSwitchAccessibility(@StringRes int accessibilitySuffixStringRes) {
@StringRes final int prefixStringRes = R.string.bulk_download_switch;
final Resources resources = binding.swDownload.getResources();
binding.swDownload.setContentDescription(resources.getString(prefixStringRes) + " " + binding.tvTitle.getText() + ". " + binding.tvSubtitle.getText() + ". " + resources.getString(accessibilitySuffixStringRes));
}
Aggregations