From a4395df63a6ec34cdc927c1e2a4188bbace75ac1 Mon Sep 17 00:00:00 2001 From: rlam20 <52076121+rlam20@users.noreply.github.com> Date: Mon, 22 Jul 2024 13:54:31 -0400 Subject: [PATCH 01/13] mycourses: cleaner archive button (fixes #3888) (#3905) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../myplanet/ui/courses/CoursesFragment.kt | 24 +++++++++++++++++-- .../main/res/layout/fragment_my_course.xml | 6 ++--- app/src/main/res/values-ar/strings.xml | 2 ++ app/src/main/res/values-es/strings.xml | 2 ++ app/src/main/res/values-fr/strings.xml | 2 ++ app/src/main/res/values-ne/strings.xml | 2 ++ app/src/main/res/values-so/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 9 files changed, 39 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9fed27a93f..75ba052851 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1711 - versionName "0.17.11" + versionCode 1712 + versionName "0.17.12" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/courses/CoursesFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/courses/CoursesFragment.kt index eee4879e0b..26c94148de 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/courses/CoursesFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/courses/CoursesFragment.kt @@ -40,6 +40,7 @@ class CoursesFragment : BaseRecyclerFragment(), OnCourseItemSele private lateinit var etSearch: EditText private lateinit var adapterCourses: AdapterCourses private lateinit var btnRemove: Button + private lateinit var btnArchive: Button private lateinit var orderByDate: Button private lateinit var orderByTitle: Button private lateinit var selectAll: CheckBox @@ -80,8 +81,8 @@ class CoursesFragment : BaseRecyclerFragment(), OnCourseItemSele searchTags = ArrayList() initializeView() if (isMyCourseLib) { - tvDelete?.setText(R.string.archive) btnRemove.visibility = View.VISIBLE + btnArchive.visibility = View.VISIBLE checkList() } @@ -112,6 +113,22 @@ class CoursesFragment : BaseRecyclerFragment(), OnCourseItemSele } .setNegativeButton(R.string.no, null).show() } + btnArchive.setOnClickListener { + val alertDialogBuilder = AlertDialog.Builder(this.context) + val message = if (countSelected() == 1) { + R.string.are_you_sure_you_want_to_archive_this_course + } else { + R.string.are_you_sure_you_want_to_archive_these_courses + } + alertDialogBuilder.setMessage(message) + .setPositiveButton(R.string.yes) { _: DialogInterface?, _: Int -> + deleteSelected(true) + val newFragment = CoursesFragment() + recreateFragment(newFragment) + checkList() + } + .setNegativeButton(R.string.no, null).show() + } requireView().findViewById(R.id.btn_collections).setOnClickListener { val f = CollectionsFragment.getInstance(searchTags, "courses") @@ -153,6 +170,7 @@ class CoursesFragment : BaseRecyclerFragment(), OnCourseItemSele etSearch = requireView().findViewById(R.id.et_search) tvSelected = requireView().findViewById(R.id.tv_selected) btnRemove = requireView().findViewById(R.id.btn_remove) + btnArchive = requireView().findViewById(R.id.btn_archive) spnGrade = requireView().findViewById(R.id.spn_grade) spnSubject = requireView().findViewById(R.id.spn_subject) tvMessage = requireView().findViewById(R.id.tv_message) @@ -164,6 +182,7 @@ class CoursesFragment : BaseRecyclerFragment(), OnCourseItemSele if(userModel?.isGuest() == true){ tvAddToLib.visibility = View.GONE btnRemove.visibility = View.GONE + btnArchive.visibility = View.GONE selectAll.visibility = View.GONE } checkList() @@ -189,7 +208,7 @@ class CoursesFragment : BaseRecyclerFragment(), OnCourseItemSele requireView().findViewById(R.id.filter).visibility = View.GONE btnRemove.visibility = View.GONE tvSelected.visibility = View.GONE - tvDelete?.visibility = View.GONE + btnArchive.visibility = View.GONE } } @@ -260,6 +279,7 @@ class CoursesFragment : BaseRecyclerFragment(), OnCourseItemSele private fun changeButtonStatus() { tvAddToLib.isEnabled = (selectedItems?.size ?: 0) > 0 btnRemove.isEnabled = (selectedItems?.size ?: 0) > 0 + btnArchive.isEnabled = (selectedItems?.size ?: 0) > 0 if (adapterCourses.areAllSelected()) { selectAll.isChecked = true selectAll.text = getString(R.string.unselect_all) diff --git a/app/src/main/res/layout/fragment_my_course.xml b/app/src/main/res/layout/fragment_my_course.xml index ded24e34ce..989d02fc27 100644 --- a/app/src/main/res/layout/fragment_my_course.xml +++ b/app/src/main/res/layout/fragment_my_course.xml @@ -84,15 +84,15 @@ android:visibility="gone" app:drawableLeftCompat="@drawable/ic_delete" /> - %s %s %s %s %s + هل أنت متأكد أنك تريد أرشفة هذه الدورات؟ + هل أنت متأكد أنك تريد أرشفة هذه الدورة؟ diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 5829d69f63..cfe3a1f333 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1077,5 +1077,7 @@ %s %s %s %s %s %1$s (%2$d visitas) + ¿Está seguro de que desea archivar estos cursos? + ¿Estás seguro de que deseas archivar este curso? diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index bf12b92077..222850649c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1077,5 +1077,7 @@ %s %s %s %s %s %1$s (%2$d visites) + Etes-vous sûr de vouloir archiver ces cours ? + Êtes-vous sûr de vouloir archiver ce cours ? diff --git a/app/src/main/res/values-ne/strings.xml b/app/src/main/res/values-ne/strings.xml index 494df4ac53..3a50ec25d2 100644 --- a/app/src/main/res/values-ne/strings.xml +++ b/app/src/main/res/values-ne/strings.xml @@ -1077,5 +1077,7 @@ %s %s %s %s %s %1$s (%2$d भ्रमण) + के तपाइँ यी पाठ्यक्रमहरू संग्रह गर्न निश्चित हुनुहुन्छ? + के तपाइँ निश्चित हुनुहुन्छ कि तपाइँ यो पाठ्यक्रम संग्रह गर्न चाहनुहुन्छ? diff --git a/app/src/main/res/values-so/strings.xml b/app/src/main/res/values-so/strings.xml index bff862baee..30f007a1e8 100644 --- a/app/src/main/res/values-so/strings.xml +++ b/app/src/main/res/values-so/strings.xml @@ -1077,5 +1077,7 @@ %s %s %s %s %s %1$s (%2$d booqasho) + Ma hubtaa inaad rabto inaad kaydiso koorsooyinkan? + Ma hubtaa inaad rabto inaad kaydiso koorsadan? diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 80d394466d..51ebe32906 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1077,5 +1077,7 @@ %s %s %s %s %s %1$s (%2$d visits) + Are you sure you want to archive these courses? + Are you sure you want to archive this course? From 5311f1139accf94746a8ced488f8bfbf214b014a Mon Sep 17 00:00:00 2001 From: Elijah Whang <59347000+ewhang5@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:59:00 -0500 Subject: [PATCH 02/13] surveys: smoother submissions update (fixes #3897) (fixes #3896) (#3914) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../planet/myplanet/model/RealmSubmission.kt | 23 +++++++++---------- .../myplanet/ui/exam/TakeExamFragment.kt | 6 ++++- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 75ba052851..43fec00838 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1712 - versionName "0.17.12" + versionCode 1713 + versionName "0.17.13" 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 a235f6f2ff..6809c7b53c 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 @@ -115,7 +115,7 @@ open class RealmSubmission : RealmObject() { } } - fun serializeExamResult(mRealm: Realm, sub: RealmSubmission, context: Context): JsonObject { + private fun serializeExamResult(mRealm: Realm, sub: RealmSubmission, context: Context): JsonObject { val `object` = JsonObject() val user = mRealm.where(RealmUserModel::class.java).equalTo("id", sub.userId).findFirst() var examId = sub.parentId @@ -164,11 +164,11 @@ open class RealmSubmission : RealmObject() { @JvmStatic fun createSubmission(sub: RealmSubmission?, mRealm: Realm): RealmSubmission { - var sub = sub - if (sub == null || sub.status == "complete" && sub.type == "exam") sub = - mRealm.createObject(RealmSubmission::class.java, UUID.randomUUID().toString()) - sub!!.lastUpdateTime = Date().time - return sub + var submission = sub + if (submission == null || submission.status == "complete" && (submission.type == "exam" || submission.type == "survey")) + submission = mRealm.createObject(RealmSubmission::class.java, UUID.randomUUID().toString()) + submission!!.lastUpdateTime = Date().time + return submission } @JvmStatic @@ -188,12 +188,11 @@ open class RealmSubmission : RealmObject() { @JvmStatic fun getNoOfSubmissionByUser(id: String?, userId: String?, mRealm: Realm): String { - val submissionCount = mRealm.where(RealmSubmission::class.java).equalTo("parentId", id).equalTo("userId", userId).findAll().size - var pluralizedString: String? = null - if (submissionCount <= 1) { - pluralizedString = MainApplication.context.getString(R.string.time) - } else if (submissionCount > 1) { - pluralizedString = MainApplication.context.getString(R.string.times) + val submissionCount = mRealm.where(RealmSubmission::class.java).equalTo("parentId", id).equalTo("userId", userId).equalTo("status", "complete").findAll().size + val pluralizedString: String = if (submissionCount == 1) { + MainApplication.context.getString(R.string.time) + } else { + MainApplication.context.getString(R.string.times) } return MainApplication.context.getString(R.string.survey_taken) + " " + submissionCount + " " + pluralizedString } diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/exam/TakeExamFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/exam/TakeExamFragment.kt index 7ac0dc0a80..4f4278b3ea 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/exam/TakeExamFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/exam/TakeExamFragment.kt @@ -231,7 +231,11 @@ class TakeExamFragment : BaseExamFragment(), View.OnClickListener, CompoundButto val flag: Boolean startTransaction() sub?.status = if (currentIndex == (questions?.size ?: 0) - 1) { - "requires grading" + if (sub?.type == "survey") { + "complete" + } else { + "requires grading" + } } else { "pending" } From 969385640b7f2f49039adf3fe1a26eceda1151d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:04:08 -0400 Subject: [PATCH 03/13] all: bump `org.jetbrains.kotlinx:kotlinx-serialization-json` to 1.7.1 (fixes #3921) (#3916) 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 43fec00838..11f07313bb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1713 - versionName "0.17.13" + versionCode 1714 + versionName "0.17.14" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true @@ -141,7 +141,7 @@ dependencies { implementation 'org.osmdroid:osmdroid-android:6.1.18' implementation 'org.jetbrains:annotations:24.1.0' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2" + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1" implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.29' implementation 'com.mikepenz:google-material-typeface:3.0.1.1.original@aar' From 7575c4bd11a33b094cbfcf99e13f6bf366aa39ee Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Mon, 22 Jul 2024 21:09:58 +0300 Subject: [PATCH 04/13] all: better non-activity context handling (fixes #3915) (#3917) Co-authored-by: dogi --- app/build.gradle | 4 ++-- app/src/main/java/org/ole/planet/myplanet/MainApplication.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 11f07313bb..177d5339eb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1714 - versionName "0.17.14" + versionCode 1715 + versionName "0.17.15" 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 4eb0185d70..5136440cdd 100644 --- a/app/src/main/java/org/ole/planet/myplanet/MainApplication.kt +++ b/app/src/main/java/org/ole/planet/myplanet/MainApplication.kt @@ -213,7 +213,7 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks { mRealm.commitTransaction() val homeIntent = Intent(Intent.ACTION_MAIN) homeIntent.addCategory(Intent.CATEGORY_HOME) - homeIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP + homeIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK startActivity(homeIntent) } From e594a04d4355c85a80fa146f1b05da7e0a627955 Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Mon, 22 Jul 2024 21:14:44 +0300 Subject: [PATCH 05/13] teams: show name and type (fixes #3918) (#3919) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../org/ole/planet/myplanet/ui/team/TeamDetailFragment.kt | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 177d5339eb..f5ae815651 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1715 - versionName "0.17.15" + versionCode 1716 + versionName "0.17.16" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/team/TeamDetailFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/team/TeamDetailFragment.kt index b0897824f6..2e60b6b0ef 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/team/TeamDetailFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/team/TeamDetailFragment.kt @@ -35,6 +35,9 @@ class TeamDetailFragment : BaseTeamFragment() { tab.text = (fragmentTeamDetailBinding.viewPager2.adapter as TeamPagerAdapter).getPageTitle(position) }.attach() + fragmentTeamDetailBinding.title.text = team.name + fragmentTeamDetailBinding.subtitle.text = team.type + if (!isMyTeam) { fragmentTeamDetailBinding.llActionButtons.visibility = View.GONE } else { From 1e7202a374c38275964e5b11d647ccb5952aecdc Mon Sep 17 00:00:00 2001 From: Vivian Li <112584985+strawberrybread@users.noreply.github.com> Date: Tue, 23 Jul 2024 15:26:42 -0400 Subject: [PATCH 06/13] teams: smoother message reply (fixes #3827) (#3920) Co-authored-by: dogi --- app/build.gradle | 4 +-- .../planet/myplanet/ui/news/ReplyActivity.kt | 25 +++++++++++++------ .../planet/myplanet/utilities/FileUtils.kt | 2 ++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f5ae815651..b7afcbfe21 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1716 - versionName "0.17.16" + versionCode 1717 + versionName "0.17.17" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/news/ReplyActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/news/ReplyActivity.kt index 56c718d919..ad0053b375 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/news/ReplyActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/news/ReplyActivity.kt @@ -33,7 +33,6 @@ import org.ole.planet.myplanet.utilities.FileUtils.getFileNameFromUrl import org.ole.planet.myplanet.utilities.FileUtils.getImagePath import org.ole.planet.myplanet.utilities.FileUtils.getRealPathFromURI import org.ole.planet.myplanet.utilities.JsonUtils.getString -import org.ole.planet.myplanet.utilities.Utilities import java.io.File open class ReplyActivity : AppCompatActivity(), OnNewsItemClickListener { @@ -45,6 +44,7 @@ open class ReplyActivity : AppCompatActivity(), OnNewsItemClickListener { private lateinit var imageList: RealmList private var llImage: LinearLayout? = null private lateinit var openFolderLauncher: ActivityResultLauncher + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) activityReplyBinding = ActivityReplyBinding.inflate(layoutInflater) @@ -85,20 +85,29 @@ open class ReplyActivity : AppCompatActivity(), OnNewsItemClickListener { override fun addImage(llImage: LinearLayout?) { this.llImage = llImage val intent = Intent(Intent.ACTION_GET_CONTENT) - val uri = Uri.parse(Utilities.SD_PATH) - intent.setDataAndType(uri, "*/*") - openFolderLauncher.launch(Intent.createChooser(intent, "Open folder")) + intent.type = "image/*" + openFolderLauncher.launch(Intent.createChooser(intent, "Select Image")) } private fun handleImageSelection(url: Uri?) { + if (url == null) { + return + } + var path: String? = getRealPathFromURI(this, url) if (TextUtils.isEmpty(path)) { path = getImagePath(this, url) } - val `object` = JsonObject() - `object`.addProperty("imageUrl", path) - `object`.addProperty("fileName", getFileNameFromUrl(path)) - imageList.add(Gson().toJson(`object`)) + + if (path == null) { + return + } + + val jsonObject = JsonObject() + jsonObject.addProperty("imageUrl", path) + jsonObject.addProperty("fileName", getFileNameFromUrl(path)) + imageList.add(Gson().toJson(jsonObject)) + try { showSelectedImages() } catch (e: Exception) { diff --git a/app/src/main/java/org/ole/planet/myplanet/utilities/FileUtils.kt b/app/src/main/java/org/ole/planet/myplanet/utilities/FileUtils.kt index f8f48ebf93..255d723713 100644 --- a/app/src/main/java/org/ole/planet/myplanet/utilities/FileUtils.kt +++ b/app/src/main/java/org/ole/planet/myplanet/utilities/FileUtils.kt @@ -265,6 +265,8 @@ object FileUtils { } } } + } catch (e: Exception) { + e.printStackTrace() } finally { cursor?.close() } From 9edd47328f5d76ef28e4eba3952d0ff6b80e0343 Mon Sep 17 00:00:00 2001 From: Elijah Whang <59347000+ewhang5@users.noreply.github.com> Date: Tue, 23 Jul 2024 15:28:03 -0500 Subject: [PATCH 07/13] all: add dark mode (fixes #3564) (#3624) Co-authored-by: Gideon Okuro Co-authored-by: dogi --- app/build.gradle | 4 +- .../ole/planet/myplanet/MainApplication.kt | 15 + .../myplanet/base/BaseResourceFragment.kt | 2 +- .../ole/planet/myplanet/ui/SettingActivity.kt | 22 + .../community/HomeCommunityDialogFragment.kt | 5 +- .../ui/dashboard/BaseDashboardFragment.kt | 2 +- .../dashboard/BaseDashboardFragmentPlugin.kt | 2 +- .../ui/dashboard/DashboardActivity.kt | 10 +- .../ui/dashboard/DashboardActivity.kt.lite | 10 +- .../planet/myplanet/ui/news/AdapterNews.kt | 3 +- .../ui/onBoarding/OnBoardingAdapter.kt | 5 + .../myplanet/ui/survey/SurveyFragment.kt | 2 + .../ui/sync/ProcessUserDataActivity.kt | 8 +- .../myplanet/views/RoundedListPreference.kt | 43 ++ .../res/drawable/alertdialog_background.xml | 5 + .../res/drawable/dialog_window_background.xml | 8 + app/src/main/res/drawable/light_rect.xml | 4 +- .../res/drawable/non_selected_item_dot.xml | 4 +- app/src/main/res/drawable/oval_white.xml | 4 +- .../main/res/drawable/selected_item_dot.xml | 4 +- .../main/res/layout-night/activity_login.xml | 375 ++++++++++++++++++ .../main/res/layout-night/app_bar_bell.xml | 65 +++ .../layout-night/fragment_notification.xml | 47 +++ app/src/main/res/layout/activity_about.xml | 3 +- app/src/main/res/layout/activity_login.xml | 30 +- .../main/res/layout/activity_on_boarding.xml | 7 +- app/src/main/res/layout/card_profile_bell.xml | 13 +- .../res/layout/custom_simple_list_item_1.xml | 13 + app/src/main/res/layout/dialog_progress.xml | 13 +- .../main/res/layout/dialog_server_url_.xml | 40 +- app/src/main/res/layout/fragment_about.xml | 5 +- .../main/res/layout/fragment_chat_detail.xml | 5 +- .../res/layout/fragment_chat_history_list.xml | 3 + .../res/layout/fragment_course_detail.xml | 48 ++- .../main/res/layout/fragment_course_step.xml | 5 +- .../main/res/layout/fragment_disclaimer.xml | 5 +- .../layout/fragment_enterprise_calendar.xml | 8 +- .../res/layout/fragment_feedback_list.xml | 12 +- app/src/main/res/layout/fragment_finance.xml | 10 +- .../res/layout/fragment_library_detail.xml | 73 ++-- .../main/res/layout/fragment_my_course.xml | 10 +- .../main/res/layout/fragment_my_library.xml | 29 +- app/src/main/res/layout/fragment_news.xml | 1 + app/src/main/res/layout/fragment_plan.xml | 7 +- app/src/main/res/layout/fragment_services.xml | 2 +- app/src/main/res/layout/fragment_survey.xml | 6 +- .../main/res/layout/fragment_take_course.xml | 3 +- app/src/main/res/layout/fragment_team.xml | 15 +- .../main/res/layout/fragment_team_detail.xml | 16 +- app/src/main/res/layout/home_card_courses.xml | 5 +- app/src/main/res/layout/home_card_library.xml | 5 +- app/src/main/res/layout/home_card_mylife.xml | 7 +- app/src/main/res/layout/home_card_teams.xml | 7 +- app/src/main/res/layout/item_team_list.xml | 9 +- app/src/main/res/layout/layout_search.xml | 6 +- .../res/layout/my_library_alertdialog.xml | 3 +- app/src/main/res/layout/row_chat_history.xml | 5 +- app/src/main/res/layout/row_course.xml | 21 +- app/src/main/res/layout/row_finance.xml | 16 +- app/src/main/res/layout/row_joined_user.xml | 4 +- app/src/main/res/layout/row_library.xml | 27 +- app/src/main/res/layout/row_news.xml | 13 +- app/src/main/res/layout/row_notification.xml | 10 +- app/src/main/res/layout/row_steps.xml | 9 +- app/src/main/res/layout/row_survey.xml | 6 +- app/src/main/res/layout/rowlayout.xml | 4 +- app/src/main/res/layout/spinner_item.xml | 3 +- app/src/main/res/values-ar/strings.xml | 6 + app/src/main/res/values-es/strings.xml | 6 + app/src/main/res/values-fr/strings.xml | 6 + app/src/main/res/values-ne/strings.xml | 6 + app/src/main/res/values-night/colors.xml | 37 ++ app/src/main/res/values-night/styles.xml | 167 ++++++++ app/src/main/res/values-so/strings.xml | 6 + app/src/main/res/values/colors.xml | 15 +- app/src/main/res/values/strings.xml | 6 + app/src/main/res/values/styles.xml | 22 + app/src/main/res/xml/pref.xml | 13 +- 78 files changed, 1245 insertions(+), 236 deletions(-) create mode 100644 app/src/main/java/org/ole/planet/myplanet/views/RoundedListPreference.kt create mode 100644 app/src/main/res/drawable/alertdialog_background.xml create mode 100644 app/src/main/res/drawable/dialog_window_background.xml create mode 100644 app/src/main/res/layout-night/activity_login.xml create mode 100644 app/src/main/res/layout-night/app_bar_bell.xml create mode 100644 app/src/main/res/layout-night/fragment_notification.xml create mode 100644 app/src/main/res/layout/custom_simple_list_item_1.xml create mode 100644 app/src/main/res/values-night/colors.xml create mode 100644 app/src/main/res/values-night/styles.xml diff --git a/app/build.gradle b/app/build.gradle index b7afcbfe21..ec8e3e770c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1717 - versionName "0.17.17" + versionCode 1718 + versionName "0.17.18" 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 5136440cdd..a33c2daf9e 100644 --- a/app/src/main/java/org/ole/planet/myplanet/MainApplication.kt +++ b/app/src/main/java/org/ole/planet/myplanet/MainApplication.kt @@ -11,6 +11,8 @@ import android.os.StrictMode import android.os.StrictMode.VmPolicy import android.provider.Settings import androidx.annotation.RequiresApi +import androidx.appcompat.app.AppCompatDelegate +import androidx.preference.PreferenceManager import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager @@ -93,6 +95,9 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks { context = this preferences = getSharedPreferences(PREFS_NAME, MODE_PRIVATE) + nightMode() + // UNCOMMENT BELOW TO FORCE DARK MODE FOR DARK MODE DEVELOPMENT + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) val builder = VmPolicy.Builder() StrictMode.setVmPolicy(builder.build()) builder.detectFileUriExposure() @@ -114,6 +119,16 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks { onAppStarted() } + private fun nightMode() { + val preference = PreferenceManager.getDefaultSharedPreferences(this).getString("dark_mode", "Follow System") + val options = listOf(*resources.getStringArray(R.array.dark_mode_options)) + when (options.indexOf(preference)) { + 0 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) + 1 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) + 2 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) + } + } + private fun scheduleAutoSyncWork(syncInterval: Int?) { val autoSyncWork: PeriodicWorkRequest? = syncInterval?.let { PeriodicWorkRequest.Builder(AutoSyncWorker::class.java, it.toLong(), TimeUnit.SECONDS).build() } val workManager = WorkManager.getInstance(this) diff --git a/app/src/main/java/org/ole/planet/myplanet/base/BaseResourceFragment.kt b/app/src/main/java/org/ole/planet/myplanet/base/BaseResourceFragment.kt index e49bde2809..d6d528e653 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/BaseResourceFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/base/BaseResourceFragment.kt @@ -104,7 +104,7 @@ abstract class BaseResourceFragment : Fragment() { } val inflater = activity?.layoutInflater convertView = inflater?.inflate(R.layout.my_library_alertdialog, null) - val alertDialogBuilder = AlertDialog.Builder(requireContext()) + val alertDialogBuilder = AlertDialog.Builder(requireContext(), R.style.AlertDialogTheme) alertDialogBuilder.setView(convertView) .setTitle(R.string.download_suggestion) alertDialogBuilder.setPositiveButton(R.string.download_selected) { _: DialogInterface?, _: Int -> 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 ae439e696c..7aca3a5fcb 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 @@ -3,12 +3,14 @@ package org.ole.planet.myplanet.ui import android.content.Context import android.content.DialogInterface import android.content.Intent +import android.content.SharedPreferences.OnSharedPreferenceChangeListener import android.os.Build import android.os.Bundle import android.view.MenuItem import androidx.annotation.RequiresApi import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.app.AppCompatDelegate import androidx.preference.ListPreference import androidx.preference.Preference import androidx.preference.Preference.OnPreferenceChangeListener @@ -70,6 +72,7 @@ class SettingActivity : AppCompatActivity() { @RequiresApi(Build.VERSION_CODES.O) override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { + requireContext().setTheme(R.style.PreferencesTheme) setPreferencesFromResource(R.xml.pref, rootKey) profileDbHandler = UserProfileDbHandler(requireActivity()) user = profileDbHandler.userModel @@ -85,6 +88,17 @@ class SettingActivity : AppCompatActivity() { } } + val darkMode = findPreference("dark_mode") + if (darkMode != null) { + darkMode.onPreferenceChangeListener = OnPreferenceChangeListener { preference: Preference?, newValue: Any? -> + if (preference?.key == "dark_mode") { + darkMode(newValue.toString()) + return@OnPreferenceChangeListener true + } + false + } + } + // Show Available space under the "Freeup Space" preference. val spacePreference = findPreference("freeup_space") if (spacePreference != null) { @@ -181,6 +195,14 @@ class SettingActivity : AppCompatActivity() { profileDbHandler.onDestory() } } + + private fun darkMode(key: String) { + when (key) { + "ON" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) + "OFF" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) + "Follow System" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) + } + } } companion object { diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/community/HomeCommunityDialogFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/community/HomeCommunityDialogFragment.kt index d75943401e..0a702cd5f5 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/community/HomeCommunityDialogFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/community/HomeCommunityDialogFragment.kt @@ -37,8 +37,9 @@ class HomeCommunityDialogFragment : BottomSheetDialogFragment() { tab.text = (fragmentTeamDetailBinding.viewPager2.adapter as CommunityPagerAdapter).getPageTitle(position) }.attach() fragmentTeamDetailBinding.title.text = communityName - fragmentTeamDetailBinding.title.setTextColor(ContextCompat.getColor(requireContext(), R.color.md_black_1000)) - fragmentTeamDetailBinding.subtitle.setTextColor(ContextCompat.getColor(requireContext(), R.color.md_black_1000)) + fragmentTeamDetailBinding.title.setTextColor(ContextCompat.getColor(requireContext(), R.color.daynight_textColor)) + fragmentTeamDetailBinding.subtitle.setTextColor(ContextCompat.getColor(requireContext(), R.color.daynight_textColor)) fragmentTeamDetailBinding.subtitle.text = TimeUtils.getFormatedDateWithTime(Date().time) + fragmentTeamDetailBinding.appBar.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.secondary_bg)) } } \ No newline at end of file diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BaseDashboardFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BaseDashboardFragment.kt index 282ab47202..41786b36a0 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BaseDashboardFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BaseDashboardFragment.kt @@ -162,7 +162,7 @@ open class BaseDashboardFragment : BaseDashboardFragmentPlugin(), NotificationCa val itemLibraryHomeBinding = ItemLibraryHomeBinding.inflate(LayoutInflater.from(activity)) val v = itemLibraryHomeBinding.root setTextColor(itemLibraryHomeBinding.title, itemCnt) - val colorResId = if (itemCnt % 2 == 0) R.color.md_white_1000 else R.color.md_grey_300 + val colorResId = if (itemCnt % 2 == 0) R.color.dashboard_item else R.color.dashboard_item_alternative val color = context?.let { ContextCompat.getColor(it, colorResId) } if (color != null) { v.setBackgroundColor(color) diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BaseDashboardFragmentPlugin.kt b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BaseDashboardFragmentPlugin.kt index 4ae63111b9..ba0a6eb7cc 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BaseDashboardFragmentPlugin.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BaseDashboardFragmentPlugin.kt @@ -153,7 +153,7 @@ open class BaseDashboardFragmentPlugin : BaseContainerFragment() { if (count % 2 == 0) { v.setBackgroundResource(R.drawable.light_rect) } else { - v.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.md_grey_300)) + v.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.dashboard_item_alternative)) } } } \ No newline at end of file diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt index 3b260cece3..c11c4fc819 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt @@ -15,6 +15,7 @@ import android.view.Menu import android.view.MenuItem import android.view.View import androidx.activity.OnBackPressedCallback +import androidx.appcompat.app.AppCompatDelegate import androidx.core.content.ContextCompat import androidx.core.content.res.ResourcesCompat import androidx.core.view.WindowInsetsCompat @@ -300,7 +301,14 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N .build() val headerBackground = header.headerBackgroundView headerBackground.setPadding(30, 60, 30, 60) - headerBackground.setColorFilter(ContextCompat.getColor(this, R.color.md_white_1000), PorterDuff.Mode.SRC_IN) + val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK + if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO || + (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM && currentNightMode == Configuration.UI_MODE_NIGHT_NO)) { + headerBackground.setColorFilter( + ContextCompat.getColor(this, R.color.md_white_1000), + PorterDuff.Mode.SRC_IN + ) + } return header } diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite index aab391a885..514c2c866c 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite +++ b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite @@ -15,6 +15,7 @@ import android.view.Menu import android.view.MenuItem import android.view.View import androidx.activity.OnBackPressedCallback +import androidx.appcompat.app.AppCompatDelegate import androidx.core.content.ContextCompat import androidx.core.content.res.ResourcesCompat import androidx.core.view.WindowInsetsCompat @@ -300,7 +301,14 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N .build() val headerBackground = header.headerBackgroundView headerBackground.setPadding(30, 60, 30, 60) - headerBackground.setColorFilter(ContextCompat.getColor(this, R.color.md_white_1000), PorterDuff.Mode.SRC_IN) + val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK + if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO || + (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM && currentNightMode == Configuration.UI_MODE_NIGHT_NO)) { + headerBackground.setColorFilter( + ContextCompat.getColor(this, R.color.md_white_1000), + PorterDuff.Mode.SRC_IN + ) + } return header } diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/news/AdapterNews.kt b/app/src/main/java/org/ole/planet/myplanet/ui/news/AdapterNews.kt index c98f195ffe..bdc2047eae 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/news/AdapterNews.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/news/AdapterNews.kt @@ -3,7 +3,6 @@ package org.ole.planet.myplanet.ui.news import android.app.Activity import android.content.Context import android.content.DialogInterface -import android.content.Intent import android.os.Build import android.view.LayoutInflater import android.view.MenuItem @@ -250,6 +249,7 @@ class AdapterNews(var context: Context, private val list: MutableList = mRealm.where(RealmNews::class.java).sort("time", Sort.DESCENDING).equalTo("replyTo", finalNews?.id, Case.INSENSITIVE).findAll() viewHolder.rowNewsBinding.btnShowReply.text = String.format(context.getString(R.string.show_replies) + " (%d)", replies.size) + viewHolder.rowNewsBinding.btnShowReply.setTextColor(context.getColor(R.color.daynight_textColor)) viewHolder.rowNewsBinding.btnShowReply.visibility = if (replies.isNotEmpty()) { View.VISIBLE } else { diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/onBoarding/OnBoardingAdapter.kt b/app/src/main/java/org/ole/planet/myplanet/ui/onBoarding/OnBoardingAdapter.kt index 5af78f6cb5..b6ef080113 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/onBoarding/OnBoardingAdapter.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/onBoarding/OnBoardingAdapter.kt @@ -1,11 +1,13 @@ package org.ole.planet.myplanet.ui.onBoarding import android.content.Context +import android.os.Build import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView +import androidx.annotation.RequiresApi import androidx.viewpager.widget.PagerAdapter import org.ole.planet.myplanet.R @@ -19,6 +21,7 @@ class OnBoardingAdapter(private val mContext: Context, private val onBoardItems: return view == `object` } + @RequiresApi(Build.VERSION_CODES.M) override fun instantiateItem(container: ViewGroup, position: Int): Any { val itemView = LayoutInflater.from(mContext).inflate(R.layout.onboard_item, container, false) @@ -27,8 +30,10 @@ class OnBoardingAdapter(private val mContext: Context, private val onBoardItems: imageView.setImageResource(item.imageID) val tvTitle = itemView.findViewById(R.id.tv_header) tvTitle.text = item.title + tvTitle.setTextColor(mContext.getColor(R.color.daynight_textColor)) val tvContent = itemView.findViewById(R.id.tv_desc) tvContent.text = item.description + tvContent.setTextColor(mContext.getColor(R.color.daynight_textColor)) container.addView(itemView) return itemView diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/survey/SurveyFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/survey/SurveyFragment.kt index 54d47a5a41..e35b76a9e7 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/survey/SurveyFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/survey/SurveyFragment.kt @@ -1,5 +1,6 @@ package org.ole.planet.myplanet.ui.survey +import android.annotation.SuppressLint import android.os.Bundle import android.view.View import android.widget.AdapterView @@ -25,6 +26,7 @@ class SurveyFragment : BaseRecyclerFragment() { }!! } + @SuppressLint("ResourceAsColor") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) spn = requireView().findViewById(R.id.spn_sort) diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/sync/ProcessUserDataActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/sync/ProcessUserDataActivity.kt index f44d85a176..44d70ba0c1 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/sync/ProcessUserDataActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/sync/ProcessUserDataActivity.kt @@ -5,6 +5,7 @@ import android.content.Context import android.content.DialogInterface import android.content.Intent import android.content.SharedPreferences +import android.content.res.Configuration import android.graphics.Color import android.graphics.PorterDuff import android.net.Uri @@ -18,6 +19,7 @@ import android.widget.EditText import android.widget.ImageView import android.widget.Toast import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatDelegate import androidx.core.content.ContextCompat import com.google.android.material.textfield.TextInputLayout import org.ole.planet.myplanet.R @@ -115,7 +117,11 @@ abstract class ProcessUserDataActivity : PermissionActivity(), SuccessListener { val green = Color.green(newColor) val blue = Color.blue(newColor) val alphaWhite = Color.argb(alpha, red, green, blue) - logo.setColorFilter(alphaWhite, PorterDuff.Mode.SRC_ATOP) + val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK + if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO || + (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM && currentNightMode == Configuration.UI_MODE_NIGHT_NO)) { + logo.setColorFilter(alphaWhite, PorterDuff.Mode.SRC_ATOP) + } } fun setUrlParts(url: String, password: String): String { diff --git a/app/src/main/java/org/ole/planet/myplanet/views/RoundedListPreference.kt b/app/src/main/java/org/ole/planet/myplanet/views/RoundedListPreference.kt new file mode 100644 index 0000000000..e326fcf96d --- /dev/null +++ b/app/src/main/java/org/ole/planet/myplanet/views/RoundedListPreference.kt @@ -0,0 +1,43 @@ +package org.ole.planet.myplanet.views + +import android.app.AlertDialog +import android.content.Context +import android.content.DialogInterface +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.util.AttributeSet +import android.view.ContextThemeWrapper +import androidx.preference.ListPreference +import org.ole.planet.myplanet.R + +class RoundedListPreference : ListPreference { + + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super( + context, + attrs, + defStyleAttr + ) + + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) + + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + + constructor(context: Context) : super(context) + + override fun onClick() { + val currentIndex = findIndexOfValue(value) + val dialog = AlertDialog.Builder(ContextThemeWrapper(context, R.style.CustomAlertDialogStyle)) + .setTitle(title) + .setSingleChoiceItems(entryValues, currentIndex) { dialog: DialogInterface, index: Int -> + if (callChangeListener(entryValues[index].toString())) { + setValueIndex(index) + } + dialog.dismiss() + } + .setNegativeButton(R.string.cancel) { dialog: DialogInterface, _: Int -> dialog.dismiss() }.create() + dialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + + dialog.show() + } + +} \ No newline at end of file diff --git a/app/src/main/res/drawable/alertdialog_background.xml b/app/src/main/res/drawable/alertdialog_background.xml new file mode 100644 index 0000000000..4d7ecdbec7 --- /dev/null +++ b/app/src/main/res/drawable/alertdialog_background.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/dialog_window_background.xml b/app/src/main/res/drawable/dialog_window_background.xml new file mode 100644 index 0000000000..26d2d4d9a6 --- /dev/null +++ b/app/src/main/res/drawable/dialog_window_background.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/light_rect.xml b/app/src/main/res/drawable/light_rect.xml index a879576c0a..d5728b32f0 100644 --- a/app/src/main/res/drawable/light_rect.xml +++ b/app/src/main/res/drawable/light_rect.xml @@ -1,5 +1,5 @@ - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/non_selected_item_dot.xml b/app/src/main/res/drawable/non_selected_item_dot.xml index ebc327ddec..64032fbda1 100644 --- a/app/src/main/res/drawable/non_selected_item_dot.xml +++ b/app/src/main/res/drawable/non_selected_item_dot.xml @@ -8,5 +8,5 @@ android:width="8dp" android:height="8dp" /> - - \ No newline at end of file + + diff --git a/app/src/main/res/drawable/oval_white.xml b/app/src/main/res/drawable/oval_white.xml index cfbddd473e..84057907cb 100644 --- a/app/src/main/res/drawable/oval_white.xml +++ b/app/src/main/res/drawable/oval_white.xml @@ -3,5 +3,5 @@ android:shape="oval" > - - \ No newline at end of file + + diff --git a/app/src/main/res/drawable/selected_item_dot.xml b/app/src/main/res/drawable/selected_item_dot.xml index dbfb629211..149a7c01ee 100644 --- a/app/src/main/res/drawable/selected_item_dot.xml +++ b/app/src/main/res/drawable/selected_item_dot.xml @@ -7,5 +7,5 @@ android:width="8dp" android:height="8dp" /> - - \ No newline at end of file + + diff --git a/app/src/main/res/layout-night/activity_login.xml b/app/src/main/res/layout-night/activity_login.xml new file mode 100644 index 0000000000..9d3bf889ed --- /dev/null +++ b/app/src/main/res/layout-night/activity_login.xml @@ -0,0 +1,375 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +