From 05dc421ea8e4c87a268ff7ef045a9c09180489ab Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Fri, 2 Aug 2019 14:59:59 +0200 Subject: [PATCH] Fix orientation change entry with many bugs #228 --- .../keepass/activities/EntryEditActivity.kt | 407 +++++++----------- .../keepass/activities/GroupActivity.kt | 4 +- .../dialogs/GroupEditDialogFragment.kt | 2 +- .../dialogs/IconPickerDialogFragment.kt | 7 +- .../activities/lock/LockingActivity.kt | 11 +- .../keepass/autofill/AutofillHelper.kt | 36 +- .../database/element/EntryVersioned.kt | 43 +- .../keepass/database/element/PwEntryV3.kt | 6 +- .../keepass/database/element/PwEntryV4.kt | 20 +- .../keepass/database/element/PwGroupV3.kt | 6 +- .../keepass/database/element/PwGroupV4.kt | 21 +- .../keepass/database/element/PwIcon.kt | 2 +- .../keepass/database/element/PwIconCustom.kt | 6 +- .../keepass/database/element/PwIconFactory.kt | 2 +- .../database/element/PwIconStandard.kt | 2 +- .../keepass/database/element/PwNode.kt | 9 +- .../database/file/save/PwDbV4Output.kt | 4 +- .../KeyboardEntryNotificationService.kt | 10 +- .../keepass/magikeyboard/MagikIME.kt | 30 +- .../keepass/model/{Entry.kt => EntryInfo.kt} | 12 +- .../java/com/kunzisoft/keepass/model/Field.kt | 13 +- .../keepass/view/EntryContentsView.kt | 113 +++-- .../keepass/view/EntryCustomField.kt | 8 +- .../keepass/view/EntryEditContentsView.kt | 211 +++++++++ .../keepass/view/EntryEditCustomField.kt | 21 +- app/src/main/res/layout/entry_edit.xml | 164 +------ .../res/layout/entry_edit_view_contents.xml | 183 ++++++++ app/src/main/res/layout/entry_view.xml | 3 +- 28 files changed, 769 insertions(+), 587 deletions(-) rename app/src/main/java/com/kunzisoft/keepass/model/{Entry.kt => EntryInfo.kt} (80%) create mode 100644 app/src/main/java/com/kunzisoft/keepass/view/EntryEditContentsView.kt create mode 100644 app/src/main/res/layout/entry_edit_view_contents.xml diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt index 17fbcd652..633658d5c 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt @@ -20,7 +20,6 @@ package com.kunzisoft.keepass.activities import android.app.Activity import android.content.Intent -import android.graphics.Color import android.os.Bundle import android.os.Handler import android.support.v7.widget.Toolbar @@ -28,12 +27,10 @@ import android.util.Log import android.view.Menu import android.view.MenuItem import android.view.View -import android.view.ViewGroup -import android.widget.* +import android.widget.ScrollView import com.kunzisoft.keepass.R import com.kunzisoft.keepass.activities.dialogs.GeneratePasswordDialogFragment import com.kunzisoft.keepass.activities.dialogs.IconPickerDialogFragment -import com.kunzisoft.keepass.activities.dialogs.IconPickerDialogFragment.Companion.KEY_ICON_STANDARD import com.kunzisoft.keepass.activities.lock.LockingHideActivity import com.kunzisoft.keepass.app.App import com.kunzisoft.keepass.database.action.ProgressDialogSaveDatabaseThread @@ -42,45 +39,30 @@ import com.kunzisoft.keepass.database.action.node.AddEntryRunnable import com.kunzisoft.keepass.database.action.node.AfterActionNodeFinishRunnable import com.kunzisoft.keepass.database.action.node.UpdateEntryRunnable import com.kunzisoft.keepass.database.element.* -import com.kunzisoft.keepass.database.element.security.ProtectedString import com.kunzisoft.keepass.education.EntryEditActivityEducation -import com.kunzisoft.keepass.icons.assignDatabaseIcon -import com.kunzisoft.keepass.icons.assignDefaultDatabaseIcon import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.tasks.ActionRunnable import com.kunzisoft.keepass.timeout.TimeoutHelper import com.kunzisoft.keepass.utils.MenuUtil -import com.kunzisoft.keepass.utils.Util -import com.kunzisoft.keepass.utils.applyFontVisibility -import com.kunzisoft.keepass.view.EntryEditCustomField +import com.kunzisoft.keepass.view.EntryEditContentsView class EntryEditActivity : LockingHideActivity(), IconPickerDialogFragment.IconPickerListener, GeneratePasswordDialogFragment.GeneratePasswordListener { private var mDatabase: Database? = null + // Refs of an entry and group in database, are not modifiable private var mEntry: EntryVersioned? = null private var mParent: GroupVersioned? = null + // New or copy of mEntry in the database to be modifiable private var mNewEntry: EntryVersioned? = null private var mIsNew: Boolean = false - private var mSelectedIconStandard: PwIconStandard? = null // Views private var scrollView: ScrollView? = null - private var entryTitleView: EditText? = null - private var entryIconView: ImageView? = null - private var entryUserNameView: EditText? = null - private var entryUrlView: EditText? = null - private var entryPasswordView: EditText? = null - private var entryConfirmationPasswordView: EditText? = null - private var generatePasswordView: View? = null - private var entryCommentView: EditText? = null - private var entryExtraFieldsContainer: ViewGroup? = null - private var addNewFieldView: View? = null - private var saveView: View? = null - private var iconColor: Int = 0 - // View validation message - private var validationErrorMessageId = UNKNOWN_MESSAGE + private var entryEditContentsView: EntryEditContentsView? = null + + private var saveView: View? = null // Education private var entryEditActivityEducation: EntryEditActivityEducation? = null @@ -97,40 +79,21 @@ class EntryEditActivity : LockingHideActivity(), IconPickerDialogFragment.IconPi scrollView = findViewById(R.id.entry_edit_scroll) scrollView?.scrollBarStyle = View.SCROLLBARS_INSIDE_INSET - entryTitleView = findViewById(R.id.entry_edit_title) - entryIconView = findViewById(R.id.entry_edit_icon_button) - entryUserNameView = findViewById(R.id.entry_edit_user_name) - entryUrlView = findViewById(R.id.entry_edit_url) - entryPasswordView = findViewById(R.id.entry_edit_password) - entryConfirmationPasswordView = findViewById(R.id.entry_edit_confirmation_password) - entryCommentView = findViewById(R.id.entry_edit_notes) - entryExtraFieldsContainer = findViewById(R.id.entry_edit_advanced_container) - + entryEditContentsView = findViewById(R.id.entry_edit_contents) + entryEditContentsView?.applyFontVisibilityToFields(PreferencesUtil.fieldFontIsInVisibility(this)) // Focus view to reinitialize timeout - resetAppTimeoutWhenViewFocusedOrChanged( - entryTitleView, - entryIconView, - entryUserNameView, - entryUrlView, - entryPasswordView, - entryConfirmationPasswordView, - entryCommentView, - entryExtraFieldsContainer) + resetAppTimeoutWhenViewFocusedOrChanged(entryEditContentsView) // Likely the app has been killed exit the activity mDatabase = App.currentDatabase - // Retrieve the textColor to tint the icon - val taIconColor = theme.obtainStyledAttributes(intArrayOf(android.R.attr.textColorPrimary)) - iconColor = taIconColor.getColor(0, Color.WHITE) - taIconColor.recycle() - - mSelectedIconStandard = mDatabase?.iconFactory?.unknownIcon - // Entry is retrieve, it's an entry to update intent.getParcelableExtra>(KEY_ENTRY)?.let { mIsNew = false + // Create an Entry copy to modify from the database entry mEntry = mDatabase?.getEntryById(it) + + // Retrieve the parent mEntry?.let { entry -> mParent = entry.parent // If no parent, add root group as parent @@ -138,57 +101,56 @@ class EntryEditActivity : LockingHideActivity(), IconPickerDialogFragment.IconPi mParent = mDatabase?.rootGroup entry.parent = mParent } - fillEntryDataInContentsView(entry) + } + + // Retrieve the icon after an orientation change + if (savedInstanceState != null && savedInstanceState.containsKey(KEY_NEW_ENTRY)) { + mNewEntry = savedInstanceState.getParcelable(KEY_NEW_ENTRY) as EntryVersioned + } else { + mEntry?.let { entry -> + // Create a copy to modify + mNewEntry = EntryVersioned(entry).also { newEntry -> + + // WARNING Remove the parent to keep memory with parcelable + newEntry.parent = null + } + } } } // Parent is retrieve, it's a new entry to create intent.getParcelableExtra>(KEY_PARENT)?.let { mIsNew = true - mEntry = mDatabase?.createEntry() + mNewEntry = mDatabase?.createEntry() mParent = mDatabase?.getGroupById(it) // Add the default icon mDatabase?.drawFactory?.let { iconFactory -> - entryIconView?.assignDefaultDatabaseIcon(iconFactory, iconColor) + entryEditContentsView?.setDefaultIcon(iconFactory) } } // Close the activity if entry or parent can't be retrieve - if (mEntry == null || mParent == null) { + if (mNewEntry == null || mParent == null) { finish() return } + populateViewsWithEntry(mNewEntry!!) + // Assign title title = if (mIsNew) getString(R.string.add_entry) else getString(R.string.edit_entry) - // Retrieve the icon after an orientation change - savedInstanceState?.let { - if (it.containsKey(KEY_ICON_STANDARD)) { - iconPicked(it) - } - } - // Add listener to the icon - entryIconView?.setOnClickListener { IconPickerDialogFragment.launch(this@EntryEditActivity) } + entryEditContentsView?.setOnIconViewClickListener { IconPickerDialogFragment.launch(this@EntryEditActivity) } // Generate password button - generatePasswordView = findViewById(R.id.entry_edit_generate_button) - generatePasswordView?.setOnClickListener { openPasswordGenerator() } + entryEditContentsView?.setOnPasswordGeneratorClickListener { openPasswordGenerator() } // Save button saveView = findViewById(R.id.entry_edit_save) - mEntry?.let { entry -> - saveView?.setOnClickListener { saveEntry(entry) } - } + saveView?.setOnClickListener { saveEntry() } - if (mEntry?.allowExtraFields() == true) { - addNewFieldView = findViewById(R.id.entry_edit_add_new_field) - addNewFieldView?.apply { - visibility = View.VISIBLE - setOnClickListener { addNewCustomField() } - } - } + entryEditContentsView?.allowCustomField(mNewEntry?.allowExtraFields() == true) { addNewCustomField() } // Verify the education views entryEditActivityEducation = EntryEditActivityEducation(this) @@ -198,9 +160,12 @@ class EntryEditActivity : LockingHideActivity(), IconPickerDialogFragment.IconPi } private fun performedNextEducation(entryEditActivityEducation: EntryEditActivityEducation) { - if (generatePasswordView != null + val passwordView = entryEditContentsView?.generatePasswordView + val addNewFieldView = entryEditContentsView?.addNewFieldView + + if (passwordView != null && entryEditActivityEducation.checkAndPerformedGeneratePasswordEducation( - generatePasswordView!!, + passwordView, { openPasswordGenerator() }, @@ -208,16 +173,62 @@ class EntryEditActivity : LockingHideActivity(), IconPickerDialogFragment.IconPi performedNextEducation(entryEditActivityEducation) } )) - else if (mEntry != null - && mEntry!!.allowExtraFields() - && !mEntry!!.containsCustomFields() - && addNewFieldView != null + else if (mNewEntry != null && mNewEntry!!.allowExtraFields() && !mNewEntry!!.containsCustomFields() + && addNewFieldView != null && addNewFieldView.visibility == View.VISIBLE && entryEditActivityEducation.checkAndPerformedEntryNewFieldEducation( - addNewFieldView!!, + addNewFieldView, { addNewCustomField() })) - ; + ; + } + + private fun populateViewsWithEntry(newEntry: EntryVersioned) { + // Don't start the field reference manager, we want to see the raw ref + mDatabase?.stopManageEntry(newEntry) + + // Set info in temp parameters + temporarilySaveAndShowSelectedIcon(newEntry.icon) + + // Set info in view + entryEditContentsView?.apply { + title = newEntry.title + username = newEntry.username + url = newEntry.url + password = newEntry.password + notes = newEntry.notes + newEntry.fields.doActionToAllCustomProtectedField { key, value -> + addNewCustomField(key, value) + } + } + } + + private fun populateEntryWithViews(newEntry: EntryVersioned) { + + mDatabase?.startManageEntry(newEntry) + + newEntry.apply { + // Build info from view + entryEditContentsView?.let { entryView -> + title = entryView.title + username = entryView.username + url = entryView.url + password = entryView.password + notes = entryView.notes + entryView.customFields.forEach { customField -> + addExtraField(customField.name, customField.protectedValue) + } + } + } + + mDatabase?.stopManageEntry(newEntry) + } + + private fun temporarilySaveAndShowSelectedIcon(icon: PwIcon) { + mNewEntry?.icon = icon + mDatabase?.drawFactory?.let { iconDrawFactory -> + entryEditContentsView?.setIcon(iconDrawFactory, icon) + } } /** @@ -228,15 +239,10 @@ class EntryEditActivity : LockingHideActivity(), IconPickerDialogFragment.IconPi } /** - * Add a new view to fill in the information of the customized field + * Add a new customized field view and scroll to bottom */ private fun addNewCustomField() { - val entryEditCustomField = EntryEditCustomField(this@EntryEditActivity) - entryEditCustomField.setData("", ProtectedString(false, "")) - val visibilityFontActivated = PreferencesUtil.fieldFontIsInVisibility(this) - entryEditCustomField.setFontVisibility(visibilityFontActivated) - entryExtraFieldsContainer?.addView(entryEditCustomField) - + entryEditContentsView?.addNewCustomField() // Scroll bottom scrollView?.post { scrollView?.fullScroll(ScrollView.FOCUS_DOWN) } } @@ -244,136 +250,56 @@ class EntryEditActivity : LockingHideActivity(), IconPickerDialogFragment.IconPi /** * Saves the new entry or update an existing entry in the database */ - private fun saveEntry(entry: EntryVersioned) { + private fun saveEntry() { // Launch a validation and show the error if present - if (!isValid()) { - if (validationErrorMessageId != UNKNOWN_MESSAGE) - Toast.makeText(this@EntryEditActivity, validationErrorMessageId, Toast.LENGTH_LONG).show() - return - } - // Clone the entry - mDatabase?.let { database -> - mNewEntry = EntryVersioned(entry) - mNewEntry?.let { newEntry -> - populateEntryWithViewInfo(newEntry) + if (entryEditContentsView?.isValid() == true) { + // Clone the entry + mDatabase?.let { database -> + mNewEntry?.let { newEntry -> - // Open a progress dialog and save entry - var actionRunnable: ActionRunnable? = null - val afterActionNodeFinishRunnable = object : AfterActionNodeFinishRunnable() { - override fun onActionNodeFinish(actionNodeValues: ActionNodeValues) { - if (actionNodeValues.result.isSuccess) - finish() + // WARNING Add the parent previously deleted + newEntry.parent = mEntry?.parent + // Build info + newEntry.lastAccessTime = PwDate() + newEntry.lastModificationTime = PwDate() + + populateEntryWithViews(newEntry) + + // Open a progress dialog and save entry + var actionRunnable: ActionRunnable? = null + val afterActionNodeFinishRunnable = object : AfterActionNodeFinishRunnable() { + override fun onActionNodeFinish(actionNodeValues: ActionNodeValues) { + if (actionNodeValues.result.isSuccess) + finish() + } } - } - if (mIsNew) { - mParent?.let { parent -> - actionRunnable = AddEntryRunnable(this@EntryEditActivity, - database, - newEntry, - parent, - afterActionNodeFinishRunnable, - !readOnly) + if (mIsNew) { + mParent?.let { parent -> + actionRunnable = AddEntryRunnable(this@EntryEditActivity, + database, + newEntry, + parent, + afterActionNodeFinishRunnable, + !readOnly) + } + + } else { + mEntry?.let { oldEntry -> + actionRunnable = UpdateEntryRunnable(this@EntryEditActivity, + database, + oldEntry, + newEntry, + afterActionNodeFinishRunnable, + !readOnly) + } } - - } else { - actionRunnable = UpdateEntryRunnable(this@EntryEditActivity, - database, - entry, - newEntry, - afterActionNodeFinishRunnable, - !readOnly) - } - actionRunnable?.let { runnable -> - ProgressDialogSaveDatabaseThread(this@EntryEditActivity) {runnable}.start() - } - } - } - } - - /** - * Validate or not the entry form - * - * @return ErrorValidation An error with a message or a validation without message - */ - private fun isValid(): Boolean { - - // Require title - if (entryTitleView?.text.toString().isEmpty()) { - validationErrorMessageId = R.string.error_title_required - return false - } - - // Validate password - if (entryPasswordView?.text.toString() != entryConfirmationPasswordView?.text.toString()) { - validationErrorMessageId = R.string.error_pass_match - return false - } - - // Validate extra fields - if (mEntry?.allowExtraFields() == true) { - entryExtraFieldsContainer?.let { - for (i in 0 until it.childCount) { - val entryEditCustomField = it.getChildAt(i) as EntryEditCustomField - val key = entryEditCustomField.label - if (key.isEmpty()) { - validationErrorMessageId = R.string.error_string_key - return false + actionRunnable?.let { runnable -> + ProgressDialogSaveDatabaseThread(this@EntryEditActivity) { runnable }.start() } } } } - return true - } - - private fun populateEntryWithViewInfo(newEntry: EntryVersioned) { - - mDatabase?.startManageEntry(newEntry) - - newEntry.lastAccessTime = PwDate() - newEntry.lastModificationTime = PwDate() - - newEntry.title = entryTitleView?.text.toString() - newEntry.icon = retrieveIcon() - - newEntry.url = entryUrlView?.text.toString() - newEntry.username = entryUserNameView?.text.toString() - newEntry.notes = entryCommentView?.text.toString() - newEntry.password = entryPasswordView?.text.toString() - - if (newEntry.allowExtraFields()) { - // Delete all extra strings - newEntry.removeAllCustomFields() - // Add extra fields from views - entryExtraFieldsContainer?.let { - for (i in 0 until it.childCount) { - val view = it.getChildAt(i) as EntryEditCustomField - val key = view.label - val value = view.value - val protect = view.isProtected - newEntry.addExtraField(key, ProtectedString(protect, value)) - } - } - } - - mDatabase?.stopManageEntry(newEntry) - } - - /** - * Retrieve the icon by the selection, or the first icon in the list if the entry is new or the last one - */ - private fun retrieveIcon(): PwIcon { - - return if (mSelectedIconStandard?.isUnknown != true) - mSelectedIconStandard - else { - if (mIsNew) { - mDatabase?.iconFactory?.keyIcon - } else { - // Keep previous icon, if no new one was selected - mEntry?.icon - } - } ?: PwIconStandard() } override fun onCreateOptionsMenu(menu: Menu): Boolean { @@ -401,65 +327,21 @@ class EntryEditActivity : LockingHideActivity(), IconPickerDialogFragment.IconPi return super.onOptionsItemSelected(item) } - private fun assignIconView() { - if (mDatabase?.drawFactory != null && mEntry?.icon != null) { - entryIconView?.assignDatabaseIcon(mDatabase?.drawFactory!!, mEntry?.icon!!, iconColor) - } - } - - private fun fillEntryDataInContentsView(entry: EntryVersioned) { - - assignIconView() - - // Don't start the field reference manager, we want to see the raw ref - mDatabase?.stopManageEntry(entry) - - entryTitleView?.setText(entry.title) - entryUserNameView?.setText(entry.username) - entryUrlView?.setText(entry.url) - val password = entry.password - entryPasswordView?.setText(password) - entryConfirmationPasswordView?.setText(password) - entryCommentView?.setText(entry.notes) - - val visibilityFontActivated = PreferencesUtil.fieldFontIsInVisibility(this) - if (visibilityFontActivated) { - entryUserNameView?.applyFontVisibility() - entryPasswordView?.applyFontVisibility() - entryConfirmationPasswordView?.applyFontVisibility() - entryCommentView?.applyFontVisibility() - } - - if (entry.allowExtraFields()) { - val container = findViewById(R.id.entry_edit_advanced_container) - entry.fields.doActionToAllCustomProtectedField { key, value -> - val entryEditCustomField = EntryEditCustomField(this@EntryEditActivity) - entryEditCustomField.setData(key, value) - entryEditCustomField.setFontVisibility(visibilityFontActivated) - container.addView(entryEditCustomField) - } - } - } - override fun iconPicked(bundle: Bundle) { - mSelectedIconStandard = bundle.getParcelable(KEY_ICON_STANDARD) - mSelectedIconStandard?.let { - mEntry?.icon = it + IconPickerDialogFragment.getIconStandardFromBundle(bundle)?.let { icon -> + temporarilySaveAndShowSelectedIcon(icon) } - assignIconView() } override fun onSaveInstanceState(outState: Bundle) { - if (!mSelectedIconStandard!!.isUnknown) { - outState.putParcelable(KEY_ICON_STANDARD, mSelectedIconStandard) - super.onSaveInstanceState(outState) - } + outState.putParcelable(KEY_NEW_ENTRY, mNewEntry) + + super.onSaveInstanceState(outState) } override fun acceptPassword(bundle: Bundle) { bundle.getString(GeneratePasswordDialogFragment.KEY_PASSWORD_ID)?.let { - entryPasswordView?.setText(it) - entryConfirmationPasswordView?.setText(it) + entryEditContentsView?.password = it } entryEditActivityEducation?.let { @@ -500,14 +382,15 @@ class EntryEditActivity : LockingHideActivity(), IconPickerDialogFragment.IconPi const val KEY_ENTRY = "entry" const val KEY_PARENT = "parent" + // SaveInstanceState + const val KEY_NEW_ENTRY = "new_entry" + // Keys for callback const val ADD_ENTRY_RESULT_CODE = 31 const val UPDATE_ENTRY_RESULT_CODE = 32 const val ADD_OR_UPDATE_ENTRY_REQUEST_CODE = 7129 const val ADD_OR_UPDATE_ENTRY_KEY = "ADD_OR_UPDATE_ENTRY_KEY" - const val UNKNOWN_MESSAGE = -1 - /** * Launch EntryEditActivity to update an existing entry * diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt index 08871373c..085db6a41 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt @@ -408,7 +408,7 @@ class GroupActivity : LockingActivity(), }, { mDatabase?.let { database -> - MagikIME.entryKey = entryVersioned.getEntry(database) + MagikIME.entryInfoKey = entryVersioned.getEntryInfo(database) } // Show the notification if allowed in Preferences if (PreferencesUtil.enableKeyboardNotificationEntry(this@GroupActivity)) { @@ -424,7 +424,7 @@ class GroupActivity : LockingActivity(), // Build response with the entry selected if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && mDatabase != null) { AutofillHelper.buildResponseWhenEntrySelected(this@GroupActivity, - entryVersioned.getEntry(mDatabase!!)) + entryVersioned.getEntryInfo(mDatabase!!)) } finish() }) diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GroupEditDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GroupEditDialogFragment.kt index a2dc5c4a0..d16614e7f 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GroupEditDialogFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/GroupEditDialogFragment.kt @@ -152,7 +152,7 @@ class GroupEditDialogFragment : DialogFragment(), IconPickerDialogFragment.IconP } override fun iconPicked(bundle: Bundle) { - iconGroup = bundle.getParcelable(IconPickerDialogFragment.KEY_ICON_STANDARD) + iconGroup = IconPickerDialogFragment.getIconStandardFromBundle(bundle) assignIconView() } diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt index e47a49351..c6105d041 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt @@ -54,7 +54,6 @@ class IconPickerDialogFragment : DialogFragment() { throw ClassCastException(context!!.toString() + " must implement " + IconPickerListener::class.java.name) } - } override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { @@ -127,7 +126,11 @@ class IconPickerDialogFragment : DialogFragment() { companion object { - const val KEY_ICON_STANDARD = "KEY_ICON_STANDARD" + private const val KEY_ICON_STANDARD = "KEY_ICON_STANDARD" + + fun getIconStandardFromBundle(bundle: Bundle): PwIconStandard? { + return bundle.getParcelable(KEY_ICON_STANDARD) + } fun launch(activity: StylishActivity) { // Create an instance of the dialog fragment and show it diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt index 293294dc7..88b7c67d7 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft. + * Copyright 2019 Jeremy Jamet / Kunzisoft. * * This file is part of KeePass DX. * @@ -28,6 +28,7 @@ import android.content.IntentFilter import android.os.Bundle import android.util.Log import android.view.View +import android.view.ViewGroup import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper import com.kunzisoft.keepass.app.App @@ -39,6 +40,8 @@ abstract class LockingActivity : StylishActivity() { companion object { + private const val TAG = "LockingActivity" + const val LOCK_ACTION = "com.kunzisoft.keepass.LOCK" const val RESULT_EXIT_LOCK = 1450 @@ -166,9 +169,15 @@ abstract class LockingActivity : StylishActivity() { views.forEach { it?.setOnFocusChangeListener { _, hasFocus -> if (hasFocus) { + Log.d(TAG, "View focused, reset app timeout") TimeoutHelper.checkTimeAndLockIfTimeoutOrResetTimeout(this) } } + if (it is ViewGroup) { + for (i in 0..it.childCount) { + resetAppTimeoutWhenViewFocusedOrChanged(it.getChildAt(i)) + } + } } } diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt index c6b89deb7..980e0d3f2 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt @@ -33,7 +33,7 @@ import android.view.autofill.AutofillValue import android.widget.RemoteViews import com.kunzisoft.keepass.R import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper -import com.kunzisoft.keepass.model.Entry +import com.kunzisoft.keepass.model.EntryInfo import java.util.* @@ -51,32 +51,32 @@ object AutofillHelper { return null } - private fun makeEntryTitle(entry: Entry): String { - if (entry.title.isNotEmpty() && entry.username.isNotEmpty()) - return String.format("%s (%s)", entry.title, entry.username) - if (entry.title.isNotEmpty()) - return entry.title - if (entry.username.isNotEmpty()) - return entry.username - if (entry.url.isNotEmpty()) - return entry.url + private fun makeEntryTitle(entryInfo: EntryInfo): String { + if (entryInfo.title.isNotEmpty() && entryInfo.username.isNotEmpty()) + return String.format("%s (%s)", entryInfo.title, entryInfo.username) + if (entryInfo.title.isNotEmpty()) + return entryInfo.title + if (entryInfo.username.isNotEmpty()) + return entryInfo.username + if (entryInfo.url.isNotEmpty()) + return entryInfo.url return "" } private fun buildDataset(context: Context, - entry: Entry, + entryInfo: EntryInfo, struct: StructureParser.Result): Dataset? { - val title = makeEntryTitle(entry) + val title = makeEntryTitle(entryInfo) val views = newRemoteViews(context.packageName, title) val builder = Dataset.Builder(views) - builder.setId(entry.id) + builder.setId(entryInfo.id) - struct.password.forEach { id -> builder.setValue(id, AutofillValue.forText(entry.password)) } + struct.password.forEach { id -> builder.setValue(id, AutofillValue.forText(entryInfo.password)) } val ids = ArrayList(struct.username) - if (entry.username.contains("@") || struct.username.isEmpty()) + if (entryInfo.username.contains("@") || struct.username.isEmpty()) ids.addAll(struct.email) - ids.forEach { id -> builder.setValue(id, AutofillValue.forText(entry.username)) } + ids.forEach { id -> builder.setValue(id, AutofillValue.forText(entryInfo.username)) } return try { builder.build() @@ -89,7 +89,7 @@ object AutofillHelper { /** * Method to hit when right key is selected */ - fun buildResponseWhenEntrySelected(activity: Activity, entry: Entry) { + fun buildResponseWhenEntrySelected(activity: Activity, entryInfo: EntryInfo) { var setResultOk = false activity.intent?.extras?.let { extras -> if (extras.containsKey(ASSIST_STRUCTURE)) { @@ -97,7 +97,7 @@ object AutofillHelper { StructureParser(structure).parse()?.let { result -> // New Response val responseBuilder = FillResponse.Builder() - val dataset = buildDataset(activity, entry, result) + val dataset = buildDataset(activity, entryInfo, result) responseBuilder.addDataset(dataset) val mReplyIntent = Intent() Log.d(activity.javaClass.name, "Successed Autofill auth.") diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/EntryVersioned.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/EntryVersioned.kt index d1603bc71..c4c6d6e18 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/EntryVersioned.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/EntryVersioned.kt @@ -3,7 +3,7 @@ package com.kunzisoft.keepass.database.element import android.os.Parcel import android.os.Parcelable import com.kunzisoft.keepass.database.element.security.ProtectedString -import com.kunzisoft.keepass.model.Entry +import com.kunzisoft.keepass.model.EntryInfo import com.kunzisoft.keepass.model.Field import java.util.* import kotlin.collections.ArrayList @@ -77,14 +77,7 @@ class EntryVersioned : NodeVersioned, PwEntryInterface { override var icon: PwIcon get() { - var iconGet: PwIcon? = pwEntryV3?.icon - if (iconGet == null) - iconGet = pwEntryV4?.iconCustom - if (iconGet == null || iconGet.isUnknown) - iconGet = pwEntryV4?.icon - if (iconGet == null) - PwIconStandard() - return iconGet!! + return pwEntryV3?.icon ?: pwEntryV4?.icon ?: PwIconStandard() } set(value) { pwEntryV3?.icon = value @@ -231,7 +224,7 @@ class EntryVersioned : NodeVersioned, PwEntryInterface { */ var iconCustom: PwIconCustom - get() = pwEntryV4?.iconCustom ?: PwIconCustom.ZERO + get() = pwEntryV4?.iconCustom ?: PwIconCustom.UNKNOWN_ICON set(value) { pwEntryV4?.iconCustom = value } @@ -325,23 +318,27 @@ class EntryVersioned : NodeVersioned, PwEntryInterface { ------------ */ - fun getEntry(database: Database): Entry { - val entryModel = Entry() - database.startManageEntry(this) - entryModel.id = nodeId.toString() - entryModel.title = title - entryModel.username = username - entryModel.password = password - entryModel.url = url - entryModel.notes = notes + fun getEntryInfo(database: Database?, raw: Boolean = false): EntryInfo { + val entryInfo = EntryInfo() + if (raw) + database?.stopManageEntry(this) + else + database?.startManageEntry(this) + entryInfo.id = nodeId.toString() + entryInfo.title = title + entryInfo.username = username + entryInfo.password = password + entryInfo.url = url + entryInfo.notes = notes if (containsCustomFields()) { fields.doActionToAllCustomProtectedField { key, value -> - entryModel.customFields.add( - Field(key, value.toString())) + entryInfo.customFields.add( + Field(key, value)) } } - database.stopManageEntry(this) - return entryModel + if (!raw) + database?.stopManageEntry(this) + return entryInfo } /* diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/PwEntryV3.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/PwEntryV3.kt index 8e0216de7..ad30d83c6 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/PwEntryV3.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/PwEntryV3.kt @@ -92,10 +92,14 @@ class PwEntryV3 : PwEntry { parcel.readByteArray(binaryData) } - override fun readParentParcelable(parcel: Parcel): PwGroupV3 { + override fun readParentParcelable(parcel: Parcel): PwGroupV3? { return parcel.readParcelable(PwGroupV3::class.java.classLoader) } + override fun writeParentParcelable(parent: PwGroupV3?, parcel: Parcel, flags: Int) { + parcel.writeParcelable(parent, flags) + } + override fun writeToParcel(dest: Parcel, flags: Int) { super.writeToParcel(dest, flags) dest.writeString(title) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/PwEntryV4.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/PwEntryV4.kt index db1e96cef..7a2cc93fc 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/PwEntryV4.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/PwEntryV4.kt @@ -34,7 +34,19 @@ class PwEntryV4 : PwEntry, NodeV4Interface { @Transient private var mDecodeRef = false - var iconCustom = PwIconCustom.ZERO + override var icon: PwIcon + get() { + return if (iconCustom.isUnknown) + super.icon + else + iconCustom + } + set(value) { + if (value is PwIconStandard) + iconCustom = PwIconCustom.UNKNOWN_ICON + super.icon = value + } + var iconCustom = PwIconCustom.UNKNOWN_ICON private var customData = HashMap() var fields = ExtraFields() private set @@ -161,10 +173,14 @@ class PwEntryV4 : PwEntry, NodeV4Interface { return PwNodeIdUUID(nodeId.id) } - override fun readParentParcelable(parcel: Parcel): PwGroupV4 { + override fun readParentParcelable(parcel: Parcel): PwGroupV4? { return parcel.readParcelable(PwGroupV4::class.java.classLoader) } + override fun writeParentParcelable(parent: PwGroupV4?, parcel: Parcel, flags: Int) { + parcel.writeParcelable(parent, flags) + } + /** * Decode a reference key with the SprEngineV4 * @param decodeRef diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroupV3.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroupV3.kt index 7cd9dd5f2..d19c3859a 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroupV3.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroupV3.kt @@ -36,10 +36,14 @@ class PwGroupV3 : PwGroup { flags = parcel.readInt() } - override fun readParentParcelable(parcel: Parcel): PwGroupV3 { + override fun readParentParcelable(parcel: Parcel): PwGroupV3? { return parcel.readParcelable(PwGroupV3::class.java.classLoader) } + override fun writeParentParcelable(parent: PwGroupV3?, parcel: Parcel, flags: Int) { + parcel.writeParcelable(parent, flags) + } + override fun writeToParcel(dest: Parcel, flags: Int) { super.writeToParcel(dest, flags) dest.writeInt(level) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroupV4.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroupV4.kt index e772017d9..f731c2cfb 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroupV4.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroupV4.kt @@ -27,7 +27,20 @@ import java.util.UUID class PwGroupV4 : PwGroup, NodeV4Interface { - var iconCustom = PwIconCustom.ZERO + // TODO Encapsulate + override var icon: PwIcon + get() { + return if (iconCustom.isUnknown) + super.icon + else + iconCustom + } + set(value) { + if (value is PwIconStandard) + iconCustom = PwIconCustom.UNKNOWN_ICON + super.icon = value + } + var iconCustom = PwIconCustom.UNKNOWN_ICON private val customData = HashMap() var notes = "" var isExpanded = true @@ -65,10 +78,14 @@ class PwGroupV4 : PwGroup, NodeV4Interface { lastTopVisibleEntry = parcel.readSerializable() as UUID } - override fun readParentParcelable(parcel: Parcel): PwGroupV4 { + override fun readParentParcelable(parcel: Parcel): PwGroupV4? { return parcel.readParcelable(PwGroupV4::class.java.classLoader) } + override fun writeParentParcelable(parent: PwGroupV4?, parcel: Parcel, flags: Int) { + parcel.writeParcelable(parent, flags) + } + override fun writeToParcel(dest: Parcel, flags: Int) { super.writeToParcel(dest, flags) dest.writeParcelable(iconCustom, flags) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/PwIcon.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/PwIcon.kt index 00c2c36af..b34ae0222 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/PwIcon.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/PwIcon.kt @@ -32,6 +32,6 @@ abstract class PwIcon protected constructor() : Parcelable { } companion object { - const val UNKNOWN = -1 + const val UNKNOWN_ID = -1 } } diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconCustom.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconCustom.kt index af6250b8f..ce8f47801 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconCustom.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconCustom.kt @@ -74,16 +74,16 @@ class PwIconCustom : PwIcon { } override val iconId: Int - get() = UNKNOWN + get() = UNKNOWN_ID override val isUnknown: Boolean - get() = this == ZERO + get() = this == UNKNOWN_ICON override val isMetaStreamIcon: Boolean get() = false companion object { - val ZERO = PwIconCustom(PwDatabase.UUID_ZERO, ByteArray(0)) + val UNKNOWN_ICON = PwIconCustom(PwDatabase.UUID_ZERO, ByteArray(0)) @JvmField val CREATOR: Parcelable.Creator = object : Parcelable.Creator { diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconFactory.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconFactory.kt index 51b619645..d8a53fd7a 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconFactory.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconFactory.kt @@ -38,7 +38,7 @@ class PwIconFactory { private val customCache = ReferenceMap(AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK) val unknownIcon: PwIconStandard - get() = getIcon(PwIcon.UNKNOWN) + get() = getIcon(PwIcon.UNKNOWN_ID) val keyIcon: PwIconStandard get() = getIcon(PwIconStandard.KEY) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconStandard.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconStandard.kt index b28e09a76..4d7931986 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconStandard.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/PwIconStandard.kt @@ -65,7 +65,7 @@ class PwIconStandard : PwIcon { override val iconId: Int override val isUnknown: Boolean - get() = iconId == UNKNOWN + get() = iconId == UNKNOWN_ID override val isMetaStreamIcon: Boolean get() = iconId == 0 diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/PwNode.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/PwNode.kt index aa0b11a42..355b1767f 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/PwNode.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/PwNode.kt @@ -39,7 +39,7 @@ abstract class PwNode, Entry : protected constructor(parcel: Parcel) { this.nodeId = parcel.readParcelable(PwNodeId::class.java.classLoader) this.parent = this.readParentParcelable(parcel) - this.icon = parcel.readParcelable(PwIconStandard::class.java.classLoader) + this.icon = parcel.readParcelable(PwIcon::class.java.classLoader) this.creationTime = parcel.readParcelable(PwDate::class.java.classLoader) this.lastModificationTime = parcel.readParcelable(PwDate::class.java.classLoader) this.lastAccessTime = parcel.readParcelable(PwDate::class.java.classLoader) @@ -48,7 +48,7 @@ abstract class PwNode, Entry : override fun writeToParcel(dest: Parcel, flags: Int) { dest.writeParcelable(nodeId, flags) - dest.writeParcelable(parent, flags) + writeParentParcelable(parent, dest, flags) dest.writeParcelable(icon, flags) dest.writeParcelable(creationTime, flags) dest.writeParcelable(lastModificationTime, flags) @@ -72,11 +72,12 @@ abstract class PwNode, Entry : protected abstract fun initNodeId(): PwNodeId protected abstract fun copyNodeId(nodeId: PwNodeId): PwNodeId - protected abstract fun readParentParcelable(parcel: Parcel): Parent + protected abstract fun readParentParcelable(parcel: Parcel): Parent? + protected abstract fun writeParentParcelable(parent: Parent?, parcel: Parcel, flags: Int) final override var parent: Parent? = null - final override var icon: PwIcon = PwIconStandard() + override var icon: PwIcon = PwIconStandard() final override var creationTime: PwDate = PwDate() diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/save/PwDbV4Output.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/save/PwDbV4Output.kt index 515d6351d..a0a51aa86 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/file/save/PwDbV4Output.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/file/save/PwDbV4Output.kt @@ -313,7 +313,7 @@ class PwDbV4Output(private val mDatabaseV4: PwDatabaseV4, outputStream: OutputSt writeObject(PwDatabaseV4XML.ElemNotes, group.notes) writeObject(PwDatabaseV4XML.ElemIcon, group.icon.iconId.toLong()) - if (group.iconCustom != PwIconCustom.ZERO) { + if (group.iconCustom != PwIconCustom.UNKNOWN_ICON) { writeObject(PwDatabaseV4XML.ElemCustomIconID, group.iconCustom.uuid) } @@ -338,7 +338,7 @@ class PwDbV4Output(private val mDatabaseV4: PwDatabaseV4, outputStream: OutputSt writeObject(PwDatabaseV4XML.ElemUuid, entry.id) writeObject(PwDatabaseV4XML.ElemIcon, entry.icon.iconId.toLong()) - if (entry.iconCustom != PwIconCustom.ZERO) { + if (entry.iconCustom != PwIconCustom.UNKNOWN_ICON) { writeObject(PwDatabaseV4XML.ElemCustomIconID, entry.iconCustom.uuid) } diff --git a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/KeyboardEntryNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/KeyboardEntryNotificationService.kt index 03b83b9f0..a6a2737c6 100644 --- a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/KeyboardEntryNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/KeyboardEntryNotificationService.kt @@ -67,13 +67,13 @@ class KeyboardEntryNotificationService : Service() { val deleteIntent = Intent(this, NotificationDeleteBroadcastReceiver::class.java) pendingDeleteIntent = PendingIntent.getBroadcast(applicationContext, 0, deleteIntent, 0) - if (MagikIME.entryKey != null) { + if (MagikIME.entryInfoKey != null) { var entryTitle: String? = getString(R.string.keyboard_notification_entry_content_title_text) var entryUsername: String? = "" - if (MagikIME.entryKey!!.title.isNotEmpty()) - entryTitle = MagikIME.entryKey!!.title - if (MagikIME.entryKey!!.username.isNotEmpty()) - entryUsername = MagikIME.entryKey!!.username + if (MagikIME.entryInfoKey!!.title.isNotEmpty()) + entryTitle = MagikIME.entryInfoKey!!.title + if (MagikIME.entryInfoKey!!.username.isNotEmpty()) + entryUsername = MagikIME.entryInfoKey!!.username val builder = NotificationCompat.Builder(this, CHANNEL_ID_KEYBOARD) .setSmallIcon(R.drawable.ic_vpn_key_white_24dp) diff --git a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt index 31cea54c5..f91f6bf2e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt +++ b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt @@ -39,7 +39,7 @@ import com.kunzisoft.keepass.magikeyboard.adapter.FieldsAdapter import com.kunzisoft.keepass.magikeyboard.receiver.LockBroadcastReceiver import com.kunzisoft.keepass.magikeyboard.receiver.LockBroadcastReceiver.Companion.LOCK_ACTION import com.kunzisoft.keepass.magikeyboard.view.MagikeyboardView -import com.kunzisoft.keepass.model.Entry +import com.kunzisoft.keepass.model.EntryInfo import com.kunzisoft.keepass.model.Field import com.kunzisoft.keepass.settings.PreferencesUtil @@ -60,7 +60,7 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener { // Remove the entry and lock the keyboard when the lock signal is receive lockBroadcastReceiver = object : LockBroadcastReceiver() { override fun onReceiveLock(context: Context, intent: Intent) { - entryKey = null + entryInfoKey = null assignKeyboardView() } } @@ -95,7 +95,7 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener { fieldsAdapter = FieldsAdapter(this) fieldsAdapter?.onItemClickListener = object : FieldsAdapter.OnItemClickListener { override fun onItemClick(item: Field) { - currentInputConnection.commitText(item.value, 1) + currentInputConnection.commitText(item.protectedValue.toString(), 1) } } recyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true) @@ -112,7 +112,7 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener { private fun assignKeyboardView() { if (keyboardView != null) { - if (entryKey != null) { + if (entryInfoKey != null) { if (keyboardEntry != null) keyboardView?.keyboard = keyboardEntry } else { @@ -178,7 +178,7 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener { KEY_ENTRY -> { // Stop current service and reinit entry stopService(Intent(this, KeyboardEntryNotificationService::class.java)) - entryKey = null + entryInfoKey = null val intent = Intent(this, KeyboardLauncherActivity::class.java) // New task needed because don't launch from an Activity context intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK @@ -189,23 +189,23 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener { dismissCustomKeys() } KEY_USERNAME -> { - if (entryKey != null) { - inputConnection.commitText(entryKey!!.username, 1) + if (entryInfoKey != null) { + inputConnection.commitText(entryInfoKey!!.username, 1) } } KEY_PASSWORD -> { - if (entryKey != null) { - inputConnection.commitText(entryKey!!.password, 1) + if (entryInfoKey != null) { + inputConnection.commitText(entryInfoKey!!.password, 1) } } KEY_URL -> { - if (entryKey != null) { - inputConnection.commitText(entryKey!!.url, 1) + if (entryInfoKey != null) { + inputConnection.commitText(entryInfoKey!!.url, 1) } } KEY_FIELDS -> { - if (entryKey != null) { - fieldsAdapter?.fields = entryKey!!.customFields + if (entryInfoKey != null) { + fieldsAdapter?.fields = entryInfoKey!!.customFields } popupCustomKeys?.showAtLocation(keyboardView, Gravity.END or Gravity.TOP, 0, 0) } @@ -262,12 +262,12 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener { private const val KEY_URL = 520 private const val KEY_FIELDS = 530 - var entryKey: Entry? = null + var entryInfoKey: EntryInfo? = null fun deleteEntryKey(context: Context) { val lockIntent = Intent(LOCK_ACTION) context.sendBroadcast(lockIntent) - entryKey = null + entryInfoKey = null } } } \ No newline at end of file diff --git a/app/src/main/java/com/kunzisoft/keepass/model/Entry.kt b/app/src/main/java/com/kunzisoft/keepass/model/EntryInfo.kt similarity index 80% rename from app/src/main/java/com/kunzisoft/keepass/model/Entry.kt rename to app/src/main/java/com/kunzisoft/keepass/model/EntryInfo.kt index ad74d8d54..465f5d24e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/model/Entry.kt +++ b/app/src/main/java/com/kunzisoft/keepass/model/EntryInfo.kt @@ -5,7 +5,7 @@ import android.os.Parcelable import java.util.ArrayList -class Entry : Parcelable { +class EntryInfo : Parcelable { var id: String = "" var title: String = "" @@ -31,7 +31,7 @@ class Entry : Parcelable { return 0 } - override fun writeToParcel(parcel: Parcel, i: Int) { + override fun writeToParcel(parcel: Parcel, flags: Int) { parcel.writeString(id) parcel.writeString(title) parcel.writeString(username) @@ -44,12 +44,12 @@ class Entry : Parcelable { companion object { @JvmField - val CREATOR: Parcelable.Creator = object : Parcelable.Creator { - override fun createFromParcel(parcel: Parcel): Entry { - return Entry(parcel) + val CREATOR: Parcelable.Creator = object : Parcelable.Creator { + override fun createFromParcel(parcel: Parcel): EntryInfo { + return EntryInfo(parcel) } - override fun newArray(size: Int): Array { + override fun newArray(size: Int): Array { return arrayOfNulls(size) } } diff --git a/app/src/main/java/com/kunzisoft/keepass/model/Field.kt b/app/src/main/java/com/kunzisoft/keepass/model/Field.kt index 7a2001e85..9d4abcfae 100644 --- a/app/src/main/java/com/kunzisoft/keepass/model/Field.kt +++ b/app/src/main/java/com/kunzisoft/keepass/model/Field.kt @@ -2,20 +2,21 @@ package com.kunzisoft.keepass.model import android.os.Parcel import android.os.Parcelable +import com.kunzisoft.keepass.database.element.security.ProtectedString class Field : Parcelable { - var name: String? = null - var value: String? = null + var name: String = "" + var protectedValue: ProtectedString = ProtectedString() - constructor(name: String, value: String) { + constructor(name: String, value: ProtectedString) { this.name = name - this.value = value + this.protectedValue = value } constructor(parcel: Parcel) { this.name = parcel.readString() - this.value = parcel.readString() + this.protectedValue = parcel.readParcelable(ProtectedString::class.java.classLoader) } override fun describeContents(): Int { @@ -24,7 +25,7 @@ class Field : Parcelable { override fun writeToParcel(dest: Parcel, flags: Int) { dest.writeString(name) - dest.writeString(value) + dest.writeParcelable(protectedValue, flags) } companion object { diff --git a/app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.kt b/app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.kt index 9d8191134..37509fd14 100644 --- a/app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.kt +++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.kt @@ -31,7 +31,6 @@ import android.widget.LinearLayout import android.widget.TextView import com.kunzisoft.keepass.R import com.kunzisoft.keepass.database.element.security.ProtectedString -import com.kunzisoft.keepass.utils.Util import com.kunzisoft.keepass.utils.applyFontVisibility import java.text.DateFormat import java.util.* @@ -41,52 +40,37 @@ class EntryContentsView @JvmOverloads constructor(context: Context, attrs: Attri private var fontInVisibility: Boolean = false private val colorAccent: Int - private var userNameContainerView: View? = null - private var userNameView: TextView? = null - private var userNameActionView: ImageView? = null + private val userNameContainerView: View + private val userNameView: TextView + private val userNameActionView: ImageView - private var passwordContainerView: View? = null - private var passwordView: TextView? = null - private var passwordActionView: ImageView? = null + private val passwordContainerView: View + private val passwordView: TextView + private val passwordActionView: ImageView - private var urlContainerView: View? = null - private var urlView: TextView? = null + private val urlContainerView: View + private val urlView: TextView - private var commentContainerView: View? = null - private var commentView: TextView? = null + private val commentContainerView: View + private val commentView: TextView - private var extrasView: ViewGroup? = null + private val extrasView: ViewGroup - private val dateFormat: DateFormat - private val timeFormat: DateFormat + private val dateFormat: DateFormat = android.text.format.DateFormat.getDateFormat(context) + private val timeFormat: DateFormat = android.text.format.DateFormat.getTimeFormat(context) - private var creationDateView: TextView? = null - private var modificationDateView: TextView? = null - private var lastAccessDateView: TextView? = null - private var expiresDateView: TextView? = null + private val creationDateView: TextView + private val modificationDateView: TextView + private val lastAccessDateView: TextView + private val expiresDateView: TextView val isUserNamePresent: Boolean - get() = userNameContainerView?.visibility == View.VISIBLE + get() = userNameContainerView.visibility == View.VISIBLE val isPasswordPresent: Boolean - get() = passwordContainerView?.visibility == View.VISIBLE + get() = passwordContainerView.visibility == View.VISIBLE init { - - fontInVisibility = false - - dateFormat = android.text.format.DateFormat.getDateFormat(context) - timeFormat = android.text.format.DateFormat.getTimeFormat(context) - - inflate(context) - - val attrColorAccent = intArrayOf(R.attr.colorAccentCompat) - val taColorAccent = context.theme.obtainStyledAttributes(attrColorAccent) - colorAccent = taColorAccent.getColor(0, Color.BLACK) - taColorAccent.recycle() - } - - private fun inflate(context: Context) { val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater inflater.inflate(R.layout.entry_view_contents, this) @@ -110,6 +94,11 @@ class EntryContentsView @JvmOverloads constructor(context: Context, attrs: Attri modificationDateView = findViewById(R.id.entry_modified) lastAccessDateView = findViewById(R.id.entry_accessed) expiresDateView = findViewById(R.id.entry_expires) + + val attrColorAccent = intArrayOf(R.attr.colorAccentCompat) + val taColorAccent = context.theme.obtainStyledAttributes(attrColorAccent) + colorAccent = taColorAccent.getColor(0, Color.BLACK) + taColorAccent.recycle() } fun applyFontVisibilityToFields(fontInVisibility: Boolean) { @@ -118,47 +107,47 @@ class EntryContentsView @JvmOverloads constructor(context: Context, attrs: Attri fun assignUserName(userName: String?) { if (userName != null && userName.isNotEmpty()) { - userNameContainerView?.visibility = View.VISIBLE - userNameView?.apply { + userNameContainerView.visibility = View.VISIBLE + userNameView.apply { text = userName if (fontInVisibility) applyFontVisibility() } } else { - userNameContainerView?.visibility = View.GONE + userNameContainerView.visibility = View.GONE } } fun assignUserNameCopyListener(onClickListener: OnClickListener) { - userNameActionView?.setOnClickListener(onClickListener) + userNameActionView.setOnClickListener(onClickListener) } fun assignPassword(password: String?, allowCopyPassword: Boolean) { if (password != null && password.isNotEmpty()) { - passwordContainerView?.visibility = View.VISIBLE - passwordView?.apply { + passwordContainerView.visibility = View.VISIBLE + passwordView.apply { text = password if (fontInVisibility) applyFontVisibility() } if (!allowCopyPassword) { - passwordActionView?.setColorFilter(ContextCompat.getColor(context, R.color.grey_dark)) + passwordActionView.setColorFilter(ContextCompat.getColor(context, R.color.grey_dark)) } else { - passwordActionView?.setColorFilter(colorAccent) + passwordActionView.setColorFilter(colorAccent) } } else { - passwordContainerView?.visibility = View.GONE + passwordContainerView.visibility = View.GONE } } fun assignPasswordCopyListener(onClickListener: OnClickListener?) { if (onClickListener == null) isClickable = false - passwordActionView?.setOnClickListener(onClickListener) + passwordActionView.setOnClickListener(onClickListener) } fun atLeastOneFieldProtectedPresent(): Boolean { - extrasView?.let { + extrasView.let { for (i in 0 until it.childCount) { val childCustomView = it.getChildAt(i) if (childCustomView is EntryCustomFieldProtected) @@ -170,12 +159,12 @@ class EntryContentsView @JvmOverloads constructor(context: Context, attrs: Attri fun setHiddenPasswordStyle(hiddenStyle: Boolean) { if (!hiddenStyle) { - passwordView?.transformationMethod = null + passwordView.transformationMethod = null } else { - passwordView?.transformationMethod = PasswordTransformationMethod.getInstance() + passwordView.transformationMethod = PasswordTransformationMethod.getInstance() } // Hidden style for custom fields - extrasView?.let { + extrasView.let { for (i in 0 until it.childCount) { val childCustomView = it.getChildAt(i) if (childCustomView is EntryCustomFieldProtected) @@ -186,24 +175,24 @@ class EntryContentsView @JvmOverloads constructor(context: Context, attrs: Attri fun assignURL(url: String?) { if (url != null && url.isNotEmpty()) { - urlContainerView?.visibility = View.VISIBLE - urlView?.text = url + urlContainerView.visibility = View.VISIBLE + urlView.text = url } else { - urlContainerView?.visibility = View.GONE + urlContainerView.visibility = View.GONE } } fun assignComment(comment: String?) { if (comment != null && comment.isNotEmpty()) { - commentContainerView?.visibility = View.VISIBLE - commentView?.apply { + commentContainerView.visibility = View.VISIBLE + commentView.apply { text = comment if (fontInVisibility) applyFontVisibility() } } else { - commentContainerView?.visibility = View.GONE + commentContainerView.visibility = View.GONE } } @@ -214,11 +203,11 @@ class EntryContentsView @JvmOverloads constructor(context: Context, attrs: Attri else entryCustomField = EntryCustomField(context, null, title, value, showAction, onActionClickListener) entryCustomField.applyFontVisibility(fontInVisibility) - extrasView?.addView(entryCustomField) + extrasView.addView(entryCustomField) } fun clearExtraFields() { - extrasView?.removeAllViews() + extrasView.removeAllViews() } private fun getDateTime(date: Date): String { @@ -226,23 +215,23 @@ class EntryContentsView @JvmOverloads constructor(context: Context, attrs: Attri } fun assignCreationDate(date: Date) { - creationDateView?.text = getDateTime(date) + creationDateView.text = getDateTime(date) } fun assignModificationDate(date: Date) { - modificationDateView?.text = getDateTime(date) + modificationDateView.text = getDateTime(date) } fun assignLastAccessDate(date: Date) { - lastAccessDateView?.text = getDateTime(date) + lastAccessDateView.text = getDateTime(date) } fun assignExpiresDate(date: Date) { - expiresDateView?.text = getDateTime(date) + expiresDateView.text = getDateTime(date) } fun assignExpiresDate(constString: String) { - expiresDateView?.text = constString + expiresDateView.text = constString } override fun generateDefaultLayoutParams(): LayoutParams { diff --git a/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.kt b/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.kt index 43ea862c1..3877f7f61 100644 --- a/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.kt +++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.kt @@ -26,10 +26,8 @@ import android.view.LayoutInflater import android.widget.ImageView import android.widget.LinearLayout import android.widget.TextView - import com.kunzisoft.keepass.R import com.kunzisoft.keepass.database.element.security.ProtectedString -import com.kunzisoft.keepass.utils.Util import com.kunzisoft.keepass.utils.applyFontVisibility open class EntryCustomField(context: Context, @@ -40,9 +38,9 @@ open class EntryCustomField(context: Context, onClickActionListener: OnClickListener?) : LinearLayout(context, attrs) { - protected var labelView: TextView - protected var valueView: TextView - protected var actionImageView: ImageView + protected val labelView: TextView + protected val valueView: TextView + protected val actionImageView: ImageView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, title: String? = null, value: ProtectedString? = null) diff --git a/app/src/main/java/com/kunzisoft/keepass/view/EntryEditContentsView.kt b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditContentsView.kt new file mode 100644 index 000000000..dbba679eb --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditContentsView.kt @@ -0,0 +1,211 @@ +package com.kunzisoft.keepass.view + +import android.content.Context +import android.graphics.Color +import android.support.design.widget.TextInputLayout +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.EditText +import android.widget.ImageView +import android.widget.LinearLayout +import com.kunzisoft.keepass.R +import com.kunzisoft.keepass.database.element.PwIcon +import com.kunzisoft.keepass.database.element.security.ProtectedString +import com.kunzisoft.keepass.icons.IconDrawableFactory +import com.kunzisoft.keepass.icons.assignDatabaseIcon +import com.kunzisoft.keepass.icons.assignDefaultDatabaseIcon +import com.kunzisoft.keepass.model.Field +import com.kunzisoft.keepass.utils.applyFontVisibility + +class EntryEditContentsView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : LinearLayout(context, attrs) { + + private var fontInVisibility: Boolean = false + + private val entryTitleLayoutView: TextInputLayout + private val entryTitleView: EditText + private val entryIconView: ImageView + private val entryUserNameView: EditText + private val entryUrlView: EditText + private val entryPasswordLayoutView: TextInputLayout + private val entryPasswordView: EditText + private val entryConfirmationPasswordView: EditText + val generatePasswordView: View + private val entryCommentView: EditText + private val entryExtraFieldsContainer: ViewGroup + val addNewFieldView: View + + private var iconColor: Int = 0 + + init { + val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater + inflater.inflate(R.layout.entry_edit_view_contents, this) + + entryTitleLayoutView = findViewById(R.id.entry_edit_container_title) + entryTitleView = findViewById(R.id.entry_edit_title) + entryIconView = findViewById(R.id.entry_edit_icon_button) + entryUserNameView = findViewById(R.id.entry_edit_user_name) + entryUrlView = findViewById(R.id.entry_edit_url) + entryPasswordLayoutView = findViewById(R.id.entry_edit_container_password) + entryPasswordView = findViewById(R.id.entry_edit_password) + entryConfirmationPasswordView = findViewById(R.id.entry_edit_confirmation_password) + generatePasswordView = findViewById(R.id.entry_edit_generate_button) + entryCommentView = findViewById(R.id.entry_edit_notes) + entryExtraFieldsContainer = findViewById(R.id.entry_edit_advanced_container) + addNewFieldView = findViewById(R.id.entry_edit_add_new_field) + + // Retrieve the textColor to tint the icon + val taIconColor = context.theme.obtainStyledAttributes(intArrayOf(android.R.attr.textColorPrimary)) + iconColor = taIconColor.getColor(0, Color.WHITE) + taIconColor.recycle() + } + + fun applyFontVisibilityToFields(fontInVisibility: Boolean) { + this.fontInVisibility = fontInVisibility + } + + var title: String + get() { + return entryTitleView.text.toString() + } + set(value) { + entryTitleView.setText(value) + if (fontInVisibility) + entryTitleView.applyFontVisibility() + } + + fun setDefaultIcon(iconFactory: IconDrawableFactory) { + entryIconView.assignDefaultDatabaseIcon(iconFactory, iconColor) + } + + fun setIcon(iconFactory: IconDrawableFactory, icon: PwIcon) { + entryIconView.assignDatabaseIcon(iconFactory, icon, iconColor) + } + + fun setOnIconViewClickListener(clickListener: () -> Unit) { + entryIconView.setOnClickListener { clickListener.invoke() } + } + + var username: String + get() { + return entryUserNameView.text.toString() + } + set(value) { + entryUserNameView.setText(value) + if (fontInVisibility) + entryUserNameView.applyFontVisibility() + } + + var url: String + get() { + return entryUrlView.text.toString() + } + set(value) { + entryUrlView.setText(value) + if (fontInVisibility) + entryUrlView.applyFontVisibility() + } + + var password: String // TODO Error exception + get() { + return entryPasswordView.text.toString() + } + set(value) { + entryPasswordView.setText(value) + entryConfirmationPasswordView.setText(value) + if (fontInVisibility) { + entryPasswordView.applyFontVisibility() + entryConfirmationPasswordView.applyFontVisibility() + } + } + + fun setOnPasswordGeneratorClickListener(clickListener: () -> Unit) { + generatePasswordView.setOnClickListener { clickListener.invoke() } + } + + var notes: String + get() { + return entryCommentView.text.toString() + } + set(value) { + entryCommentView.setText(value) + if (fontInVisibility) + entryCommentView.applyFontVisibility() + } + + fun allowCustomField(allow: Boolean, action: () -> Unit) { + addNewFieldView.apply { + if (allow) { + visibility = View.VISIBLE + setOnClickListener { action.invoke() } + } else { + visibility = View.GONE + setOnClickListener(null) + } + } + } + + val customFields: MutableList + get() { + val customFieldsArray = ArrayList() + // Add extra fields from views + entryExtraFieldsContainer.let { + for (i in 0 until it.childCount) { + val view = it.getChildAt(i) as EntryEditCustomField + val key = view.label + val value = view.value + val protect = view.isProtected + customFieldsArray.add(Field(key, ProtectedString(protect, value))) + } + } + return customFieldsArray + } + + /** + * Add a new view to fill in the information of the customized field + */ + fun addNewCustomField(name: String = "", value:ProtectedString = ProtectedString(false, "")) { + val entryEditCustomField = EntryEditCustomField(context) + entryEditCustomField.setData(name, value) + entryEditCustomField.setFontVisibility(fontInVisibility) + entryExtraFieldsContainer.addView(entryEditCustomField) + } + + /** + * Validate or not the entry form + * + * @return ErrorValidation An error with a message or a validation without message + */ + fun isValid(): Boolean { + var isValid = true + + // Require title + if (entryTitleView.text.toString().isEmpty()) { + entryTitleLayoutView.error = context.getString(R.string.error_title_required) + isValid = false + } else { + entryTitleLayoutView.error = null + } + + // Validate password + if (entryPasswordView.text.toString() != entryConfirmationPasswordView.text.toString()) { + entryPasswordLayoutView.error = context.getString(R.string.error_pass_match) + isValid = false + } else { + entryPasswordLayoutView.error = null + } + + // Validate extra fields + entryExtraFieldsContainer.let { + for (i in 0 until it.childCount) { + val entryEditCustomField = it.getChildAt(i) as EntryEditCustomField + if (!entryEditCustomField.isValid()) { + isValid = false + } + } + } + return isValid + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.kt b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.kt index 5b01c89ff..2f2f42652 100644 --- a/app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.kt +++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.kt @@ -20,6 +20,7 @@ package com.kunzisoft.keepass.view import android.content.Context +import android.support.design.widget.TextInputLayout import android.util.AttributeSet import android.util.Log import android.view.LayoutInflater @@ -29,10 +30,8 @@ import android.widget.CompoundButton import android.widget.EditText import android.widget.RelativeLayout import android.widget.TextView - import com.kunzisoft.keepass.R import com.kunzisoft.keepass.database.element.security.ProtectedString -import com.kunzisoft.keepass.utils.Util import com.kunzisoft.keepass.utils.applyFontVisibility class EntryEditCustomField @JvmOverloads constructor(context: Context, @@ -40,6 +39,7 @@ class EntryEditCustomField @JvmOverloads constructor(context: Context, defStyle: Int = 0) : RelativeLayout(context, attrs, defStyle) { + private val labelLayoutView: TextInputLayout private val labelView: TextView private val valueView: EditText private val protectionCheckView: CompoundButton @@ -61,6 +61,7 @@ class EntryEditCustomField @JvmOverloads constructor(context: Context, val deleteView = findViewById(R.id.entry_edit_new_field_delete) deleteView.setOnClickListener { deleteViewFromParent() } + labelLayoutView = findViewById(R.id.title_container) labelView = findViewById(R.id.entry_edit_new_field_label) valueView = findViewById(R.id.entry_edit_new_field_value) protectionCheckView = findViewById(R.id.protection) @@ -75,6 +76,22 @@ class EntryEditCustomField @JvmOverloads constructor(context: Context, } } + /** + * Validate or not the entry form + * + * @return ErrorValidation An error with a message or a validation without message + */ + fun isValid(): Boolean { + // Validate extra field + if (label.isEmpty()) { + labelLayoutView.error = context.getString(R.string.error_string_key) + return false + } else { + labelLayoutView.error = null + } + return true + } + fun setFontVisibility(applyFontVisibility: Boolean) { if (applyFontVisibility) valueView.applyFontVisibility() diff --git a/app/src/main/res/layout/entry_edit.xml b/app/src/main/res/layout/entry_edit.xml index b4df8a2e3..b2fd55c22 100644 --- a/app/src/main/res/layout/entry_edit.xml +++ b/app/src/main/res/layout/entry_edit.xml @@ -33,172 +33,20 @@ - + android:layout_height="wrap_content"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/entry_view.xml b/app/src/main/res/layout/entry_view.xml index 8d5616c40..e8b4c1bf5 100644 --- a/app/src/main/res/layout/entry_view.xml +++ b/app/src/main/res/layout/entry_view.xml @@ -62,10 +62,11 @@