use filled icons for the selected tabs
This commit is contained in:
parent
00f115df52
commit
1d1a887073
14 changed files with 57 additions and 17 deletions
|
@ -64,7 +64,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:7f288cc10b'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:971e86fcd2'
|
||||
implementation 'com.facebook.stetho:stetho:1.5.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'com.shawnlin:number-picker:2.4.6'
|
||||
|
|
|
@ -115,7 +115,6 @@ class MainActivity : SimpleActivity() {
|
|||
.build()
|
||||
}
|
||||
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
storeStateVariables()
|
||||
|
@ -229,22 +228,22 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
main_tabs_holder.onTabSelectionChanged(
|
||||
tabUnselectedAction = {
|
||||
updateBottomTabItemColors(it.customView, false)
|
||||
updateBottomTabItemColors(it.customView, false, getDeselectedTabDrawableIds()[it.position])
|
||||
},
|
||||
tabSelectedAction = {
|
||||
view_pager.currentItem = it.position
|
||||
updateBottomTabItemColors(it.customView, true)
|
||||
updateBottomTabItemColors(it.customView, true, getSelectedTabDrawableIds()[it.position])
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private fun setupTabColors() {
|
||||
val activeView = main_tabs_holder.getTabAt(view_pager.currentItem)?.customView
|
||||
updateBottomTabItemColors(activeView, true)
|
||||
updateBottomTabItemColors(activeView, true, getSelectedTabDrawableIds()[view_pager.currentItem])
|
||||
|
||||
getInactiveTabIndexes(view_pager.currentItem).forEach { index ->
|
||||
val inactiveView = main_tabs_holder.getTabAt(index)?.customView
|
||||
updateBottomTabItemColors(inactiveView, false)
|
||||
updateBottomTabItemColors(inactiveView, false, getDeselectedTabDrawableIds()[index])
|
||||
}
|
||||
|
||||
main_tabs_holder.getTabAt(view_pager.currentItem)?.select()
|
||||
|
@ -255,6 +254,20 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
private fun getInactiveTabIndexes(activeIndex: Int) = arrayListOf(0, 1, 2, 3).filter { it != activeIndex }
|
||||
|
||||
private fun getSelectedTabDrawableIds() = arrayOf(
|
||||
R.drawable.ic_clock_filled_vector,
|
||||
R.drawable.ic_alarm_filled_vector,
|
||||
R.drawable.ic_stopwatch_filled_vector,
|
||||
R.drawable.ic_hourglass_filled_vector
|
||||
)
|
||||
|
||||
private fun getDeselectedTabDrawableIds() = arrayOf(
|
||||
R.drawable.ic_clock_vector,
|
||||
R.drawable.ic_alarm_vector,
|
||||
R.drawable.ic_stopwatch_vector,
|
||||
R.drawable.ic_hourglass_vector
|
||||
)
|
||||
|
||||
private fun launchSettings() {
|
||||
startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
||||
}
|
||||
|
|
3
app/src/main/res/drawable/ic_alarm_filled_vector.xml
Normal file
3
app/src/main/res/drawable/ic_alarm_filled_vector.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="48" android:viewportHeight="48">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M24 43.9q-3.7 0-6.975-1.4-3.275-1.4-5.7-3.85-2.425-2.45-3.85-5.7-1.425-3.25-1.425-7 0-3.7 1.425-6.975Q8.9 15.7 11.325 13.25q2.425-2.45 5.7-3.85Q20.3 8 24 8q3.7 0 6.975 1.4 3.275 1.4 5.725 3.85 2.45 2.45 3.85 5.725 1.4 3.275 1.4 6.975 0 3.75-1.4 7t-3.85 5.7q-2.45 2.45-5.725 3.85Q27.7 43.9 24 43.9zm-1.35-26.4v8.6q0 0.3 0.1 0.55 0.1 0.25 0.35 0.5l5.95 5.95q0.4 0.4 1 0.4t1.05-0.45q0.45-0.45 0.45-1.05 0-0.6-0.45-1.05l-5.45-5.45v-8.05q0-0.6-0.425-1.025Q24.8 16 24.15 16q-0.65 0-1.075 0.425Q22.65 16.85 22.65 17.5zM5.7 13.65q-0.45 0.4-1.05 0.4-0.6 0-1.05-0.45-0.45-0.45-0.45-1.075T3.6 11.5l6.1-5.85q0.45-0.4 1.05-0.4 0.6 0 1.05 0.45 0.45 0.45 0.45 1.075T11.8 7.8zm36.6-0.05l-6.1-5.85q-0.45-0.4-0.45-1T36.2 5.7q0.4-0.4 1.025-0.4 0.625 0 1.075 0.4l6.1 5.85q0.45 0.4 0.45 1T44.4 13.6Q44 14 43.375 14q-0.625 0-1.075-0.4z"/>
|
||||
</vector>
|
|
@ -1,3 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:pathData="M10.04 6.29C10.66 6.11 11.32 6 12 6c3.86 0 7 3.14 7 7 0 0.68-0.11 1.34-0.29 1.96l1.56 1.56C20.74 15.44 21 14.25 21 13c0-4.97-4.03-9-9-9-1.25 0-2.44 0.26-3.53 0.72l1.57 1.57zm-6.33-3.5c-0.38-0.38-1-0.38-1.39 0L2.3 2.82c-0.39 0.39-0.39 1.01 0 1.39l0.68 0.68-0.17 0.14C2.39 5.37 2.34 5.99 2.68 6.41l0.03 0.03c0.35 0.42 0.96 0.47 1.38 0.12L4.4 6.31l0.8 0.8C3.83 8.69 3 10.75 3 13c0 4.97 4.03 9 9 9 2.25 0 4.31-0.83 5.89-2.2l1.41 1.41c0.38 0.38 1 0.38 1.39 0l0.03-0.03c0.38-0.38 0.38-1 0-1.39l-17.01-17zM12 20c-3.86 0-7-3.14-7-7 0-1.7 0.61-3.26 1.62-4.47l9.85 9.85C15.26 19.39 13.7 20 12 20zm7.91-13.44c0.42 0.35 1.03 0.29 1.38-0.12l0.03-0.03c0.35-0.42 0.29-1.03-0.12-1.38l-3.1-2.59c-0.42-0.35-1.03-0.29-1.38 0.12l-0.03 0.03c-0.35 0.42-0.29 1.03 0.12 1.38l3.1 2.59zM7.43 3.68c0.18-0.34 0.15-0.77-0.11-1.09L7.29 2.56c-0.3-0.36-0.8-0.43-1.2-0.22l1.34 1.34z" android:fillColor="#FFFFFF"/>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="48" android:viewportHeight="48">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M39.15 35l-2.25-2.25q0.85-1.55 1.25-3.275 0.4-1.725 0.4-3.525 0.1-6.4-4.45-10.65t-10.8-4.25q-1.7 0-3.375 0.4t-3.125 1.2l-2.2-2.2q2.05-1.25 4.2-1.825 2.15-0.575 4.5-0.575 3.75 0 7.075 1.375T36.2 13.2q2.5 2.4 3.95 5.675 1.45 3.275 1.4 7.075-0.05 2.35-0.65 4.65-0.6 2.3-1.75 4.4zM35.6 5.65q0.5-0.4 1.125-0.375Q37.35 5.3 37.8 5.75l6 5.75q0.5 0.45 0.5 1.1 0 0.65-0.5 1.15-0.5 0.5-1.15 0.5-0.65 0-1.15-0.5l-6.05-6.1q-0.4-0.4-0.325-1 0.075-0.6 0.475-1zm7.55 39.65q-0.45 0.45-1.075 0.45T41 45.3l-5.6-5.55q-2.4 2.2-5.45 3.225Q26.9 44 23.6 44q-3.7 0-6.95-1.425t-5.65-3.9q-2.4-2.475-3.8-5.75T5.8 25.9q0-3.2 1.15-6.15t3.15-5.45l-2.6-2.6-1.85 1.85Q5.2 14 4.55 13.975 3.9 13.95 3.45 13.5 3 13.05 3 12.375t0.45-1.125l1.8-1.8L2.8 7Q2.35 6.55 2.35 5.95q0-0.6 0.45-1.05 0.45-0.45 1.075-0.45T4.95 4.9l38.2 38.3q0.45 0.45 0.45 1.05 0 0.6-0.45 1.05zM23.6 40.9q2.6-0.05 5.05-0.925 2.45-0.875 4.5-2.525L12.1 16.4q-1.7 2.05-2.575 4.475Q8.65 23.3 8.65 25.95q0 6.25 4.3 10.65t10.65 4.3zm-0.95-14zm4.2-4.2z"/>
|
||||
</vector>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:pathData="M15.87 15.25l-3.37-2V8.72c0-0.4-0.32-0.72-0.72-0.72h-0.06C11.32 8 11 8.32 11 8.72v4.72c0 0.35 0.18 0.68 0.49 0.86l3.65 2.19c0.34 0.2 0.78 0.1 0.98-0.24 0.21-0.35 0.1-0.8-0.25-1zm5.31-10.24L18.1 2.45c-0.42-0.35-1.05-0.3-1.41 0.13C16.34 3 16.4 3.63 16.82 3.99l3.07 2.56c0.42 0.35 1.05 0.3 1.41-0.13 0.36-0.42 0.3-1.05-0.12-1.41zM4.1 6.55l3.07-2.56C7.6 3.63 7.66 3 7.3 2.58 6.95 2.15 6.32 2.1 5.9 2.45L2.82 5.01C2.4 5.37 2.34 6 2.7 6.42 3.05 6.85 3.68 6.9 4.1 6.55zM12 4c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9-4.03-9-9-9zm0 16c-3.86 0-7-3.14-7-7s3.14-7 7-7 7 3.14 7 7-3.14 7-7 7z" android:fillColor="#FFFFFFFF"/>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="48" android:viewportHeight="48">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M24 43.9q-3.7 0-6.975-1.4-3.275-1.4-5.7-3.825-2.425-2.425-3.85-5.7Q6.05 29.7 6.05 25.95q0-3.7 1.425-6.975Q8.9 15.7 11.325 13.25q2.425-2.45 5.7-3.85Q20.3 8 24 8q3.7 0 6.975 1.4 3.275 1.4 5.725 3.85 2.45 2.45 3.85 5.725 1.4 3.275 1.4 6.975 0 3.75-1.4 7.025-1.4 3.275-3.85 5.7-2.45 2.425-5.725 3.825Q27.7 43.9 24 43.9zm0-17.85zm-1.35-8.55v8.6q0 0.3 0.1 0.55 0.1 0.25 0.35 0.5l5.95 5.95q0.4 0.4 1 0.4t1.05-0.45q0.45-0.45 0.45-1.05 0-0.6-0.45-1.05l-5.45-5.45v-8.05q0-0.6-0.425-1.025Q24.8 16 24.15 16q-0.65 0-1.075 0.425Q22.65 16.85 22.65 17.5zM5.7 13.65q-0.45 0.4-1.05 0.4-0.6 0-1.05-0.45-0.45-0.45-0.45-1.075T3.6 11.5l6.1-5.85q0.45-0.4 1.05-0.4 0.6 0 1.05 0.45 0.45 0.45 0.45 1.075T11.8 7.8zm36.6-0.05l-6.1-5.85q-0.4-0.4-0.425-1Q35.75 6.15 36.2 5.7q0.4-0.4 1.025-0.4 0.625 0 1.075 0.4l6.1 5.85q0.4 0.4 0.425 1 0.025 0.6-0.425 1.05Q44 14 43.375 14q-0.625 0-1.075-0.4zM24 40.9q6.25 0 10.6-4.35t4.35-10.6q0-6.25-4.35-10.6T24 11q-6.25 0-10.6 4.35t-4.35 10.6q0 6.25 4.35 10.6T24 40.9z"/>
|
||||
</vector>
|
||||
|
|
9
app/src/main/res/drawable/ic_clock_small.xml
Normal file
9
app/src/main/res/drawable/ic_clock_small.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:width="@dimen/textview_drawable_size"
|
||||
android:height="@dimen/textview_drawable_size"
|
||||
android:drawable="@drawable/ic_clock_vector" />
|
||||
|
||||
</layer-list>
|
3
app/src/main/res/drawable/ic_hourglass_filled_vector.xml
Normal file
3
app/src/main/res/drawable/ic_hourglass_filled_vector.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="48" android:viewportHeight="48">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M8 44v-3h4.8v-6.35q0-3.5 1.825-6.425T19.7 24q-3.25-1.3-5.075-4.25Q12.8 16.8 12.8 13.3V7H8V4h32v3h-4.8v6.3q0 3.5-1.825 6.45T28.3 24q3.25 1.3 5.075 4.225Q35.2 31.15 35.2 34.65V41H40v3z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_hourglass_small.xml
Normal file
9
app/src/main/res/drawable/ic_hourglass_small.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:width="@dimen/textview_drawable_size"
|
||||
android:height="@dimen/textview_drawable_size"
|
||||
android:drawable="@drawable/ic_hourglass_vector" />
|
||||
|
||||
</layer-list>
|
|
@ -1,3 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:pathData="M8 2C6.9 2 6 2.9 6 4l0.01 3.18c0 0.53 0.21 1.03 0.58 1.41L10 12l-3.41 3.43c-0.37 0.37-0.58 0.88-0.58 1.41L6 20c0 1.1 0.9 2 2 2h8c1.1 0 2-0.9 2-2v-3.16c0-0.53-0.21-1.04-0.58-1.41L14 12l3.41-3.4C17.79 8.22 18 7.71 18 7.18V4c0-1.1-0.9-2-2-2H8zm8 14.91V19c0 0.55-0.45 1-1 1H9c-0.55 0-1-0.45-1-1v-2.09c0-0.27 0.11-0.52 0.29-0.71L12 12.5l3.71 3.71c0.18 0.18 0.29 0.44 0.29 0.7z" android:fillColor="#FFFFFFFF"/>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="48" android:viewportHeight="48">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M15.8 41h16.4v-6.35q0-3.5-2.375-6.025Q27.45 26.1 24 26.1t-5.825 2.525Q15.8 31.15 15.8 34.65zM24 21.9q3.45 0 5.825-2.525T32.2 13.3V7H15.8v6.3q0 3.55 2.375 6.075Q20.55 21.9 24 21.9zM8 44v-3h4.8v-6.35q0-3.5 1.825-6.425T19.7 24q-3.25-1.3-5.075-4.25Q12.8 16.8 12.8 13.3V7H8V4h32v3h-4.8v6.3q0 3.5-1.825 6.45T28.3 24q3.25 1.3 5.075 4.225Q35.2 31.15 35.2 34.65V41H40v3z"/>
|
||||
</vector>
|
||||
|
|
3
app/src/main/res/drawable/ic_stopwatch_filled_vector.xml
Normal file
3
app/src/main/res/drawable/ic_stopwatch_filled_vector.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="48" android:viewportHeight="48">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M19.5 5q-0.65 0-1.075-0.425Q18 4.15 18 3.5q0-0.65 0.425-1.075Q18.85 2 19.5 2h9q0.65 0 1.075 0.425Q30 2.85 30 3.5q0 0.65-0.425 1.075Q29.15 5 28.5 5zM24 27.35q0.65 0 1.075-0.425Q25.5 26.5 25.5 25.85v-8.5q0-0.65-0.425-1.075Q24.65 15.85 24 15.85q-0.65 0-1.075 0.425Q22.5 16.7 22.5 17.35v8.5q0 0.65 0.425 1.075Q23.35 27.35 24 27.35zm0 16.6q-3.7 0-6.975-1.425Q13.75 41.1 11.3 38.65q-2.45-2.45-3.875-5.725Q6 29.65 6 25.95q0-3.7 1.425-6.975Q8.85 15.7 11.3 13.25q2.45-2.45 5.725-3.875Q20.3 7.95 24 7.95q3.35 0 6.275 1.1 2.925 1.1 5.225 3.1l1.5-1.5q0.45-0.45 1.05-0.45 0.6 0 1.1 0.45 0.4 0.45 0.4 1.1 0 0.65-0.4 1.05l-1.5 1.5q1.8 2 3.075 4.85Q42 22 42 25.95q0 3.7-1.425 6.975Q39.15 36.2 36.7 38.65q-2.45 2.45-5.725 3.875Q27.7 43.95 24 43.95z"/>
|
||||
</vector>
|
|
@ -1,4 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M19.03 7.39l0.844-0.763c0.333-0.3 0.297-0.879-0.063-1.249-0.352-0.362-0.85-0.366-1.234-0.089L17.62 5.98C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-0.74-4.07-1.97-5.61zM12 20c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/>
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M13.003 12.099V8.094c0.002-0.547-0.44-1-1-1.002-0.547 0-0.993 0.448-1.002 1.002l-0.007 3.997c0 0.547 0.44 1 1.002 1.001 0.553 0.009 0.999-0.44 1.007-0.993zM9.992 3.234h4.005c0.547 0.001 1-0.44 1.001-1 0.001-0.547-0.448-0.994-1-1.002L10 1.225c-0.547 0-1 0.44-1.001 1.001-0.009 0.553 0.44 1 0.993 1.008z"/>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="48dp" android:height="48dp" android:viewportWidth="48" android:viewportHeight="48">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M19.5 5q-0.65 0-1.075-0.425Q18 4.15 18 3.5q0-0.65 0.425-1.075Q18.85 2 19.5 2h9q0.65 0 1.075 0.425Q30 2.85 30 3.5q0 0.65-0.425 1.075Q29.15 5 28.5 5zM24 27.35q0.65 0 1.075-0.425Q25.5 26.5 25.5 25.85v-8.5q0-0.65-0.425-1.075Q24.65 15.85 24 15.85q-0.65 0-1.075 0.425Q22.5 16.7 22.5 17.35v8.5q0 0.65 0.425 1.075Q23.35 27.35 24 27.35zm0 16.6q-3.7 0-6.975-1.425Q13.75 41.1 11.3 38.65q-2.45-2.45-3.875-5.725Q6 29.65 6 25.95q0-3.7 1.425-6.975Q8.85 15.7 11.3 13.25q2.45-2.45 5.725-3.875Q20.3 7.95 24 7.95q3.35 0 6.3 1.125 2.95 1.125 5.25 3.125l1.55-1.55q0.4-0.4 1-0.4t1.05 0.45q0.45 0.45 0.45 1.05 0 0.6-0.45 1.05l-1.5 1.5q1.8 2 3.075 4.85Q42 22 42 25.95q0 3.7-1.425 6.975Q39.15 36.2 36.7 38.65q-2.45 2.45-5.725 3.875Q27.7 43.95 24 43.95zm0-3q6.25 0 10.625-4.375T39 25.95q0-6.25-4.375-10.625T24 10.95q-6.25 0-10.625 4.375T9 25.95q0 6.25 4.375 10.625T24 40.95zM24 26z"/>
|
||||
</vector>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:drawableLeft="@drawable/ic_hourglass_vector"
|
||||
android:drawableLeft="@drawable/ic_hourglass_small"
|
||||
android:drawablePadding="@dimen/normal_margin"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
android:layout_below="@+id/clock_date"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:drawableLeft="@drawable/ic_alarm_vector"
|
||||
android:drawableLeft="@drawable/ic_clock_small"
|
||||
android:drawablePadding="@dimen/small_margin"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="@dimen/big_text_size"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<dimen name="fab_list_bottom_padding">68dp</dimen>
|
||||
<dimen name="timer_button_small_size">50dp</dimen>
|
||||
<dimen name="timer_button_size">56dp</dimen>
|
||||
<dimen name="textview_drawable_size">24dp</dimen>
|
||||
|
||||
<dimen name="clock_text_size">70sp</dimen>
|
||||
<dimen name="clock_text_size_smaller">60sp</dimen>
|
||||
|
|
Loading…
Reference in a new issue