minor modifications to improve Material UI. Change dialog to Material Dialogs.

This commit is contained in:
Philipp Crocoll
2024-12-17 13:14:56 +01:00
parent e14cd62e75
commit bf5411bdb8
28 changed files with 99 additions and 68 deletions

View File

@@ -15,6 +15,7 @@
<PackageReference Include="Microsoft.Graph.Auth" Version="1.0.0-preview.7" /> <PackageReference Include="Microsoft.Graph.Auth" Version="1.0.0-preview.7" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.49.1" /> <PackageReference Include="Microsoft.Identity.Client" Version="4.49.1" />
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.13.1.5" /> <PackageReference Include="Xamarin.AndroidX.Core" Version="1.13.1.5" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.11.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\AndroidFileChooserBindingSdkStyle\AndroidFileChooserBindingSdkStyle.csproj" /> <ProjectReference Include="..\AndroidFileChooserBindingSdkStyle\AndroidFileChooserBindingSdkStyle.csproj" />

View File

@@ -21,6 +21,7 @@ using Android.App;
using Android.Content; using Android.Content;
using Android.OS; using Android.OS;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
namespace keepass2android namespace keepass2android
{ {
@@ -132,7 +133,7 @@ namespace keepass2android
{ {
try try
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(ctx); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(ctx);
builder.SetMessage(message) builder.SetMessage(message)
.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => ((Dialog)sender).Dismiss()) .SetPositiveButton(Android.Resource.String.Ok, (sender, args) => ((Dialog)sender).Dismiss())

View File

@@ -9,6 +9,7 @@ using Android.OS;
using Android.Runtime; using Android.Runtime;
using Android.Views; using Android.Views;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
namespace keepass2android namespace keepass2android
@@ -23,7 +24,8 @@ namespace keepass2android
//we don't try to handle this better //we don't try to handle this better
//But at least explain to the user what happened! //But at least explain to the user what happened!
((NotificationManager)GetSystemService(Context.NotificationService)).CancelAll(); ((NotificationManager)GetSystemService(Context.NotificationService)).CancelAll();
AlertDialog.Builder b = new AlertDialog.Builder(this);
MaterialAlertDialogBuilder b = new MaterialAlertDialogBuilder(this);
b.SetMessage(Resource.String.killed_by_os); b.SetMessage(Resource.String.killed_by_os);
b.SetPositiveButton(Android.Resource.String.Ok, delegate b.SetPositiveButton(Android.Resource.String.Ok, delegate
{ {

View File

@@ -17,6 +17,7 @@ using Android.Text.Util;
using Android.Views; using Android.Views;
using Android.Webkit; using Android.Webkit;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
namespace keepass2android namespace keepass2android
@@ -25,7 +26,7 @@ namespace keepass2android
{ {
public static void ShowChangeLog(Context ctx, Action onDismiss) public static void ShowChangeLog(Context ctx, Action onDismiss)
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeHoloLightDialog)); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(ctx);
builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title)); builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title));
List<string> changeLog = new List<string>{ List<string> changeLog = new List<string>{
BuildChangelogString(ctx, new List<int>{Resource.Array.ChangeLog_1_11,Resource.Array.ChangeLog_1_11_net}, "1.11"), BuildChangelogString(ctx, new List<int>{Resource.Array.ChangeLog_1_11,Resource.Array.ChangeLog_1_11_net}, "1.11"),

View File

@@ -16,6 +16,7 @@ using Android.Text;
using Android.Util; using Android.Util;
using Android.Views; using Android.Views;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
using keepass2android.database.edit; using keepass2android.database.edit;
using KeePass.Util.Spr; using KeePass.Util.Spr;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
@@ -288,7 +289,7 @@ namespace keepass2android
FindViewById<Button>(Resource.Id.add_child_db_button).Click += (sender, args) => FindViewById<Button>(Resource.Id.add_child_db_button).Click += (sender, args) =>
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(this); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.SetTitle(Resource.String.add_child_db); builder.SetTitle(Resource.String.add_child_db);
List<string> items = new List<string>(); List<string> items = new List<string>();
@@ -321,7 +322,7 @@ namespace keepass2android
AlertDialog dialog = builder.Create(); var dialog = builder.Create();
dialog.Show(); dialog.Show();
}; };
} }

View File

@@ -53,6 +53,7 @@ using keepass2android.fileselect;
using KeeTrayTOTP.Libraries; using KeeTrayTOTP.Libraries;
using Boolean = Java.Lang.Boolean; using Boolean = Java.Lang.Boolean;
using Android.Util; using Android.Util;
using Google.Android.Material.Dialog;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
namespace keepass2android namespace keepass2android
@@ -604,7 +605,7 @@ namespace keepass2android
return; return;
} }
new AlertDialog.Builder(this) new MaterialAlertDialogBuilder(this)
.SetTitle(Resource.String.post_notifications_dialog_title) .SetTitle(Resource.String.post_notifications_dialog_title)
.SetMessage(Resource.String.post_notifications_dialog_message) .SetMessage(Resource.String.post_notifications_dialog_message)
.SetNegativeButton(Resource.String.post_notifications_dialog_disable, (sender, args) => .SetNegativeButton(Resource.String.post_notifications_dialog_disable, (sender, args) =>
@@ -890,7 +891,7 @@ namespace keepass2android
{ {
Button btnSender = (Button)(sender); Button btnSender = (Button)(sender);
AlertDialog.Builder builder = new AlertDialog.Builder(this); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.SetTitle(GetString(Resource.String.SaveAttachmentDialog_title)); builder.SetTitle(GetString(Resource.String.SaveAttachmentDialog_title));
builder.SetMessage(GetString(Resource.String.SaveAttachmentDialog_text)); builder.SetMessage(GetString(Resource.String.SaveAttachmentDialog_text));
@@ -1047,11 +1048,9 @@ namespace keepass2android
ViewGroup historyGroup = (ViewGroup)FindViewById(Resource.Id.previous_versions); ViewGroup historyGroup = (ViewGroup)FindViewById(Resource.Id.previous_versions);
int index = 0; int index = 0;
foreach (var previousVersion in Entry.History) foreach (var previousVersion in Entry.History)
{ {
Button btn = (Button)LayoutInflater.Inflate(Resource.Layout.VersionHistoryButton, null);
Button btn = new Button(this);
btn.Text = getDateTime(previousVersion.LastModificationTime); btn.Text = getDateTime(previousVersion.LastModificationTime);
//copy variable from outer scope for capturing it below. //copy variable from outer scope for capturing it below.

View File

@@ -5,6 +5,7 @@ using Android.Content;
using Android.Content.PM; using Android.Content.PM;
using Android.Util; using Android.Util;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
using KeePass.DataExchange; using KeePass.DataExchange;
using KeePass.DataExchange.Formats; using KeePass.DataExchange.Formats;
using KeePassLib.Interfaces; using KeePassLib.Interfaces;
@@ -60,7 +61,7 @@ namespace keepass2android
protected override void OnCreate(Android.OS.Bundle savedInstanceState) protected override void OnCreate(Android.OS.Bundle savedInstanceState)
{ {
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
AlertDialog.Builder builder = new AlertDialog.Builder(this); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.SetTitle(Resource.String.export_fileformats_title); builder.SetTitle(Resource.String.export_fileformats_title);
builder.SetSingleChoiceItems(Resource.Array.export_fileformat_options, _fileFormatIndex, builder.SetSingleChoiceItems(Resource.Array.export_fileformat_options, _fileFormatIndex,
delegate(object sender, DialogClickEventArgs args) { _fileFormatIndex = args.Which; }); delegate(object sender, DialogClickEventArgs args) { _fileFormatIndex = args.Which; });

View File

@@ -13,7 +13,7 @@ using Android.OS;
using Android.Runtime; using Android.Runtime;
using Android.Views; using Android.Views;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
using Java.IO; using Java.IO;
using keepass2android.Io; using keepass2android.Io;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
@@ -62,7 +62,7 @@ namespace keepass2android
private void ShowSftpDialog(Activity activity, Util.FileSelectedHandler onStartBrowse, Action onCancel, string defaultPath) private void ShowSftpDialog(Activity activity, Util.FileSelectedHandler onStartBrowse, Action onCancel, string defaultPath)
{ {
#if !EXCLUDE_JAVAFILESTORAGE && !NoNet #if !EXCLUDE_JAVAFILESTORAGE && !NoNet
AlertDialog.Builder builder = new AlertDialog.Builder(activity); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
View dlgContents = activity.LayoutInflater.Inflate(Resource.Layout.sftpcredentials, null); View dlgContents = activity.LayoutInflater.Inflate(Resource.Layout.sftpcredentials, null);
var ctx = activity.ApplicationContext; var ctx = activity.ApplicationContext;
var fileStorage = new Keepass2android.Javafilestorage.SftpStorage(ctx); var fileStorage = new Keepass2android.Javafilestorage.SftpStorage(ctx);
@@ -312,7 +312,7 @@ namespace keepass2android
private void ShowHttpDialog(Activity activity, Util.FileSelectedHandler onStartBrowse, Action onCancel, string defaultPath) private void ShowHttpDialog(Activity activity, Util.FileSelectedHandler onStartBrowse, Action onCancel, string defaultPath)
{ {
#if !EXCLUDE_JAVAFILESTORAGE && !NoNet #if !EXCLUDE_JAVAFILESTORAGE && !NoNet
AlertDialog.Builder builder = new AlertDialog.Builder(activity); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
View dlgContents = activity.LayoutInflater.Inflate(Resource.Layout.httpcredentials, null); View dlgContents = activity.LayoutInflater.Inflate(Resource.Layout.httpcredentials, null);
if (!defaultPath.EndsWith(_schemeSeparator)) if (!defaultPath.EndsWith(_schemeSeparator))
{ {
@@ -353,7 +353,7 @@ namespace keepass2android
private void ShowFtpDialog(Activity activity, Util.FileSelectedHandler onStartBrowse, Action onCancel, string defaultPath) private void ShowFtpDialog(Activity activity, Util.FileSelectedHandler onStartBrowse, Action onCancel, string defaultPath)
{ {
#if !NoNet #if !NoNet
AlertDialog.Builder builder = new AlertDialog.Builder(activity); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
View dlgContents = activity.LayoutInflater.Inflate(Resource.Layout.ftpcredentials, null); View dlgContents = activity.LayoutInflater.Inflate(Resource.Layout.ftpcredentials, null);
if (!defaultPath.EndsWith(_schemeSeparator)) if (!defaultPath.EndsWith(_schemeSeparator))
{ {
@@ -411,7 +411,7 @@ namespace keepass2android
{ {
#if !NoNet #if !NoNet
var settings = MegaFileStorage.GetAccountSettings(activity); var settings = MegaFileStorage.GetAccountSettings(activity);
AlertDialog.Builder builder = new AlertDialog.Builder(activity); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
View dlgContents = activity.LayoutInflater.Inflate(Resource.Layout.megacredentials, null); View dlgContents = activity.LayoutInflater.Inflate(Resource.Layout.megacredentials, null);
if (!defaultPath.EndsWith(_schemeSeparator)) if (!defaultPath.EndsWith(_schemeSeparator))
{ {
@@ -500,7 +500,7 @@ namespace keepass2android
private void ShowOwncloudDialog(Activity activity, Util.FileSelectedHandler onStartBrowse, Action onCancel, string defaultPath, string subtype) private void ShowOwncloudDialog(Activity activity, Util.FileSelectedHandler onStartBrowse, Action onCancel, string defaultPath, string subtype)
{ {
#if !EXCLUDE_JAVAFILESTORAGE && !NoNet #if !EXCLUDE_JAVAFILESTORAGE && !NoNet
AlertDialog.Builder builder = new AlertDialog.Builder(activity); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
View dlgContents = activity.LayoutInflater.Inflate(Resource.Layout.owncloudcredentials, null); View dlgContents = activity.LayoutInflater.Inflate(Resource.Layout.owncloudcredentials, null);
builder.SetView(dlgContents); builder.SetView(dlgContents);
@@ -561,7 +561,7 @@ namespace keepass2android
protected void ShowFilenameWarning(string fileName, Action onUserWantsToContinue, Action onUserWantsToCorrect) protected void ShowFilenameWarning(string fileName, Action onUserWantsToContinue, Action onUserWantsToCorrect)
{ {
new AlertDialog.Builder(_activity) new MaterialAlertDialogBuilder(_activity)
.SetPositiveButton(Resource.String.Continue, delegate { onUserWantsToContinue(); }) .SetPositiveButton(Resource.String.Continue, delegate { onUserWantsToContinue(); })
.SetMessage(Resource.String.NoFilenameWarning) .SetMessage(Resource.String.NoFilenameWarning)
.SetCancelable(false) .SetCancelable(false)

View File

@@ -13,6 +13,7 @@ using Android.Text;
using Android.Util; using Android.Util;
using Android.Views; using Android.Views;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
using keepass2android.Io; using keepass2android.Io;
using keepass2android.view; using keepass2android.view;
using AlertDialog = Android.App.AlertDialog; using AlertDialog = Android.App.AlertDialog;
@@ -177,7 +178,7 @@ namespace keepass2android
if (protocolId.Contains(",")) if (protocolId.Contains(","))
{ {
//bring up a selection dialog to select the variant of the file storage //bring up a selection dialog to select the variant of the file storage
AlertDialog.Builder builder = new AlertDialog.Builder(this); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.SetItems(protocolId.Split(",").Select(singleProtocolId => App.Kp2a.GetStorageDisplayName(singleProtocolId)).ToArray(), builder.SetItems(protocolId.Split(",").Select(singleProtocolId => App.Kp2a.GetStorageDisplayName(singleProtocolId)).ToArray(),
delegate(object sender, DialogClickEventArgs args) delegate(object sender, DialogClickEventArgs args)
@@ -200,7 +201,7 @@ namespace keepass2android
//set help: //set help:
string help = GetString((int)field.GetValue(null)); string help = GetString((int)field.GetValue(null));
new AlertDialog.Builder(this) new MaterialAlertDialogBuilder(this)
.SetTitle(GetString(Resource.String.app_name)) .SetTitle(GetString(Resource.String.app_name))
.SetMessage(help) .SetMessage(help)
.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => ReturnProtocol(protocolId)) .SetPositiveButton(Android.Resource.String.Ok, (sender, args) => ReturnProtocol(protocolId))

View File

@@ -12,6 +12,7 @@ using Android.Preferences;
using Android.Runtime; using Android.Runtime;
using Android.Views; using Android.Views;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
using Java.Lang; using Java.Lang;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
using KeePassLib.Keys; using KeePassLib.Keys;
@@ -169,7 +170,7 @@ namespace keepass2android
} }
catch (Exception e) catch (Exception e)
{ {
new AlertDialog.Builder(this) new MaterialAlertDialogBuilder(this)
.SetTitle(GetString(Resource.String.ErrorOcurred)) .SetTitle(GetString(Resource.String.ErrorOcurred))
.SetMessage(GetString(Resource.String.FingerprintSetupFailed)) .SetMessage(GetString(Resource.String.FingerprintSetupFailed))
.SetCancelable(false) .SetCancelable(false)

View File

@@ -28,6 +28,7 @@ using Android.OS;
using Android.Preferences; using Android.Preferences;
using Android.Views; using Android.Views;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
using Java.Util; using Java.Util;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
using KeePassLib.Cryptography; using KeePassLib.Cryptography;
@@ -278,7 +279,7 @@ namespace keepass2android
.Click += (sender, args) => .Click += (sender, args) =>
{ {
var editText = new EditText(this); var editText = new EditText(this);
new AlertDialog.Builder(this) new MaterialAlertDialogBuilder(this)
.SetMessage(Resource.String.save_password_generation_profile_text) .SetMessage(Resource.String.save_password_generation_profile_text)
.SetView(editText) .SetView(editText)
.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => .SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) =>

View File

@@ -33,6 +33,7 @@ using Android.Graphics;
using Android.Graphics.Drawables; using Android.Graphics.Drawables;
using Android.Preferences; using Android.Preferences;
using Android.Runtime; using Android.Runtime;
using Google.Android.Material.Dialog;
using keepass2android.Io; using keepass2android.Io;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
using KeePassLib.Security; using KeePassLib.Security;
@@ -267,7 +268,7 @@ namespace keepass2android
} }
if (templates.Count > 1) if (templates.Count > 1)
{ {
new AlertDialog.Builder(this) new MaterialAlertDialogBuilder(this)
.SetAdapter(new TemplateListAdapter(this, Android.Resource.Layout.SelectDialogItem, .SetAdapter(new TemplateListAdapter(this, Android.Resource.Layout.SelectDialogItem,
Android.Resource.Id.Text1, templates), Android.Resource.Id.Text1, templates),
(o, args) => { EntryEditActivity.Launch(this, Group, templates[args.Which].Uuid, AppTask); }) (o, args) => { EntryEditActivity.Launch(this, Group, templates[args.Which].Uuid, AppTask); })

View File

@@ -542,7 +542,7 @@ namespace keepass2android
{ {
//this exception was reported by many Huawei users //this exception was reported by many Huawei users
Kp2aLog.LogUnexpectedError(e); Kp2aLog.LogUnexpectedError(e);
new AlertDialog.Builder(this) new MaterialAlertDialogBuilder(this)
.SetTitle(Resource.String.autofill_enable) .SetTitle(Resource.String.autofill_enable)
.SetMessage(Resource.String.autofill_enable_failed) .SetMessage(Resource.String.autofill_enable_failed)
.SetPositiveButton(Resource.String.Ok, (o, eventArgs) => { }) .SetPositiveButton(Resource.String.Ok, (o, eventArgs) => { })
@@ -694,7 +694,7 @@ namespace keepass2android
} }
catch (Exception e) catch (Exception e)
{ {
new AlertDialog.Builder(this) new MaterialAlertDialogBuilder(this)
.SetTitle("Unexpected error") .SetTitle("Unexpected error")
.SetMessage( .SetMessage(
"Opening the settings failed. Please report this to crocoapps@gmail.com including information about your device vendor and OS. Please try to configure the notifications by long pressing a KP2A notification. Details: " + e.ToString()) "Opening the settings failed. Please report this to crocoapps@gmail.com including information about your device vendor and OS. Please try to configure the notifications by long pressing a KP2A notification. Details: " + e.ToString())
@@ -1248,7 +1248,7 @@ namespace keepass2android
int selectedBefore = sortOrderManager.GetCurrentSortOrderIndex(); int selectedBefore = sortOrderManager.GetCurrentSortOrderIndex();
new AlertDialog.Builder(this) new MaterialAlertDialogBuilder(this)
.SetSingleChoiceItems(sortOptions.ToArray(), selectedBefore, (sender, args) => .SetSingleChoiceItems(sortOptions.ToArray(), selectedBefore, (sender, args) =>
{ {
int selectedAfter = args.Which; int selectedAfter = args.Which;

View File

@@ -21,6 +21,7 @@ using Android.App;
using Android.Content; using Android.Content;
using Android.Content.PM; using Android.Content.PM;
using Android.Runtime; using Android.Runtime;
using Google.Android.Material.Dialog;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
namespace keepass2android namespace keepass2android
@@ -139,7 +140,7 @@ namespace keepass2android
} }
if (promptToInstall) if (promptToInstall)
{ {
AlertDialog.Builder b = new AlertDialog.Builder(this); MaterialAlertDialogBuilder b = new MaterialAlertDialogBuilder(this);
string message = GetString(Resource.String.NoChallengeApp) + " " + GetString(Resource.String.PleaseInstallApp, new Java.Lang.Object[]{"ykDroid"}); string message = GetString(Resource.String.NoChallengeApp) + " " + GetString(Resource.String.PleaseInstallApp, new Java.Lang.Object[]{"ykDroid"});
Intent yubichalIntent = new Intent("com.yubichallenge.NFCActivity.CHALLENGE"); Intent yubichalIntent = new Intent("com.yubichallenge.NFCActivity.CHALLENGE");

View File

@@ -43,6 +43,7 @@ using AndroidX.CoordinatorLayout.Widget;
using AndroidX.Core.View; using AndroidX.Core.View;
using AndroidX.DrawerLayout.Widget; using AndroidX.DrawerLayout.Widget;
using Google.Android.Material.AppBar; using Google.Android.Material.AppBar;
using Google.Android.Material.Dialog;
using Java.Lang; using Java.Lang;
using KeePassLib.Keys; using KeePassLib.Keys;
using KeePassLib.Serialization; using KeePassLib.Serialization;
@@ -727,7 +728,7 @@ namespace keepass2android
{ {
if (!string.IsNullOrEmpty((string)btn.Tag)) if (!string.IsNullOrEmpty((string)btn.Tag))
{ {
AlertDialog.Builder b = new AlertDialog.Builder(this); MaterialAlertDialogBuilder b = new MaterialAlertDialogBuilder(this);
b.SetTitle(Resource.String.fingerprint_prefs); b.SetTitle(Resource.String.fingerprint_prefs);
b.SetMessage(btn.Tag.ToString()); b.SetMessage(btn.Tag.ToString());
b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss()); b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss());
@@ -2132,7 +2133,7 @@ namespace keepass2android
if ((Message != null) && (Message.Length > 150)) //show long messages as dialog if ((Message != null) && (Message.Length > 150)) //show long messages as dialog
{ {
new AlertDialog.Builder(_act).SetMessage(Message) new MaterialAlertDialogBuilder(_act).SetMessage(Message)
.SetPositiveButton(Android.Resource.String.Ok, .SetPositiveButton(Android.Resource.String.Ok,
(sender, args) => (sender, args) =>
{ {

View File

@@ -29,6 +29,7 @@ using Android.Runtime;
using Android.Views.InputMethods; using Android.Views.InputMethods;
using Google.Android.Material.AppBar; using Google.Android.Material.AppBar;
using Google.Android.Material.Dialog;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
using KeePassLib; using KeePassLib;
using KeePassLib.Serialization; using KeePassLib.Serialization;
@@ -409,7 +410,7 @@ namespace keepass2android
} }
else else
{ {
AlertDialog.Builder b = new AlertDialog.Builder(this); MaterialAlertDialogBuilder b = new MaterialAlertDialogBuilder(this);
b.SetTitle(Resource.String.fingerprint_prefs); b.SetTitle(Resource.String.fingerprint_prefs);
b.SetMessage(btn.Tag.ToString()); b.SetMessage(btn.Tag.ToString());
b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss()); b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss());

View File

@@ -3,7 +3,7 @@
<item > <item >
<shape android:shape="rectangle" > <shape android:shape="rectangle" >
<corners android:radius="6dip" /> <corners android:radius="6dip" />
<solid android:color="#fff" /> <solid android:color="@color/md_theme_background" />
</shape> </shape>
</item> </item>
</selector> </selector>

View File

@@ -48,7 +48,7 @@ android:fitsSystemWindows="true">
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginBottom="4sp" android:layout_marginBottom="0sp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:textSize="10sp" android:textSize="10sp"
android:text="/storage/emulated/0/keepass/keepass/database.kdbx" /> android:text="/storage/emulated/0/keepass/keepass/database.kdbx" />

View File

@@ -153,9 +153,8 @@
<Button <Button
android:id="@+id/add_advanced" android:id="@+id/add_advanced"
style="?attr/materialButtonOutlinedStyle" style="?attr/materialButtonOutlinedStyle"
app:icon="@drawable/baseline_add_24" app:icon="@drawable/baseline_add_circle_outline_24"
android:paddingLeft="8dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -164,7 +163,6 @@
<Button <Button
style="?attr/materialButtonOutlinedStyle" style="?attr/materialButtonOutlinedStyle"
android:id="@+id/configure_totp" android:id="@+id/configure_totp"
android:paddingLeft="8dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@@ -34,15 +34,17 @@
android:orientation="horizontal" android:orientation="horizontal"
android:clickable="true" android:clickable="true"
android:background="?android:attr/selectableItemBackground"> android:background="?android:attr/selectableItemBackground">
<Button
style="?attr/materialIconButtonStyle" <ImageView
app:icon="@drawable/baseline_more_vert_24" android:id="@+id/group_name_vdots"
android:id="@+id/group_name_vdots" android:layout_width="wrap_content"
android:layout_width="wrap_content" android:layout_height="20dp"
android:layout_height="15dp" android:paddingRight="12dp"
android:tint="@color/md_theme_primary"
android:gravity="right|bottom" android:src="@drawable/baseline_more_vert_24"
android:layout_alignParentRight="true" /> android:gravity="right|bottom"
android:layout_alignParentRight="true" />
<TextView <TextView
android:id="@+id/entry_group_name" android:id="@+id/entry_group_name"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@@ -81,7 +83,9 @@
<ImageView <ImageView
android:id="@+id/username_vdots" android:id="@+id/username_vdots"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="15dp" android:layout_height="20dp"
android:paddingRight="12dp"
android:tint="@color/md_theme_primary"
android:src="@drawable/baseline_more_vert_24" android:src="@drawable/baseline_more_vert_24"
android:gravity="right|bottom" android:gravity="right|bottom"
android:layout_alignParentRight="true" /> android:layout_alignParentRight="true" />
@@ -123,7 +127,9 @@
<ImageView <ImageView
android:id="@+id/url_vdots" android:id="@+id/url_vdots"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="15dp" android:layout_height="20dp"
android:paddingRight="12dp"
android:tint="@color/md_theme_primary"
android:src="@drawable/baseline_more_vert_24" android:src="@drawable/baseline_more_vert_24"
android:gravity="right|bottom" android:gravity="right|bottom"
android:layout_alignParentRight="true" /> android:layout_alignParentRight="true" />
@@ -166,7 +172,9 @@
<ImageView <ImageView
android:id="@+id/password_vdots" android:id="@+id/password_vdots"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="15dp" android:layout_height="20dp"
android:paddingRight="12dp"
android:tint="@color/md_theme_primary"
android:src="@drawable/baseline_more_vert_24" android:src="@drawable/baseline_more_vert_24"
android:gravity="right|bottom" android:gravity="right|bottom"
android:layout_alignParentRight="true" /> android:layout_alignParentRight="true" />
@@ -216,7 +224,9 @@
<ImageView <ImageView
android:id="@+id/totp_vdots" android:id="@+id/totp_vdots"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="15dp" android:layout_height="20dp"
android:paddingRight="12dp"
android:tint="@color/md_theme_primary"
android:src="@drawable/baseline_more_vert_24" android:src="@drawable/baseline_more_vert_24"
android:gravity="right|bottom" android:gravity="right|bottom"
android:layout_alignParentRight="true" /> android:layout_alignParentRight="true" />
@@ -278,7 +288,9 @@
<ImageView <ImageView
android:id="@+id/comment_vdots" android:id="@+id/comment_vdots"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="15dp" android:layout_height="20dp"
android:paddingRight="12dp"
android:tint="@color/md_theme_primary"
android:src="@drawable/baseline_more_vert_24" android:src="@drawable/baseline_more_vert_24"
android:gravity="right|bottom" android:gravity="right|bottom"
android:layout_alignParentRight="true" /> android:layout_alignParentRight="true" />
@@ -503,8 +515,7 @@
android:orientation="vertical"> android:orientation="vertical">
<!-- previous versions--> <!-- previous versions-->
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/entry_history" android:text="@string/entry_history"

View File

@@ -51,8 +51,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginBottom="4sp" android:layout_marginBottom="0sp"
android:layout_marginLeft="16dp" android:layout_marginLeft="48dp"
android:textSize="10sp" android:textSize="10sp"
android:text="/storage/emulated/0/keepass/keepass/database.kdbx" /> android:text="/storage/emulated/0/keepass/keepass/database.kdbx" />
</RelativeLayout> </RelativeLayout>
@@ -61,6 +61,7 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:layout_marginBottom="16sp"
app:layout_collapseMode="pin"/> app:layout_collapseMode="pin"/>
</com.google.android.material.appbar.CollapsingToolbarLayout> </com.google.android.material.appbar.CollapsingToolbarLayout>

View File

@@ -3,6 +3,7 @@ using Android.App;
using Android.Content; using Android.Content;
using Android.OS; using Android.OS;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
using KeePassLib.Serialization; using KeePassLib.Serialization;
using KeePassLib.Utility; using KeePassLib.Utility;
using keepass2android.Io; using keepass2android.Io;
@@ -156,7 +157,8 @@ namespace keepass2android
protected override void ShowAlertDialog(string message, EventHandler<DialogClickEventArgs> onOk, EventHandler<DialogClickEventArgs> onCancel) protected override void ShowAlertDialog(string message, EventHandler<DialogClickEventArgs> onOk, EventHandler<DialogClickEventArgs> onCancel)
{ {
new AlertDialog.Builder(this) new
MaterialAlertDialogBuilder(this)
.SetPositiveButton(Android.Resource.String.Ok, onOk) .SetPositiveButton(Android.Resource.String.Ok, onOk)
.SetMessage(message) .SetMessage(message)
.SetCancelable(false) .SetCancelable(false)

View File

@@ -36,6 +36,7 @@ using Android.Hardware.Display;
using Android.Util; using Android.Util;
using Android.Views.InputMethods; using Android.Views.InputMethods;
using AndroidX.Core.View.InputMethod; using AndroidX.Core.View.InputMethod;
using Google.Android.Material.Dialog;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
using KeePassLib; using KeePassLib;
using KeePassLib.Security; using KeePassLib.Security;
@@ -582,7 +583,7 @@ namespace keepass2android
public static void ShowFilenameDialog(Activity activity, Func<string, Dialog, bool> onOpen, Func<string, Dialog, bool> onCreate, Action onCancel, bool showBrowseButton, string defaultFilename, string detailsText, int requestCodeBrowse) public static void ShowFilenameDialog(Activity activity, Func<string, Dialog, bool> onOpen, Func<string, Dialog, bool> onCreate, Action onCancel, bool showBrowseButton, string defaultFilename, string detailsText, int requestCodeBrowse)
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(activity); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
builder.SetView(activity.LayoutInflater.Inflate(Resource.Layout.file_selection_filename, null)); builder.SetView(activity.LayoutInflater.Inflate(Resource.Layout.file_selection_filename, null));
if (onCancel != null) if (onCancel != null)
@@ -646,7 +647,7 @@ namespace keepass2android
public static void QueryCredentials(IOConnectionInfo ioc, Action<IOConnectionInfo> afterQueryCredentials, Activity activity) public static void QueryCredentials(IOConnectionInfo ioc, Action<IOConnectionInfo> afterQueryCredentials, Activity activity)
{ {
//Build dialog to query credentials: //Build dialog to query credentials:
AlertDialog.Builder builder = new AlertDialog.Builder(activity); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
builder.SetTitle(activity.GetString(Resource.String.credentials_dialog_title)); builder.SetTitle(activity.GetString(Resource.String.credentials_dialog_title));
builder.SetPositiveButton(activity.GetString(Android.Resource.String.Ok), (dlgSender, dlgEvt) => builder.SetPositiveButton(activity.GetString(Android.Resource.String.Ok), (dlgSender, dlgEvt) =>
{ {

View File

@@ -34,6 +34,7 @@ using KeePassLib.Keys;
using KeePassLib.Serialization; using KeePassLib.Serialization;
using Android.Preferences; using Android.Preferences;
using AndroidX.Core.Content; using AndroidX.Core.Content;
using Google.Android.Material.Dialog;
#if !EXCLUDE_TWOFISH #if !EXCLUDE_TWOFISH
using TwofishCipher; using TwofishCipher;
#endif #endif
@@ -472,7 +473,7 @@ namespace keepass2android
private void AskForReload(Activity activity, Action<bool> actionOnResult) private void AskForReload(Activity activity, Action<bool> actionOnResult)
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(activity); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
builder.SetTitle(activity.GetString(Resource.String.AskReloadFile_title)); builder.SetTitle(activity.GetString(Resource.String.AskReloadFile_title));
builder.SetMessage(activity.GetString(Resource.String.AskReloadFile)); builder.SetMessage(activity.GetString(Resource.String.AskReloadFile));
@@ -592,7 +593,7 @@ namespace keepass2android
Handler handler = new Handler(Looper.MainLooper); Handler handler = new Handler(Looper.MainLooper);
handler.Post(() => handler.Post(() =>
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(ctx); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(ctx);
builder.SetTitle(GetResourceString(titleKey)); builder.SetTitle(GetResourceString(titleKey));
builder.SetMessage(GetResourceString(messageKey) + (messageSuffix != "" ? " " + messageSuffix : "")); builder.SetMessage(GetResourceString(messageKey) + (messageSuffix != "" ? " " + messageSuffix : ""));
@@ -632,7 +633,7 @@ namespace keepass2android
cancelHandlerWithShow); cancelHandlerWithShow);
} }
AlertDialog dialog = builder.Create(); var dialog = builder.Create();
if (dismissHandler != null) if (dismissHandler != null)
{ {
dialog.SetOnDismissListener(new Util.DismissListener(() => { dialog.SetOnDismissListener(new Util.DismissListener(() => {

View File

@@ -13,6 +13,7 @@ using KeePassLib.Utility;
using KeeTrayTOTP.Libraries; using KeeTrayTOTP.Libraries;
using Android.Content.Res; using Android.Content.Res;
using Android.Preferences; using Android.Preferences;
using Google.Android.Material.Dialog;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
namespace keepass2android namespace keepass2android
@@ -495,7 +496,7 @@ namespace keepass2android
/// </summary> /// </summary>
public void AskAddUrlThenCompleteCreate(EntryActivity activity, string url, Thread notifyPluginsOnOpenThread) public void AskAddUrlThenCompleteCreate(EntryActivity activity, string url, Thread notifyPluginsOnOpenThread)
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(activity); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
builder.SetTitle(activity.GetString(Resource.String.AddUrlToEntryDialog_title)); builder.SetTitle(activity.GetString(Resource.String.AddUrlToEntryDialog_title));
builder.SetMessage(activity.GetString(Resource.String.AddUrlToEntryDialog_text, new Java.Lang.Object[] { url })); builder.SetMessage(activity.GetString(Resource.String.AddUrlToEntryDialog_text, new Java.Lang.Object[] { url }));

View File

@@ -11,6 +11,7 @@ using Java.Util;
using keepass2android.services.AutofillBase.model; using keepass2android.services.AutofillBase.model;
using System.Linq; using System.Linq;
using Android.Content.PM; using Android.Content.PM;
using Google.Android.Material.Dialog;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
using Kp2aAutofillParser; using Kp2aAutofillParser;
using AlertDialog = Android.App.AlertDialog; using AlertDialog = Android.App.AlertDialog;
@@ -64,7 +65,7 @@ namespace keepass2android.services.AutofillBase
Kp2aLog.Log("ChooseForAutofillActivityBase: ExtraDisplayWarning = " + warning); Kp2aLog.Log("ChooseForAutofillActivityBase: ExtraDisplayWarning = " + warning);
if (warning != AutofillServiceBase.DisplayWarning.None) if (warning != AutofillServiceBase.DisplayWarning.None)
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(this); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.SetTitle(this.GetString(Resource.String.AutofillWarning_title)); builder.SetTitle(this.GetString(Resource.String.AutofillWarning_title));
string appName = Intent.GetStringExtra(ExtraQueryPackageString); string appName = Intent.GetStringExtra(ExtraQueryPackageString);

View File

@@ -43,6 +43,7 @@ using Preference = AndroidX.Preference.Preference;
using PreferenceFragment = AndroidX.Preference.PreferenceFragment; using PreferenceFragment = AndroidX.Preference.PreferenceFragment;
using Toolbar = AndroidX.AppCompat.Widget.Toolbar; using Toolbar = AndroidX.AppCompat.Widget.Toolbar;
using Android.Views.Autofill; using Android.Views.Autofill;
using Google.Android.Material.Dialog;
using AlertDialog = AndroidX.AppCompat.App.AlertDialog; using AlertDialog = AndroidX.AppCompat.App.AlertDialog;
using String = System.String; using String = System.String;
using KeePassLib.Cryptography.Cipher; using KeePassLib.Cryptography.Cipher;
@@ -238,7 +239,7 @@ namespace keepass2android
var newIoc = IoUtil.ImportFileToInternalDirectory(sourceIoc, Activity, App.Kp2a); var newIoc = IoUtil.ImportFileToInternalDirectory(sourceIoc, Activity, App.Kp2a);
return () => return () =>
{ {
var builder = new AlertDialog.Builder(Activity); var builder = new MaterialAlertDialogBuilder(Activity);
builder builder
.SetMessage(Resource.String.DatabaseFileMoved); .SetMessage(Resource.String.DatabaseFileMoved);
builder.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => builder.SetPositiveButton(Android.Resource.String.Ok, (sender, args) =>
@@ -340,7 +341,7 @@ namespace keepass2android
return () => return () =>
{ {
UpdateImportKeyfilePref(); UpdateImportKeyfilePref();
var builder = new AlertDialog.Builder(Activity); var builder = new MaterialAlertDialogBuilder(Activity);
builder builder
.SetMessage(Resource.String.KeyfileMoved); .SetMessage(Resource.String.KeyfileMoved);
builder.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => { }); builder.SetPositiveButton(Android.Resource.String.Ok, (sender, args) => { });
@@ -494,7 +495,7 @@ namespace keepass2android
{ {
if ((bool)args.NewValue) if ((bool)args.NewValue)
{ {
new AlertDialog.Builder(ctx) new MaterialAlertDialogBuilder(ctx)
.SetTitle(ctx.GetString(AppNames.AppNameResource)) .SetTitle(ctx.GetString(AppNames.AppNameResource))
.SetCancelable(false) .SetCancelable(false)
.SetPositiveButton(Android.Resource.String.Ok, delegate (object o, DialogClickEventArgs eventArgs) .SetPositiveButton(Android.Resource.String.Ok, delegate (object o, DialogClickEventArgs eventArgs)
@@ -608,7 +609,7 @@ namespace keepass2android
{ {
if (!(bool)e.NewValue) if (!(bool)e.NewValue)
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(Activity); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(Activity);
builder.SetTitle(GetString(Resource.String.ClearOfflineCache_title)); builder.SetTitle(GetString(Resource.String.ClearOfflineCache_title));
builder.SetMessage(GetString(Resource.String.ClearOfflineCache_question)); builder.SetMessage(GetString(Resource.String.ClearOfflineCache_question));
@@ -934,7 +935,7 @@ namespace keepass2android
{ {
//this exception was reported by many Huawei users //this exception was reported by many Huawei users
Kp2aLog.LogUnexpectedError(e); Kp2aLog.LogUnexpectedError(e);
new AlertDialog.Builder(Context) new MaterialAlertDialogBuilder(Context)
.SetTitle(Resource.String.autofill_enable) .SetTitle(Resource.String.autofill_enable)
.SetMessage(Resource.String.autofill_enable_failed) .SetMessage(Resource.String.autofill_enable_failed)
.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => { }) .SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => { })

View File

@@ -16,6 +16,7 @@ using Android.Text.Util;
using Android.Util; using Android.Util;
using Android.Views; using Android.Views;
using Android.Widget; using Android.Widget;
using Google.Android.Material.Dialog;
using keepass2android_appSdkStyle; using keepass2android_appSdkStyle;
namespace keepass2android.views namespace keepass2android.views
@@ -78,7 +79,7 @@ namespace keepass2android.views
string title = Context.GetString(AppNames.AppNameResource); string title = Context.GetString(AppNames.AppNameResource);
if (!string.IsNullOrEmpty(TitleText)) if (!string.IsNullOrEmpty(TitleText))
title = TitleText; title = TitleText;
new AlertDialog.Builder(Context) new MaterialAlertDialogBuilder(Context)
.SetTitle(title) .SetTitle(title)
.SetMessage(_helpText) .SetMessage(_helpText)
.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => { }) .SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => { })