Browse Source

Implement custom theming to match Google's AOSP design

Closes: #4
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
master
Harsh Shandilya 4 years ago
committed by Jason A. Donenfeld
parent
commit
d25702d99d
30 changed files with 185 additions and 60 deletions
  1. +0
    -3
      .idea/codeStyles/Project.xml
  2. +2
    -2
      app/build.gradle
  3. +34
    -0
      app/sampledata/interface_names.json
  4. +1
    -1
      app/src/main/res/drawable/ic_action_add_white.xml
  5. +1
    -1
      app/src/main/res/drawable/ic_action_delete.xml
  6. +1
    -1
      app/src/main/res/drawable/ic_action_edit.xml
  7. +1
    -1
      app/src/main/res/drawable/ic_action_edit_white.xml
  8. +0
    -9
      app/src/main/res/drawable/ic_action_open.xml
  9. +1
    -1
      app/src/main/res/drawable/ic_action_open_white.xml
  10. +1
    -1
      app/src/main/res/drawable/ic_action_save.xml
  11. +1
    -1
      app/src/main/res/drawable/ic_action_scan_qr_code_white.xml
  12. +1
    -1
      app/src/main/res/drawable/ic_action_select_all.xml
  13. +2
    -9
      app/src/main/res/drawable/list_item_background.xml
  14. +7
    -3
      app/src/main/res/layout/app_list_dialog_fragment.xml
  15. +8
    -4
      app/src/main/res/layout/app_list_item.xml
  16. +2
    -2
      app/src/main/res/layout/tunnel_detail_fragment.xml
  17. +1
    -1
      app/src/main/res/layout/tunnel_detail_peer.xml
  18. +3
    -3
      app/src/main/res/layout/tunnel_editor_fragment.xml
  19. +1
    -1
      app/src/main/res/layout/tunnel_editor_peer.xml
  20. +8
    -5
      app/src/main/res/layout/tunnel_list_fragment.xml
  21. +6
    -3
      app/src/main/res/layout/tunnel_list_item.xml
  22. +5
    -0
      app/src/main/res/values-night/bools.xml
  23. +14
    -1
      app/src/main/res/values-night/colors.xml
  24. +28
    -0
      app/src/main/res/values-v27/styles.xml
  25. +5
    -0
      app/src/main/res/values/attrs.xml
  26. +5
    -0
      app/src/main/res/values/bools.xml
  27. +19
    -2
      app/src/main/res/values/colors.xml
  28. +25
    -2
      app/src/main/res/values/styles.xml
  29. +1
    -1
      build.gradle
  30. +1
    -1
      gradle/wrapper/gradle-wrapper.properties

+ 0
- 3
.idea/codeStyles/Project.xml View File

@@ -29,9 +29,6 @@
<emptyLine /> <emptyLine />
</value> </value>
</option> </option>
<AndroidXmlCodeStyleSettings>
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
</AndroidXmlCodeStyleSettings>
<JavaCodeStyleSettings> <JavaCodeStyleSettings>
<option name="GENERATE_FINAL_LOCALS" value="true" /> <option name="GENERATE_FINAL_LOCALS" value="true" />
<option name="GENERATE_FINAL_PARAMETERS" value="true" /> <option name="GENERATE_FINAL_PARAMETERS" value="true" />


+ 2
- 2
app/build.gradle View File

