Search in sources :

Example 91 with Toast

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();
        }
    }
}
Also used : PackageManager(android.content.pm.PackageManager) Toast(android.widget.Toast) Intent(android.content.Intent)

Example 92 with Toast

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;
}
Also used : Toast(android.widget.Toast)

Example 93 with 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();
    }
}
Also used : Toast(android.widget.Toast)

Example 94 with Toast

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();
}
Also used : Toast(android.widget.Toast)

Example 95 with Toast

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) {
        }
    });
}
Also used : GsonConverter(retrofit.converter.GsonConverter) User(io.plaidapp.data.api.dribbble.model.User) GsonBuilder(com.google.gson.GsonBuilder) GsonBuilder(com.google.gson.GsonBuilder) AuthInterceptor(io.plaidapp.data.api.AuthInterceptor) Gson(com.google.gson.Gson) CircleTransform(io.plaidapp.util.glide.CircleTransform) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) Response(retrofit.client.Response) DribbbleService(io.plaidapp.data.api.dribbble.DribbbleService) Toast(android.widget.Toast) ImageView(android.widget.ImageView) RestAdapter(retrofit.RestAdapter) RetrofitError(retrofit.RetrofitError)

Aggregations

Toast (android.widget.Toast)485 Context (android.content.Context)89 View (android.view.View)86 TextView (android.widget.TextView)74 Intent (android.content.Intent)55 Rect (android.graphics.Rect)34 LayoutInflater (android.view.LayoutInflater)31 SuppressLint (android.annotation.SuppressLint)30 JSONObject (org.json.JSONObject)23 ImageView (android.widget.ImageView)21 RequestQueue (com.android.volley.RequestQueue)20 Response (com.android.volley.Response)20 EditText (android.widget.EditText)19 JSONException (org.json.JSONException)18 VolleyError (com.android.volley.VolleyError)17 JsonObjectRequest (com.android.volley.toolbox.JsonObjectRequest)17 User (model.User)16 PendingIntent (android.app.PendingIntent)15 File (java.io.File)15 HashMap (java.util.HashMap)15