Skip to content

Commit

Permalink
Update to new colors (with dark mode!)
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed May 8, 2024
1 parent 54aaa4b commit a289bf7
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies {
implementation 'me.dm7.barcodescanner:zxing:1.9.13'
implementation 'com.beust:klaxon:5.5'
implementation 'com.squareup.okhttp3:okhttp:4.3.0'
implementation 'com.google.android.material:material:1.1.0-beta02'
implementation 'com.google.android.material:material:1.4.0'
implementation 'net.swiftzer.semver:semver:1.1.1'
implementation 'io.sentry:sentry-android:1.7.27'
implementation 'org.slf4j:slf4j-nop:1.7.25'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.view.MenuItem
import android.view.View
import android.widget.PopupMenu
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.widget.doAfterTextChanged
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import kotlinx.android.synthetic.main.apps_list.*
Expand Down Expand Up @@ -146,7 +147,7 @@ class ApplicationListActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefres
override fun onClick(v: View?) {
when (v?.id) {
R.id.apps_list_more_menu -> {
PopupMenu(this, apps_list_more_menu).apply {
PopupMenu(ContextThemeWrapper(this, R.style.PopupMenu), apps_list_more_menu).apply {
this.inflate(R.menu.menu_app_list)
this.menu.findItem(R.id.action_show_system).isChecked = showSystem
this.menu.findItem(R.id.action_show_enabled).isChecked = showEnabledOnly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Intent
import android.os.Bundle
import android.widget.PopupMenu
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.widget.doAfterTextChanged
import kotlinx.android.synthetic.main.ports_list.*
import kotlinx.coroutines.*
Expand Down Expand Up @@ -55,7 +56,7 @@ class PortListActivity : AppCompatActivity(), CoroutineScope by MainScope() {

// Show the menu, and listen for clicks:
ports_list_more_menu.setOnClickListener {
PopupMenu(this, ports_list_more_menu).apply {
PopupMenu(ContextThemeWrapper(this, R.style.PopupMenu), ports_list_more_menu).apply {
this.inflate(R.menu.menu_ports_list)

this.menu.findItem(R.id.action_reset_ports).isEnabled =
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/app_interception_status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
style="@style/ConnectionStatusButtonText"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:drawableStart="@drawable/ic_apps_24"
app:drawableStartCompat="@drawable/ic_apps_24"
android:text="@string/all_apps" />

</com.google.android.material.card.MaterialCardView>
Expand All @@ -47,7 +47,7 @@
style="@style/ConnectionStatusButtonText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_network_ports_24"
app:drawableStartCompat="@drawable/ic_network_ports_24"
android:text="@string/default_ports" />

</com.google.android.material.card.MaterialCardView>
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/res/layout/apps_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
app:cardBackgroundColor="#FFFFFF"

app:cardBackgroundColor="@color/textInputBackground"
app:cardCornerRadius="2dp"
app:cardElevation="4dp"
app:cardUseCompatPadding="true">
Expand All @@ -26,6 +27,8 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:textColor="@color/textInputColor"
android:textColorHint="@color/textInputPlaceholderColor"
android:hint="@string/all_applications"
android:padding="16dp"
android:textSize="18sp"
Expand All @@ -37,6 +40,7 @@
android:layout_height="wrap_content"
android:id="@+id/apps_list_more_menu"
android:padding="16dp"
app:tint="@color/textInputColor"
app:srcCompat="@drawable/ic_baseline_more_vert_24"
tools:ignore="ContentDescription" />
</LinearLayout>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/item_app_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
android:layout_toEndOf="@id/row_app_icon_image"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textColor="@color/textColor"
tools:text="@tools:sample/full_names" />

<TextView
Expand All @@ -37,6 +38,7 @@
android:maxLines="2"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textColor="@color/textColor"
tools:text="@tools:sample/lorem/random" />

<com.google.android.material.switchmaterial.SwitchMaterial
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/layout/item_port_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
android:layout_toStartOf="@id/row_port_delete"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textColor="@color/textColor"
tools:text="@tools:sample/us_phones" />

<TextView
Expand All @@ -26,6 +27,7 @@
android:maxLines="2"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textColor="@color/textColor"
tools:text="@tools:sample/lorem/random" />

<ImageView
Expand All @@ -36,6 +38,7 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:tint="@color/textColor"
android:minWidth="0dp"
android:minHeight="0dp" />
</RelativeLayout>
7 changes: 6 additions & 1 deletion app/src/main/res/layout/ports_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
app:cardBackgroundColor="#FFFFFF"

app:cardBackgroundColor="@color/textInputBackground"
app:cardCornerRadius="2dp"
app:cardElevation="4dp"
app:cardUseCompatPadding="true">
Expand All @@ -35,6 +36,8 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:textColor="@color/textInputColor"
android:textColorHint="@color/textInputPlaceholderColor"
android:hint="@string/add_port_prompt"
android:padding="16dp"
android:textSize="18sp"
Expand All @@ -51,6 +54,7 @@
android:layout_height="wrap_content"
android:minWidth="0dp"
android:minHeight="0dp"
app:tint="@color/textInputColor"
tools:ignore="ContentDescription,RtlSymmetry" />

<ImageView
Expand All @@ -59,6 +63,7 @@
android:layout_height="wrap_content"
android:padding="16dp"
android:paddingStart="8dp"
app:tint="@color/textInputColor"
app:srcCompat="@drawable/ic_baseline_more_vert_24"
tools:ignore="ContentDescription,RtlSymmetry" />
</LinearLayout>
Expand Down
21 changes: 21 additions & 0 deletions app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="textColor">#ffffff</color>
<color name="popColor">#e1421f</color>
<color name="lowLightColor">#9a9da8</color>

<color name="successColor">#4caf7d</color>
<color name="warningColor">#f1971f</color>

<color name="containerBackground">#1e2028</color>
<color name="mainBackground">#32343b</color>

<color name="primaryInputBackground">#2d4cbd</color>
<color name="primaryInputColor">#ffffff</color>

<color name="textInputBackground">#16181e</color>
<color name="textInputColor">#ffffff</color>
<color name="textInputPlaceholderColor">#818490</color>

<color name="transparent">#00000000</color>
</resources>
17 changes: 0 additions & 17 deletions app/src/main/res/values-v23/styles.xml

This file was deleted.

14 changes: 9 additions & 5 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="textColor">#222222</color>
<color name="textColor">#1e2028</color>
<color name="popColor">#e1421f</color>
<color name="lowLightColor">#808f8f</color>
<color name="lowLightColor">#818490</color>

<color name="successColor">#4caf7d</color>
<color name="warningColor">#f1971f</color>

<color name="containerBackground">#d8e2e6</color>
<color name="containerBackground">#e4e8ed</color>
<color name="mainBackground">#fafafa</color>

<color name="primaryInputBackground">#1076b9</color>
<color name="primaryInputColor">#fafafa</color>
<color name="primaryInputBackground">#2d4cbd</color>
<color name="primaryInputColor">#ffffff</color>

<color name="textInputBackground">#ffffff</color>
<color name="textInputColor">#1e2028</color>
<color name="textInputPlaceholderColor">#53565e</color>

<color name="transparent">#00000000</color>
</resources>
28 changes: 24 additions & 4 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
<resources>

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:textColor">@color/textColor</item>

<item name="android:windowBackground">@color/containerBackground</item>
<item name="android:colorBackground">@color/mainBackground</item>
<item name="android:statusBarColor">@color/containerBackground</item>
<item name="colorSurface">@color/containerBackground</item>

<item name="colorPrimary">@color/primaryInputBackground</item>
<item name="colorPrimaryDark">@color/primaryInputBackground</item>
<item name="colorPrimaryVariant">@color/primaryInputBackground</item>

<item name="colorOnPrimary">@color/primaryInputColor</item>
<item name="colorOnBackground">@color/textColor</item>
<item name="colorOnSurface">@color/textColor</item>

<item name="android:fontFamily">@font/lato</item>
<item name="android:textStyle">normal</item>
<item name="android:textAllCaps">false</item>
<item name="android:letterSpacing">0</item>

<item name="colorPrimary">@color/primaryInputBackground</item>
<item name="android:statusBarColor">@color/containerBackground</item>
<item name="materialAlertDialogTheme">@style/AlertDialogTheme</item>
</style>

<style name="StatusText" parent="@android:style/Widget.TextView">
Expand Down Expand Up @@ -74,6 +84,7 @@
</style>

<style name="ConnectionStatusCard" parent="@style/Widget.MaterialComponents.CardView">
<item name="cardBackgroundColor">@color/mainBackground</item>
<item name="cardElevation">0dp</item>
<item name="contentPadding">10dp</item>
<item name="android:layout_marginBottom">10dp</item>
Expand Down Expand Up @@ -118,4 +129,13 @@
<item name="android:textSize">12sp</item>
</style>

<style name="AlertDialogTheme" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
<item name="colorPrimary">@color/textColor</item>
</style>

<style name="PopupMenu" parent="Widget.AppCompat.PopupMenu">
<item name="android:background">@color/mainBackground</item>
<item name="android:textColor">@color/textColor</item>
</style>

</resources>

0 comments on commit a289bf7

Please sign in to comment.