Search in sources :

Example 6 with Toast

use of android.widget.Toast in project QLibrary by DragonsQC.

the class ToastUtils method showCenter.

/**
     * 系统 Toast 显示在屏幕中间,默认显示时长 Toast.LENGTH_SHORT
     *
     * @param context      context
     * @param charSequence 字符串
     */
public static void showCenter(@NonNull Context context, @NonNull CharSequence charSequence) {
    Toast toast = Toast.makeText(context.getApplicationContext(), charSequence, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
}
Also used : Toast(android.widget.Toast)

Example 7 with Toast

use of android.widget.Toast in project android_frameworks_base by ResurrectionRemix.

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)

Example 8 with Toast

use of android.widget.Toast in project android_frameworks_base by ResurrectionRemix.

the class AELogger method onAccessibilityEvent.

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    final String eventClass = event.getClassName() != null ? event.getClassName().toString() : null;
    final String eventText = event.getText() != null ? String.valueOf(event.getText()).toLowerCase(Locale.getDefault()) : null;
    final String eventType = AccessibilityEvent.eventTypeToString(event.getEventType());
    Log.d(TAG, String.format("typ=%s cls=%s pkg=%s txt=%s dsc=%s", eventType, eventClass, event.getPackageName(), eventText, event.getContentDescription()));
    // Show selected event types
    if (0 != (TOAST_EVENT_TYPES & event.getEventType())) {
        final Toast toast = Toast.makeText(this, eventType + ": " + eventClass, Toast.LENGTH_SHORT);
        toast.show();
    }
}
Also used : Toast(android.widget.Toast)

Example 9 with Toast

use of android.widget.Toast in project LshUtils by SenhLinsh.

the class LshToastUtils method showToast.

private static void showToast(Context context, String text, int duration) {
    Toast toast;
    if (context instanceof Application) {
        toast = sToast.get();
        if (toast == null) {
            toast = Toast.makeText(context, text, duration);
            sToast = new SoftReference<>(toast);
        } else {
            toast.setDuration(duration);
        }
    } else {
        toast = Toast.makeText(context, text, duration);
    }
    toast.setText(text);
    toast.show();
}
Also used : Toast(android.widget.Toast) Application(android.app.Application)

Example 10 with Toast

use of android.widget.Toast in project android_frameworks_base by ResurrectionRemix.

the class SysUIToast method makeText.

public static Toast makeText(Context context, CharSequence text, int duration) {
    Toast toast = Toast.makeText(context, text, duration);
    toast.getWindowParams().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
    return toast;
}
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