Search in sources :

Example 41 with Toast

use of android.widget.Toast in project generic-oauth2-login-for-android by wareninja.

the class NotifierHelper method displayToast.

public static void displayToast(Context caller, String toastMsg, int toastType) {
    try {
        // try-catch to avoid stupid app crashes
        LayoutInflater inflater = LayoutInflater.from(caller);
        View mainLayout = inflater.inflate(R.layout.toast_layout, null);
        View rootLayout = mainLayout.findViewById(R.id.toast_layout_root);
        ImageView image = (ImageView) mainLayout.findViewById(R.id.image);
        image.setImageResource(R.drawable.img_icon_notification);
        TextView text = (TextView) mainLayout.findViewById(R.id.text);
        text.setText(toastMsg);
        Toast toast = new Toast(caller);
        //toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        toast.setGravity(Gravity.BOTTOM, 0, 0);
        if (//(isShort)
        toastType == SHORT_TOAST)
            toast.setDuration(Toast.LENGTH_SHORT);
        else
            toast.setDuration(Toast.LENGTH_LONG);
        toast.setView(rootLayout);
        toast.show();
    } catch (Exception ex) {
        // to avoid stupid app crashes
        Log.w(TAG, ex.toString());
    }
}
Also used : Toast(android.widget.Toast) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View)

Example 42 with Toast

use of android.widget.Toast in project Small by wequick.

the class UIUtils method showToast.

public static void showToast(Context context, String tips) {
    Toast toast = Toast.makeText(context, "lib.utils: " + tips, Toast.LENGTH_SHORT);
    toast.show();
}
Also used : Toast(android.widget.Toast)

Example 43 with Toast

use of android.widget.Toast in project glitch-hq-android by tinyspeck.

the class Util method shortToast.

public static void shortToast(Activity context, String msg) {
    Toast sentNotification = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    sentNotification.setGravity(Gravity.CENTER, 0, 0);
    sentNotification.show();
}
Also used : Toast(android.widget.Toast)

Example 44 with Toast

use of android.widget.Toast in project Conversations by siacs.

the class ConversationActivity method attachImageToConversation.

private void attachImageToConversation(Conversation conversation, Uri uri) {
    if (conversation == null) {
        return;
    }
    final Toast prepareFileToast = Toast.makeText(getApplicationContext(), getText(R.string.preparing_image), Toast.LENGTH_LONG);
    prepareFileToast.show();
    xmppConnectionService.attachImageToConversation(conversation, uri, new UiCallback<Message>() {

        @Override
        public void userInputRequried(PendingIntent pi, Message object) {
            hidePrepareFileToast(prepareFileToast);
        }

        @Override
        public void success(Message message) {
            hidePrepareFileToast(prepareFileToast);
            xmppConnectionService.sendMessage(message);
        }

        @Override
        public void error(final int error, Message message) {
            hidePrepareFileToast(prepareFileToast);
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    replaceToast(getString(error));
                }
            });
        }
    });
}
Also used : Toast(android.widget.Toast) Message(eu.siacs.conversations.entities.Message) PendingIntent(android.app.PendingIntent) SuppressLint(android.annotation.SuppressLint)

Example 45 with Toast

use of android.widget.Toast in project platform_frameworks_base by android.

the class NekoActivationActivity method toastUp.

private void toastUp(String s) {
    Toast toast = Toast.makeText(this, s, Toast.LENGTH_SHORT);
    toast.getView().setBackgroundDrawable(null);
    toast.show();
}
Also used : Toast(android.widget.Toast)

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