Fix compilation, flickering and crash with Autofill

This commit is contained in:
J-Jamet
2018-03-09 12:45:20 +01:00
parent 7e746bb01c
commit e073b21544
7 changed files with 20 additions and 14 deletions

View File

@@ -10,6 +10,7 @@ android {
targetSdkVersion 27
versionCode = 5
versionName = "2.5.0.0beta5"
multiDexEnabled true
testApplicationId = "com.keepassdroid.tests"
testInstrumentationRunner = "android.test.InstrumentationTestRunner"

View File

@@ -19,16 +19,16 @@
*/
package com.keepassdroid.app;
import android.app.Application;
import android.support.multidex.MultiDexApplication;
import com.keepassdroid.database.Database;
import com.keepassdroid.compat.PRNGFixes;
import com.keepassdroid.database.Database;
import com.keepassdroid.fileselect.RecentFileHistory;
import com.keepassdroid.stylish.Stylish;
import java.util.Calendar;
public class App extends Application {
public class App extends MultiDexApplication {
private static Database db = null;
private static boolean shutdown = false;
private static Calendar calendar = null;

View File

@@ -39,8 +39,8 @@ public class AutoFillAuthActivity extends KeePass {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
autofillHelper = new AutofillHelper();
super.onCreate(savedInstanceState);
}
public static IntentSender getAuthIntentSenderForResponse(Context context) {

View File

@@ -37,7 +37,8 @@ import android.widget.RemoteViews;
import com.keepassdroid.database.PwEntry;
import com.kunzisoft.keepass.R;
import java.util.stream.Stream;
import java.util.ArrayList;
import java.util.List;
@RequiresApi(api = Build.VERSION_CODES.O)
@@ -89,9 +90,9 @@ public class AutofillHelper {
}
if (entry.getUsername() != null) {
AutofillValue value = AutofillValue.forText(entry.getUsername());
Stream<AutofillId> ids = struct.username.stream();
List<AutofillId> ids = new ArrayList<>(struct.username);
if (entry.getUsername().contains("@") || struct.username.isEmpty())
ids = Stream.concat(ids, struct.email.stream());
ids.addAll(struct.email);
ids.forEach(id -> builder.setValue(id, value));
}
try {

View File

@@ -40,7 +40,6 @@ import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.autofill.AutofillManager;
import android.widget.EditText;
import android.widget.Toast;
@@ -256,6 +255,8 @@ public class FileSelectActivity extends StylishActivity implements
if (assistStructure == null) {
PasswordActivity.launch(FileSelectActivity.this, path);
}
// Delete flickering for kitkat <
overridePendingTransition(0, 0);
} catch (Exception e) {
// Ignore exception
}

View File

@@ -21,16 +21,20 @@ package com.kunzisoft.keepass;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import com.keepassdroid.fileselect.FileSelectActivity;
public class KeePass extends Activity {
@Override
protected void onStart() {
super.onStart();
startFileSelectActivity();
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startFileSelectActivity();
// Delete flickering for kitkat <
overridePendingTransition(0, 0);
}
protected void startFileSelectActivity() {
FileSelectActivity.launch(this);

View File

@@ -1 +0,0 @@
android.enableD8=true