Update UI: a concept for launching icon

This commit is contained in:
yuhan6665
2023-08-13 15:01:07 -04:00
parent 0bf8beda94
commit 4b4f5d145b
14 changed files with 50 additions and 17 deletions

View File

@@ -38,12 +38,18 @@ class WidgetProvider : AppWidgetProvider() {
})
remoteViews.setOnClickPendingIntent(R.id.layout_switch, pendingIntent)
if (isRunning) {
if (!Utils.getDarkModeStatus(context)) {
remoteViews.setInt(R.id.image_switch, "setImageResource", R.drawable.ic_stat_name)
}
remoteViews.setInt(
R.id.layout_switch,
"setBackgroundResource",
R.drawable.ic_rounded_corner_theme
R.drawable.ic_rounded_corner_active
)
} else {
if (!Utils.getDarkModeStatus(context)) {
remoteViews.setInt(R.id.image_switch, "setImageResource", R.drawable.ic_stat_name_black)
}
remoteViews.setInt(
R.id.layout_switch,
"setBackgroundResource",

View File

@@ -131,11 +131,17 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
mainViewModel.isRunning.observe(this) { isRunning ->
adapter.isRunning = isRunning
if (isRunning) {
binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.colorSelected))
if (!Utils.getDarkModeStatus(this)) {
binding.fab.setImageResource(R.drawable.ic_stat_name)
}
binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.color_fab_orange))
setTestState(getString(R.string.connection_connected))
binding.layoutTest.isFocusable = true
} else {
binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.colorUnselected))
if (!Utils.getDarkModeStatus(this)) {
binding.fab.setImageResource(R.drawable.ic_stat_name_black)
}
binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.color_fab_grey))
setTestState(getString(R.string.connection_not_connected))
binding.layoutTest.isFocusable = false
}

View File

@@ -9,7 +9,7 @@
android:bottom="2dp" />
<item
android:drawable="@drawable/ic_stat_name_grey"
android:drawable="@drawable/ic_stat_name"
android:left="12dp"
android:top="12dp"
android:right="12dp"

View File

@@ -5,14 +5,14 @@
android:viewportHeight="48">
<path
android:fillColor="#999999"
android:fillColor="@color/colorBg"
android:pathData="M24,24m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0Z" />
<path
android:fillColor="#ffffff"
android:fillColor="@color/colorText"
android:pathData="M24,21.8 C25.7673,21.8,27.2,23.2327,27.2,25 C27.2,26.7673,25.7673,28.2,24,28.2
C22.2327,28.2,20.8,26.7673,20.8,25 C20.8,23.2327,22.2327,21.8,24,21.8 Z" />
<path
android:fillColor="#ffffff"
android:fillColor="@color/colorText"
android:pathData="M21,15 L19.17,17 L16,17 A2,2,0,0,0,14,19 L14,31 A2,2,0,0,0,16,33 L32,33
A2,2,0,0,0,34,31 L34,19 A2,2,0,0,0,32,17 L28.83,17 L27,15 Z M24,30
A5,5,0,1,1,29,25 A5,5,0,0,1,24,30 Z" />

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/ic_shortcut_background"
android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp" />
<item
android:drawable="@drawable/ic_stat_name_black"
android:left="12dp"
android:top="12dp"
android:right="12dp"
android:bottom="12dp" />
</layer-list>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorSelected"/>
<solid android:color="@color/color_fab_orange"/>
<corners android:radius="20dp"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorUnselected"/>
<solid android:color="@color/color_fab_grey"/>
<corners android:radius="20dp"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape>

View File

@@ -2,6 +2,6 @@
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/colorUnselected" />
<solid android:color="@color/colorBg" />
<size android:width="44dp" android:height="44dp" />
</shape>

View File

@@ -91,7 +91,7 @@
android:clickable="true"
android:focusable="true"
android:nextFocusLeft="@+id/layout_test"
android:src="@drawable/ic_stat_name_grey"
android:src="@drawable/ic_stat_name"
app:layout_anchorGravity="bottom|right|end" />
</com.github.jorgecastilloprz.FABProgressCircle>

View File

@@ -8,8 +8,9 @@
android:orientation="vertical">
<ImageView
android:id="@+id/image_switch"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="10dp"
android:src="@drawable/ic_stat_name_grey" />
android:src="@drawable/ic_stat_name" />
</LinearLayout>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="color_fab_grey">#424242</color>
<color name="color_secondary">#BDBDBD</color>
<color name="colorSelected">#FFFFFF</color>
<color name="colorUnselected">#222222</color>

View File

@@ -4,6 +4,7 @@
<color name="colorPingRed">#FF0099</color>
<color name="color_fab_orange">#f97910</color>
<color name="color_fab_grey">#EDEDED</color>
<color name="color_secondary">#727272</color>
<color name="colorSelected">#000000</color>
<color name="colorUnselected">#FFFFFF</color>

View File

@@ -2,7 +2,7 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_qu_switch_black_24dp"
android:icon="@drawable/ic_qu_switch_24dp"
android:shortcutDisabledMessage="@string/app_widget_name"
android:shortcutId="shortcuts_switch"
android:shortcutLongLabel="@string/app_widget_name"
@@ -16,7 +16,7 @@
</shortcut>
<shortcut
android:enabled="true"
android:icon="@drawable/ic_qu_scan_black_24dp"
android:icon="@drawable/ic_qu_scan_24dp"
android:shortcutDisabledMessage="@string/menu_item_import_config_qrcode"
android:shortcutId="shortcuts_scan"
android:shortcutLongLabel="@string/menu_item_import_config_qrcode"
@@ -30,7 +30,7 @@
</shortcut>
<shortcut
android:enabled="true"
android:icon="@drawable/ic_qu_settings_black_24dp"
android:icon="@drawable/ic_qu_settings_24dp"
android:shortcutDisabledMessage="@string/title_settings"
android:shortcutId="shortcuts_settings"
android:shortcutLongLabel="@string/title_settings"