mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-29 21:34:44 +02:00
Added B/W toast
This commit is contained in:
@@ -21,6 +21,7 @@ package eu.faircode.email;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.os.Looper;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -54,6 +55,20 @@ public class ToastEx extends Toast {
|
||||
return toast;
|
||||
}
|
||||
|
||||
public static ToastEx makeTextBw(Context context, CharSequence text, int duration) {
|
||||
ToastEx toast = new ToastEx(context);
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
View view = inflater.inflate(R.layout.toast, null);
|
||||
view.setBackground(context.getDrawable(android.R.drawable.toast_frame));
|
||||
|
||||
TextView tv = view.findViewById(android.R.id.message);
|
||||
tv.setTextColor(Color.parseColor("#de000000")); // primary_text_default_material_light
|
||||
tv.setText(text);
|
||||
toast.setView(view);
|
||||
toast.setDuration(duration);
|
||||
return toast;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
// https://developer.android.com/preview/features/toasts
|
||||
|
||||
Reference in New Issue
Block a user