@@ -58,6 +58,7 @@ public class ShowEntry extends Fragment implements OnClickListener, BackButtonHa
5858 private transient EditText userText ;
5959 private transient EditText passwordText ;
6060 private transient EditText descriptionText ;
61+ private boolean passwordVisibleWhenNotEditing ;
6162
6263 /**
6364 * Creates a ShowEntry fragment.
@@ -167,7 +168,7 @@ private void addToClipboard(String data) {
167168 private void prepareUiElements (View v ) {
168169 if (!(edit || delete )) {
169170 TextView passTitle = (TextView ) v .findViewById (R .id .passwordLabel );
170- passTitle .append (" (tap here to reveal)" );
171+ passTitle .append (" (tap here to reveal or hide )" );
171172 passTitle .setOnTouchListener (this );
172173 }
173174 Button eb = (Button ) v .findViewById (R .id .editButton );
@@ -253,10 +254,12 @@ private void restore(Bundle state) {
253254
254255 @ Override
255256 public boolean onTouch (View view , MotionEvent motionEvent ) {
256- if (motionEvent .getAction () == MotionEvent .ACTION_DOWN ) {
257+ if (motionEvent .getAction () == MotionEvent .ACTION_DOWN && ! passwordVisibleWhenNotEditing ) {
257258 passwordText .setTransformationMethod (null );
258- } else {
259+ passwordVisibleWhenNotEditing = !passwordVisibleWhenNotEditing ;
260+ } else if (motionEvent .getAction () == MotionEvent .ACTION_DOWN && passwordVisibleWhenNotEditing ) {
259261 passwordText .setTransformationMethod (PasswordTransformationMethod .getInstance ());
262+ passwordVisibleWhenNotEditing = !passwordVisibleWhenNotEditing ;
260263 }
261264 return true ;
262265 }
0 commit comments