From 7c945bde2f5305da8dc804bad11644f9875e8c34 Mon Sep 17 00:00:00 2001 From: Hamza417 Date: Tue, 29 Aug 2023 19:52:49 +0530 Subject: [PATCH] Build91 - Fixed the crash that occurred unexpectedly --- app/build.gradle | 4 ++-- app/src/main/assets/html/changelogs.html | 7 ++++++- .../app/simple/inure/adapters/details/AdapterTags.kt | 12 ++++-------- .../searchview/SearchViewEventListener.java | 2 ++ .../app/simple/inure/ui/launcher/SplashScreen.kt | 11 ++++++++++- .../main/java/app/simple/inure/ui/panels/Search.kt | 4 ++++ app/src/main/res/values/strings.xml | 2 +- .../android/en-US/changelogs/{90.txt => 91.txt} | 0 8 files changed, 29 insertions(+), 13 deletions(-) rename fastlane/metadata/android/en-US/changelogs/{90.txt => 91.txt} (100%) diff --git a/app/build.gradle b/app/build.gradle index aacfb0109..1aaba604b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,8 +20,8 @@ android { applicationId "app.simple.inure" minSdkVersion 23 targetSdkVersion 34 - versionCode 90 - versionName "build90" + versionCode 91 + versionName "build91" vectorDrawables.useSupportLibrary = true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/assets/html/changelogs.html b/app/src/main/assets/html/changelogs.html index 4827b8c24..204f4da0e 100644 --- a/app/src/main/assets/html/changelogs.html +++ b/app/src/main/assets/html/changelogs.html @@ -13,7 +13,7 @@

Change Logs


(Current Version) -

Build90

+

Build91

@@ -73,6 +73,11 @@

Changes



+
+

+ Build90 was skipped. +

+
diff --git a/app/src/main/java/app/simple/inure/adapters/details/AdapterTags.kt b/app/src/main/java/app/simple/inure/adapters/details/AdapterTags.kt index 908c04e96..aec83b066 100644 --- a/app/src/main/java/app/simple/inure/adapters/details/AdapterTags.kt +++ b/app/src/main/java/app/simple/inure/adapters/details/AdapterTags.kt @@ -41,7 +41,7 @@ class AdapterTags(private val tags: ArrayList, private val showNewTag: B } override fun onBindViewHolder(holder: Holder, position: Int) { - if (tags.size == 0 || position == tags.size) { + if (position == tags.size && showNewTag) { holder.tag.text = holder.itemView.context.getString(R.string.add_tag) holder.tag.setChipIconResource(R.drawable.ic_add) holder.tag.chipStartPadding = 25F @@ -81,14 +81,10 @@ class AdapterTags(private val tags: ArrayList, private val showNewTag: B } override fun getItemCount(): Int { - return if (tags.size == 0) { - 1 + return if (showNewTag) { + tags.size.plus(1) } else { - if (showNewTag) { - tags.size.plus(1) - } else { - tags.size - } + tags.size } } diff --git a/app/src/main/java/app/simple/inure/decorations/searchview/SearchViewEventListener.java b/app/src/main/java/app/simple/inure/decorations/searchview/SearchViewEventListener.java index df62dbae6..a5cc483c0 100644 --- a/app/src/main/java/app/simple/inure/decorations/searchview/SearchViewEventListener.java +++ b/app/src/main/java/app/simple/inure/decorations/searchview/SearchViewEventListener.java @@ -29,4 +29,6 @@ public interface SearchViewEventListener { void onSearchTextChanged(@NotNull String keywords, int count); void onSearchRefreshPressed(View button); + + void onClear(View button); } diff --git a/app/src/main/java/app/simple/inure/ui/launcher/SplashScreen.kt b/app/src/main/java/app/simple/inure/ui/launcher/SplashScreen.kt index 81b526e24..a22c67bd8 100644 --- a/app/src/main/java/app/simple/inure/ui/launcher/SplashScreen.kt +++ b/app/src/main/java/app/simple/inure/ui/launcher/SplashScreen.kt @@ -60,6 +60,7 @@ class SplashScreen : ScopedFragment() { private var isFrequentlyUsedLoaded = false private var isBatteryOptimizationLoaded = false private var isBootManagerLoaded = false + private var isTagsLoaded = false private val launcherViewModel: LauncherViewModel by viewModels() @@ -172,6 +173,7 @@ class SplashScreen : ScopedFragment() { val batchViewModel = ViewModelProvider(requireActivity())[BatchViewModel::class.java] val notesViewModel = ViewModelProvider(requireActivity())[NotesViewModel::class.java] val apkBrowserViewModel = ViewModelProvider(requireActivity())[ApkBrowserViewModel::class.java] + val tagsViewModel = ViewModelProvider(requireActivity())[TagsViewModel::class.java] val batteryOptimizationViewModel = if (ConfigurationPreferences.isUsingRoot() || ConfigurationPreferences.isUsingShizuku()) { ViewModelProvider(requireActivity())[BatteryOptimizationViewModel::class.java] @@ -267,6 +269,12 @@ class SplashScreen : ScopedFragment() { openApp() } + tagsViewModel.getTags().observe(viewLifecycleOwner) { + Log.d(TAG, "Tags data loaded in ${(System.currentTimeMillis() - startTime) / 1000} seconds") + isTagsLoaded = true + openApp() + } + /** * One shell warning is enough, I guess!! * Skip the boot manager ones if the user has already seen the warning @@ -340,7 +348,8 @@ class SplashScreen : ScopedFragment() { isBatteryOptimizationLoaded && isBatchLoaded && isBootManagerLoaded && - isNotesLoaded + isNotesLoaded && + isTagsLoaded } private fun checkForPermission(): Boolean { diff --git a/app/src/main/java/app/simple/inure/ui/panels/Search.kt b/app/src/main/java/app/simple/inure/ui/panels/Search.kt index d8ae23137..1be2a0d85 100644 --- a/app/src/main/java/app/simple/inure/ui/panels/Search.kt +++ b/app/src/main/java/app/simple/inure/ui/panels/Search.kt @@ -232,6 +232,10 @@ class Search : KeyboardScopedFragment(), SharedPreferences.OnSharedPreferenceCha override fun onSearchRefreshPressed(button: View?) { searchViewModel.reload() } + + override fun onClear(button: View?) { + setTagsStripState("") + } }) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d9e82fa3b..1cc982219 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -699,6 +699,6 @@ Backup and Restore app\'s data. Import Tags - Assign a Tag + Add a New Tag New update available diff --git a/fastlane/metadata/android/en-US/changelogs/90.txt b/fastlane/metadata/android/en-US/changelogs/91.txt similarity index 100% rename from fastlane/metadata/android/en-US/changelogs/90.txt rename to fastlane/metadata/android/en-US/changelogs/91.txt