[Android] Fix login dialog

Geoffrey Métais git at videolan.org
Wed Feb 3 18:49:01 CET 2016


vlc-android | branch: dialog | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb  3 18:48:42 2016 +0100| [17d6ae64fa8d2216ad98ade484bd4a2e32b04a02] | committer: Geoffrey Métais

Fix login dialog

> https://code.videolan.org/videolan/vlc-android/commit/17d6ae64fa8d2216ad98ade484bd4a2e32b04a02
---

 vlc-android/AndroidManifest.xml                    |  7 ++-
 vlc-android/res/layout/network_login_dialog.xml    | 57 +++++++++++++++++-----
 vlc-android/res/values/strings.xml                 |  2 +
 .../vlc/gui/dialogs/NetworkLoginDialog.java        | 11 +++--
 4 files changed, 58 insertions(+), 19 deletions(-)

diff --git a/vlc-android/AndroidManifest.xml b/vlc-android/AndroidManifest.xml
index daa4269..149c278 100644
--- a/vlc-android/AndroidManifest.xml
+++ b/vlc-android/AndroidManifest.xml
@@ -455,8 +455,11 @@
         <activity
             android:name=".gui.video.VideoPlayerActivity"
             android:configChanges="orientation|screenSize"
-            android:theme="@style/Theme.VLC.Player" >
-        </activity>
+            android:theme="@style/Theme.VLC.Player" />
+
+        <activity
+            android:name=".gui.DialogActivity"
+            android:theme="@style/TransparentTheme" />
 
         <service android:name=".extensions.ExtensionManagerService" />
         <service android:name=".PlaybackService" />
diff --git a/vlc-android/res/layout/network_login_dialog.xml b/vlc-android/res/layout/network_login_dialog.xml
index 05a585b..62cd1c4 100644
--- a/vlc-android/res/layout/network_login_dialog.xml
+++ b/vlc-android/res/layout/network_login_dialog.xml
@@ -1,39 +1,70 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent" android:layout_height="match_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:padding="10dp">
 
     <TextView
-        android:id="@+id/login"
+        android:id="@+id/text"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:text="login"
-        android:layout_alignParentTop="true"/>
-    <TextView
-        android:id="@+id/password"
+        android:layout_alignParentTop="true"
+        android:layout_margin="10dp" />
+    <android.support.design.widget.TextInputLayout
+        android:id="@+id/login_container"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/text"
+        android:layout_margin="10dp" >
+        <EditText
+            android:id="@+id/login"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:minWidth="200dp"
+            android:hint="@string/login"
+            android:inputType="textNoSuggestions"
+            android:singleLine="true" />
+    </android.support.design.widget.TextInputLayout>
+    <android.support.design.widget.TextInputLayout
+        android:id="@+id/password_container"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:inputType="textPassword"
-        android:text="password"
-        android:layout_below="@+id/login"/>
+        android:layout_below="@+id/login_container"
+        android:layout_margin="10dp" >
+        <EditText
+            android:id="@+id/password"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:minWidth="200dp"
+            android:hint="@string/password"
+            android:inputType="textPassword"
+            android:singleLine="true" />
+    </android.support.design.widget.TextInputLayout>
     <CheckBox
         android:id="@+id/store"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_below="@+id/password"
+        android:layout_below="@+id/password_container"
         android:text="store"
-        android:layout_alignParentLeft="true"/>
+        android:layout_alignParentLeft="true"
+        android:layout_margin="5dp" />
     <Button
         android:id="@+id/cancel"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_below="@+id/store"
         android:text="@android:string/cancel"
-        android:layout_toLeftOf="@+id/action" />
+        android:layout_toLeftOf="@+id/action"
+        tools:targetApi="11"
+        style="?android:attr/borderlessButtonStyle" />
     <Button
         android:id="@+id/action"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentRight="true"
         android:layout_below="@+id/store"
-        android:text="@android:string/ok" />
+        android:text="@android:string/ok"
+        tools:targetApi="11"
+        style="?android:attr/borderlessButtonStyle" />
 </RelativeLayout>
\ No newline at end of file
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 4e9c100..31b892b 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -159,6 +159,8 @@
     <string name="server_username_hint">Username</string>
     <string name="server_servername_hint">Server name, for conveniency</string>
     <string name="server_port">Port: </string>
+    <string name="login">Login</string>
+    <string name="password">Password</string>
 
     <string name="search_results">Search results</string>
     <string name="favorites_add">Add to favorites</string>
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkLoginDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkLoginDialog.java
index 034ddef..23d77f3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkLoginDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkLoginDialog.java
@@ -32,6 +32,7 @@ import android.view.ViewGroup;
 import android.widget.Button;
 import android.widget.CheckBox;
 import android.widget.CompoundButton;
+import android.widget.EditText;
 import android.widget.TextView;
 
 import org.videolan.libvlc.Dialog;
@@ -41,12 +42,12 @@ import org.videolan.vlc.gui.DialogActivity;
 
 public class NetworkLoginDialog extends VLCDialog<Dialog.LoginDialog> implements CompoundButton.OnCheckedChangeListener, View.OnClickListener {
 
-    TextView mLogin,mPassword;
+    TextView mText;
+    EditText mLogin,mPassword;
     CheckBox mStore;
     Button mCancel, mKay;
 
     public NetworkLoginDialog() {
-        super();
         mVlcDialog = (Dialog.LoginDialog) VLCApplication.getData(DialogActivity.KEY_LOGIN);
     }
 
@@ -54,12 +55,14 @@ public class NetworkLoginDialog extends VLCDialog<Dialog.LoginDialog> implements
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         View v = inflater.inflate(R.layout.network_login_dialog, container, false);
-        mLogin = (TextView) v.findViewById(R.id.title);
-        mPassword = (TextView) v.findViewById(R.id.password);
+        mText = (TextView) v.findViewById(R.id.text);
+        mLogin = (EditText) v.findViewById(R.id.login);
+        mPassword = (EditText) v.findViewById(R.id.password);
         mStore = (CheckBox) v.findViewById(R.id.store);
         mCancel = (Button) v.findViewById(R.id.cancel);
         mKay = (Button) v.findViewById(R.id.action);
 
+        mText.setText(mVlcDialog.getText());
         mStore.setVisibility(mVlcDialog.asksStore() ? View.VISIBLE : View.GONE);
         mCancel.setOnClickListener(this);
         mKay.setOnClickListener(this);



More information about the Android mailing list