summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorAleksandr Granin <aleksandr@mullvad.net>2021-02-26 16:10:39 +0100
committerAleksandr Granin <aleksandr@mullvad.net>2021-03-02 09:26:36 +0100
commit7781891d0701626421c4d98eea100f05fab30451 (patch)
tree37198ed54281d830e8ba5cc5ff850efebc3f00ca /android
parent4fd3dc59480e313d043acd7b4ba69b7b6f4e392f (diff)
downloadmullvadvpn-7781891d0701626421c4d98eea100f05fab30451.tar.xz
mullvadvpn-7781891d0701626421c4d98eea100f05fab30451.zip
Create switch style and all needed assets for this
Remove empty lines. Should be squashed
Diffstat (limited to 'android')
-rw-r--r--android/src/main/res/color/switch_thumb_fill_selector.xml7
-rw-r--r--android/src/main/res/drawable/switch_thumb.xml16
-rw-r--r--android/src/main/res/drawable/switch_track.xml17
-rw-r--r--android/src/main/res/values/colors.xml7
-rw-r--r--android/src/main/res/values/dimensions.xml7
-rw-r--r--android/src/main/res/values/styles.xml10
6 files changed, 64 insertions, 0 deletions
diff --git a/android/src/main/res/color/switch_thumb_fill_selector.xml b/android/src/main/res/color/switch_thumb_fill_selector.xml
new file mode 100644
index 0000000000..b294ee1038
--- /dev/null
+++ b/android/src/main/res/color/switch_thumb_fill_selector.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@color/switch_thumb_fill_checked"
+ android:state_checked="true" />
+ <item android:color="@color/switch_thumb_fill_unchecked"/>
+</selector>
diff --git a/android/src/main/res/drawable/switch_thumb.xml b/android/src/main/res/drawable/switch_thumb.xml
new file mode 100644
index 0000000000..1b32766d34
--- /dev/null
+++ b/android/src/main/res/drawable/switch_thumb.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:dither="true"
+ android:shape="oval"
+ android:useLevel="false"
+ android:visible="true">
+ <size android:width="@dimen/switch_thumb_size"
+ android:height="@dimen/switch_thumb_size" />
+ <padding android:bottom="@dimen/switch_thumb_padding"
+ android:left="@dimen/switch_thumb_padding"
+ android:right="@dimen/switch_thumb_padding"
+ android:top="@dimen/switch_thumb_padding" />
+ <solid android:color="@color/switch_thumb_fill" />
+ <stroke android:width="@dimen/switch_thumb_padding"
+ android:color="@color/switch_thumb_border" />
+</shape>
diff --git a/android/src/main/res/drawable/switch_track.xml b/android/src/main/res/drawable/switch_track.xml
new file mode 100644
index 0000000000..eb287d3316
--- /dev/null
+++ b/android/src/main/res/drawable/switch_track.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:dither="true"
+ android:shape="rectangle"
+ android:useLevel="false"
+ android:visible="true">
+ <size android:width="@dimen/switch_width"
+ android:height="@dimen/switch_height" />
+ <padding android:bottom="@dimen/switch_thumb_padding"
+ android:left="@dimen/switch_thumb_padding"
+ android:right="@dimen/switch_thumb_padding"
+ android:top="@dimen/switch_thumb_padding" />
+ <solid android:color="@color/switch_track_fill" />
+ <stroke android:width="@dimen/switch_track_stroke"
+ android:color="@color/switch_track_border" />
+ <corners android:radius="@dimen/switch_track_radius" />
+</shape>
diff --git a/android/src/main/res/values/colors.xml b/android/src/main/res/values/colors.xml
index 23d4ff564f..9fb5760781 100644
--- a/android/src/main/res/values/colors.xml
+++ b/android/src/main/res/values/colors.xml
@@ -23,4 +23,11 @@
<color name="red40">#66E34039</color>
<color name="yellow">#FFD323</color>
<color name="textInputBorder">#234161</color>
+ <!-- Switch Colors -->
+ <color name="switch_thumb_fill_checked">@color/green</color>
+ <color name="switch_thumb_fill_unchecked">@color/red</color>
+ <color name="switch_thumb_fill">@color/switch_thumb_fill_selector</color>
+ <color name="switch_thumb_border">@android:color/transparent</color>
+ <color name="switch_track_fill">@android:color/transparent</color>
+ <color name="switch_track_border">@color/white80</color>
</resources>
diff --git a/android/src/main/res/values/dimensions.xml b/android/src/main/res/values/dimensions.xml
index 34c5c18eb3..cce4a34a3f 100644
--- a/android/src/main/res/values/dimensions.xml
+++ b/android/src/main/res/values/dimensions.xml
@@ -41,4 +41,11 @@
<dimen name="button_separation">18dp</dimen>
<dimen name="screen_vertical_margin">22dp</dimen>
<dimen name="app_list_item_icon_size">35dp</dimen>
+ <!-- Switch Dimens-->
+ <dimen name="switch_width">46dp</dimen>
+ <dimen name="switch_height">30dp</dimen>
+ <dimen name="switch_thumb_size">30dp</dimen>
+ <dimen name="switch_thumb_padding">8dp</dimen>
+ <dimen name="switch_track_radius">16dp</dimen>
+ <dimen name="switch_track_stroke">2dp</dimen>
</resources>
diff --git a/android/src/main/res/values/styles.xml b/android/src/main/res/values/styles.xml
index 1fc47c0e6f..738b4d951a 100644
--- a/android/src/main/res/values/styles.xml
+++ b/android/src/main/res/values/styles.xml
@@ -3,6 +3,7 @@
parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="android:windowBackground">@color/blue</item>
+ <item name="switchStyle">@style/AppTheme.Switch</item>
</style>
<style name="InputText"
parent="Widget.AppCompat.EditText">
@@ -53,4 +54,13 @@
parent="SettingsHeader">
<item name="android:textSize">@dimen/text_medium</item>
</style>
+ <!-- Switch Style -->
+ <style name="AppTheme.Switch">
+ <item name="android:layout_width">@dimen/switch_width</item>
+ <item name="android:layout_height">@dimen/switch_height</item>
+ <item name="track">@drawable/switch_track</item>
+ <item name="android:thumb">@drawable/switch_thumb</item>
+ <item name="switchMinWidth">@dimen/switch_width</item>
+ <item name="showText">false</item>
+ </style>
</resources>