Solve protected field display

This commit is contained in:
J-Jamet
2018-03-31 14:57:01 +02:00
parent 72b0cdf0d7
commit 90084ed2f7
2 changed files with 12 additions and 3 deletions

View File

@@ -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);
}
}

View File

@@ -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);