diff --git a/.github/android_build.yml b/.github/workflows/android_ci.yml similarity index 100% rename from .github/android_build.yml rename to .github/workflows/android_ci.yml diff --git a/.idea/compiler.xml b/.idea/compiler.xml index fb7f4a8..b73660a 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 4700283..4f801b7 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/app/src/main/java/www/thecodemonks/techbytes/ui/articles/ArticlesFragment.kt b/app/src/main/java/www/thecodemonks/techbytes/ui/articles/ArticlesFragment.kt index 4449c33..ddfdd8d 100644 --- a/app/src/main/java/www/thecodemonks/techbytes/ui/articles/ArticlesFragment.kt +++ b/app/src/main/java/www/thecodemonks/techbytes/ui/articles/ArticlesFragment.kt @@ -142,7 +142,7 @@ class ArticlesFragment : Fragment(R.layout.fragment_articles) { val isChecked = viewModel.readDataStore.first() val item = menu.findItem(R.id.action_night_mode) item.isChecked = isChecked - setUIMode(isChecked) + setUIMode(item, isChecked) } } @@ -156,20 +156,24 @@ class ArticlesFragment : Fragment(R.layout.fragment_articles) { R.id.action_night_mode -> { item.isChecked = !item.isChecked - setUIMode(item.isChecked) + setUIMode(item, item.isChecked) true } else -> super.onOptionsItemSelected(item) } } - private fun setUIMode(isChecked: Boolean) { + private fun setUIMode(item: MenuItem, isChecked: Boolean) { if (isChecked) { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) viewModel.saveToDataStore(true) + item.setIcon(R.drawable.ic_night) + } else { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) viewModel.saveToDataStore(false) + item.setIcon(R.drawable.ic_day) + } } diff --git a/app/src/main/res/drawable/ic_bookmarks.xml b/app/src/main/res/drawable/ic_bookmarks.xml new file mode 100644 index 0000000..a2ee518 --- /dev/null +++ b/app/src/main/res/drawable/ic_bookmarks.xml @@ -0,0 +1,46 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_day.xml b/app/src/main/res/drawable/ic_day.xml new file mode 100644 index 0000000..a676278 --- /dev/null +++ b/app/src/main/res/drawable/ic_day.xml @@ -0,0 +1,53 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_night.xml b/app/src/main/res/drawable/ic_night.xml new file mode 100644 index 0000000..54a5c89 --- /dev/null +++ b/app/src/main/res/drawable/ic_night.xml @@ -0,0 +1,46 @@ + + + + + + diff --git a/app/src/main/res/menu/menu.xml b/app/src/main/res/menu/menu.xml index 8b66a6e..60be34e 100644 --- a/app/src/main/res/menu/menu.xml +++ b/app/src/main/res/menu/menu.xml @@ -1,15 +1,41 @@ + + diff --git a/build.gradle b/build.gradle index 7595777..9b9120a 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.0-alpha12' + classpath 'com.android.tools.build:gradle:4.2.0-alpha13' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0"