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();
}
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();
}
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();
}
}
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();
}
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;
}
Aggregations