mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-04-28 22:39:50 +00:00
Scone
This commit is contained in:
parent
24380b7e69
commit
c251c4880b
40 changed files with 1270 additions and 1185 deletions
|
|
@ -1,7 +1,14 @@
|
|||
package com.vectras.vm.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import androidx.activity.ComponentActivity;
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
|
|
@ -367,5 +374,64 @@ public class UIUtils {
|
|||
|
||||
}
|
||||
|
||||
public static void oneDialog(String _title, String _message, boolean _cancel, boolean _finish, Activity _activity) {
|
||||
AlertDialog alertDialog = new AlertDialog.Builder(_activity, R.style.MainDialogTheme).create();
|
||||
alertDialog.setTitle(_title);
|
||||
alertDialog.setMessage(_message);
|
||||
if (!_cancel) {
|
||||
alertDialog.setCancelable(false);
|
||||
}
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (_finish) {
|
||||
_activity.finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
public static void oneDialogWithCustomButtonPositive(String _title, String _message, String _buttontext,boolean _cancel, boolean _finish, Activity _activity) {
|
||||
AlertDialog alertDialog = new AlertDialog.Builder(_activity, R.style.MainDialogTheme).create();
|
||||
alertDialog.setTitle(_title);
|
||||
alertDialog.setMessage(_message);
|
||||
if (!_cancel) {
|
||||
alertDialog.setCancelable(false);
|
||||
}
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, _buttontext, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (_finish) {
|
||||
_activity.finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
public static void oneDialogWithContext(String _title, String _message, boolean _cancel, Context _context) {
|
||||
AlertDialog alertDialog = new AlertDialog.Builder(_context, R.style.MainDialogTheme).create();
|
||||
alertDialog.setTitle(_title);
|
||||
alertDialog.setMessage(_message);
|
||||
if (!_cancel) {
|
||||
alertDialog.setCancelable(false);
|
||||
}
|
||||
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
}
|
||||
});
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
public static void edgeToEdge(ComponentActivity _activity) {
|
||||
EdgeToEdge.enable(_activity);
|
||||
}
|
||||
|
||||
public static void setOnApplyWindowInsetsListener(View _view) {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(_view, (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout() | WindowInsetsCompat.Type.ime());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue