mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
add note field to entry
This commit is contained in:
parent
3464f93c39
commit
97f28c6089
5 changed files with 49 additions and 1 deletions
|
@ -102,6 +102,7 @@ public class EditEntryActivity extends AegisActivity {
|
|||
private TextInputLayout _textDigitsLayout;
|
||||
private TextInputEditText _textSecret;
|
||||
private TextInputEditText _textUsageCount;
|
||||
private TextInputEditText _textNote;
|
||||
|
||||
private AutoCompleteTextView _dropdownType;
|
||||
private AutoCompleteTextView _dropdownAlgo;
|
||||
|
@ -153,6 +154,7 @@ public class EditEntryActivity extends AegisActivity {
|
|||
_textDigitsLayout = findViewById(R.id.text_digits_layout);
|
||||
_textSecret = findViewById(R.id.text_secret);
|
||||
_textUsageCount = findViewById(R.id.text_usage_count);
|
||||
_textNote = findViewById(R.id.text_note);
|
||||
_dropdownType = findViewById(R.id.dropdown_type);
|
||||
DropdownHelper.fillDropdown(this, _dropdownType, R.array.otp_types_array);
|
||||
_dropdownAlgoLayout = findViewById(R.id.dropdown_algo_layout);
|
||||
|
@ -201,6 +203,7 @@ public class EditEntryActivity extends AegisActivity {
|
|||
|
||||
_textName.setText(_origEntry.getName());
|
||||
_textIssuer.setText(_origEntry.getIssuer());
|
||||
_textNote.setText(_origEntry.getNote());
|
||||
|
||||
OtpInfo info = _origEntry.getInfo();
|
||||
if (info instanceof TotpInfo) {
|
||||
|
@ -675,6 +678,7 @@ public class EditEntryActivity extends AegisActivity {
|
|||
entry.setInfo(info);
|
||||
entry.setIssuer(_textIssuer.getText().toString());
|
||||
entry.setName(_textName.getText().toString());
|
||||
entry.setNote(_textNote.getText().toString());
|
||||
|
||||
int groupPos = _dropdownGroupList.indexOf(_dropdownGroup.getText().toString());
|
||||
if (groupPos != 0) {
|
||||
|
|
|
@ -27,6 +27,7 @@ public class VaultEntry extends UUIDMap.Value {
|
|||
private byte[] _icon;
|
||||
private IconType _iconType = IconType.INVALID;
|
||||
private int _usageCount;
|
||||
private String _note = "";
|
||||
|
||||
private VaultEntry(UUID uuid, OtpInfo info) {
|
||||
super(uuid);
|
||||
|
@ -64,6 +65,7 @@ public class VaultEntry extends UUIDMap.Value {
|
|||
obj.put("name", _name);
|
||||
obj.put("issuer", _issuer);
|
||||
obj.put("group", _group);
|
||||
obj.put("note", _note);
|
||||
obj.put("icon", _icon == null ? JSONObject.NULL : Base64.encode(_icon));
|
||||
obj.put("icon_mime", _icon == null ? null : _iconType.toMimeType());
|
||||
obj.put("info", _info.toJson());
|
||||
|
@ -89,6 +91,7 @@ public class VaultEntry extends UUIDMap.Value {
|
|||
entry.setName(obj.getString("name"));
|
||||
entry.setIssuer(obj.getString("issuer"));
|
||||
entry.setGroup(obj.optString("group", null));
|
||||
entry.setNote(obj.optString("note", ""));
|
||||
|
||||
Object icon = obj.get("icon");
|
||||
if (icon != JSONObject.NULL) {
|
||||
|
@ -137,6 +140,8 @@ public class VaultEntry extends UUIDMap.Value {
|
|||
return _usageCount;
|
||||
}
|
||||
|
||||
public String getNote() { return _note; }
|
||||
|
||||
public void setName(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
@ -164,6 +169,8 @@ public class VaultEntry extends UUIDMap.Value {
|
|||
|
||||
public void setUsageCount(int usageCount) { _usageCount = usageCount; }
|
||||
|
||||
public void setNote(String note) { _note = note; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof VaultEntry)) {
|
||||
|
@ -185,7 +192,8 @@ public class VaultEntry extends UUIDMap.Value {
|
|||
&& Objects.equals(getGroup(), entry.getGroup())
|
||||
&& getInfo().equals(entry.getInfo())
|
||||
&& Arrays.equals(getIcon(), entry.getIcon())
|
||||
&& getIconType().equals(entry.getIconType());
|
||||
&& getIconType().equals(entry.getIconType())
|
||||
&& getNote().equals(entry.getNote());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
10
app/src/main/res/drawable/ic_baseline_notes_black_24.xml
Normal file
10
app/src/main/res/drawable/ic_baseline_notes_black_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3,18h12v-2L3,16v2zM3,6v2h18L21,6L3,6zM3,13h18v-2L3,11v2z"/>
|
||||
</vector>
|
|
@ -131,6 +131,31 @@
|
|||
android:inputType="none"/>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_baseline_notes_black_24"
|
||||
app:tint="?attr/iconColorPrimary"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:hint="@string/note"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/text_note"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text|textMultiLine"/>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_secret"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -259,6 +259,7 @@
|
|||
<string name="preference_reset_usage_count">Reset usage count</string>
|
||||
<string name="preference_reset_usage_count_summary">Reset the usage count of every entry in your vault</string>
|
||||
<string name="preference_reset_usage_count_dialog">Are you sure you want to set the usage count of every entry in your vault to 0?</string>
|
||||
<string name="note">Note</string>
|
||||
<string name="clear">Clear</string>
|
||||
|
||||
<string name="pref_highlight_entry_title">Highlight tokens when tapped</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue