mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2023-12-13 20:50:18 +01:00
30921ea330
Title update Color clean up switch to another account and update the token at login Add new account Add fab button for new account and activity update libs Remove account from Manage accounts list Co-authored-by: M M Arif <mmarif@swatian.com> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/624 Reviewed-by: 6543 <6543@noreply.codeberg.org>
76 lines
1.9 KiB
Java
76 lines
1.9 KiB
Java
package org.mian.gitnex.helpers;
|
|
|
|
import android.content.Context;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.widget.TextView;
|
|
import android.widget.Toast;
|
|
import org.mian.gitnex.R;
|
|
|
|
/**
|
|
* Author M M Arif
|
|
*/
|
|
|
|
public class Toasty {
|
|
|
|
public static void info(Context context, String message) {
|
|
|
|
LayoutInflater inflater = LayoutInflater.from(context);
|
|
View view = inflater.inflate(context.getResources().getLayout(R.layout.custom_toast_info), null);
|
|
|
|
TextView text = view.findViewById(R.id.toastText);
|
|
text.setText(message);
|
|
|
|
Toast toast = new Toast(context);
|
|
toast.setDuration(Toast.LENGTH_LONG);
|
|
toast.setView(view);
|
|
toast.show();
|
|
|
|
}
|
|
|
|
public static void error(Context context, String message) {
|
|
|
|
LayoutInflater inflater = LayoutInflater.from(context);
|
|
View view = inflater.inflate(context.getResources().getLayout(R.layout.custom_toast_error), null);
|
|
|
|
TextView text = view.findViewById(R.id.toastText);
|
|
text.setText(message);
|
|
|
|
Toast toast = new Toast(context);
|
|
toast.setDuration(Toast.LENGTH_LONG);
|
|
toast.setView(view);
|
|
toast.show();
|
|
|
|
}
|
|
|
|
public static void warning(Context context, String message) {
|
|
|
|
LayoutInflater inflater = LayoutInflater.from(context);
|
|
View view = inflater.inflate(context.getResources().getLayout(R.layout.custom_toast_warning), null);
|
|
|
|
TextView text = view.findViewById(R.id.toastText);
|
|
text.setText(message);
|
|
|
|
Toast toast = new Toast(context);
|
|
toast.setDuration(Toast.LENGTH_LONG);
|
|
toast.setView(view);
|
|
toast.show();
|
|
|
|
}
|
|
|
|
public static void success(Context context, String message) {
|
|
|
|
LayoutInflater inflater = LayoutInflater.from(context);
|
|
View view = inflater.inflate(context.getResources().getLayout(R.layout.custom_toast_success), null);
|
|
|
|
TextView text = view.findViewById(R.id.toastText);
|
|
text.setText(message);
|
|
|
|
Toast toast = new Toast(context);
|
|
toast.setDuration(Toast.LENGTH_LONG);
|
|
toast.setView(view);
|
|
toast.show();
|
|
|
|
}
|
|
|
|
}
|