mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 00:02:27 -08:00
Merge branch 'develop' into feature/EncryptionSettings
This commit is contained in:
commit
d5acd04a19
18 files changed
+100
-88
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user