use of android.widget.Toast in project packages_apps_ResurrectionOTA by ResurrectionRemix.
the class OTAUtils method launchUrl.
public static void launchUrl(String url, Context context) {
if (!url.isEmpty() && context != null) {
PackageManager pm = context.getPackageManager();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
if (intent.resolveActivity(pm) != null) {
context.startActivity(intent);
} else {
Toast toast = Toast.makeText(context, R.string.toast_message, Toast.LENGTH_LONG);
toast.show();
}
}
}
use of android.widget.Toast in project WordPress-Utils-Android by wordpress-mobile.
the class ToastUtils method showToast.
public static Toast showToast(Context context, String text, Duration duration) {
Toast toast = Toast.makeText(context, text, (duration == Duration.SHORT ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG));
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
return toast;
}
use of android.widget.Toast in project easysshfs by bobrofon.
the class EasySSHFSActivity method showToast.
public static void showToast(final CharSequence message) {
if (mContext != null) {
Toast toast = Toast.makeText(mContext, message, Toast.LENGTH_SHORT);
toast.show();
}
}
use of android.widget.Toast in project android_packages_apps_Settings by crdroidandroid.
the class WebViewUpdateServiceWrapper method showInvalidChoiceToast.
/**
* Show a toast to explain the chosen package can no longer be chosen.
*/
public void showInvalidChoiceToast(Context context) {
// The user chose a package that became invalid since the list was last updated,
// show a Toast to explain the situation.
Toast toast = Toast.makeText(context, R.string.select_webview_provider_toast_text, Toast.LENGTH_SHORT);
toast.show();
}
use of android.widget.Toast in project sbt-android by scala-android.
the class DribbbleLogin method showLoggedInUser.
private void showLoggedInUser() {
Gson gson = new GsonBuilder().setDateFormat(DribbbleService.DATE_FORMAT).create();
RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(DribbbleService.ENDPOINT).setConverter(new GsonConverter(gson)).setRequestInterceptor(new AuthInterceptor(dribbblePrefs.getAccessToken())).build();
DribbbleService dribbbleApi = restAdapter.create((DribbbleService.class));
dribbbleApi.getAuthenticatedUser(new Callback<User>() {
@Override
public void success(User user, Response response) {
dribbblePrefs.setLoggedInUser(user);
Toast confirmLogin = new Toast(getApplicationContext());
View v = LayoutInflater.from(DribbbleLogin.this).inflate(R.layout.toast_logged_in_confirmation, null, false);
((TextView) v.findViewById(R.id.name)).setText(user.name);
// need to use app context here as the activity will be destroyed shortly
Glide.with(getApplicationContext()).load(user.avatar_url).placeholder(R.drawable.ic_player).transform(new CircleTransform(getApplicationContext())).into((ImageView) v.findViewById(R.id.avatar));
v.findViewById(R.id.scrim).setBackground(ScrimUtil.makeCubicGradientScrimDrawable(ContextCompat.getColor(DribbbleLogin.this, R.color.scrim), 5, Gravity.BOTTOM));
confirmLogin.setView(v);
confirmLogin.setGravity(Gravity.BOTTOM | Gravity.FILL_HORIZONTAL, 0, 0);
confirmLogin.setDuration(Toast.LENGTH_LONG);
confirmLogin.show();
}
@Override
public void failure(RetrofitError error) {
}
});
}
Aggregations