summaryrefslogtreecommitdiffhomepage
path: root/android/src/main/res
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-01-28 18:10:45 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-02-10 15:40:36 +0000
commitb361f24f32843dfadf39a3590f8aa66dff1db84c (patch)
tree4ee9bf5e9c5aced2f2e58e6c94fd372524a4706e /android/src/main/res
parent0d9611d8f799598ff8c12d457d87f2a872089919 (diff)
downloadmullvadvpn-b361f24f32843dfadf39a3590f8aa66dff1db84c.tar.xz
mullvadvpn-b361f24f32843dfadf39a3590f8aa66dff1db84c.zip
Create `CellSwitch` widget
Diffstat (limited to 'android/src/main/res')
-rw-r--r--android/src/main/res/drawable/cell_switch_background.xml27
-rw-r--r--android/src/main/res/layout/preferences.xml5
-rw-r--r--android/src/main/res/values/dimensions.xml6
3 files changed, 38 insertions, 0 deletions
diff --git a/android/src/main/res/drawable/cell_switch_background.xml b/android/src/main/res/drawable/cell_switch_background.xml
new file mode 100644
index 0000000000..71f6fe0802
--- /dev/null
+++ b/android/src/main/res/drawable/cell_switch_background.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle"
+ >
+ <item android:state_enabled="false">
+ <shape android:shape="rectangle">
+ <corners android:radius="@dimen/cell_switch_border_radius"/>
+ <stroke android:color="@color/white20" android:width="2dp"/>
+ <size
+ android:width="@dimen/cell_switch_width"
+ android:height="@dimen/cell_switch_height"
+ />
+ </shape>
+ </item>
+
+ <item android:state_enabled="true">
+ <shape android:shape="rectangle">
+ <corners android:radius="@dimen/cell_switch_border_radius"/>
+ <stroke android:color="@color/white" android:width="2dp"/>
+ <size
+ android:width="@dimen/cell_switch_width"
+ android:height="@dimen/cell_switch_height"
+ />
+ </shape>
+ </item>
+</selector>
diff --git a/android/src/main/res/layout/preferences.xml b/android/src/main/res/layout/preferences.xml
index 38089ce7e4..870a9a5206 100644
--- a/android/src/main/res/layout/preferences.xml
+++ b/android/src/main/res/layout/preferences.xml
@@ -60,6 +60,11 @@
android:textStyle="bold"
android:text="@string/local_network_sharing"
/>
+ <net.mullvad.mullvadvpn.ui.CellSwitch
+ android:layout_width="52dp"
+ android:layout_height="32dp"
+ android:layout_weight="0"
+ />
</LinearLayout>
<TextView android:id="@+id/allow_lan_footer"
android:layout_width="match_parent"
diff --git a/android/src/main/res/values/dimensions.xml b/android/src/main/res/values/dimensions.xml
index 800e1ed0ac..5d106210ea 100644
--- a/android/src/main/res/values/dimensions.xml
+++ b/android/src/main/res/values/dimensions.xml
@@ -6,4 +6,10 @@
<dimen name="account_input_corner_radius">4dp</dimen>
<dimen name="normal_button_height">44dp</dimen>
<dimen name="tall_button_height">64dp</dimen>
+ <dimen name="cell_switch_border_radius">16dp</dimen>
+ <dimen name="cell_switch_width">32dp</dimen>
+ <dimen name="cell_switch_height">52dp</dimen>
+ <dimen name="cell_switch_knob_margin">4dp</dimen>
+ <dimen name="cell_switch_knob_max_translation">20dp</dimen>
+ <dimen name="cell_switch_knob_size">24dp</dimen>
</resources>