diff --git a/app/build.gradle b/app/build.gradle index 506c13acd..d8db80b03 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.kunzisoft.keepass" minSdkVersion 14 targetSdkVersion 27 - versionCode = 7 - versionName = "2.5.0.0beta7" + versionCode = 8 + versionName = "2.5.0.0beta8" multiDexEnabled true testApplicationId = "com.keepassdroid.tests" diff --git a/app/src/main/java/com/keepassdroid/activities/EntryActivity.java b/app/src/main/java/com/keepassdroid/activities/EntryActivity.java index 538f2b3e5..411260853 100644 --- a/app/src/main/java/com/keepassdroid/activities/EntryActivity.java +++ b/app/src/main/java/com/keepassdroid/activities/EntryActivity.java @@ -304,10 +304,10 @@ public class EntryActivity extends LockingHideActivity { MenuItem togglePassword = menu.findItem(R.id.menu_toggle_pass); if (entryContentsView != null && togglePassword != null) { - if (!entryContentsView.isPasswordPresent()) { - togglePassword.setVisible(false); - } else { + if (entryContentsView.isPasswordPresent() || entryContentsView.atLeastOneFieldProtectedPresent()) { changeShowPasswordIcon(togglePassword); + } else { + togglePassword.setVisible(false); } } diff --git a/app/src/main/java/com/keepassdroid/fileselect/FileSelectActivity.java b/app/src/main/java/com/keepassdroid/fileselect/FileSelectActivity.java index 24d116855..37e83baa1 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/FileSelectActivity.java +++ b/app/src/main/java/com/keepassdroid/fileselect/FileSelectActivity.java @@ -135,21 +135,21 @@ public class FileSelectActivity extends StylishActivity implements setContentView(R.layout.file_selection); fileListTitle = findViewById(R.id.file_list_title); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); toolbar.setTitle(getString(R.string.app_name)); setSupportActionBar(toolbar); - openFileNameView = (EditText) findViewById(R.id.file_filename); - fileNameView = (FileNameView) findViewById(R.id.file_select); + openFileNameView = findViewById(R.id.file_filename); + fileNameView = findViewById(R.id.file_select); // Set the initial value of the filename defaultPath = Environment.getExternalStorageDirectory().getAbsolutePath() + getString(R.string.database_file_path_default) + getString(R.string.database_file_name_default) + getString(R.string.database_file_extension_default); - openFileNameView.setHint(defaultPath); + openFileNameView.setHint(R.string.open_link_database); - RecyclerView mListFiles = (RecyclerView) findViewById(R.id.file_list); + RecyclerView mListFiles = findViewById(R.id.file_list); mListFiles.setLayoutManager(new LinearLayoutManager(this)); // To retrieve info for AutoFill diff --git a/app/src/main/java/com/keepassdroid/utils/DateUtil.java b/app/src/main/java/com/keepassdroid/utils/DateUtil.java index 35ea57d1f..81193c879 100644 --- a/app/src/main/java/com/keepassdroid/utils/DateUtil.java +++ b/app/src/main/java/com/keepassdroid/utils/DateUtil.java @@ -21,7 +21,7 @@ package com.keepassdroid.utils; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; -import org.joda.time.Seconds; +import org.joda.time.Duration; import java.util.Date; @@ -32,9 +32,6 @@ public class DateUtil { private static final long epochOffset; static { - Date dotNet = dotNetEpoch.toDate(); - Date java = javaEpoch.toDate(); - epochOffset = (javaEpoch.getMillis() - dotNetEpoch.getMillis()) / 1000L; } @@ -51,7 +48,8 @@ public class DateUtil { } public static long convertDateToKDBX4Time(DateTime dt) { - Seconds secs = Seconds.secondsBetween(javaEpoch, dt); - return secs.getSeconds() + epochOffset; + Duration duration = new Duration( javaEpoch, dt ); + long seconds = ( duration.getMillis() / 1000L ); + return seconds + epochOffset; } } diff --git a/app/src/main/java/com/keepassdroid/utils/Util.java b/app/src/main/java/com/keepassdroid/utils/Util.java index f5d8a5027..204707265 100644 --- a/app/src/main/java/com/keepassdroid/utils/Util.java +++ b/app/src/main/java/com/keepassdroid/utils/Util.java @@ -52,9 +52,13 @@ public class Util { public static void copyStream(InputStream in, OutputStream out) throws IOException { byte[] buf = new byte[1024]; int read; - while ((read = in.read(buf)) != -1) { - out.write(buf, 0, read); - } + try { + while ((read = in.read(buf)) != -1) { + out.write(buf, 0, read); + } + } catch (OutOfMemoryError error) { + throw new IOException(error); + } } private final static String stringToStrikeThrough = "0"; diff --git a/app/src/main/java/com/keepassdroid/view/EntryContentsView.java b/app/src/main/java/com/keepassdroid/view/EntryContentsView.java index 4db7fb149..9c6d95ec5 100644 --- a/app/src/main/java/com/keepassdroid/view/EntryContentsView.java +++ b/app/src/main/java/com/keepassdroid/view/EntryContentsView.java @@ -146,6 +146,15 @@ public class EntryContentsView extends LinearLayout { return passwordContainerView.getVisibility() == VISIBLE; } + public boolean atLeastOneFieldProtectedPresent() { + for (int i = 0; i < extrasView.getChildCount(); i++) { + View childCustomView = extrasView.getChildAt(i); + if (childCustomView instanceof EntryCustomFieldProtected) + return true; + } + return false; + } + public void setHiddenPasswordStyle(boolean hiddenStyle) { if ( !hiddenStyle ) { passwordView.setTransformationMethod(null); diff --git a/app/src/main/java/com/keepassdroid/view/FileNameView.java b/app/src/main/java/com/keepassdroid/view/FileNameView.java index 828d7abc1..4975f36f4 100644 --- a/app/src/main/java/com/keepassdroid/view/FileNameView.java +++ b/app/src/main/java/com/keepassdroid/view/FileNameView.java @@ -54,19 +54,12 @@ public class FileNameView extends RelativeLayout { warning = R.string.warning_unmounted; } - TextView tv = (TextView) findViewById(R.id.label_warning); - TextView label = (TextView) findViewById(R.id.label_open_by_filename); - RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - + TextView tv = findViewById(R.id.label_warning); if (warning != -1) { tv.setText(warning); tv.setVisibility(VISIBLE); - - lp.addRule(RelativeLayout.BELOW, R.id.label_warning); } else { tv.setVisibility(INVISIBLE); } - - label.setLayoutParams(lp); } } diff --git a/app/src/main/res/drawable/ic_folder_open_white_24dp.xml b/app/src/main/res/drawable/ic_folder_open_white_24dp.xml new file mode 100644 index 000000000..2202fe1dc --- /dev/null +++ b/app/src/main/res/drawable/ic_folder_open_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_open_folder_white_24dp.xml b/app/src/main/res/drawable/ic_open_folder_white_24dp.xml deleted file mode 100644 index ff6b4690f..000000000 --- a/app/src/main/res/drawable/ic_open_folder_white_24dp.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_send_white_24dp.xml b/app/src/main/res/drawable/ic_send_white_24dp.xml new file mode 100644 index 000000000..795b2ba45 --- /dev/null +++ b/app/src/main/res/drawable/ic_send_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layout/file_selection.xml b/app/src/main/res/layout/file_selection.xml index dd8724aaf..9ad3490bb 100644 --- a/app/src/main/res/layout/file_selection.xml +++ b/app/src/main/res/layout/file_selection.xml @@ -45,10 +45,12 @@ app:contentScrim="?attr/colorPrimary" app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> - + android:layout_marginTop="?attr/actionBarSize" + android:layout_marginBottom="24dp"/> + android:src="@drawable/ic_folder_white_24dp" + android:theme="?attr/whiteFab" + app:useCompatPadding="true" + app:layout_anchor="@+id/app_bar" + app:layout_anchorGravity="end|bottom" /> + android:layout_marginBottom="@dimen/default_margin"> - - - - + android:visibility="gone" /> + + diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index a404c6b54..84779d81a 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -135,7 +135,7 @@ Aucun résultat pour cette recherche. Impossible d\'ouvrir cette URL. Sélectionner une base de données existante : - Ouvrir une base de données récente : + Bases de données récentes : Ignorer les sauvegardes Ignorer le groupe Sauvegardes des résultats de recherche (uniquement pour .kdb) Création d\'une nouvelle base de données… @@ -247,6 +247,7 @@ Copie de mot de passe Autoriser la copie du mot de passe dans le presse-papiers. ATTENTION : désactiver cette fonctionnalité peut engendrer une impossibilité d\'ouvrir ou sauvegarder les bases de données + Lien du fichier Kdbx à ouvrir 5 secondes diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index df05f3038..fdffe19e4 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -27,6 +27,8 @@ + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 34c0383e4..a9a13d620 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -137,7 +137,7 @@ No search results No handler for this url. Select an existing database : - Open a recent database : + Recent databases : Don\'t search backup entries Omit \'Backup\' group from search results (applies to .kdb only) Creating new database… @@ -251,6 +251,7 @@ Copy of password Allow the copy of the password to the clipboard. WARNING : disabling this feature may result in an inability to open or save the databases + Link of the Kdbx file to open 5 seconds diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 2803ba4fc..c1973e6ca 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -65,6 +65,9 @@ @style/KeepassDXStyle.Toolbar @style/KeepassDXStyle.Light.Toolbar.Popup + + + @style/KeepassDXStyle.Fab.White @@ -224,6 +230,10 @@ +