mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-06-06 14:50:17 +00:00
Add seperate dialog for creating groups
To improve layout
This commit is contained in:
parent
324df53df5
commit
ae0b4b5a37
4 changed files with 40 additions and 18 deletions
|
@ -58,12 +58,8 @@ public class Dialogs {
|
||||||
showSecureDialog(new AlertDialog.Builder(context)
|
showSecureDialog(new AlertDialog.Builder(context)
|
||||||
.setTitle(titleId)
|
.setTitle(titleId)
|
||||||
.setView(input)
|
.setView(input)
|
||||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.ok, (dialog, which) ->
|
||||||
@Override
|
listener.onTextInputResult(input.getText().toString()))
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
listener.onTextInputResult(input.getText().toString());
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.create());
|
.create());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +137,20 @@ public class Dialogs {
|
||||||
showSecureDialog(dialog);
|
showSecureDialog(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void showCreateNewGroupDialog(Activity activity, TextInputListener listener) {
|
||||||
|
View view = activity.getLayoutInflater().inflate(R.layout.dialog_newgroup, null);
|
||||||
|
EditText groupName = view.findViewById(R.id.text_groupname);
|
||||||
|
|
||||||
|
AlertDialog dialog = new AlertDialog.Builder(activity)
|
||||||
|
.setTitle(R.string.set_password)
|
||||||
|
.setView(view)
|
||||||
|
.setPositiveButton(android.R.string.ok, (dialog1, which) ->
|
||||||
|
listener.onTextInputResult(groupName.getText().toString()))
|
||||||
|
.create();
|
||||||
|
|
||||||
|
showSecureDialog(dialog);
|
||||||
|
}
|
||||||
|
|
||||||
public static void showFingerprintDialog(Activity activity, Dialogs.SlotListener listener) {
|
public static void showFingerprintDialog(Activity activity, Dialogs.SlotListener listener) {
|
||||||
View view = activity.getLayoutInflater().inflate(R.layout.dialog_fingerprint, null);
|
View view = activity.getLayoutInflater().inflate(R.layout.dialog_fingerprint, null);
|
||||||
TextView textFingerprint = view.findViewById(R.id.text_fingerprint);
|
TextView textFingerprint = view.findViewById(R.id.text_fingerprint);
|
||||||
|
|
|
@ -219,18 +219,15 @@ public class EditEntryActivity extends AegisActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
if (position == _spinnerGroupList.size() - 1) {
|
if (position == _spinnerGroupList.size() - 1) {
|
||||||
Dialogs.showTextInputDialog(activity, R.string.enter_group_name, new Dialogs.TextInputListener() {
|
Dialogs.showCreateNewGroupDialog(activity, text -> {
|
||||||
@Override
|
if (text.isEmpty()) {
|
||||||
public void onTextInputResult(String text) {
|
return;
|
||||||
if (text.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_groups.add(text);
|
|
||||||
// reset the selection to "No group" to work around a quirk
|
|
||||||
_spinnerGroup.setSelection(0, false);
|
|
||||||
updateGroupSpinnerList();
|
|
||||||
_spinnerGroup.setSelection(_spinnerGroupList.indexOf(text), false);
|
|
||||||
}
|
}
|
||||||
|
_groups.add(text);
|
||||||
|
// reset the selection to "No group" to work around a quirk
|
||||||
|
_spinnerGroup.setSelection(0, false);
|
||||||
|
updateGroupSpinnerList();
|
||||||
|
_spinnerGroup.setSelection(_spinnerGroupList.indexOf(text), false);
|
||||||
});
|
});
|
||||||
_spinnerGroup.setSelection(prevPosition, false);
|
_spinnerGroup.setSelection(prevPosition, false);
|
||||||
} else {
|
} else {
|
||||||
|
|
14
app/src/main/res/layout/dialog_newgroup.xml
Normal file
14
app/src/main/res/layout/dialog_newgroup.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingTop="20dp">
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/text_groupname"
|
||||||
|
android:hint="@string/group_name_hint"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
|
@ -139,6 +139,7 @@
|
||||||
<string name="all">All</string>
|
<string name="all">All</string>
|
||||||
<string name="name">Name</string>
|
<string name="name">Name</string>
|
||||||
<string name="no_group">No group</string>
|
<string name="no_group">No group</string>
|
||||||
<string name="new_group">New group</string>
|
<string name="new_group">New group...</string>
|
||||||
<string name="enter_group_name">Enter a group name</string>
|
<string name="enter_group_name">Enter a group name</string>
|
||||||
|
<string name="group_name_hint">Group name</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue