Parcourir la source

Merge pull request #1205 from vnidens/sharing_password_visibility

[Share] Enter password: toggle visibility of password #1171
Tobias Kaminsky il y a 7 ans
Parent
commit
a3fc2aec19

+ 9 - 0
src/main/res/drawable/ic_show.xml

@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
+</vector>

+ 8 - 0
src/main/res/drawable/password_visibility_selector.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/visible"
+        android:drawable="@drawable/ic_show"
+        android:state_checked="true" />
+    <item android:id="@+id/masked"
+        android:drawable="@drawable/ic_hide" />
+</selector>

+ 4 - 1
src/main/res/layout-land/account_setup.xml

@@ -19,6 +19,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -->
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
 	android:padding="@dimen/standard_padding"
@@ -228,7 +229,9 @@
 					android:id="@+id/input_layout_account_password"
 					android:layout_width="match_parent"
 					android:layout_height="wrap_content"
-					android:visibility="gone">
+					android:visibility="gone"
+					app:passwordToggleDrawable="@drawable/password_visibility_selector"
+					app:passwordToggleTint="@color/white">
 
                     <EditText
                         android:id="@+id/account_password"

+ 4 - 1
src/main/res/layout/account_setup.xml

@@ -19,6 +19,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -->
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_gravity="center"
@@ -218,7 +219,9 @@
             android:id="@+id/input_layout_account_password"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:visibility="gone">
+            android:visibility="gone"
+            app:passwordToggleDrawable="@drawable/password_visibility_selector"
+            app:passwordToggleTint="@color/white">
 
             <EditText
                 android:id="@+id/account_password"

+ 14 - 6
src/main/res/layout/password_dialog.xml

@@ -18,17 +18,25 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <EditText
-        android:id="@+id/share_password"
+    <android.support.design.widget.TextInputLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:ems="10"
-		android:inputType="textPassword"
-        android:layout_margin="@dimen/standard_margin">
-    </EditText>
+        app:passwordToggleDrawable="@drawable/password_visibility_selector">
+
+        <EditText
+            android:id="@+id/share_password"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:ems="10"
+            android:inputType="textPassword"
+            android:layout_margin="@dimen/standard_margin">
+        </EditText>
+
+    </android.support.design.widget.TextInputLayout>
 
 </LinearLayout>