@@ -71,11 +71,11 @@ ext {
appcompatVersion = '1.1.0' appcompatVersion = '1.1.0'
cardviewVersion = '1.0.0' cardviewVersion = '1.0.0'
databindingVersion = '3.5.3' databindingVersion = '3.5.3'
materialComponentsVersion = '1.0.0'
materialComponentsVersion = '1.1.0'
jsr305Version = '3.0.2' jsr305Version = '3.0.2'
preferenceVersion = '1.1.0' preferenceVersion = '1.1.0'
streamsupportVersion = '1.7.1' streamsupportVersion = '1.7.1'
threetenabpVersion = '1.2.1'
threetenabpVersion = '1.2.2'
// ZXING switched minSdk to 24 so we cannot upgrade to 4.0.2 without following suit. // ZXING switched minSdk to 24 so we cannot upgrade to 4.0.2 without following suit.
// If you choose to upgrade to minSDK 24 then you should also disable Jetifier from // If you choose to upgrade to minSDK 24 then you should also disable Jetifier from
// gradle.properties. // gradle.properties.


+ 34
- 0
app/sampledata/interface_names.json View File

@@ -0,0 +1,34 @@
{
"comment": "Interface names",
"names": [
{
"names": [
{ "name": "wg0" },
{ "name": "wg1" },
{ "name": "wg2" },
{ "name": "wg3" },
{ "name": "wg4" },
{ "name": "wg5" },
{ "name": "wg6" },
{ "name": "wg7" },
{ "name": "wg8" },
{ "name": "wg9" },
{ "name": "wg10" },
{ "name": "wg11" }
],
"checked": [
{ "checked": true },
{ "checked": false },
{ "checked": true },
{ "checked": false },
{ "checked": true },
{ "checked": false },
{ "checked": true },
{ "checked": false },
{ "checked": true },
{ "checked": false },
{ "checked": true }
]
}
]
}

+ 1
- 1
app/src/main/res/drawable/ic_action_add_white.xml View File

@@ -4,6 +4,6 @@
android:viewportHeight="24.0" android:viewportHeight="24.0"
android:viewportWidth="24.0"> android:viewportWidth="24.0">
<path <path
android:fillColor="#ffffff"
android:fillColor="?attr/colorOnSecondary"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" /> android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</vector> </vector>

+ 1
- 1
app/src/main/res/drawable/ic_action_delete.xml View File

@@ -4,6 +4,6 @@
android:viewportHeight="24" android:viewportHeight="24"
android:viewportWidth="24"> android:viewportWidth="24">
<path <path
android:fillColor="?android:attr/colorForeground"
android:fillColor="?attr/colorOnPrimary"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z" /> android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z" />
</vector> </vector>

+ 1
- 1
app/src/main/res/drawable/ic_action_edit.xml View File

@@ -4,6 +4,6 @@
android:viewportHeight="24" android:viewportHeight="24"
android:viewportWidth="24"> android:viewportWidth="24">
<path <path
android:fillColor="?android:attr/colorForeground"
android:fillColor="?attr/colorOnPrimary"
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" /> android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" />
</vector> </vector>

+ 1
- 1
app/src/main/res/drawable/ic_action_edit_white.xml View File

@@ -4,6 +4,6 @@
android:viewportHeight="24" android:viewportHeight="24"
android:viewportWidth="24"> android:viewportWidth="24">
<path <path
android:fillColor="#ffffff"
android:fillColor="?attr/colorOnSecondary"
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" /> android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" />
</vector> </vector>

+ 0
- 9
app/src/main/res/drawable/ic_action_open.xml View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="?android:attr/colorForeground"
android:pathData="M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6L6,2zM13,9L13,3.5L18.5,9L13,9z" />
</vector>

+ 1
- 1
app/src/main/res/drawable/ic_action_open_white.xml View File

@@ -4,6 +4,6 @@
android:viewportHeight="24" android:viewportHeight="24"
android:viewportWidth="24"> android:viewportWidth="24">
<path <path
android:fillColor="#ffffff"
android:fillColor="?attr/colorOnSecondary"
android:pathData="M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6L6,2zM13,9L13,3.5L18.5,9L13,9z" /> android:pathData="M6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6L6,2zM13,9L13,3.5L18.5,9L13,9z" />
</vector> </vector>

+ 1
- 1
app/src/main/res/drawable/ic_action_save.xml View File

@@ -5,6 +5,6 @@
android:viewportHeight="24" android:viewportHeight="24"
android:viewportWidth="24"> android:viewportWidth="24">
<path <path
android:fillColor="?android:attr/colorForeground"
android:fillColor="?attr/colorOnPrimary"
android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z" /> android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z" />
</vector> </vector>

+ 1
- 1
app/src/main/res/drawable/ic_action_scan_qr_code_white.xml View File

@@ -4,6 +4,6 @@
android:viewportHeight="24" android:viewportHeight="24"
android:viewportWidth="24"> android:viewportWidth="24">
<path <path
android:fillColor="#ffffff"
android:fillColor="?attr/colorOnSecondary"
android:pathData="M4,4H10V10H4V4M20,4V10H14V4H20M14,15H16V13H14V11H16V13H18V11H20V13H18V15H20V18H18V20H16V18H13V20H11V16H14V15M16,15V18H18V15H16M4,20V14H10V20H4M6,6V8H8V6H6M16,6V8H18V6H16M6,16V18H8V16H6M4,11H6V13H4V11M9,11H13V15H11V13H9V11M11,6H13V10H11V6M2,2V6H0V2A2,2 0 0,1 2,0H6V2H2M22,0A2,2 0 0,1 24,2V6H22V2H18V0H22M2,18V22H6V24H2A2,2 0 0,1 0,22V18H2M22,22V18H24V22A2,2 0 0,1 22,24H18V22H22Z" /> android:pathData="M4,4H10V10H4V4M20,4V10H14V4H20M14,15H16V13H14V11H16V13H18V11H20V13H18V15H20V18H18V20H16V18H13V20H11V16H14V15M16,15V18H18V15H16M4,20V14H10V20H4M6,6V8H8V6H6M16,6V8H18V6H16M6,16V18H8V16H6M4,11H6V13H4V11M9,11H13V15H11V13H9V11M11,6H13V10H11V6M2,2V6H0V2A2,2 0 0,1 2,0H6V2H2M22,0A2,2 0 0,1 24,2V6H22V2H18V0H22M2,18V22H6V24H2A2,2 0 0,1 0,22V18H2M22,22V18H24V22A2,2 0 0,1 22,24H18V22H22Z" />
</vector> </vector>

+ 1
- 1
app/src/main/res/drawable/ic_action_select_all.xml View File

@@ -5,6 +5,6 @@
android:viewportHeight="24" android:viewportHeight="24"
android:viewportWidth="24"> android:viewportWidth="24">
<path <path
android:fillColor="?android:attr/colorForeground"
android:fillColor="?attr/colorOnPrimary"
android:pathData="M3 5L5 5 5 3C3.9 3 3 3.9 3 5Zm0 8l2 0 0 -2 -2 0 0 2zm4 8l2 0 0 -2 -2 0 0 2zM3 9L5 9 5 7 3 7 3 9Zm10 -6l-2 0 0 2 2 0 0 -2zm6 0l0 2 2 0C21 3.9 20.1 3 19 3ZM5 21L5 19 3 19c0 1.1 0.9 2 2 2zm-2 -4l2 0 0 -2 -2 0 0 2zM9 3L7 3 7 5 9 5 9 3Zm2 18l2 0 0 -2 -2 0 0 2zm8 -8l2 0 0 -2 -2 0 0 2zm0 8c1.1 0 2 -0.9 2 -2l-2 0 0 2zm0 -12l2 0 0 -2 -2 0 0 2zm0 8l2 0 0 -2 -2 0 0 2zm-4 4l2 0 0 -2 -2 0 0 2zm0 -16l2 0 0 -2 -2 0 0 2zM7 17L17 17 17 7 7 7 7 17Zm2 -8l6 0 0 6 -6 0 0 -6z" /> android:pathData="M3 5L5 5 5 3C3.9 3 3 3.9 3 5Zm0 8l2 0 0 -2 -2 0 0 2zm4 8l2 0 0 -2 -2 0 0 2zM3 9L5 9 5 7 3 7 3 9Zm10 -6l-2 0 0 2 2 0 0 -2zm6 0l0 2 2 0C21 3.9 20.1 3 19 3ZM5 21L5 19 3 19c0 1.1 0.9 2 2 2zm-2 -4l2 0 0 -2 -2 0 0 2zM9 3L7 3 7 5 9 5 9 3Zm2 18l2 0 0 -2 -2 0 0 2zm8 -8l2 0 0 -2 -2 0 0 2zm0 8c1.1 0 2 -0.9 2 -2l-2 0 0 2zm0 -12l2 0 0 -2 -2 0 0 2zm0 8l2 0 0 -2 -2 0 0 2zm-4 4l2 0 0 -2 -2 0 0 2zm0 -16l2 0 0 -2 -2 0 0 2zM7 17L17 17 17 7 7 7 7 17Zm2 -8l6 0 0 6 -6 0 0 -6z" />
</vector> </vector>

+ 2
- 9
app/src/main/res/drawable/list_item_background.xml View File

@@ -3,15 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item> <item>
<selector> <selector>
<item
android:state_activated="true"
app:state_multiselected="true">
<color android:color="?attr/colorControlActivated" />
</item>
<item
android:state_activated="true"
app:state_multiselected="false">
<color android:color="?attr/colorControlHighlight" />
<item app:state_multiselected="true" android:state_activated="true">
<color android:color="?attr/colorMultiselectActiveBackground" />
</item> </item>
</selector> </selector>
</item> </item>


+ 7
- 3
app/src/main/res/layout/app_list_dialog_fragment.xml View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">


<data> <data>


@@ -28,14 +29,17 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:indeterminate="true" android:indeterminate="true"
android:visibility="@{appData.isEmpty() ? View.VISIBLE : View.GONE}" />
android:visibility="@{appData.isEmpty() ? View.VISIBLE : View.GONE}"
tools:visibility="gone" />


<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/app_list" android:id="@+id/app_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:items="@{appData}" app:items="@{appData}"
app:layout="@{@layout/app_list_item}" />
app:layout="@{@layout/app_list_item}"
tools:itemCount="10"
tools:listitem="@layout/app_list_item" />


</FrameLayout> </FrameLayout>




+ 8
- 4
app/src/main/res/layout/app_list_item.xml View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">


<data> <data>


@@ -31,7 +32,8 @@
android:id="@+id/app_icon" android:id="@+id/app_icon"
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="32dp" android:layout_height="32dp"
android:src="@{item.icon}" />
android:src="@{item.icon}"
tools:src="@tools:sample/avatars" />


<TextView <TextView
android:id="@+id/app_name" android:id="@+id/app_name"
@@ -43,13 +45,15 @@
android:maxLines="1" android:maxLines="1"
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:paddingStart="8dp" android:paddingStart="8dp"
android:text="@{key}" />
android:text="@{key}"
tools:text="@tools:sample/full_names" />


<CheckBox <CheckBox
android:id="@+id/excluded_checkbox" android:id="@+id/excluded_checkbox"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="@={item.excludedFromTunnel}" />
android:checked="@={item.excludedFromTunnel}"
tools:checked="true" />


</LinearLayout> </LinearLayout>
</layout> </layout>

+ 2
- 2
app/src/main/res/layout/tunnel_detail_fragment.xml View File

@@ -25,7 +25,7 @@
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?android:attr/colorBackground">
android:background="?attr/colorBackground">


<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -39,7 +39,7 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:background="?android:attr/colorBackground"
android:background="?attr/colorBackground"
app:cardCornerRadius="4dp" app:cardCornerRadius="4dp"
app:cardElevation="2dp" app:cardElevation="2dp"
app:contentPadding="8dp"> app:contentPadding="8dp">


+ 1
- 1
app/src/main/res/layout/tunnel_detail_peer.xml View File

@@ -18,7 +18,7 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:background="?android:attr/colorBackground"
android:background="?attr/colorBackground"
app:cardCornerRadius="4dp" app:cardCornerRadius="4dp"
app:cardElevation="2dp" app:cardElevation="2dp"
app:contentPadding="8dp"> app:contentPadding="8dp">


+ 3
- 3
app/src/main/res/layout/tunnel_editor_fragment.xml View File

@@ -28,7 +28,7 @@
android:id="@+id/main_container" android:id="@+id/main_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?android:attr/colorBackground">
android:background="?attr/colorBackground">


<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -46,7 +46,7 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:background="?android:attr/colorBackground"
android:background="?attr/colorBackground"
app:cardCornerRadius="4dp" app:cardCornerRadius="4dp"
app:cardElevation="2dp" app:cardElevation="2dp"
app:contentPadding="8dp"> app:contentPadding="8dp">
@@ -104,7 +104,7 @@
<Button <Button
android:id="@+id/generate_private_key_button" android:id="@+id/generate_private_key_button"
style="@style/Widget.AppCompat.Button.Borderless.Colored" style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="96dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="@id/private_key_text" android:layout_alignBottom="@id/private_key_text"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"


+ 1
- 1
app/src/main/res/layout/tunnel_editor_peer.xml View File

@@ -24,7 +24,7 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:background="?android:attr/colorBackground"
android:background="?attr/colorBackground"
app:cardCornerRadius="4dp" app:cardCornerRadius="4dp"
app:cardElevation="2dp" app:cardElevation="2dp"
app:contentPadding="8dp"> app:contentPadding="8dp">


+ 8
- 5
app/src/main/res/layout/tunnel_list_fragment.xml View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">


<data> <data>


@@ -23,7 +24,7 @@
android:id="@+id/main_container" android:id="@+id/main_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?android:attr/colorBackground"
android:background="?attr/colorBackground"
android:clipChildren="false"> android:clipChildren="false">


<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
@@ -36,14 +37,17 @@
android:visibility="@{tunnels.size() > 0 ? android.view.View.VISIBLE : android.view.View.GONE}" android:visibility="@{tunnels.size() > 0 ? android.view.View.VISIBLE : android.view.View.GONE}"
app:configurationHandler="@{rowConfigurationHandler}" app:configurationHandler="@{rowConfigurationHandler}"
app:items="@{tunnels}" app:items="@{tunnels}"
app:layout="@{@layout/tunnel_list_item}" />
app:layout="@{@layout/tunnel_list_item}"
tools:listitem="@layout/tunnel_list_item"
tools:itemCount="12" />


<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:visibility="@{tunnels.size() == 0 ? android.view.View.VISIBLE : android.view.View.GONE}">
android:visibility="@{tunnels.size() == 0 ? android.view.View.VISIBLE : android.view.View.GONE}"
tools:visibility="gone">


<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/logo_placeholder" android:id="@+id/logo_placeholder"
@@ -51,7 +55,6 @@
android:layout_height="140dp" android:layout_height="140dp"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp"
android:layout_marginTop="-70dp"
android:alpha="0.3333333" android:alpha="0.3333333"
android:src="@mipmap/ic_launcher" /> android:src="@mipmap/ic_launcher" />




+ 6
- 3
app/src/main/res/layout/tunnel_list_item.xml View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">


<data> <data>


@@ -44,7 +45,8 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="@{key}" />
android:text="@{key}"
tools:text="@sample/interface_names.json/names/names/name" />


<com.wireguard.android.widget.ToggleSwitch <com.wireguard.android.widget.ToggleSwitch
android:id="@+id/tunnel_switch" android:id="@+id/tunnel_switch"
@@ -54,6 +56,7 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:nextFocusLeft="@+id/tunnel_list_item" android:nextFocusLeft="@+id/tunnel_list_item"
app:checked="@{item.state == State.UP}" app:checked="@{item.state == State.UP}"
app:onBeforeCheckedChanged="@{fragment::setTunnelState}" />
app:onBeforeCheckedChanged="@{fragment::setTunnelState}"
tools:checked="@sample/interface_names.json/names/checked/checked" />
</com.wireguard.android.widget.MultiselectableRelativeLayout> </com.wireguard.android.widget.MultiselectableRelativeLayout>
</layout> </layout>

+ 5
- 0
app/src/main/res/values-night/bools.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="light_status_bar">false</bool>
<bool name="light_navigation_bar">false</bool>
</resources>

+ 14
- 1
app/src/main/res/values-night/colors.xml View File

@@ -4,5 +4,18 @@
<color name="fab_label_text_color">#000000</color> <color name="fab_label_text_color">#000000</color>
<color name="fab_label_background_color">#bbbbbb</color> <color name="fab_label_background_color">#bbbbbb</color>


<color name="accent">#5e97f6</color>
<!-- Base palette -->
<color name="primary_color">#ff212121</color>
<color name="primary_light_color">#ff484848</color>
<color name="primary_dark_color">#ff000000</color>
<color name="secondary_color">#ff4285f4</color>
<color name="secondary_light_color">#ff80b4ff</color>
<color name="secondary_dark_color">#ff0059c1</color>
<color name="primary_text_color">#ffffffff</color>
<color name="secondary_text_color">#ffffffff</color>

<!-- Theme variables -->
<color name="list_multiselect_background">#1aeeeeee</color>
<color name="status_bar_color">#21242424</color>
<color name="navigation_bar_color">#aa242424</color>
</resources> </resources>

+ 28
- 0
app/src/main/res/values-v27/styles.xml View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
<item name="colorPrimary">@color/primary_color</item>
<item name="colorOnPrimary">@color/color_control_normal</item>
<item name="colorPrimaryDark">@color/primary_color</item>
<item name="colorPrimaryVariant">@color/primary_light_color</item>
<item name="colorSecondary">@color/secondary_color</item>
<item name="colorOnSecondary">@color/secondary_text_color</item>
<item name="colorSurface">@color/primary_color</item>
<item name="colorOnSurface">@color/color_control_normal</item>
<item name="colorBackground">@color/primary_color</item>
<item name="colorControlNormal">@color/color_control_normal</item>
<item name="colorMultiselectActiveBackground">@color/list_multiselect_background</item>
<item name="elevationOverlayColor">@color/primary_light_color</item>
<item name="elevationOverlayEnabled">true</item>
<item name="android:colorBackground">@color/primary_color</item>
<item name="android:navigationBarColor">@color/navigation_bar_color</item>
<item name="android:statusBarColor">@color/status_bar_color</item>
<item name="android:windowLightNavigationBar">@bool/light_navigation_bar</item>
<item name="android:windowLightStatusBar">@bool/light_status_bar</item>
<item name="android:windowBackground">@color/primary_color</item>
<item name="alertDialogTheme">@style/AppTheme.Dialog</item>
<item name="materialAlertDialogTheme">@style/AppTheme.Dialog</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.MaterialComponents.ActionBar</item>
</style>
</resources>

+ 5
- 0
app/src/main/res/values/attrs.xml View File

@@ -2,5 +2,10 @@
<resources> <resources>
<declare-styleable name="Multiselected"> <declare-styleable name="Multiselected">
<attr name="state_multiselected" format="boolean" /> <attr name="state_multiselected" format="boolean" />
<attr name="colorMultiselectActiveBackground" format="reference|color"/>
</declare-styleable>

<declare-styleable name="custom_color">
<attr name="colorBackground" format="reference|color"/>
</declare-styleable> </declare-styleable>
</resources> </resources>

+ 5
- 0
app/src/main/res/values/bools.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="light_status_bar">true</bool>
<bool name="light_navigation_bar">true</bool>
</resources>

+ 19
- 2
app/src/main/res/values/colors.xml View File

@@ -1,8 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- TODO(msf): remove these 2 hard-coded colors and replace with theme colors --> <!-- TODO(msf): remove these 2 hard-coded colors and replace with theme colors -->
<color name="fab_label_text_color">#ffffff</color> <color name="fab_label_text_color">#ffffff</color>
<color name="fab_label_background_color">#444444</color> <color name="fab_label_background_color">#444444</color>


<color name="accent">#2196F3</color>
<!-- Base palette -->
<color name="primary_color">#ffffffff</color>
<color name="primary_light_color">#ffffffff</color>
<color name="primary_dark_color">#ffcccccc</color>
<color name="secondary_color">#ff1a73e8</color>
<color name="secondary_light_color">#ff1a73e8</color>
<color name="secondary_dark_color">#ff1a73e8</color>
<color name="primary_text_color">#ff000000</color>
<color name="secondary_text_color">#ffffffff</color>

<!-- Theme variables -->
<color name="color_control_normal">@color/primary_text_color</color>
<color name="status_bar_color">@color/primary_color</color>
<color name="navigation_bar_color">#aaffffff</color>
<color name="list_multiselect_background">#ffeeeeee</color>
<color name="mtrl_textinput_default_box_stroke_color" tools:override="true">@color/secondary_color</color>
<color name="white">#ffffffff</color>

</resources> </resources>

+ 25
- 2
app/src/main/res/values/styles.xml View File

@@ -1,8 +1,31 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">


<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorAccent">@color/accent</item>
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
<item name="colorPrimary">@color/primary_color</item>
<item name="colorOnPrimary">@color/color_control_normal</item>
<item name="colorPrimaryDark">@color/primary_color</item>
<item name="colorPrimaryVariant">@color/primary_light_color</item>
<item name="colorSecondary">@color/secondary_color</item>
<item name="colorOnSecondary">@color/secondary_text_color</item>
<item name="colorSurface">@color/primary_color</item>
<item name="colorOnSurface">@color/color_control_normal</item>
<item name="colorBackground">@color/primary_color</item>
<item name="colorMultiselectActiveBackground">@color/list_multiselect_background</item>
<item name="colorControlNormal">@color/color_control_normal</item>
<item name="elevationOverlayColor">@color/primary_light_color</item>
<item name="elevationOverlayEnabled">true</item>
<item name="android:statusBarColor">@color/status_bar_color</item>
<item name="android:windowBackground">@color/primary_color</item>
<item name="alertDialogTheme">@style/AppTheme.Dialog</item>
<item name="materialAlertDialogTheme">@style/AppTheme.Dialog</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.MaterialComponents.ActionBar</item>
</style>

<style name="AppTheme.Dialog" parent="Theme.MaterialComponents.DayNight.Dialog.Alert">
<item name="colorPrimary">@color/secondary_color</item>
<item name="colorSecondary">@color/secondary_color</item>
<item name="android:windowBackground">?attr/colorBackground</item>
</style> </style>


<style name="NoBackgroundTheme" parent="AppTheme"> <style name="NoBackgroundTheme" parent="AppTheme">


+ 1
- 1
build.gradle View File

@@ -21,7 +21,7 @@ task clean(type: Delete) {


tasks { tasks {
wrapper { wrapper {
gradleVersion = "6.1"
gradleVersion = "6.1.1"
distributionType = Wrapper.DistributionType.ALL distributionType = Wrapper.DistributionType.ALL
} }
} }

+ 1
- 1
gradle/wrapper/gradle-wrapper.properties View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

Loading…
Cancel
Save