mirror of
https://github.com/bitwarden/mobile
synced 2025-12-25 20:53:25 +00:00
add/edit/delete custom fields. remove field page.
This commit is contained in:
@@ -13,5 +13,6 @@
|
||||
<item name="android:windowBackground">@color/lightgray</item>
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
<item name="android:navigationBarColor">@color/darkaccent</item>
|
||||
<item name="android:actionModeBackground">@color/darkaccent</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -24,6 +24,7 @@ using Bit.Android.Autofill;
|
||||
using System.Linq;
|
||||
using Plugin.Settings.Abstractions;
|
||||
using Android.Views.InputMethods;
|
||||
using Android.Widget;
|
||||
|
||||
namespace Bit.Android.Services
|
||||
{
|
||||
@@ -469,5 +470,44 @@ namespace Bit.Android.Services
|
||||
_progressDialog.Dispose();
|
||||
_progressDialog = null;
|
||||
}
|
||||
|
||||
public Task<string> DisplayPromptAync(string title = null, string description = null, string text = null)
|
||||
{
|
||||
var activity = (MainActivity)CurrentContext;
|
||||
var alertBuilder = new AlertDialog.Builder(activity);
|
||||
alertBuilder.SetTitle(title);
|
||||
alertBuilder.SetMessage(description);
|
||||
|
||||
var input = new EditText(activity)
|
||||
{
|
||||
InputType = global::Android.Text.InputTypes.ClassText
|
||||
};
|
||||
if(text != null)
|
||||
{
|
||||
input.Text = text;
|
||||
input.SetSelection(text.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
input.FocusedByDefault = true;
|
||||
}
|
||||
alertBuilder.SetView(input);
|
||||
|
||||
var result = new TaskCompletionSource<string>();
|
||||
alertBuilder.SetPositiveButton(AppResources.Ok, (sender, args) =>
|
||||
{
|
||||
result.TrySetResult(input.Text ?? string.Empty);
|
||||
});
|
||||
|
||||
alertBuilder.SetNegativeButton(AppResources.Cancel, (sender, args) =>
|
||||
{
|
||||
result.TrySetResult(null);
|
||||
});
|
||||
|
||||
var alert = alertBuilder.Create();
|
||||
alert.Window.SetSoftInputMode(global::Android.Views.SoftInput.StateVisible);
|
||||
alert.Show();
|
||||
return result.Task;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user