dialog and error messages redesigned
This commit is contained in:
parent
3c90ab9d15
commit
29fef9a266
@ -200,6 +200,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
.setNegativeButton(R.string.cancel, (view, which) -> {})
|
||||
.create();
|
||||
|
||||
dialog.getWindow().setBackgroundDrawableResource(R.drawable.dialog_themed); // TODO: dialog style
|
||||
binding.codeTypes.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, options));
|
||||
binding.codeTypes.setOnItemClickListener((AdapterView<?> parent, View view, int position, long id) -> {
|
||||
switch(position) {
|
||||
|
@ -32,7 +32,7 @@ public class DialogUtil {
|
||||
.setNegativeButton(R.string.cancel, (btnView, which) -> {})
|
||||
.create();
|
||||
|
||||
//dialog.getWindow().setBackgroundDrawableResource(R.drawable.button_themed); TODO: dialog style
|
||||
dialog.getWindow().setBackgroundDrawableResource(R.drawable.dialog_themed); // TODO: dialog style
|
||||
|
||||
dialog.setOnShowListener(d -> {
|
||||
Button okButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
@ -45,11 +45,13 @@ public class DialogUtil {
|
||||
}
|
||||
|
||||
public static void showErrorDialog(Context context, String errorMessage) {
|
||||
new AlertDialog.Builder(context)
|
||||
AlertDialog dialog = new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.failed_title)
|
||||
.setMessage(errorMessage)
|
||||
.setPositiveButton(R.string.ok, (dialog, which) -> {})
|
||||
.show();
|
||||
.setPositiveButton(R.string.ok, (d, which) -> {})
|
||||
.create();
|
||||
dialog.getWindow().setBackgroundDrawableResource(R.drawable.dialog_themed); // TODO: dialog style
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static void showTOTPDialog(LayoutInflater inflater, OTPData initialData, Consumer<OTPData> callback, Runnable back, boolean view) {
|
||||
@ -171,5 +173,4 @@ public class DialogUtil {
|
||||
case TOTP: showTOTPDialog(inflater, initialData, callback, back, false); break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
36
app/src/main/res/drawable/dialog_themed.xml
Normal file
36
app/src/main/res/drawable/dialog_themed.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke
|
||||
android:width="0dp"
|
||||
android:color="#FFFFFF" />
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:startColor="?attr/colorTheme1"
|
||||
android:endColor="?attr/colorTheme2" />
|
||||
<corners
|
||||
android:bottomLeftRadius="20dp"
|
||||
android:bottomRightRadius="25dp"
|
||||
android:topLeftRadius="20dp"
|
||||
android:topRightRadius="25dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:bottom="0dp"
|
||||
android:left="2dp"
|
||||
android:right="0dp"
|
||||
android:top="0dp">
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke
|
||||
android:width="0dp"
|
||||
android:color="#FFFFFF" />
|
||||
<solid android:color="?attr/colorOnBackground" />
|
||||
<corners
|
||||
android:bottomLeftRadius="20dp"
|
||||
android:bottomRightRadius="20dp"
|
||||
android:topLeftRadius="20dp"
|
||||
android:topRightRadius="20dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
Loading…
Reference in New Issue
Block a user