summaryrefslogtreecommitdiffhomepage
path: root/android/src
diff options
context:
space:
mode:
Diffstat (limited to 'android/src')
-rw-r--r--android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountInput.kt35
-rw-r--r--android/src/main/res/layout/account_input.xml24
-rw-r--r--android/src/main/res/layout/login.xml31
3 files changed, 63 insertions, 27 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountInput.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountInput.kt
new file mode 100644
index 0000000000..04e0e3a3c9
--- /dev/null
+++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountInput.kt
@@ -0,0 +1,35 @@
+package net.mullvad.mullvadvpn.ui.widget
+
+import android.content.Context
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.widget.LinearLayout
+import net.mullvad.mullvadvpn.R
+
+class AccountInput : LinearLayout {
+ private val container =
+ context.getSystemService(Context.LAYOUT_INFLATER_SERVICE).let { service ->
+ val inflater = service as LayoutInflater
+
+ inflater.inflate(R.layout.account_input, this)
+ }
+
+ constructor(context: Context) : super(context) {}
+
+ constructor(context: Context, attributes: AttributeSet) : super(context, attributes) {}
+
+ constructor(context: Context, attributes: AttributeSet, defaultStyleAttribute: Int) :
+ super(context, attributes, defaultStyleAttribute) {}
+
+ constructor(
+ context: Context,
+ attributes: AttributeSet,
+ defaultStyleAttribute: Int,
+ defaultStyleResource: Int
+ ) : super(context, attributes, defaultStyleAttribute, defaultStyleResource) {
+ }
+
+ init {
+ orientation = HORIZONTAL
+ }
+}
diff --git a/android/src/main/res/layout/account_input.xml b/android/src/main/res/layout/account_input.xml
new file mode 100644
index 0000000000..8e3ca9dd98
--- /dev/null
+++ b/android/src/main/res/layout/account_input.xml
@@ -0,0 +1,24 @@
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+ <EditText android:id="@+id/account_input"
+ android:digits="0123456789"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:paddingHorizontal="12dp"
+ android:background="@drawable/account_input_background"
+ android:inputType="number"
+ android:singleLine="true"
+ android:imeOptions="flagNoPersonalizedLearning"
+ android:textCursorDrawable="@drawable/text_input_cursor"
+ android:hint="@string/login_hint"
+ android:textColorHint="@color/blue40"
+ android:textColor="@color/blue"
+ android:textSize="@dimen/text_medium_plus"
+ android:textStyle="bold" />
+ <ImageButton android:id="@+id/login_button"
+ android:layout_width="48dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0"
+ android:background="@drawable/login_button_background"
+ android:src="@drawable/login_button_arrow" />
+</merge>
diff --git a/android/src/main/res/layout/login.xml b/android/src/main/res/layout/login.xml
index 87e240928c..005d2dbf9f 100644
--- a/android/src/main/res/layout/login.xml
+++ b/android/src/main/res/layout/login.xml
@@ -67,33 +67,10 @@
<net.mullvad.mullvadvpn.ui.AccountInputContainer android:id="@+id/account_input_container"
android:layout_width="match_parent"
android:layout_height="48dp">
- <LinearLayout android:layout_width="match_parent"
- android:layout_height="48dp"
- android:layout_alignParentTop="true"
- android:orientation="horizontal">
- <EditText android:id="@+id/account_input"
- android:digits="0123456789"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:paddingHorizontal="12dp"
- android:background="@drawable/account_input_background"
- android:inputType="number"
- android:singleLine="true"
- android:imeOptions="flagNoPersonalizedLearning"
- android:textCursorDrawable="@drawable/text_input_cursor"
- android:hint="@string/login_hint"
- android:textColorHint="@color/blue40"
- android:textColor="@color/blue"
- android:textSize="@dimen/text_medium_plus"
- android:textStyle="bold" />
- <ImageButton android:id="@+id/login_button"
- android:layout_width="48dp"
- android:layout_height="match_parent"
- android:layout_weight="0"
- android:background="@drawable/login_button_background"
- android:src="@drawable/login_button_arrow" />
- </LinearLayout>
+ <net.mullvad.mullvadvpn.ui.widget.AccountInput android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:layout_alignParentTop="true"
+ android:orientation="horizontal" />
</net.mullvad.mullvadvpn.ui.AccountInputContainer>
<ListView android:id="@+id/account_history_list"
android:layout_width="fill_parent"