Skip to content

Commit

Permalink
Merge branch 'release/2.5.0.0beta6'
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Jamet committed Mar 10, 2018
2 parents e5d3a0a + 65d1c73 commit 943d7ca
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 45 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.kunzisoft.keepass"
minSdkVersion 14
targetSdkVersion 27
versionCode = 5
versionName = "2.5.0.0beta5"
versionCode = 6
versionName = "2.5.0.0beta6"
multiDexEnabled true

testApplicationId = "com.keepassdroid.tests"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
@Override
protected void onResume() {
super.onResume();

TimeoutHelper.checkShutdown(this);
TimeoutHelper.resume(this);
TimeoutHelper.recordTime(this);
}

@Override
protected void onPause() {
super.onPause();

TimeoutHelper.pause(this);
TimeoutHelper.checkTime(this);
TimeoutHelper.checkShutdown(this);
}

@Override
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/keepassdroid/adapters/NodeAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public void setActivateContextMenu(boolean activate) {
*/
public void rebuildList(PwGroup group) {
this.nodeSortedList.clear();
this.nodeSortedList.addAll(group.getDirectChildren());
if (group != null) {
this.nodeSortedList.addAll(group.getDirectChildren());
}
}

/**
Expand Down
17 changes: 12 additions & 5 deletions app/src/main/java/com/keepassdroid/app/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
public class App extends MultiDexApplication {
private static Database db = null;
private static boolean shutdown = false;
private static CharSequence mMessage = "";
private static Calendar calendar = null;
private static RecentFileHistory fileHistory = null;

public static Database getDB() {
if ( db == null ) {
db = new Database();
}

return db;
}

Expand All @@ -56,17 +56,27 @@ public static boolean isShutdown() {

public static void setShutdown() {
shutdown = true;
mMessage = "";
}

public static void setShutdown(CharSequence message) {
shutdown = true;
mMessage = message;
}

public static CharSequence getMessage() {
return mMessage;
}

public static void clearShutdown() {
shutdown = false;
mMessage = "";
}

public static Calendar getCalendar() {
if ( calendar == null ) {
calendar = Calendar.getInstance();
}

return calendar;
}

Expand All @@ -75,9 +85,7 @@ public void onCreate() {
super.onCreate();

Stylish.init(this);

fileHistory = new RecentFileHistory(this);

PRNGFixes.apply();
}

Expand All @@ -86,7 +94,6 @@ public void onTerminate() {
if ( db != null ) {
db.clear();
}

super.onTerminate();
}
}
6 changes: 2 additions & 4 deletions app/src/main/java/com/keepassdroid/database/PwDatabaseV3.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,16 @@ public PwGroupIdV3 newGroupId() {

public byte[] getMasterKey(String key, InputStream keyInputStream)
throws InvalidKeyFileException, IOException {
assert (key != null);

if (key.length() > 0 && keyInputStream != null) {
if (key != null && key.length() > 0 && keyInputStream != null) {
return getCompositeKey(key, keyInputStream);
} else if (key.length() > 0) {
} else if (key != null && key.length() > 0) {
return getPasswordKey(key);
} else if (keyInputStream != null) {
return getFileKey(keyInputStream);
} else {
throw new IllegalArgumentException("Key cannot be empty.");
}

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,26 +381,32 @@ public void onAssignKeyDialogPositiveClick(
boolean masterPasswordChecked, String masterPassword,
boolean keyFileChecked, Uri keyFile) {

String databaseFilename = databaseUri.getPath();

// Prep an object to collect a password once the database has
// been created
FileOnFinish launchActivityOnFinish = new FileOnFinish(
new LaunchGroupActivity(databaseFilename));
AssignPasswordOnFinish assignPasswordOnFinish =
new AssignPasswordOnFinish(launchActivityOnFinish);

// Create the new database
CreateDB create = new CreateDB(FileSelectActivity.this,
databaseFilename, assignPasswordOnFinish, true);

ProgressTask createTask = new ProgressTask(
FileSelectActivity.this, create,
R.string.progress_create);
createTask.run();
assignPasswordHelper =
new AssignPasswordHelper(this,
masterPassword, keyFile);
try {
String databaseFilename = databaseUri.getPath();

// Prep an object to collect a password once the database has
// been created
FileOnFinish launchActivityOnFinish = new FileOnFinish(
new LaunchGroupActivity(databaseFilename));
AssignPasswordOnFinish assignPasswordOnFinish =
new AssignPasswordOnFinish(launchActivityOnFinish);

// Create the new database
CreateDB create = new CreateDB(FileSelectActivity.this,
databaseFilename, assignPasswordOnFinish, true);

ProgressTask createTask = new ProgressTask(
FileSelectActivity.this, create,
R.string.progress_create);
createTask.run();
assignPasswordHelper =
new AssignPasswordHelper(this,
masterPassword, keyFile);
} catch (Exception e) {
String error = "Unable to create database with this password and key file";
Toast.makeText(this, error, Toast.LENGTH_LONG).show();
Log.e(TAG, error + " " + e.getMessage());
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ protected void onResume() {
setEmptyViews();
}

// Show message if exists
CharSequence appMessage = App.getMessage();
if (! appMessage.toString().isEmpty())
Toast.makeText(this, appMessage, Toast.LENGTH_SHORT).show();

// Clear the shutdown flag
App.clearShutdown();

Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/keepassdroid/tasks/ProgressTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import android.content.Context;
import android.os.Handler;

import com.kunzisoft.keepass.R;
import com.keepassdroid.database.edit.OnFinish;
import com.keepassdroid.database.edit.RunnableOnFinish;
import com.kunzisoft.keepass.R;

/** Designed to Pop up a progress dialog, run a thread in the background,
* run cleanup in the current thread, close the dialog. Without blocking
Expand Down Expand Up @@ -82,11 +82,11 @@ public void run() {
}

private class CloseProcessDialog implements Runnable {

public void run() {
mPd.dismiss();
if (mPd != null && mPd.isShowing()) {
mPd.dismiss();
}
}

}

}
8 changes: 3 additions & 5 deletions app/src/main/java/com/keepassdroid/timeout/TimeoutHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class TimeoutHelper {

private static final long DEFAULT_TIMEOUT = 5 * 60 * 1000; // 5 minutes

public static void pause(Activity act) {
public static void recordTime(Activity act) {
// Record timeout time in case timeout service is killed
long time = System.currentTimeMillis();

Expand All @@ -46,14 +46,12 @@ public static void pause(Activity act) {
if ( App.getDB().Loaded() ) {
Timeout.start(act);
}

}

public static void resume(Activity act) {
public static void checkTime(Activity act) {
if ( App.getDB().Loaded() ) {
Timeout.cancel(act);
}


// Check whether the timeout has expired
long cur_time = System.currentTimeMillis();
Expand Down Expand Up @@ -82,7 +80,7 @@ public static void resume(Activity act) {
long diff = cur_time - timeout_start;
if (diff >= timeout) {
// We have timed out
App.setShutdown();
App.setShutdown(act.getString(R.string.app_timeout));
}
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@
<string name="permission_external_storage_rationale_read_database">KeePass DX a besoin d\'une permission de stockage externe pour lire une URI non fournie par un Content Provider</string>
<string name="permission_external_storage_denied">Permission de stockage externe refusée</string>
<string name="permission_external_storage_never_ask">Impossible d\'effectuer l\'action sans autorisation de stockage externe</string>
<string name="monospace_font_fields_enable_title">Police des champs</string>
<string name="monospace_font_fields_enable_summary">Change la police de caractères des champs pour une meilleure visibilité</string>

<string-array name="clipboard_timeout_options">
<item>5 secondes</item>
Expand Down
8 changes: 8 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* Autofill (Android O)
* Fix timeout and other bugs
* Deletion for group
* New sorts with (Asc/Dsc, Groups before or after)
* Setting to change font of field (monospace for a better visibility)
* Hide empty fields
* Add copy button for Username / Password and extra field
* New list to add and delete node with animation
8 changes: 8 additions & 0 deletions fastlane/metadata/android/fr-FR/changelogs/6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* Remplissage automatique (Android O)
* Correction du timeout et d'autres bugs
* Suppression pour les groupes
* Nouveau tri avec (Asc / Dsc, Groupes avant ou après)
* Réglage pour changer la police de champ (monospace pour une meilleure visibilité)
* Masquage des champs vides
* Ajout d'un bouton de copie pour le nom d'utilisateur / mot de passe et champ supplémentaire
* Nouvelle liste pour ajouter et supprimer un noeud avec animation

0 comments on commit 943d7ca

Please sign in to comment.