mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Add gray copy icon when copy not available
This commit is contained in:
@@ -330,8 +330,9 @@ public class EntryActivity extends LockingHideActivity {
|
||||
getString(R.string.copy_field, getString(R.string.entry_user_name)))
|
||||
);
|
||||
|
||||
entryContentsView.assignPassword(mEntry.getPassword());
|
||||
if (PreferencesUtil.allowCopyPasswordAndProtectedFields(this)) {
|
||||
boolean allowCopyPassword = PreferencesUtil.allowCopyPasswordAndProtectedFields(this);
|
||||
entryContentsView.assignPassword(mEntry.getPassword(), allowCopyPassword);
|
||||
if (allowCopyPassword) {
|
||||
entryContentsView.assignPasswordCopyListener(view ->
|
||||
clipboardHelper.timeoutCopyToClipboard(mEntry.getPassword(),
|
||||
getString(R.string.copy_field, getString(R.string.entry_password)))
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package com.kunzisoft.keepass.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -129,13 +130,18 @@ public class EntryContentsView extends LinearLayout {
|
||||
return userNameContainerView.getVisibility() == VISIBLE;
|
||||
}
|
||||
|
||||
public void assignPassword(String password) {
|
||||
public void assignPassword(String password, boolean allowCopyPassword) {
|
||||
if (password != null && !password.isEmpty()) {
|
||||
passwordContainerView.setVisibility(VISIBLE);
|
||||
passwordView.setText(password);
|
||||
if (fontInVisibility)
|
||||
Util.applyFontVisibilityTo(getContext(), passwordView);
|
||||
passwordActionView.setVisibility(GONE);
|
||||
if (!allowCopyPassword) {
|
||||
passwordActionView.setEnabled(false);
|
||||
passwordActionView.setColorFilter(ContextCompat.getColor(getContext(), R.color.grey_dark));
|
||||
} else {
|
||||
passwordActionView.setEnabled(true);
|
||||
}
|
||||
} else {
|
||||
passwordContainerView.setVisibility(GONE);
|
||||
}
|
||||
@@ -143,7 +149,6 @@ public class EntryContentsView extends LinearLayout {
|
||||
|
||||
public void assignPasswordCopyListener(OnClickListener onClickListener) {
|
||||
passwordActionView.setOnClickListener(onClickListener);
|
||||
passwordActionView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
public boolean isPasswordPresent() {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package com.kunzisoft.keepass.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
@@ -62,10 +63,12 @@ public class EntryCustomField extends LinearLayout {
|
||||
setLabel(label);
|
||||
setValue(value);
|
||||
|
||||
if (!showAction) {
|
||||
actionImageView.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
if (showAction) {
|
||||
actionImageView.setEnabled(true);
|
||||
setAction(onClickActionListener);
|
||||
} else {
|
||||
actionImageView.setEnabled(false);
|
||||
actionImageView.setColorFilter(ContextCompat.getColor(getContext(), R.color.grey_dark));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user