From cf00e2f442054ecbf2b0ffc6d4f9b152ead7e7c0 Mon Sep 17 00:00:00 2001 From: Deep Vora <70479785+deeppp15@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:00:13 -0500 Subject: [PATCH 01/16] surveys: smoother numbers (fixes #4833) (#4842) Co-authored-by: dogi --- app/build.gradle | 4 +-- .../planet/myplanet/model/RealmSubmission.kt | 27 ++++++++++++++----- .../myplanet/ui/survey/AdapterSurvey.kt | 4 +-- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 04da2d8270..c8fdf45da2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2127 - versionName "0.21.27" + versionCode 2128 + versionName "0.21.28" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/model/RealmSubmission.kt b/app/src/main/java/org/ole/planet/myplanet/model/RealmSubmission.kt index ba34e3b34b..f36ec0262c 100644 --- a/app/src/main/java/org/ole/planet/myplanet/model/RealmSubmission.kt +++ b/app/src/main/java/org/ole/planet/myplanet/model/RealmSubmission.kt @@ -204,12 +204,25 @@ open class RealmSubmission : RealmObject() { } } + fun generateParentId(courseId: String?, examId: String?): String? { + return if (!examId.isNullOrEmpty()) { + if (!courseId.isNullOrEmpty()) { + "$examId@$courseId" + } else { + examId + } + } else { + null + } + } + @JvmStatic - fun getNoOfSubmissionByUser(id: String?, userId: String?, mRealm: Realm): String { + fun getNoOfSubmissionByUser(id: String?, courseId:String?, userId: String?, mRealm: Realm): String { if (id == null || userId == null) return "No Submissions Found" - + val submissionParentId= generateParentId(courseId, id) + if(submissionParentId.isNullOrEmpty()) return "No Submissions Found" val submissionCount = mRealm.where(RealmSubmission::class.java) - .equalTo("parentId", id) + .equalTo("parentId", submissionParentId) .equalTo("userId", userId) .equalTo("status", "complete") .count().toInt() @@ -230,15 +243,15 @@ open class RealmSubmission : RealmObject() { } @JvmStatic - fun getRecentSubmissionDate(id: String?, userId: String?, mRealm: Realm): String { + fun getRecentSubmissionDate(id: String?, courseId:String?, userId: String?, mRealm: Realm): String { if (id == null || userId == null) return "" - + val submissionParentId= generateParentId(courseId, id) + if(submissionParentId.isNullOrEmpty()) return "" val recentSubmission = mRealm.where(RealmSubmission::class.java) - .equalTo("parentId", id) + .equalTo("parentId", submissionParentId) .equalTo("userId", userId) .sort("startTime", Sort.DESCENDING) .findFirst() - return recentSubmission?.startTime?.let { TimeUtils.getFormatedDateWithTime(it) } ?: "" } diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/survey/AdapterSurvey.kt b/app/src/main/java/org/ole/planet/myplanet/ui/survey/AdapterSurvey.kt index e4551d0ae7..b618711e36 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/survey/AdapterSurvey.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/survey/AdapterSurvey.kt @@ -85,8 +85,8 @@ class AdapterSurvey(private val context: Context, private val mRealm: Realm, pri startSurvey.visibility = View.GONE } - tvNoSubmissions.text = getNoOfSubmissionByUser(exam.id, user?.id, mRealm) - tvDateCompleted.text = getRecentSubmissionDate(exam.id, user?.id, mRealm) + tvNoSubmissions.text = getNoOfSubmissionByUser(exam.id, exam.courseId, user?.id, mRealm) + tvDateCompleted.text = getRecentSubmissionDate(exam.id, exam.courseId, user?.id, mRealm) tvDate.text = formatDate(RealmStepExam.getSurveyCreationTime(exam.id!!, mRealm)!!, "MMM dd, yyyy") } } From 8e3ad027fd7a7a8ded2a105634982586c6e6a020 Mon Sep 17 00:00:00 2001 From: Deep Vora <70479785+deeppp15@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:26:57 -0500 Subject: [PATCH 02/16] all: smoother dialogs (fixes #4844) (#4845) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../org/ole/planet/myplanet/utilities/DialogUtils.kt | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c8fdf45da2..9c10b15755 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2128 - versionName "0.21.28" + versionCode 2129 + versionName "0.21.29" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/utilities/DialogUtils.kt b/app/src/main/java/org/ole/planet/myplanet/utilities/DialogUtils.kt index 689468c50f..b9baf7fa7a 100644 --- a/app/src/main/java/org/ole/planet/myplanet/utilities/DialogUtils.kt +++ b/app/src/main/java/org/ole/planet/myplanet/utilities/DialogUtils.kt @@ -34,7 +34,7 @@ object DialogUtils { fun guestDialog(context: Context) { val profileDbHandler = UserProfileDbHandler(context) - val builder = android.app.AlertDialog.Builder(context, R.style.AlertDialogTheme) + val builder = android.app.AlertDialog.Builder(context, R.style.CustomAlertDialog) builder.setTitle(context.getString(R.string.become_a_member)) builder.setMessage(context.getString(R.string.to_access_this_feature_become_a_member)) builder.setCancelable(false) @@ -75,7 +75,7 @@ object DialogUtils { private fun showDialog(context: Context) { if (MainApplication.syncFailedCount > 3) { - val pd = AlertDialog.Builder(context) + val pd = AlertDialog.Builder(context, R.style.CustomAlertDialog) var message = if (NetworkUtils.isBluetoothEnabled()) "Bluetooth " else "" message += if (NetworkUtils.isWifiEnabled()) "Wifi " else "" message += context.getString(R.string.is_on_please_turn_of_to_save_battery) @@ -101,7 +101,7 @@ object DialogUtils { @JvmStatic fun showAlert(context: Context?, title: String?, message: String?) { if (context is Activity && !context.isFinishing) { - AlertDialog.Builder(context, R.style.AlertDialogTheme) + AlertDialog.Builder(context, R.style.CustomAlertDialog) .setTitle(title) .setMessage(message) .setPositiveButton(R.string.finish, null) @@ -111,7 +111,7 @@ object DialogUtils { @JvmStatic fun getAlertDialog(context: Context, message: String, pos: String, listener: DialogInterface.OnClickListener?): AlertDialog { - return AlertDialog.Builder(ContextThemeWrapper(context, R.style.AlertDialogTheme)) + return AlertDialog.Builder(ContextThemeWrapper(context, R.style.CustomAlertDialog)) .setMessage(message) .setIcon(R.drawable.courses) .setPositiveButton(pos, listener) @@ -130,7 +130,7 @@ object DialogUtils { @JvmStatic fun getAlertDialog(context: Context, title: String, v: View): AlertDialog { - return AlertDialog.Builder(ContextThemeWrapper(context, R.style.AlertDialogTheme)) + return AlertDialog.Builder(ContextThemeWrapper(context, R.style.CustomAlertDialog)) .setTitle(title) .setIcon(R.drawable.ic_edit) .setView(v) From f7307602c6d7b89dc989da8b4331ad9b27f00f8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:25:13 -0500 Subject: [PATCH 03/16] all: bump `dagger_hilt_version` to 2.53.1 (fixes #4854) (#4849) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dogi --- app/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9c10b15755..29c4904d8a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2129 - versionName "0.21.29" + versionCode 2130 + versionName "0.21.30" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true @@ -208,7 +208,7 @@ dependencies { implementation "androidx.camera:camera-lifecycle:$camera_version" implementation "androidx.camera:camera-view:$camera_version" - def dagger_hilt_version = "2.53" + def dagger_hilt_version = "2.53.1" implementation "com.google.dagger:hilt-android:$dagger_hilt_version" kapt "com.google.dagger:hilt-android-compiler:$dagger_hilt_version" From 5dfa28cbd7a9be0bc37d10e7f14960879a8340b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:28:55 -0500 Subject: [PATCH 04/16] all: bump `com.google.dagger:hilt-android-gradle-plugin` to 2.53.1 (fixes #4855) (#4850) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dogi --- app/build.gradle | 4 ++-- build.gradle | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 29c4904d8a..f9b7014f78 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2130 - versionName "0.21.30" + versionCode 2131 + versionName "0.21.31" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/build.gradle b/build.gradle index 757ea1c9ba..b4bfa63b58 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:8.7.3' classpath "io.realm:realm-gradle-plugin:10.19.0" - classpath "com.google.dagger:hilt-android-gradle-plugin:2.53" + classpath "com.google.dagger:hilt-android-gradle-plugin:2.53.1" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" // NOTE: Do not place your application dependencies here From 69bc403ec777942817e8f1a6dfc1b4e2dcf5bc07 Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Tue, 10 Dec 2024 22:40:06 +0300 Subject: [PATCH 05/16] chat: smoother sharing translations (fixes #4851) (#4852) Co-authored-by: dogi --- app/build.gradle | 4 +-- .../ui/chat/ChatHistoryListAdapter.kt | 26 +++++++++---------- app/src/main/res/values-ar/strings.xml | 3 +++ app/src/main/res/values-es/strings.xml | 3 +++ app/src/main/res/values-fr/strings.xml | 3 +++ app/src/main/res/values-ne/strings.xml | 3 +++ app/src/main/res/values-so/strings.xml | 3 +++ app/src/main/res/values/strings.xml | 3 +++ 8 files changed, 33 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f9b7014f78..d5f47c5b5b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2131 - versionName "0.21.31" + versionCode 2132 + versionName "0.21.32" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatHistoryListAdapter.kt b/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatHistoryListAdapter.kt index e86345f025..0aa57b9938 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatHistoryListAdapter.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatHistoryListAdapter.kt @@ -126,7 +126,7 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List chatShareDialogBinding.listView.setAdapter(expandableListAdapter) chatShareDialogBinding.listView.setOnChildClickListener { _, _, groupPosition, childPosition, _ -> - if (expandableTitleList[groupPosition] == "share with team/enterprise") { + if (expandableTitleList[groupPosition] == context.getString(R.string.share_with_team_enterprise)) { val teamList = mRealm.where(RealmMyTeam::class.java) .isEmpty("teamId").notEqualTo("status", "archived") .equalTo("type", "team").findAll() @@ -135,10 +135,10 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List .isEmpty("teamId").notEqualTo("status", "archived") .equalTo("type", "enterprise").findAll() - if (expandableDetailList[expandableTitleList[groupPosition]]?.get(childPosition) == "teams") { - showGrandChildRecyclerView(teamList, "teams", filteredChatHistory[position]) + if (expandableDetailList[expandableTitleList[groupPosition]]?.get(childPosition) == context.getString(R.string.teams)) { + showGrandChildRecyclerView(teamList, context.getString(R.string.teams), filteredChatHistory[position]) } else { - showGrandChildRecyclerView(enterpriseList, "enterprises", filteredChatHistory[position]) + showGrandChildRecyclerView(enterpriseList, context.getString(R.string.enterprises), filteredChatHistory[position]) } } else { settings = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE) @@ -146,7 +146,7 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List val communityName = settings?.getString("communityName", "") val teamId = "$communityName@$sParentcode" val community = mRealm.where(RealmMyTeam::class.java).equalTo("_id", teamId).findFirst() - showEditTextAndShareButton(community, "community", filteredChatHistory[position]) + showEditTextAndShareButton(community, context.getString(R.string.community), filteredChatHistory[position]) } dialog?.dismiss() false @@ -167,13 +167,13 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List val grandChildDialogBinding = GrandChildRecyclerviewDialogBinding.inflate(LayoutInflater.from(context)) var dialog: AlertDialog? = null - if (section == "teams") { + if (section == context.getString(R.string.teams)) { grandChildDialogBinding.title.text = context.getString(R.string.team) } else { grandChildDialogBinding.title.text = context.getString(R.string.enterprises) } val grandChildAdapter = GrandChildAdapter(items) { selectedItem -> - showEditTextAndShareButton(selectedItem, "teams", realmChatHistory) + showEditTextAndShareButton(selectedItem, context.getString(R.string.teams), realmChatHistory) dialog?.dismiss() } grandChildDialogBinding.recyclerView.layoutManager = LinearLayoutManager(context) @@ -181,7 +181,7 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List val builder = AlertDialog.Builder(context) builder.setView(grandChildDialogBinding.root) - builder.setPositiveButton("close") { _, _ -> + builder.setPositiveButton(context.getString(R.string.close)) { _, _ -> dialog?.dismiss() } dialog = builder.create() @@ -235,14 +235,14 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List private fun getData(): Map> { val expandableListDetail: MutableMap> = HashMap() val community: MutableList = ArrayList() - community.add("community") + community.add(context.getString(R.string.community)) val teams: MutableList = ArrayList() - teams.add("teams") - teams.add("enterprises") + teams.add(context.getString(R.string.teams)) + teams.add(context.getString(R.string.enterprises)) - expandableListDetail["share with community"] = community - expandableListDetail["share with team/enterprise"] = teams + expandableListDetail[context.getString(R.string.share_with_community)] = community + expandableListDetail[context.getString(R.string.share_with_team_enterprise)] = teams return expandableListDetail } diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 47eb0743ca..e6aaf8079f 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1207,5 +1207,8 @@ تم إلغاء التصدير. فشل في حفظ ملف CSV. تم حفظ ملف CSV بنجاح. + مشاركة مع الفريق/المؤسسة + فرق + مجتمع diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 3727d2c1a6..4f01459850 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1207,5 +1207,8 @@ exportación cancelada. error al guardar el archivo CSV. archivo CSV guardado con éxito. + compartir con el equipo/empresa + equipos + comunidad diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 5656636e18..c5e32d4b9a 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1207,5 +1207,8 @@ exportation annulée. échec de l\'enregistrement du fichier CSV. fichier CSV enregistré avec succès. + partager avec l\'équipe/l\'entreprise + équipes + communauté diff --git a/app/src/main/res/values-ne/strings.xml b/app/src/main/res/values-ne/strings.xml index 0b1baa8537..ed4b98b562 100644 --- a/app/src/main/res/values-ne/strings.xml +++ b/app/src/main/res/values-ne/strings.xml @@ -1207,5 +1207,8 @@ निर्यात रद्द गरियो। CSV फाइल सुरक्षित गर्न असफल। CSV फाइल सफलतापूर्वक सुरक्षित गरियो। + टोली/उद्यमसँग साझा गर्नुहोस् + टोलीहरू + समुदाय diff --git a/app/src/main/res/values-so/strings.xml b/app/src/main/res/values-so/strings.xml index 20d504d033..109e3c18bb 100644 --- a/app/src/main/res/values-so/strings.xml +++ b/app/src/main/res/values-so/strings.xml @@ -1207,5 +1207,8 @@ dhoofinta waa la joojiyay. waa lagu guuldareystay in la badbaadiyo faylka CSV. faylka CSV si guul leh ayaa loo keydiyay. + la wadaag kooxda/ganacsiga + kooxo + bulsho diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bdc706d8c1..29cb5e35ee 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1207,5 +1207,8 @@ export cancelled. failed to save CSV file. CSV file saved successfully. + share with team/enterprise + teams + community From 5d557627d450fb0b647337ee39f8fdb8b3189261 Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Wed, 11 Dec 2024 23:02:15 +0300 Subject: [PATCH 06/16] sync: smoother exceptions (fixes #4861) (#4864) Co-authored-by: dogi --- app/build.gradle | 4 +-- .../ui/sync/DashboardElementActivity.kt | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d5f47c5b5b..91d5b9712d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2132 - versionName "0.21.32" + versionCode 2133 + versionName "0.21.33" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt index f4e213c23d..d6e2042da8 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt @@ -20,9 +20,12 @@ import androidx.fragment.app.FragmentManager import androidx.lifecycle.lifecycleScope import androidx.localbroadcastmanager.content.LocalBroadcastManager import com.google.android.material.bottomnavigation.BottomNavigationView +import io.realm.Realm import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import org.ole.planet.myplanet.R import org.ole.planet.myplanet.callback.OnRatingChangeListener import org.ole.planet.myplanet.model.RealmUserChallengeActions.Companion.createAction @@ -121,10 +124,24 @@ abstract class DashboardElementActivity : SyncActivity(), FragmentManager.OnBack } fun logSyncInSharedPrefs() { - lifecycleScope.launch { - if (isServerReachable(Utilities.getUrl())) { - startUpload("dashboard") - createAction(mRealm, "${profileDbHandler.userModel?.id}", null, "sync") + lifecycleScope.launch(Dispatchers.IO + SupervisorJob()) { + try { + val isReachable = isServerReachable(Utilities.getUrl()) + if (isReachable) { + withContext(Dispatchers.Main) { + startUpload("dashboard") + } + + withContext(Dispatchers.IO) { + Realm.getDefaultInstance().use { realm -> + realm.executeTransaction { + createAction(realm, "${profileDbHandler.userModel?.id}", null, "sync") + } + } + } + } + } catch (e: Exception) { + e.printStackTrace() } } } From f3b9bc25fb8517b9f02bdd5c963d5a687cbcae97 Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Wed, 11 Dec 2024 23:18:05 +0300 Subject: [PATCH 07/16] all: smoother challenge (fixes #4865) (#4866) Co-authored-by: dogi --- app/build.gradle | 4 +- .../myplanet/base/BaseContainerFragment.kt | 35 ----------------- .../base/BaseContainerFragment.kt.lite | 39 +------------------ .../myplanet/ui/chat/ChatDetailFragment.kt | 3 -- .../planet/myplanet/ui/sync/SyncActivity.kt | 21 ---------- 5 files changed, 4 insertions(+), 98 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 91d5b9712d..2e74db8ed5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2133 - versionName "0.21.33" + versionCode 2134 + versionName "0.21.34" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt b/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt index 83545b2d85..f9b8db427b 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt @@ -29,8 +29,6 @@ import org.ole.planet.myplanet.base.PermissionActivity.Companion.hasInstallPermi import org.ole.planet.myplanet.callback.OnHomeItemClickListener import org.ole.planet.myplanet.callback.OnRatingChangeListener import org.ole.planet.myplanet.model.RealmMyLibrary -import org.ole.planet.myplanet.model.RealmUserChallengeActions -import org.ole.planet.myplanet.model.RealmUserChallengeActions.Companion.createAction import org.ole.planet.myplanet.service.UserProfileDbHandler import org.ole.planet.myplanet.service.UserProfileDbHandler.Companion.KEY_RESOURCE_DOWNLOAD import org.ole.planet.myplanet.service.UserProfileDbHandler.Companion.KEY_RESOURCE_OPEN @@ -152,29 +150,14 @@ abstract class BaseContainerFragment : BaseResourceFragment() { val filenameArray = items.resourceLocalAddress?.split("\\.".toRegex())?.toTypedArray() val extension = filenameArray?.get(filenameArray.size - 1) val mimetype = Utilities.getMimeType(items.resourceLocalAddress) - val userId = "${model?.id}" - - val existingAction = mRealm.where(RealmUserChallengeActions::class.java) - .equalTo("userId", userId) - .equalTo("resourceId", items.resourceId) - .findFirst() if (mimetype != null) { if (mimetype.contains("image")) { openIntent(items, ImageViewerActivity::class.java) - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } } else if (mimetype.contains("pdf")) { openPdf(items) - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } } else if (mimetype.contains("audio")) { openIntent(items, AudioPlayerActivity::class.java) - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } } else { checkMoreFileExtensions(extension, items) } @@ -182,35 +165,17 @@ abstract class BaseContainerFragment : BaseResourceFragment() { } private fun checkMoreFileExtensions(extension: String?, items: RealmMyLibrary) { - val userId = "${model?.id}" - val existingAction = mRealm.where(RealmUserChallengeActions::class.java) - .equalTo("userId", userId) - .equalTo("resourceId", items.resourceId) - .findFirst() - when (extension) { "txt" -> { - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } openIntent(items, TextFileViewerActivity::class.java) } "md" -> { - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } openIntent(items, MarkdownViewerActivity::class.java) } "csv" -> { - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } openIntent(items, CSVViewerActivity::class.java) } "apk" -> { - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } installApk(items) } else -> Toast.makeText(activity, getString(R.string.this_file_type_is_currently_unsupported), Toast.LENGTH_LONG).show() diff --git a/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt.lite b/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt.lite index 8a64f08109..2b983ca27f 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt.lite +++ b/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt.lite @@ -16,8 +16,8 @@ import android.widget.ArrayAdapter import android.widget.Button import android.widget.TextView import android.widget.Toast -import androidx.activity.result.ActivityResultLauncher -import androidx.activity.result.contract.ActivityResultContracts +//import androidx.activity.result.ActivityResultLauncher +//import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AlertDialog import androidx.appcompat.view.ContextThemeWrapper import androidx.appcompat.widget.AppCompatRatingBar @@ -29,8 +29,6 @@ import org.ole.planet.myplanet.R import org.ole.planet.myplanet.callback.OnHomeItemClickListener import org.ole.planet.myplanet.callback.OnRatingChangeListener import org.ole.planet.myplanet.model.RealmMyLibrary -import org.ole.planet.myplanet.model.RealmUserChallengeActions -import org.ole.planet.myplanet.model.RealmUserChallengeActions.Companion.createAction import org.ole.planet.myplanet.service.UserProfileDbHandler import org.ole.planet.myplanet.service.UserProfileDbHandler.Companion.KEY_RESOURCE_DOWNLOAD import org.ole.planet.myplanet.service.UserProfileDbHandler.Companion.KEY_RESOURCE_OPEN @@ -152,29 +150,14 @@ abstract class BaseContainerFragment : BaseResourceFragment() { val filenameArray = items.resourceLocalAddress?.split("\\.".toRegex())?.toTypedArray() val extension = filenameArray?.get(filenameArray.size - 1) val mimetype = Utilities.getMimeType(items.resourceLocalAddress) - val userId = "${model?.id}" - - val existingAction = mRealm.where(RealmUserChallengeActions::class.java) - .equalTo("userId", userId) - .equalTo("resourceId", items.resourceId) - .findFirst() if (mimetype != null) { if (mimetype.contains("image")) { openIntent(items, ImageViewerActivity::class.java) - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } } else if (mimetype.contains("pdf")) { openPdf(items) - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } } else if (mimetype.contains("audio")) { openIntent(items, AudioPlayerActivity::class.java) - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } } else { checkMoreFileExtensions(extension, items) } @@ -182,35 +165,17 @@ abstract class BaseContainerFragment : BaseResourceFragment() { } private fun checkMoreFileExtensions(extension: String?, items: RealmMyLibrary) { - val userId = "${model?.id}" - val existingAction = mRealm.where(RealmUserChallengeActions::class.java) - .equalTo("userId", userId) - .equalTo("resourceId", items.resourceId) - .findFirst() - when (extension) { "txt" -> { - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } openIntent(items, TextFileViewerActivity::class.java) } "md" -> { - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } openIntent(items, MarkdownViewerActivity::class.java) } "csv" -> { - if (existingAction == null) { - createAction(mRealm, userId, items.resourceId, "resourceOpen") - } openIntent(items, CSVViewerActivity::class.java) } // "apk" -> { -// if (existingAction == null) { -// createAction(mRealm, userId, items.resourceId, "resourceOpen") -// } // installApk(items) // } else -> Toast.makeText(activity, getString(R.string.this_file_type_is_currently_unsupported), Toast.LENGTH_LONG).show() diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatDetailFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatDetailFragment.kt index a1b1696a1b..98e5ba502d 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatDetailFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatDetailFragment.kt @@ -15,7 +15,6 @@ import org.ole.planet.myplanet.databinding.FragmentChatDetailBinding import org.ole.planet.myplanet.datamanager.* import org.ole.planet.myplanet.model.* import org.ole.planet.myplanet.model.RealmChatHistory.Companion.addConversationToChatHistory -import org.ole.planet.myplanet.model.RealmUserChallengeActions.Companion.createAction import org.ole.planet.myplanet.service.UserProfileDbHandler import org.ole.planet.myplanet.ui.dashboard.DashboardActivity import org.ole.planet.myplanet.utilities.Utilities @@ -342,8 +341,6 @@ class ChatDetailFragment : Fragment() { } (requireActivity() as? DashboardActivity)?.refreshChatHistoryList() } - - createAction(mRealm, "${user?.id}", "${response.body()?.couchDBResponse?.id}", "ai research") } else { fragmentChatDetailBinding.textGchatIndicator.visibility = View.VISIBLE fragmentChatDetailBinding.textGchatIndicator.text = if (response.message() == "null"){ diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/sync/SyncActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/sync/SyncActivity.kt index 10b8f3f4db..6f6efc9145 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/sync/SyncActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/sync/SyncActivity.kt @@ -6,7 +6,6 @@ import android.graphics.drawable.AnimationDrawable import android.os.Build import android.os.Bundle import android.text.* -import android.util.Log import android.view.* import android.webkit.URLUtil import android.widget.* @@ -38,7 +37,6 @@ import org.ole.planet.myplanet.datamanager.* import org.ole.planet.myplanet.datamanager.ApiClient.client import org.ole.planet.myplanet.datamanager.Service.* import org.ole.planet.myplanet.model.* -import org.ole.planet.myplanet.model.RealmUserChallengeActions.Companion.createAction import org.ole.planet.myplanet.service.* import org.ole.planet.myplanet.ui.dashboard.DashboardActivity import org.ole.planet.myplanet.ui.team.AdapterTeam.OnUserSelectedListener @@ -413,25 +411,6 @@ abstract class SyncActivity : ProcessUserDataActivity(), SyncListener, CheckVers fun onLogin() { val handler = UserProfileDbHandler(this) - - val userId = handler.userModel?.id - if (userId != null && userId.startsWith("guest") == false) { - Log.d("okuro", "called") - val latestAction = mRealm.where(RealmUserChallengeActions::class.java) - .equalTo("userId", userId).sort("time", Sort.DESCENDING).findFirst() - - val currentTime = System.currentTimeMillis() - val thresholdTime = 24 * 60 * 60 * 1000 - - if (latestAction == null) { - createAction(mRealm, userId, null, "login") - } else { - if (currentTime - latestAction.time >= thresholdTime) { - createAction(mRealm, userId, null, "login") - } - } - } - handler.onLogin() handler.onDestroy() editor.putBoolean(Constants.KEY_LOGIN, true).commit() From 8a22788d266e34fc3cb12c52a6c816b934cf6375 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:53:44 -0500 Subject: [PATCH 08/16] all: bump `camera_version` to 1.4.1 (fixes #4870) (#4868) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dogi --- app/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2e74db8ed5..f54d2cf864 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2134 - versionName "0.21.34" + versionCode 2135 + versionName "0.21.35" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true @@ -202,7 +202,7 @@ dependencies { implementation 'com.mikepenz:crossfadedrawerlayout:1.1.0@aar' implementation('com.mikepenz:materialdrawer:6.1.1@aar') { transitive = true} - def camera_version = "1.4.0" + def camera_version = "1.4.1" implementation "androidx.camera:camera-core:$camera_version" implementation "androidx.camera:camera-camera2:$camera_version" implementation "androidx.camera:camera-lifecycle:$camera_version" From ea6c5b799c982619464102c4d152e9fdd3291ec3 Mon Sep 17 00:00:00 2001 From: Deep Vora <70479785+deeppp15@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:54:09 -0500 Subject: [PATCH 09/16] resources: smoother list details (fixes #4860) (#4867) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../org/ole/planet/myplanet/ui/resources/AdapterResource.kt | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f54d2cf864..e5fb1900b6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2135 - versionName "0.21.35" + versionCode 2136 + versionName "0.21.36 ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/resources/AdapterResource.kt b/app/src/main/java/org/ole/planet/myplanet/ui/resources/AdapterResource.kt index a259a71a4a..e38f8b7491 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/resources/AdapterResource.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/resources/AdapterResource.kt @@ -72,6 +72,10 @@ class AdapterResource(private val context: Context, private var libraryList: Lis holder.bind() holder.rowLibraryBinding.title.text = libraryList[position]?.title setMarkdownText(holder.rowLibraryBinding.description, libraryList[position]?.description!!) + holder.rowLibraryBinding.description.setOnClickListener { + val library = libraryList[position] + openLibrary(library) + } holder.rowLibraryBinding.timesRated.text = context.getString(R.string.num_total, libraryList[position]?.timesRated) holder.rowLibraryBinding.checkbox.isChecked = selectedItems.contains(libraryList[position]) holder.rowLibraryBinding.checkbox.contentDescription = "${context.getString(R.string.selected)} ${libraryList[position]?.title}" From 05df61471fb4c2d9d3592c80004577d12d814444 Mon Sep 17 00:00:00 2001 From: Avinash Sharma <133222313+Avinash-Codes@users.noreply.github.com> Date: Sat, 14 Dec 2024 01:29:01 +0530 Subject: [PATCH 10/16] all: smoother guests navigation (fixes #4863) (#4869) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../ole/planet/myplanet/ui/sync/DashboardElementActivity.kt | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e5fb1900b6..a6db796229 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2136 - versionName "0.21.36 + versionCode 2137 + versionName "0.21.37" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt index d6e2042da8..3198454964 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt @@ -64,11 +64,7 @@ abstract class DashboardElementActivity : SyncActivity(), FragmentManager.OnBack 4 -> openEnterpriseFragment() 3 -> openCallFragment(TeamFragment(), "survey") 5 -> { - if (profileDbHandler.userModel?.isGuest() == true) { - showGuestUserDialog() - } else { - openCallFragment(CommunityTabFragment(), "community") - } + openCallFragment(CommunityTabFragment(), "community") } } } From ec65ffbc69293a7c877e4baaeb2cdb0390a7b44b Mon Sep 17 00:00:00 2001 From: Avinash Sharma <133222313+Avinash-Codes@users.noreply.github.com> Date: Sat, 14 Dec 2024 01:45:20 +0530 Subject: [PATCH 11/16] login: smoother avatar check (fixes #4872) (#4876) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../org/ole/planet/myplanet/base/BaseContainerFragment.kt | 4 +--- .../ole/planet/myplanet/base/BaseContainerFragment.kt.lite | 4 +--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a6db796229..6d45ec3f81 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2137 - versionName "0.21.37" + versionCode 2138 + versionName "0.21.38" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt b/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt index f9b8db427b..999d0b9662 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt @@ -77,9 +77,7 @@ abstract class BaseContainerFragment : BaseResourceFragment() { val url = Utilities.getUrl(library) if (!FileUtils.checkFileExist(url) && !TextUtils.isEmpty(url)) urls.add(url) } - if (urls.isNotEmpty()) startDownload(urls) else Utilities.toast( - activity, getString(R.string.no_images_to_download) - ) + if (urls.isNotEmpty()) startDownload(urls) } fun initRatingView(type: String?, id: String?, title: String?, listener: OnRatingChangeListener?) { timesRated = requireView().findViewById(R.id.times_rated) diff --git a/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt.lite b/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt.lite index 2b983ca27f..385b2c0c8a 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt.lite +++ b/app/src/main/java/org/ole/planet/myplanet/base/BaseContainerFragment.kt.lite @@ -77,9 +77,7 @@ abstract class BaseContainerFragment : BaseResourceFragment() { val url = Utilities.getUrl(library) if (!FileUtils.checkFileExist(url) && !TextUtils.isEmpty(url)) urls.add(url) } - if (urls.isNotEmpty()) startDownload(urls) else Utilities.toast( - activity, getString(R.string.no_images_to_download) - ) + if (urls.isNotEmpty()) startDownload(urls) } fun initRatingView(type: String?, id: String?, title: String?, listener: OnRatingChangeListener?) { timesRated = requireView().findViewById(R.id.times_rated) From 8cd3f2e5ea3f5617d33aa58488fd86ea09e9141b Mon Sep 17 00:00:00 2001 From: Avinash Sharma <133222313+Avinash-Codes@users.noreply.github.com> Date: Sat, 14 Dec 2024 01:52:49 +0530 Subject: [PATCH 12/16] login: smoother earth check (fixes #4875) (#4877) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../main/java/org/ole/planet/myplanet/datamanager/Service.kt | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6d45ec3f81..31e66973c2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2138 - versionName "0.21.38" + versionCode 2139 + versionName "0.21.39" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/datamanager/Service.kt b/app/src/main/java/org/ole/planet/myplanet/datamanager/Service.kt index de64caf55d..18a2b916af 100644 --- a/app/src/main/java/org/ole/planet/myplanet/datamanager/Service.kt +++ b/app/src/main/java/org/ole/planet/myplanet/datamanager/Service.kt @@ -307,7 +307,6 @@ class Service(private val context: Context) { }) { error: Throwable -> realm.close() error.printStackTrace() - callback.onSuccess("Unable to connect to planet earth") } } } @@ -315,7 +314,6 @@ class Service(private val context: Context) { override fun onFailure(call: Call, t: Throwable) { realm.close() - callback.onSuccess("Unable to connect to planet earth") } }) } From f3c7b3093ed5b02642f26eb0342af92ac3a3d2e3 Mon Sep 17 00:00:00 2001 From: Avinash Sharma <133222313+Avinash-Codes@users.noreply.github.com> Date: Sat, 14 Dec 2024 02:05:59 +0530 Subject: [PATCH 13/16] login: smoother permissions check (fixes #4873) (#4878) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../java/org/ole/planet/myplanet/base/PermissionActivity.kt | 4 +--- .../org/ole/planet/myplanet/base/PermissionActivity.kt.lite | 4 +--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 31e66973c2..f1fe17370b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2139 - versionName "0.21.39" + versionCode 2140 + versionName "0.21.40" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.kt b/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.kt index 5d516fd5b8..f623c37051 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.kt @@ -83,11 +83,9 @@ abstract class PermissionActivity : AppCompatActivity() { permissions.add(Manifest.permission.READ_EXTERNAL_STORAGE) } } - if (permissions.isNotEmpty()) { + if (permissions.isNotEmpty() && !checkPermission(Manifest.permission.RECORD_AUDIO) &&!checkPermission(Manifest.permission.CAMERA)) { val permissionsArray = permissions.toTypedArray() ActivityCompat.requestPermissions(this, permissionsArray, PERMISSION_REQUEST_CODE_FILE) - } else { - Toast.makeText(this, R.string.permissions_granted, Toast.LENGTH_SHORT).show() } } diff --git a/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.kt.lite b/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.kt.lite index 4229f08651..97ccedad8d 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.kt.lite +++ b/app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.kt.lite @@ -83,11 +83,9 @@ abstract class PermissionActivity : AppCompatActivity() { permissions.add(Manifest.permission.READ_EXTERNAL_STORAGE) } } - if (permissions.isNotEmpty()) { + if (permissions.isNotEmpty() && !checkPermission(Manifest.permission.RECORD_AUDIO) &&!checkPermission(Manifest.permission.CAMERA)) { val permissionsArray = permissions.toTypedArray() ActivityCompat.requestPermissions(this, permissionsArray, PERMISSION_REQUEST_CODE_FILE) - } else { - Toast.makeText(this, R.string.permissions_granted, Toast.LENGTH_SHORT).show() } } From aab286bde1a5d5a7d0dab9bcd611f577b07a039d Mon Sep 17 00:00:00 2001 From: Avinash Sharma <133222313+Avinash-Codes@users.noreply.github.com> Date: Wed, 18 Dec 2024 00:34:37 +0530 Subject: [PATCH 14/16] login: smoother mode handling (fixes #4879) (#4882) Co-authored-by: dogi Co-authored-by: Gideon Okuro --- app/build.gradle | 4 +- .../ole/planet/myplanet/ui/SettingActivity.kt | 77 ++++++++++++------ .../planet/myplanet/ui/sync/LoginActivity.kt | 5 ++ app/src/main/res/drawable/moon_24dp.png | Bin 0 -> 286 bytes app/src/main/res/drawable/moon_35.png | Bin 0 -> 408 bytes app/src/main/res/drawable/sun_24dp.png | Bin 0 -> 341 bytes app/src/main/res/drawable/sun_35.png | Bin 0 -> 427 bytes app/src/main/res/drawable/white_moon_24dp.png | Bin 0 -> 309 bytes .../res/layout-large-land/activity_login.xml | 15 +++- .../main/res/layout-night/activity_login.xml | 18 +++- .../res/layout-normal-land/activity_login.xml | 15 +++- .../res/layout-xlarge-land/activity_login.xml | 13 +++ app/src/main/res/layout/activity_login.xml | 18 +++- .../main/res/layout/custom_dialog_layout.xml | 21 +++++ app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-ne/strings.xml | 1 + app/src/main/res/values-so/strings.xml | 1 + 19 files changed, 154 insertions(+), 37 deletions(-) create mode 100644 app/src/main/res/drawable/moon_24dp.png create mode 100644 app/src/main/res/drawable/moon_35.png create mode 100644 app/src/main/res/drawable/sun_24dp.png create mode 100644 app/src/main/res/drawable/sun_35.png create mode 100644 app/src/main/res/drawable/white_moon_24dp.png create mode 100644 app/src/main/res/layout/custom_dialog_layout.xml diff --git a/app/build.gradle b/app/build.gradle index f1fe17370b..692cb22441 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2140 - versionName "0.21.40" + versionCode 2141 + versionName "0.21.41" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/SettingActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/SettingActivity.kt index 5a7f192220..68e8ac05f1 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/SettingActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/SettingActivity.kt @@ -10,8 +10,10 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import android.widget.ArrayAdapter +import android.widget.ListView import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.app.AppCompatDelegate import androidx.core.content.ContextCompat import androidx.preference.Preference import androidx.preference.Preference.OnPreferenceChangeListener @@ -23,6 +25,7 @@ import io.realm.Realm import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import org.ole.planet.myplanet.MainApplication.Companion.context import org.ole.planet.myplanet.MainApplication.Companion.mRealm import org.ole.planet.myplanet.MainApplication.Companion.setThemeMode import org.ole.planet.myplanet.R @@ -107,7 +110,7 @@ class SettingActivity : AppCompatActivity() { val darkMode = findPreference("dark_mode") darkMode?.setOnPreferenceClickListener { - darkMode() + darkMode(requireActivity()) true } @@ -267,36 +270,56 @@ class SettingActivity : AppCompatActivity() { dialog.show() } - private fun darkMode() { - val options = arrayOf(getString(R.string.dark_mode_off), getString(R.string.dark_mode_on), getString(R.string.dark_mode_follow_system)) - val currentMode = getCurrentThemeMode() - val checkedItem = when (currentMode) { - ThemeMode.LIGHT -> 0 - ThemeMode.DARK -> 1 - else -> 2 - } + companion object { + fun darkMode(context: Context) { + val options = arrayOf(context.getString(R.string.dark_mode_off), context.getString(R.string.dark_mode_on),context.getString(R.string.dark_mode_follow_system)) + val currentMode = getCurrentThemeMode(context) + val checkedItem = when (currentMode) { + ThemeMode.LIGHT -> 0 + ThemeMode.DARK -> 1 + else -> 2 + } - val builder = AlertDialog.Builder(requireContext()) - .setTitle(getString(R.string.select_theme_mode)) - .setSingleChoiceItems(ArrayAdapter(requireContext(), R.layout.checked_list_item, options), checkedItem) { dialog, which -> - val selectedMode = when (which) { - 0 -> ThemeMode.LIGHT - 1 -> ThemeMode.DARK - 2 -> ThemeMode.FOLLOW_SYSTEM - else -> ThemeMode.FOLLOW_SYSTEM + val builder = AlertDialog.Builder(context, R.style.CustomAlertDialogStyle) + .setTitle(context.getString(R.string.select_theme_mode)) + .setSingleChoiceItems(ArrayAdapter(context, R.layout.checked_list_item, options), checkedItem) { dialog, which -> + val selectedMode = when (which) { + 0 -> ThemeMode.LIGHT + 1 -> ThemeMode.DARK + 2 -> ThemeMode.FOLLOW_SYSTEM + else -> ThemeMode.FOLLOW_SYSTEM + } + setThemeMode(context, selectedMode) + dialog.dismiss() } - setThemeMode(selectedMode) - dialog.dismiss() - } - .setNegativeButton(R.string.cancel, null) + .setNegativeButton(R.string.cancel, null) - val dialog = builder.create() - dialog.show() - } + val dialog = builder.create() + dialog.show() - private fun getCurrentThemeMode(): String { - val sharedPreferences = requireContext().getSharedPreferences(PREFS_NAME, MODE_PRIVATE) - return sharedPreferences.getString("theme_mode", ThemeMode.FOLLOW_SYSTEM) ?: ThemeMode.FOLLOW_SYSTEM + val window = dialog.window + window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + } + + private fun getCurrentThemeMode(context: Context): String { + val sharedPreferences = context.getSharedPreferences(PREFS_NAME, MODE_PRIVATE) + return sharedPreferences.getString("theme_mode", ThemeMode.FOLLOW_SYSTEM) ?: ThemeMode.FOLLOW_SYSTEM + } + + private fun setThemeMode(context: Context, themeMode: String) { + val sharedPreferences = context.getSharedPreferences(PREFS_NAME, MODE_PRIVATE) + with(sharedPreferences.edit()) { + putString("theme_mode", themeMode) + apply() + } + AppCompatDelegate.setDefaultNightMode( + when (themeMode) { + ThemeMode.LIGHT -> AppCompatDelegate.MODE_NIGHT_NO + ThemeMode.DARK -> AppCompatDelegate.MODE_NIGHT_YES + else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM + } + ) + } } } diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.kt index 1432276248..d0eed59e4f 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.kt @@ -19,6 +19,7 @@ import org.ole.planet.myplanet.callback.SyncListener import org.ole.planet.myplanet.databinding.* import org.ole.planet.myplanet.datamanager.* import org.ole.planet.myplanet.model.* +import org.ole.planet.myplanet.ui.SettingActivity import org.ole.planet.myplanet.ui.community.HomeCommunityDialogFragment import org.ole.planet.myplanet.ui.feedback.FeedbackFragment import org.ole.planet.myplanet.ui.userprofile.* @@ -110,6 +111,10 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { } } }) + val selectDarkModeButton = findViewById(R.id.themeToggleButton) + selectDarkModeButton?.setOnClickListener{ + SettingActivity.SettingFragment.darkMode(this) + } } private fun declareElements() { diff --git a/app/src/main/res/drawable/moon_24dp.png b/app/src/main/res/drawable/moon_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..26ac0d8fa28e1f80a4dd55febfc97b12fc7bfb04 GIT binary patch literal 286 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GG!XV7ZFl!D-#RX3n z$B>FSXQ#gAI;_Cc>Ti}F+57(gE@gps(XCm*84C3|A5T9$!oa_Up@H!YgAKzbwh3`M z6ISfI%UG3Z#wqmWjLad)miG-cMh>Tr?1@>};NkC+tIcrHiaVUK*huZ92og3nJHd%sI^wwrqlyaX{{-_zM3O!LwEf*Zr{cfBRu$;IyzOFZrxy zA6t;_SNhK6a@>`>%NK>8w|E%qI_-S^oG*$Cr*y0Mx!A37x@7e!;mT=k500009a7bBm000XU z000XU0RWnu7ytkPN=ZaPRCt{2);~xaQ5?YWSAumZD1}bCxO6bMxD|9O(xI+y+NFa9 z{~?&grJbZ(g>D@zf(~xRQMv(V2liVak;*QhVrN>RJi+ew800000Li z#v-0sVa*~a3o9p`Jr z%LMF4z-bD^ZUOl$-|0Dm{C)yQ2gnz|ZB<1+2Li`Z;OGF?Wu06>ep4bH1=2?g@&@Nk zmB`#3W!>D%KHpYm2q$LSRq6eCW-buV^jW+Y0n_@K7&N`T8#5o)JG_T2JRRF54~R6BM|N$+FV ny25O@EuBR~;dT&m`q{Vx?500009a7bBm000XU z000XU0RWnu7ytkPT}ebiRCt{2mqBjAFc3v2WnI>=-~fd+s~)D@gk!{!+8zM7K!F8Z zq2&ayWS>ohel>F4M9H91$B8YGkw%sRQC`M>{=`IGbkTBPP7g@vg;&2Ipa?O=Pz1#E z?hOb<5R*QDAc3?21Vt$nWu?4`AbDPddr}uLnfSmY0#e%GiUv2yAE17dPL z$VF}2Whk~Uzuh&B{FTRPULBjZN7+ZXYivMFa+lfokZ5RI%Plg=TWn*Dh-p^w2=)By2EwXEuns0z{15|^RqM+1 z0|>q((R~K{@TCaa$G~8es+c-h(x8>`2^vz*bQ5g#<@;9R#XOS1sMRVwGcCh4e?z2v?gSDaa zu5>=JnJF?Byfm2(mhuMf{LBj~c>*od(Z)5-uon`z5YB!`pc*KD$7<*^-3A0sgXDw2 z3SOs>KVU96& + + android:layout_height="match_parent"> + + + + android:layout_height="match_parent"> + + + + + + + + diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index e6aaf8079f..ec55dc3ed6 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -30,6 +30,7 @@ تسجيل الخروج ملاحظات myPlanet + يختار مكتبتي دوراتي تجمعاتي diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 4f01459850..f899b86d94 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -30,6 +30,7 @@ Cerrar sesión Retroalimentación myPlanet + Seleccionar miBiblioteca misCursos misEncuentros diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index c5e32d4b9a..7e9dca5951 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -30,6 +30,7 @@ Déconnexion Retour d\'information myPlanet + Sélectionner maBibliothèque mesCours mesRencontres diff --git a/app/src/main/res/values-ne/strings.xml b/app/src/main/res/values-ne/strings.xml index ed4b98b562..20d2f9ff4f 100644 --- a/app/src/main/res/values-ne/strings.xml +++ b/app/src/main/res/values-ne/strings.xml @@ -30,6 +30,7 @@ लगआउट प्रतिक्रिया myPlanet + चयन गर्नुहोस् मेरो पुस्तकालय मेरो पाठ्यक्रमहरू मेरो मिठिङहरू diff --git a/app/src/main/res/values-so/strings.xml b/app/src/main/res/values-so/strings.xml index 109e3c18bb..4cc6778ff5 100644 --- a/app/src/main/res/values-so/strings.xml +++ b/app/src/main/res/values-so/strings.xml @@ -30,6 +30,7 @@ ka bax jawaab celin myPlanet + Dooro maktabadayda coursyadayda myMeetups From d23d288c07c424713834bf7158b6c9e058f51ef4 Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Tue, 17 Dec 2024 22:12:30 +0300 Subject: [PATCH 15/16] teams: smoother list message (fixes #4887) (#4888) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../java/org/ole/planet/myplanet/base/BaseRecyclerFragment.kt | 3 ++- .../main/java/org/ole/planet/myplanet/ui/team/TeamFragment.kt | 2 +- app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-ne/strings.xml | 1 + app/src/main/res/values-so/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 9 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 692cb22441..402b2213cd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2141 - versionName "0.21.41" + versionCode 2142 + versionName "0.21.42" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/base/BaseRecyclerFragment.kt b/app/src/main/java/org/ole/planet/myplanet/base/BaseRecyclerFragment.kt index 35746787be..25da0f5919 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/BaseRecyclerFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/base/BaseRecyclerFragment.kt @@ -302,7 +302,8 @@ abstract class BaseRecyclerFragment
  • : BaseRecyclerParentFragment(), On "discussions" -> (v as TextView).setText(R.string.no_news) "survey" -> (v as TextView).setText(R.string.no_surveys) "submission" -> (v as TextView).setText(R.string.no_submissions) - "teams" -> (v as TextView).setText(R.string.no_teams) + "team" -> (v as TextView).setText(R.string.no_teams) + "enterprise" -> (v as TextView).setText(R.string.no_enterprise) "chatHistory" -> (v as TextView).setText(R.string.no_chats) "feedback" -> (v as TextView).setText(R.string.no_feedback) else -> (v as TextView).setText(R.string.no_data_available_please_check_and_try_again) diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/team/TeamFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/team/TeamFragment.kt index 62bb743394..5cae9b86f5 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/team/TeamFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/team/TeamFragment.kt @@ -242,7 +242,7 @@ class TeamFragment : Fragment(), AdapterTeamList.OnClickTeamItem { fragmentTeamBinding.rvTeamList.adapter = adapterTeamList listContentDescription(conditionApplied) val itemCount = adapterTeamList.itemCount - showNoData(fragmentTeamBinding.tvMessage, itemCount, "teams") + showNoData(fragmentTeamBinding.tvMessage, itemCount, "$type") if (itemCount == 0) { fragmentTeamBinding.etSearch.visibility = View.GONE fragmentTeamBinding.tableTitle.visibility = View.GONE diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index ec55dc3ed6..405073d31a 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1211,5 +1211,6 @@ مشاركة مع الفريق/المؤسسة فرق مجتمع + المؤسسات غير متوفرة diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index f899b86d94..23c877cb17 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1211,5 +1211,6 @@ compartir con el equipo/empresa equipos comunidad + empresas no disponibles diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 7e9dca5951..045d857083 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1211,5 +1211,6 @@ partager avec l\'équipe/l\'entreprise équipes communauté + entreprises non disponibles diff --git a/app/src/main/res/values-ne/strings.xml b/app/src/main/res/values-ne/strings.xml index 20d2f9ff4f..d9920520c4 100644 --- a/app/src/main/res/values-ne/strings.xml +++ b/app/src/main/res/values-ne/strings.xml @@ -1211,5 +1211,6 @@ टोली/उद्यमसँग साझा गर्नुहोस् टोलीहरू समुदाय + उद्यमहरू उपलब्ध छैनन् diff --git a/app/src/main/res/values-so/strings.xml b/app/src/main/res/values-so/strings.xml index 4cc6778ff5..2f87ff661c 100644 --- a/app/src/main/res/values-so/strings.xml +++ b/app/src/main/res/values-so/strings.xml @@ -1211,5 +1211,6 @@ la wadaag kooxda/ganacsiga kooxo bulsho + ganacsiyo lama heli karo diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 29cb5e35ee..c23eed13c0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1210,5 +1210,6 @@ share with team/enterprise teams community + enteprises not available From 626dd23c589289054a45ab990125e9b6fe752339 Mon Sep 17 00:00:00 2001 From: Deep Vora <70479785+deeppp15@users.noreply.github.com> Date: Wed, 18 Dec 2024 14:28:34 -0500 Subject: [PATCH 16/16] all: smoother orientation change (fixes #4859) (#4871) Co-authored-by: dogi --- app/build.gradle | 4 +-- .../ole/planet/myplanet/MainApplication.kt | 33 +++++++++++++------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 402b2213cd..e489f37262 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2142 - versionName "0.21.42" + versionCode 2143 + versionName "0.21.43" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/MainApplication.kt b/app/src/main/java/org/ole/planet/myplanet/MainApplication.kt index a14ce8359e..70c0049d1f 100644 --- a/app/src/main/java/org/ole/planet/myplanet/MainApplication.kt +++ b/app/src/main/java/org/ole/planet/myplanet/MainApplication.kt @@ -5,6 +5,7 @@ import android.app.Application import android.content.Context import android.content.Intent import android.content.SharedPreferences +import android.content.res.Configuration import android.os.Bundle import android.os.StrictMode import android.os.StrictMode.VmPolicy @@ -55,7 +56,7 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks { private const val AUTO_SYNC_WORK_TAG = "autoSyncWork" private const val STAY_ONLINE_WORK_TAG = "stayOnlineWork" private const val TASK_NOTIFICATION_WORK_TAG = "taskNotificationWork" - lateinit var context: Context + lateinit var context: Context lateinit var mRealm: Realm lateinit var service: DatabaseService var preferences: SharedPreferences? = null @@ -111,10 +112,10 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks { } fun setThemeMode(themeMode: String) { - val sharedPreferences = context.getSharedPreferences("app_preferences", MODE_PRIVATE) + val sharedPreferences = context.getSharedPreferences(PREFS_NAME, MODE_PRIVATE) with(sharedPreferences.edit()) { putString("theme_mode", themeMode) - apply() + commit() } applyThemeMode(themeMode) } @@ -218,10 +219,8 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks { registerActivityLifecycleCallbacks(this) onAppStarted() - val sharedPreferences = getSharedPreferences("app_preferences", MODE_PRIVATE) - val themeMode = sharedPreferences.getString("theme_mode", ThemeMode.FOLLOW_SYSTEM) - - applyThemeMode(themeMode) + val savedThemeMode = getCurrentThemeMode() + applyThemeMode(savedThemeMode) isNetworkConnectedFlow.onEach { isConnected -> if (isConnected) { @@ -274,8 +273,17 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks { override fun onConfigurationChanged(newConfig: android.content.res.Configuration) { super.onConfigurationChanged(newConfig) - LocaleHelper.onAttach(this) - val currentNightMode = newConfig.uiMode and android.content.res.Configuration.UI_MODE_NIGHT_MASK + val currentNightMode = context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK + val isSystemNight= when (currentNightMode) { + Configuration.UI_MODE_NIGHT_YES -> true + Configuration.UI_MODE_NIGHT_NO -> false + else -> false + } + val savedThemeMode = getCurrentThemeMode() + if (savedThemeMode != ThemeMode.FOLLOW_SYSTEM) { + return + } + when (currentNightMode) { android.content.res.Configuration.UI_MODE_NIGHT_NO -> { applyThemeMode(ThemeMode.LIGHT) @@ -286,6 +294,11 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks { } } + private fun getCurrentThemeMode(): String { + val sharedPreferences = context.getSharedPreferences(PREFS_NAME, MODE_PRIVATE) + return sharedPreferences.getString("theme_mode", ThemeMode.FOLLOW_SYSTEM) ?: ThemeMode.FOLLOW_SYSTEM + } + override fun onActivityCreated(activity: Activity, bundle: Bundle?) {} override fun onActivityStarted(activity: Activity) { @@ -320,7 +333,7 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks { } } } - + private fun onAppBackgrounded() {} private fun onAppStarted() {