From 777a7c659c25711f22982ead25b8e8aed3f8b19e Mon Sep 17 00:00:00 2001 From: dogi Date: Wed, 26 Jun 2024 23:25:50 -0400 Subject: [PATCH 01/17] actions: lite release name for playstore (fixes #3704) (#3705) --- .github/workflows/android-release.yml | 13 +++++++------ app/build.gradle | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 934c745b55..2308436b0a 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -32,12 +32,6 @@ jobs: with: fetch-depth: 1 - - name: expose version from build.gradle - uses: dogi/expose-android-build.gradle-version-code-and-name@v1.0.2 - with: - expose-version-name: 'true' - expose-version-code: 'true' - - name: diff the code to get lite if: matrix.build == 'lite' run: | @@ -48,6 +42,12 @@ jobs: cp "${file}.lite" "$file" done + - name: expose version from build.gradle + uses: dogi/expose-android-build.gradle-version-code-and-name@v1.0.2 + with: + expose-version-name: 'true' + expose-version-code: 'true' + - name: setup JDK 17 uses: actions/setup-java@v4 with: @@ -119,6 +119,7 @@ jobs: track: internal releaseName: "${{ env.ANDROID_VERSION_CODE }} (${{ env.ANDROID_VERSION_NAME }})" status: completed + changesNotSentForReview: true - name: rename APK and AAB with version and branch for artifact if: github.ref != 'refs/heads/master' diff --git a/app/build.gradle b/app/build.gradle index 72b0a2f38c..c9c3056d71 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1623 - versionName "0.16.23" + versionCode 1624 + versionName "0.16.24" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true From 7caa19454d33709ea08ffeec36e3ff40e62834fc Mon Sep 17 00:00:00 2001 From: dogi Date: Thu, 27 Jun 2024 03:09:26 -0400 Subject: [PATCH 02/17] actions: smoother playstore publishing (fixes #3706) (#3708) --- .github/workflows/android-release.yml | 15 ++++++++++++++- app/build.gradle | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 2308436b0a..ac096e2cab 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -110,7 +110,20 @@ jobs: ls -alR output - name: publish AAB to playstore - if: (github.ref == 'refs/heads/master') && (matrix.build == 'lite') + id: playstore + if: github.ref == 'refs/heads/master' && matrix.build == 'lite' + continue-on-error: true + uses: dogi/upload-google-play@v1.1.3 + with: + serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} + packageName: org.ole.planet.myplanet + releaseFiles: output/myPlanet.aab + track: internal + releaseName: "${{ env.ANDROID_VERSION_CODE }} (${{ env.ANDROID_VERSION_NAME }})" + status: completed + + - name: publish AAB to playstore fallback + if: github.ref == 'refs/heads/master' && matrix.build == 'lite' && steps.playstore.outcome == 'failure' uses: dogi/upload-google-play@v1.1.3 with: serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} diff --git a/app/build.gradle b/app/build.gradle index c9c3056d71..d08cfaf404 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1624 - versionName "0.16.24" + versionCode 1625 + versionName "0.16.25" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true From f7394010307b9c318ed89da2df85f824d813cef7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 11:13:02 -0400 Subject: [PATCH 03/17] actions: bump `dogi/upload-release-action` to 2.9.0 (fixes #3714) (#3709) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dogi --- .github/workflows/android-release.yml | 2 +- app/build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index ac096e2cab..d66f5e903e 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -153,7 +153,7 @@ jobs: - name: release APK and AAB on GitHub if: github.ref == 'refs/heads/master' - uses: dogi/upload-release-action@v2.7.1 + uses: dogi/upload-release-action@v2.9.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: output/* diff --git a/app/build.gradle b/app/build.gradle index d08cfaf404..12fe75108c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1625 - versionName "0.16.25" + versionCode 1626 + versionName "0.16.26" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true From a9f74b795bde6253708580aedb16c4f49f6dc184 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 11:19:35 -0400 Subject: [PATCH 04/17] actions: bump `dogi/upload-google-play` to 1.1.4 (fixes #3713) (#3710) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dogi --- .github/workflows/android-release.yml | 4 ++-- app/build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index d66f5e903e..0346aa294d 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -113,7 +113,7 @@ jobs: id: playstore if: github.ref == 'refs/heads/master' && matrix.build == 'lite' continue-on-error: true - uses: dogi/upload-google-play@v1.1.3 + uses: dogi/upload-google-play@v1.1.4 with: serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} packageName: org.ole.planet.myplanet @@ -124,7 +124,7 @@ jobs: - name: publish AAB to playstore fallback if: github.ref == 'refs/heads/master' && matrix.build == 'lite' && steps.playstore.outcome == 'failure' - uses: dogi/upload-google-play@v1.1.3 + uses: dogi/upload-google-play@v1.1.4 with: serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} packageName: org.ole.planet.myplanet diff --git a/app/build.gradle b/app/build.gradle index 12fe75108c..04fb5b37dc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1626 - versionName "0.16.26" + versionCode 1627 + versionName "0.16.27" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true From 22820397cc13c0ee4b8786042721e920b2cc07d2 Mon Sep 17 00:00:00 2001 From: dogi Date: Thu, 27 Jun 2024 11:24:30 -0400 Subject: [PATCH 05/17] actions: bump `dogi/sign-android-release` to 5.1 (fixes #3711) (#3715) --- .github/workflows/android-release.yml | 2 +- app/build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 0346aa294d..a8acbef4ec 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -92,7 +92,7 @@ jobs: cp app/build/outputs/apk/release/app-release-unsigned.apk sign/. - name: sign release APK and AAB - uses: dogi/sign-android-release@v5 + uses: dogi/sign-android-release@v5.1 with: releaseDirectory: sign signingKeyBase64: ${{ secrets.SIGNING_KEY }} diff --git a/app/build.gradle b/app/build.gradle index 04fb5b37dc..d3de43bf5c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1627 - versionName "0.16.27" + versionCode 1628 + versionName "0.16.28" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true From ed6989bb6238cd7712a6aa7f463a98135df2d8a4 Mon Sep 17 00:00:00 2001 From: dogi Date: Thu, 27 Jun 2024 11:46:07 -0400 Subject: [PATCH 06/17] actions: less installs is faster (fixes #3707) (#3716) --- .github/workflows/android-build.yml | 23 ----------------------- .github/workflows/android-release.yml | 25 +------------------------ app/build.gradle | 4 ++-- 3 files changed, 3 insertions(+), 49 deletions(-) diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 4374fd8500..d761a4939c 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -15,8 +15,6 @@ jobs: matrix: build: [default, lite] env: - ANDROID_NDK_VERSION: "21.3.6528147" - ANDROID_SDK_ROOT: "/usr/local/lib/android/sdk" FILES: | app/src/main/AndroidManifest.xml app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.kt @@ -53,27 +51,6 @@ jobs: distribution: 'zulu' java-version: '17' - - name: cache NDK - id: cache-ndk - uses: actions/cache@v4 - with: - path: ${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.ANDROID_NDK_VERSION }} - key: ${{ runner.os }}-ndk-${{ env.ANDROID_NDK_VERSION }} - restore-keys: | - ${{ runner.os }}-ndk- - - - name: install NDK - if: steps.cache-ndk.outputs.cache-hit != 'true' - run: | - set -x - echo "y" | sudo ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --install "ndk;${ANDROID_NDK_VERSION}" --sdk_root=${ANDROID_SDK_ROOT} 2>&1 - if [ $? -ne 0 ]; then - echo "SDK Manager command failed" - exit 1 - fi - set +x - ls -al ${ANDROID_SDK_ROOT}/ndk - - name: setup gradle uses: gradle/actions/setup-gradle@v3 with: diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index a8acbef4ec..e54a22e818 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -15,8 +15,6 @@ jobs: matrix: build: [default, lite] env: - ANDROID_NDK_VERSION: "21.3.6528147" - ANDROID_SDK_ROOT: "/usr/local/lib/android/sdk" FILES: | app/src/main/AndroidManifest.xml app/src/main/java/org/ole/planet/myplanet/base/PermissionActivity.kt @@ -54,27 +52,6 @@ jobs: distribution: 'zulu' java-version: '17' - - name: cache NDK - id: cache-ndk - uses: actions/cache@v4 - with: - path: ${{ env.ANDROID_SDK_ROOT }}/ndk/${{ env.ANDROID_NDK_VERSION }} - key: ${{ runner.os }}-ndk-${{ env.ANDROID_NDK_VERSION }} - restore-keys: | - ${{ runner.os }}-ndk- - - - name: install NDK - if: steps.cache-ndk.outputs.cache-hit != 'true' - run: | - set -x - echo "y" | sudo ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --install "ndk;${ANDROID_NDK_VERSION}" --sdk_root=${ANDROID_SDK_ROOT} 2>&1 - if [ $? -ne 0 ]; then - echo "SDK Manager command failed" - exit 1 - fi - set +x - ls -al ${ANDROID_SDK_ROOT}/ndk - - name: setup gradle uses: gradle/actions/setup-gradle@v3 with: @@ -162,7 +139,7 @@ jobs: file_glob: 'true' - name: send success message to discord - if: (github.ref == 'refs/heads/master') && (matrix.build != 'lite') + if: github.ref == 'refs/heads/master' && matrix.build != 'lite' run: | sudo npm install -g @treehouses/cli export discord_channel="${{ secrets.CHANNEL }}" #remote diff --git a/app/build.gradle b/app/build.gradle index d3de43bf5c..005fcf7821 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1628 - versionName "0.16.28" + versionCode 1629 + versionName "0.16.29" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true From 42f15695c2c78fa47d969e24a6311cb5d3359890 Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Thu, 27 Jun 2024 19:07:19 +0300 Subject: [PATCH 07/17] courses: smoother list (fixes #3702) (#3718) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../planet/myplanet/ui/courses/CoursesFragment.kt | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 005fcf7821..2194b6d36c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1629 - versionName "0.16.29" + versionCode 1630 + versionName "0.16.30" 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 ee9ca15cf5..a602db8e1b 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 @@ -222,13 +222,13 @@ class CoursesFragment : BaseRecyclerFragment(), OnCourseItemSele var msg = getString(R.string.success_you_have_added_the_following_courses) if ((selectedItems?.size ?: 0) <= 5) { for (i in selectedItems?.indices!!) { - msg += " - " + selectedItems!![i]?.courseTitle + "\n" + msg += " - ${selectedItems?.get(i)?.courseTitle} \n" } } else { for (i in 0..4) { - msg += " - " + selectedItems!![i]?.courseTitle + "\n" + msg += " - ${selectedItems?.get(i)?.courseTitle} \n" } - msg += getString(R.string.and) + ((selectedItems?.size ?: 0) - 5) + getString(R.string.more_course_s) + msg += "${getString(R.string.and)}${((selectedItems?.size ?: 0) - 5)}${getString(R.string.more_course_s)}" } msg += getString(R.string.return_to_the_home_tab_to_access_mycourses) builder.setMessage(msg) @@ -271,7 +271,7 @@ class CoursesFragment : BaseRecyclerFragment(), OnCourseItemSele val li: MutableList = ArrayList() li.add(tag) searchTags = li - tvSelected.text = R.string.selected.toString() + tag.name + tvSelected.text = "${R.string.selected} ${tag.name}" adapterCourses.setCourseList(filterCourseByTag(etSearch.text.toString(), li)) showNoData(tvMessage, adapterCourses.itemCount, "courses") } @@ -327,12 +327,12 @@ class CoursesFragment : BaseRecyclerFragment(), OnCourseItemSele val transaction = parentFragmentManager.beginTransaction() transaction.replace(R.id.fragment_container, fragment) transaction.addToBackStack(null) - transaction.commit() + transaction.commitAllowingStateLoss() } else { val transaction = parentFragmentManager.beginTransaction() transaction.replace(R.id.fragment_container, fragment) transaction.addToBackStack(null) - transaction.commit() + transaction.commitAllowingStateLoss() } } } \ No newline at end of file From 7f64c6647ced7df1982b6e817ab2785bdaf725f2 Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Thu, 27 Jun 2024 19:55:24 +0300 Subject: [PATCH 08/17] teams: stabler resources list (fixes #3719) (#3720) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../myplanet/ui/team/teamResource/TeamResourceFragment.kt | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2194b6d36c..5faed198bd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1630 - versionName "0.16.30" + versionCode 1631 + versionName "0.16.31" 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/teamResource/TeamResourceFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/team/teamResource/TeamResourceFragment.kt index ff480624d8..ada1604238 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/team/teamResource/TeamResourceFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/team/teamResource/TeamResourceFragment.kt @@ -43,10 +43,16 @@ class TeamResourceFragment : BaseTeamFragment(), TeamPageListener { } private fun showResourceListDialog() { + if (!isAdded) { + return + } + val myLibraryAlertdialogBinding = MyLibraryAlertdialogBinding.inflate(layoutInflater) val alertDialogBuilder = AlertDialog.Builder(requireActivity()) alertDialogBuilder.setTitle(R.string.select_resource) - val libraries: List = mRealm.where(RealmMyLibrary::class.java).not().`in`("_id", getResourceIds(teamId, mRealm).toTypedArray()).findAll() + val libraries: List = mRealm.where(RealmMyLibrary::class.java) + .not().`in`("_id", getResourceIds(teamId, mRealm).toTypedArray()) + .findAll() alertDialogBuilder.setView(myLibraryAlertdialogBinding.root) .setPositiveButton(R.string.add) { _: DialogInterface?, _: Int -> val selected = myLibraryAlertdialogBinding.alertDialogListView.selectedItemsList From 8cd44676db55591ea26e7c80114ddd4f4af762ea Mon Sep 17 00:00:00 2001 From: Vivian Li <112584985+strawberrybread@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:04:28 -0400 Subject: [PATCH 09/17] login: smoother language selection (fixes #3698) (#3721) Co-authored-by: dogi --- app/build.gradle | 4 +-- .../ole/planet/myplanet/MainApplication.kt | 5 +++ .../ole/planet/myplanet/base/BaseActivity.kt | 6 ++++ .../planet/myplanet/ui/sync/LoginActivity.kt | 31 +++++++++++++------ 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5faed198bd..72a4f6b512 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1631 - versionName "0.16.31" + versionCode 1632 + versionName "0.16.32" 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 50449585df..e18cb32f53 100644 --- a/app/src/main/java/org/ole/planet/myplanet/MainApplication.kt +++ b/app/src/main/java/org/ole/planet/myplanet/MainApplication.kt @@ -120,6 +120,11 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks { Utilities.setContext(base) } + override fun onConfigurationChanged(newConfig: android.content.res.Configuration) { + super.onConfigurationChanged(newConfig) + LocaleHelper.onAttach(this) + } + override fun onActivityCreated(activity: Activity, bundle: Bundle?) {} override fun onActivityStarted(activity: Activity) {} diff --git a/app/src/main/java/org/ole/planet/myplanet/base/BaseActivity.kt b/app/src/main/java/org/ole/planet/myplanet/base/BaseActivity.kt index 9c8e22520c..3237d3b46b 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/BaseActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/base/BaseActivity.kt @@ -3,13 +3,19 @@ package org.ole.planet.myplanet.base import android.R import android.os.Bundle import android.view.MenuItem +import android.content.Context import androidx.appcompat.app.AppCompatActivity +import org.ole.planet.myplanet.utilities.LocaleHelper abstract class BaseActivity : AppCompatActivity() { public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) } + override fun attachBaseContext(newBase: Context) { + super.attachBaseContext(LocaleHelper.onAttach(newBase)) + } + fun initActionBar() { supportActionBar?.setHomeButtonEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true) 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 837e4da13f..98dcb68d58 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 @@ -28,6 +28,7 @@ import org.ole.planet.myplanet.utilities.FileUtils.availableOverTotalMemoryForma import org.ole.planet.myplanet.utilities.Utilities.getUrl import org.ole.planet.myplanet.utilities.Utilities.toast import java.text.Normalizer +import java.util.Locale import java.util.regex.Pattern class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { @@ -47,7 +48,6 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { lblLastSyncDate = activityLoginBinding.lblLastSyncDate btnSignIn = activityLoginBinding.btnSignin syncIcon = activityLoginBinding.syncIcon - service = Service(this) activityLoginBinding.tvAvailableSpace.text = availableOverTotalMemoryFormattedString @@ -217,19 +217,18 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { private fun setUpLanguageButton() { val languageKey = resources.getStringArray(R.array.language_keys) val languages = resources.getStringArray(R.array.language) - val selectedLanguageKey = settings.getString(Constants.SELECTED_LANGUAGE, fallbackLanguage) - val index = languageKey.indexOf(selectedLanguageKey) + val currentLanguageKey = settings.getString(Constants.SELECTED_LANGUAGE, fallbackLanguage) + val index = languageKey.indexOf(currentLanguageKey) activityLoginBinding.btnLang.text = languages[index] activityLoginBinding.btnLang.setOnClickListener { AlertDialog.Builder(this) .setTitle(R.string.select_language) .setSingleChoiceItems(languages, index) { dialog, which -> - val selectLanguageKey = languageKey[which] - if (selectLanguageKey != settings.getString(Constants.SELECTED_LANGUAGE, fallbackLanguage)) { - LocaleHelper.setLocale(this, selectLanguageKey) - settings.edit().putString(Constants.SELECTED_LANGUAGE, selectLanguageKey).apply() - activityLoginBinding.btnLang.text = languages[which] - recreate() + val selectedLanguageKey = languageKey[which] + if (selectedLanguageKey != LocaleHelper.getLanguage(this)) { + LocaleHelper.setLocale(this, selectedLanguageKey) + settings.edit().putString(Constants.SELECTED_LANGUAGE, selectedLanguageKey).apply() + updateLanguage(selectedLanguageKey) } dialog.dismiss() } @@ -238,6 +237,16 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { } } + @Suppress("DEPRECATION") + private fun updateLanguage(language: String) { + val locale = Locale(language) + Locale.setDefault(locale) + val config = resources.configuration + config.setLocale(locale) + resources.updateConfiguration(config, resources.displayMetrics) + recreate() + } + private fun declareHideKeyboardElements() { findViewById(R.id.constraintLayout).setOnTouchListener { view: View?, _: MotionEvent? -> hideKeyboard(view) @@ -588,6 +597,8 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { override fun onDestroy() { super.onDestroy() - finish() + if (!mRealm.isClosed) { + mRealm.close() + } } } From 4688b7f3fc1487989f1c6b4e860445a583aaf2c5 Mon Sep 17 00:00:00 2001 From: Vivian Li <112584985+strawberrybread@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:08:56 -0400 Subject: [PATCH 10/17] actions: less warnings is more (fixes #3722) (#3723) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../planet/myplanet/datamanager/ApiClient.kt | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 72a4f6b512..70f00d93c9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1632 - versionName "0.16.32" + versionCode 1633 + versionName "0.16.33" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/datamanager/ApiClient.kt b/app/src/main/java/org/ole/planet/myplanet/datamanager/ApiClient.kt index 06f968f708..81dd169f44 100644 --- a/app/src/main/java/org/ole/planet/myplanet/datamanager/ApiClient.kt +++ b/app/src/main/java/org/ole/planet/myplanet/datamanager/ApiClient.kt @@ -16,13 +16,17 @@ object ApiClient { val client = OkHttpClient.Builder().connectTimeout(1, TimeUnit.MINUTES) .readTimeout(30, TimeUnit.SECONDS).writeTimeout(30, TimeUnit.SECONDS).build() if (retrofit == null) { - retrofit = Retrofit.Builder().baseUrl(BASE_URL).client(client).addConverterFactory( - GsonConverterFactory.create( - GsonBuilder().setLenient() - .excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC) - .serializeNulls().create() - ) - ).build() + retrofit = Retrofit.Builder() + .baseUrl(BASE_URL) + .client(client) + .addConverterFactory( + GsonConverterFactory.create( + GsonBuilder() + .excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC) + .serializeNulls() + .create() + ) + ).build() } return retrofit } From 0f508acc32a56ec4a84f257b2a885751a92a1aca Mon Sep 17 00:00:00 2001 From: dogi Date: Fri, 28 Jun 2024 15:27:55 -0400 Subject: [PATCH 11/17] actions: smoother manual release (fixes #3712) (#3732) --- .github/workflows/android-release.yml | 18 ++++++++---------- app/build.gradle | 4 ++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index e54a22e818..9ec5e805e5 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -22,9 +22,6 @@ jobs: app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt steps: - - name: set more env - run: echo "BRANCHNAME="${GITHUB_REF##*/} >> $GITHUB_ENV - - name: checkout repository code uses: actions/checkout@v4 with: @@ -88,7 +85,7 @@ jobs: - name: publish AAB to playstore id: playstore - if: github.ref == 'refs/heads/master' && matrix.build == 'lite' + if: github.event_name != 'workflow_dispatch' && matrix.build == 'lite' continue-on-error: true uses: dogi/upload-google-play@v1.1.4 with: @@ -100,7 +97,7 @@ jobs: status: completed - name: publish AAB to playstore fallback - if: github.ref == 'refs/heads/master' && matrix.build == 'lite' && steps.playstore.outcome == 'failure' + if: github.event_name != 'workflow_dispatch' && matrix.build == 'lite' && steps.playstore.outcome == 'failure' uses: dogi/upload-google-play@v1.1.4 with: serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} @@ -112,24 +109,25 @@ jobs: changesNotSentForReview: true - name: rename APK and AAB with version and branch for artifact - if: github.ref != 'refs/heads/master' + if: github.event_name == 'workflow_dispatch' run: | mv output/myPlanet.apk output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.apk mv output/myPlanet.apk.sha256 output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.apk.sha256 mv output/myPlanet.aab output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.aab mv output/myPlanet.aab.sha256 output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.aab.sha256 ls -alR output + echo "BRANCHNAME=${GITHUB_REF##*/}" >> $GITHUB_ENV - name: upload APK and AAB as build artifact - if: github.ref != 'refs/heads/master' + if: github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v4 with: - name: myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}-${{ matrix.build }} + name: myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }} path: output/* retention-days: 9 - name: release APK and AAB on GitHub - if: github.ref == 'refs/heads/master' + if: github.event_name != 'workflow_dispatch' uses: dogi/upload-release-action@v2.9.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} @@ -139,7 +137,7 @@ jobs: file_glob: 'true' - name: send success message to discord - if: github.ref == 'refs/heads/master' && matrix.build != 'lite' + if: github.event_name != 'workflow_dispatch' && matrix.build != 'lite' run: | sudo npm install -g @treehouses/cli export discord_channel="${{ secrets.CHANNEL }}" #remote diff --git a/app/build.gradle b/app/build.gradle index 70f00d93c9..03a23d12a5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1633 - versionName "0.16.33" + versionCode 1634 + versionName "0.16.34" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true From c6a96b4aabcadd1e75e4d58d4ebb0bf7f9fb2828 Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Fri, 28 Jun 2024 22:39:22 +0300 Subject: [PATCH 12/17] surveys: smoother empty list (fixes #3724) (#3736) Co-authored-by: dogi --- app/build.gradle | 4 +-- .../myplanet/base/BaseRecyclerFragment.kt | 1 + .../ui/submission/MySubmissionFragment.kt | 27 ++++++++++--------- .../myplanet/ui/survey/SurveyFragment.kt | 3 +++ .../res/layout/fragment_my_submission.xml | 9 +++++++ 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 + 11 files changed, 35 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 03a23d12a5..dacf413ece 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1634 - versionName "0.16.34" + versionCode 1635 + versionName "0.16.35" 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 e81d07b632..9cda0ef557 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 @@ -295,6 +295,7 @@ abstract class BaseRecyclerFragment
  • : BaseRecyclerParentFragment(), On "members" -> (v as TextView).setText(R.string.no_join_request_available) "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) 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/submission/MySubmissionFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/submission/MySubmissionFragment.kt index 265f62d81c..27816a1fb3 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/submission/MySubmissionFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/submission/MySubmissionFragment.kt @@ -14,6 +14,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import io.realm.Case import io.realm.Realm import io.realm.RealmQuery +import org.ole.planet.myplanet.base.BaseRecyclerFragment.Companion.showNoData import org.ole.planet.myplanet.databinding.FragmentMySubmissionBinding import org.ole.planet.myplanet.datamanager.DatabaseService import org.ole.planet.myplanet.model.RealmStepExam @@ -58,7 +59,6 @@ class MySubmissionFragment : Fragment(), CompoundButton.OnCheckedChangeListener val cleanString = charSequence.toString() setData(cleanString) } - override fun afterTextChanged(editable: Editable) {} }) showHideRadioButton() @@ -86,18 +86,12 @@ class MySubmissionFragment : Fragment(), CompoundButton.OnCheckedChangeListener private fun setData(s: String) { val q: RealmQuery<*>? = when (type) { - "survey" -> { - mRealm.where(RealmSubmission::class.java).equalTo("userId", user?.id) - .equalTo("type", "survey") - } - "survey_submission" -> { - mRealm.where(RealmSubmission::class.java).equalTo("userId", user?.id) - .notEqualTo("status", "pending").equalTo("type", "survey") - } - else -> { - mRealm.where(RealmSubmission::class.java).equalTo("userId", user?.id) - .notEqualTo("type", "survey") - } + "survey" -> mRealm.where(RealmSubmission::class.java).equalTo("userId", user?.id) + .equalTo("type", "survey") + "survey_submission" -> mRealm.where(RealmSubmission::class.java).equalTo("userId", user?.id) + .notEqualTo("status", "pending").equalTo("type", "survey") + else -> mRealm.where(RealmSubmission::class.java).equalTo("userId", user?.id) + .notEqualTo("type", "survey") } if (!TextUtils.isEmpty(s)) { val ex: List = mRealm.where(RealmStepExam::class.java) @@ -109,6 +103,13 @@ class MySubmissionFragment : Fragment(), CompoundButton.OnCheckedChangeListener } val adapter = AdapterMySubmission(requireActivity(), submissions, exams) + val itemCount = adapter.itemCount + showNoData(fragmentMySubmissionBinding.tvMessage, itemCount, "submission") + + if (itemCount == 0) { + fragmentMySubmissionBinding.llSearch.visibility = View.GONE + fragmentMySubmissionBinding.title.visibility = View.GONE + } adapter.setmRealm(mRealm) adapter.setType(type) fragmentMySubmissionBinding.rvMysurvey.adapter = adapter 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 b63a4a163b..81b7d56eff 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 @@ -29,6 +29,9 @@ class SurveyFragment : BaseRecyclerFragment() { spn = requireView().findViewById(R.id.spn_sort) addNewServey = requireView().findViewById(R.id.fab_add_new_survey) addNewServey.setOnClickListener { } + if (getAdapter().itemCount == 0) { + spn.visibility = View.GONE + } showNoData(tvMessage, getAdapter().itemCount, "survey") spn.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { override fun onItemSelected(adapterView: AdapterView<*>?, view: View?, i: Int, l: Long) { diff --git a/app/src/main/res/layout/fragment_my_submission.xml b/app/src/main/res/layout/fragment_my_submission.xml index 3b90ef53fe..1b117e0928 100644 --- a/app/src/main/res/layout/fragment_my_submission.xml +++ b/app/src/main/res/layout/fragment_my_submission.xml @@ -10,6 +10,7 @@ android:orientation="vertical"> + + diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index d1180318b2..cbd445677f 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1045,5 +1045,6 @@ جارٍ فحص الخادم إصدار Apk أقل من المسموح. يرجى تحديث التطبيق إلى أحدث إصدار. إضافة ملاحظة (اختياري) + التقديمات غير متاحة diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index cb2b404ed3..59e5473f0a 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1045,5 +1045,6 @@ verificando el servidor la versión de la aplicación está por debajo de la permitida. Actualice la aplicación a la última versión. Agregar una nota (opcional) + envíos no disponibles diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index dcea61b2ce..1a47eccfee 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1045,5 +1045,6 @@ vérification du serveur la version de l\'app est inférieure à celle autorisée. veuillez mettre à jour l\'application vers la dernière version. Ajouter une note (optionnel) + soumissions non disponibles diff --git a/app/src/main/res/values-ne/strings.xml b/app/src/main/res/values-ne/strings.xml index 6ddc1d7164..afbfe10414 100644 --- a/app/src/main/res/values-ne/strings.xml +++ b/app/src/main/res/values-ne/strings.xml @@ -1045,5 +1045,6 @@ सर्भर जाँच गर्दै एप संस्करण अनुमत संस्करणभन्दा कम छ। कृपया अनुप्रयोगलाई नवीनतम संस्करणमा अद्यावधिक गर्नुहोस्। नोट थप्नुहोस् (वैकल्पिक) + पेशाहरू उपलब्ध छैनन् diff --git a/app/src/main/res/values-so/strings.xml b/app/src/main/res/values-so/strings.xml index 69f95a14e5..23727ecfba 100644 --- a/app/src/main/res/values-so/strings.xml +++ b/app/src/main/res/values-so/strings.xml @@ -1045,5 +1045,6 @@ hubinta server-ka nooca app-ga waa ka hooseeyaa kan la oggol yahay. fadlan cusbooneysii app-ka nooca ugu dambeeya. Ku dar falanqeey (ixtiyaacsi ah) + soo gudbin lama heli karo diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 28cf04b755..180040db0a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1045,5 +1045,6 @@ checking server app is below allowed version. please update the app to the latest version. add a note (optional) + submissions not available From ad81eb0b14bef6a38720cfa701200bf7c6a7318b Mon Sep 17 00:00:00 2001 From: Vivian Li <112584985+strawberrybread@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:45:39 -0400 Subject: [PATCH 13/17] sync: smoother downloads (fixes #3728) (#3737) Co-authored-by: dogi --- app/build.gradle | 4 +- .../myplanet/datamanager/MyDownloadService.kt | 63 ++++++++----------- .../planet/myplanet/utilities/DialogUtils.kt | 3 +- .../planet/myplanet/utilities/Utilities.kt | 19 ++++-- 4 files changed, 43 insertions(+), 46 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index dacf413ece..032681be8a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1635 - versionName "0.16.35" + versionCode 1636 + versionName "0.16.36" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/datamanager/MyDownloadService.kt b/app/src/main/java/org/ole/planet/myplanet/datamanager/MyDownloadService.kt index 6f1baffad9..4255bd1244 100644 --- a/app/src/main/java/org/ole/planet/myplanet/datamanager/MyDownloadService.kt +++ b/app/src/main/java/org/ole/planet/myplanet/datamanager/MyDownloadService.kt @@ -1,18 +1,20 @@ package org.ole.planet.myplanet.datamanager -import android.app.IntentService import android.app.NotificationManager +import android.content.Context import android.content.Intent import android.content.SharedPreferences import androidx.core.app.NotificationCompat import androidx.localbroadcastmanager.content.LocalBroadcastManager +import androidx.work.Worker +import androidx.work.WorkerParameters import io.realm.Realm import okhttp3.ResponseBody import org.ole.planet.myplanet.R import org.ole.planet.myplanet.model.Download import org.ole.planet.myplanet.model.RealmMyLibrary import org.ole.planet.myplanet.ui.dashboard.DashboardActivity -import org.ole.planet.myplanet.utilities.Constants.PREFS_NAME +import org.ole.planet.myplanet.utilities.Constants import org.ole.planet.myplanet.utilities.FileUtils import org.ole.planet.myplanet.utilities.NotificationUtil import org.ole.planet.myplanet.utilities.Utilities @@ -26,16 +28,16 @@ import java.io.OutputStream import kotlin.math.pow import kotlin.math.roundToInt -class MyDownloadService : IntentService("Download Service") { - var count = 0 - var data = ByteArray(1024 * 4) +class MyDownloadService(context: Context, params: WorkerParameters) : Worker(context, params) { + private var count = 0 + private var data = ByteArray(1024 * 4) private var outputFile: File? = null private var notificationBuilder: NotificationCompat.Builder? = null private var notificationManager: NotificationManager? = null private var totalFileSize = 0 private var preferences: SharedPreferences? = null private var url: String? = null - private var urls: ArrayList? = null + private lateinit var urls: Array private var currentIndex = 0 private var request: Call? = null private var completeAll = false @@ -48,25 +50,30 @@ class MyDownloadService : IntentService("Download Service") { databaseService.realmInstance } - override fun onHandleIntent(intent: Intent?) { - preferences = applicationContext.getSharedPreferences(PREFS_NAME, MODE_PRIVATE) - notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager - if (urls == null) { - stopSelf() + override fun doWork(): Result { + preferences = applicationContext.getSharedPreferences(Constants.PREFS_NAME, Context.MODE_PRIVATE) + notificationManager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + urls = inputData.getStringArray("urls") ?: return Result.failure() + fromSync = inputData.getBoolean("fromSync", false) + + if (urls.isEmpty()) { + return Result.failure() } - notificationBuilder = NotificationCompat.Builder(this, "11") + + notificationBuilder = NotificationCompat.Builder(applicationContext, "11") NotificationUtil.setChannel(notificationManager) val noti = notificationBuilder?.setSmallIcon(R.mipmap.ic_launcher) ?.setContentTitle("OLE Download")?.setContentText("Downloading File...") ?.setAutoCancel(true)?.build() notificationManager?.notify(0, noti) - urls = intent?.getStringArrayListExtra("urls") - fromSync = intent?.getBooleanExtra("fromSync", false) == true - for (i in urls?.indices ?: emptyList()) { - url = urls?.get(i) + + for (i in urls.indices) { + url = urls[i] currentIndex = i initDownload(fromSync) } + + return Result.success() } private fun initDownload(fromSync: Boolean) { @@ -101,7 +108,6 @@ class MyDownloadService : IntentService("Download Service") { d.failed = true d.message = message sendIntent(d, fromSync) - stopSelf() } @Throws(IOException::class) @@ -169,7 +175,7 @@ class MyDownloadService : IntentService("Download Service") { val intent = Intent(DashboardActivity.MESSAGE_PROGRESS) intent.putExtra("download", download) intent.putExtra("fromSync", fromSync) - LocalBroadcastManager.getInstance(this@MyDownloadService).sendBroadcast(intent) + LocalBroadcastManager.getInstance(applicationContext).sendBroadcast(intent) } private fun onDownloadComplete() { @@ -191,21 +197,6 @@ class MyDownloadService : IntentService("Download Service") { notificationManager?.notify(0, notificationBuilder?.build()) } - override fun onDestroy() { - super.onDestroy() - if (!completeAll) { - stopDownload() - } - } - - private fun stopDownload() { - if (request != null && outputFile != null) { - request?.cancel() - outputFile?.delete() - notificationManager?.cancelAll() - } - } - private fun changeOfflineStatus() { val currentFileName = FileUtils.getFileNameFromUrl(url) mRealm.executeTransaction { realm: Realm -> @@ -220,8 +211,4 @@ class MyDownloadService : IntentService("Download Service") { } } } - - override fun onTaskRemoved(rootIntent: Intent) { - notificationManager?.cancel(0) - } -} \ No newline at end of file +} 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 31c0814d7f..7ab1fe28c4 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 @@ -132,8 +132,7 @@ object DialogUtils { } override fun onFail() { - val url = ArrayList() - url.add(path) + val url = arrayListOf(path) if (progressDialog != null) { progressDialog.setText(context.getString(R.string.downloading_file)) progressDialog.setCancelable(false) diff --git a/app/src/main/java/org/ole/planet/myplanet/utilities/Utilities.kt b/app/src/main/java/org/ole/planet/myplanet/utilities/Utilities.kt index f3bb44346a..7dcb83810b 100644 --- a/app/src/main/java/org/ole/planet/myplanet/utilities/Utilities.kt +++ b/app/src/main/java/org/ole/planet/myplanet/utilities/Utilities.kt @@ -5,6 +5,7 @@ import android.content.Intent import android.content.SharedPreferences import android.graphics.Color import android.net.Uri +import androidx.work.Data import android.text.TextUtils import android.text.format.DateUtils import android.util.Base64 @@ -13,6 +14,8 @@ import android.util.Patterns import android.webkit.MimeTypeMap import android.widget.ImageView import android.widget.Toast +import androidx.work.OneTimeWorkRequest +import androidx.work.WorkManager import com.bumptech.glide.Glide import fisk.chipcloud.ChipCloudConfig import org.ole.planet.myplanet.MainApplication.Companion.context @@ -56,10 +59,18 @@ object Utilities { } fun openDownloadService(context: Context?, urls: ArrayList, fromSync: Boolean) { - val intent = Intent(context, MyDownloadService::class.java) - intent.putStringArrayListExtra("urls", urls) - intent.putExtra("fromSync", fromSync) - context?.startService(intent) + val inputData = Data.Builder() + .putStringArray("urls", urls.toTypedArray()) + .putBoolean("fromSync", fromSync) + .build() + + val downloadWorkRequest = OneTimeWorkRequest.Builder(MyDownloadService::class.java) + .setInputData(inputData) + .build() + + context?.let { + WorkManager.getInstance(it).enqueue(downloadWorkRequest) + } } @JvmStatic From 3286e7a85b65208f558233c12f9d3abd8b628d32 Mon Sep 17 00:00:00 2001 From: dogi Date: Fri, 28 Jun 2024 16:49:29 -0400 Subject: [PATCH 14/17] actions: unify github release(s) (fixes #3733) (#3741) --- .github/workflows/android-release.yml | 16 ++++++++++++++++ app/build.gradle | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 9ec5e805e5..b31816b61a 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -27,9 +27,16 @@ jobs: with: fetch-depth: 1 + - name: expose version from build.gradle + if: matrix.build == 'lite' + uses: dogi/expose-android-build.gradle-version-code-and-name@v1.0.2 + with: + expose-version-name: 'true' + - name: diff the code to get lite if: matrix.build == 'lite' run: | + echo "ANDROID_VERSION_NAME_ORIG=${ANDROID_VERSION_NAME}" >> $GITHUB_ENV ls -al app/build.gradle sed -i 's/\(versionName "[0-9.]\+\)"/\1-lite"/' app/build.gradle echo "${{ env.FILES }}" | xargs -n 1 | while read file; do @@ -126,6 +133,15 @@ jobs: path: output/* retention-days: 9 + - name: pre-process files and tag for lite version + if: github.event_name != 'workflow_dispatch' && matrix.build == 'lite' + run: | + mv output/myPlanet.apk output/myPlanet-lite.apk + mv output/myPlanet.apk.sha256 output/myPlanet-lite.apk.sha256 + mv output/myPlanet.aab output/myPlanet-lite.aab + mv output/myPlanet.aab.sha256 output/myPlanet-lite.aab.sha256 + echo "ANDROID_VERSION_NAME=${ANDROID_VERSION_NAME_ORIG}" >> $GITHUB_ENV + - name: release APK and AAB on GitHub if: github.event_name != 'workflow_dispatch' uses: dogi/upload-release-action@v2.9.0 diff --git a/app/build.gradle b/app/build.gradle index 032681be8a..0932c06ea7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1636 - versionName "0.16.36" + versionCode 1637 + versionName "0.16.37" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true From 45a922bc44c31b3302d55a7ac928a69f19c50b66 Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Mon, 1 Jul 2024 20:58:12 +0300 Subject: [PATCH 15/17] chat: mark shared (fixes #3734) (#3735) Co-authored-by: dogi --- app/build.gradle | 4 +- .../ui/chat/ChatHistoryListAdapter.kt | 178 ++++++++++-------- .../ui/chat/ChatHistoryListFragment.kt | 12 +- .../planet/myplanet/ui/news/NewsFragment.kt | 2 +- .../main/res/drawable/baseline_check_24.xml | 12 ++ app/src/main/res/layout/row_chat_history.xml | 2 +- 6 files changed, 127 insertions(+), 83 deletions(-) create mode 100644 app/src/main/res/drawable/baseline_check_24.xml diff --git a/app/build.gradle b/app/build.gradle index 0932c06ea7..a1bbf24235 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1637 - versionName "0.16.37" + versionCode 1638 + versionName "0.16.38" 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 96f74009de..b7998da7ea 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 @@ -7,8 +7,10 @@ import android.view.ViewGroup import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.google.gson.Gson +import io.realm.Case import io.realm.Realm import io.realm.RealmList +import io.realm.RealmResults import org.ole.planet.myplanet.R import org.ole.planet.myplanet.databinding.AddNoteDialogBinding import org.ole.planet.myplanet.databinding.ChatShareDialogBinding @@ -18,6 +20,7 @@ import org.ole.planet.myplanet.datamanager.DatabaseService import org.ole.planet.myplanet.model.Conversation import org.ole.planet.myplanet.model.RealmChatHistory import org.ole.planet.myplanet.model.RealmMyTeam +import org.ole.planet.myplanet.model.RealmNews import org.ole.planet.myplanet.model.RealmNews.Companion.createNews import org.ole.planet.myplanet.model.RealmUserModel import org.ole.planet.myplanet.service.UserProfileDbHandler @@ -27,49 +30,59 @@ import org.ole.planet.myplanet.ui.team.BaseTeamFragment.Companion.settings import org.ole.planet.myplanet.utilities.Constants.PREFS_NAME import java.util.Date -class ChatHistoryListAdapter(var context: Context, private var chatHistory: List) : - RecyclerView.Adapter() { - private lateinit var rowChatHistoryBinding: RowChatHistoryBinding - private var chatHistoryItemClickListener: ChatHistoryItemClickListener? = null - private var filteredChatHistory: List = chatHistory - private var chatTitle: String? = "" - private lateinit var expandableListAdapter: ExpandableListAdapter - private lateinit var expandableTitleList: List - private lateinit var expandableDetailList: HashMap> - private lateinit var mRealm: Realm - var user: RealmUserModel? = null - - interface ChatHistoryItemClickListener { - fun onChatHistoryItemClicked(conversations: RealmList?, _id: String, _rev: String?) - } +class ChatHistoryListAdapter(var context: Context, private var chatHistory: List, private val fragment: ChatHistoryListFragment) : RecyclerView.Adapter() { + private lateinit var rowChatHistoryBinding: RowChatHistoryBinding + private var chatHistoryItemClickListener: ChatHistoryItemClickListener? = null + private var filteredChatHistory: List = chatHistory + private var chatTitle: String? = "" + private lateinit var expandableListAdapter: ExpandableListAdapter + private lateinit var expandableTitleList: List + private lateinit var expandableDetailList: HashMap> + private lateinit var mRealm: Realm + var user: RealmUserModel? = null + private var newsList: RealmResults? = null + + interface ChatHistoryItemClickListener { + fun onChatHistoryItemClicked(conversations: RealmList?, _id: String, _rev: String?) + } - fun setChatHistoryItemClickListener(listener: ChatHistoryItemClickListener) { - chatHistoryItemClickListener = listener - } + fun setChatHistoryItemClickListener(listener: ChatHistoryItemClickListener) { + chatHistoryItemClickListener = listener + } - fun filter(query: String) { - filteredChatHistory = chatHistory.filter { chat -> - if (chat.conversations != null && chat.conversations?.isNotEmpty() == true) { - chat.conversations?.get(0)?.query?.contains(query, ignoreCase = true) == true - } else { - chat.title?.contains(query, ignoreCase = true) ==true - } + fun filter(query: String) { + filteredChatHistory = chatHistory.filter { chat -> + if (chat.conversations != null && chat.conversations?.isNotEmpty() == true) { + chat.conversations?.get(0)?.query?.contains(query, ignoreCase = true) == true + } else { + chat.title?.contains(query, ignoreCase = true) ==true } - notifyDataSetChanged() } + notifyDataSetChanged() + } - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { rowChatHistoryBinding = RowChatHistoryBinding.inflate(LayoutInflater.from(parent.context), parent, false) mRealm = DatabaseService(context).realmInstance user = UserProfileDbHandler(context).userModel + newsList = mRealm.where(RealmNews::class.java) + .equalTo("docType", "message", Case.INSENSITIVE) + .equalTo("createdOn", user?.planetCode, Case.INSENSITIVE) + .findAll() return ViewHolderChat(rowChatHistoryBinding) } - override fun getItemCount(): Int { - return filteredChatHistory.size - } + override fun getItemCount(): Int { + return filteredChatHistory.size + } - override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + fun updateChatHistory(newChatHistory: List) { + chatHistory = newChatHistory + filteredChatHistory = newChatHistory + notifyDataSetChanged() + } + + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { val viewHolderChat = holder as ViewHolderChat if (filteredChatHistory[position].conversations != null && filteredChatHistory[position].conversations?.isNotEmpty() == true) { viewHolderChat.rowChatHistoryBinding.chatTitle.text = filteredChatHistory[position].conversations?.get(0)?.query @@ -90,53 +103,62 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List ) } - viewHolderChat.rowChatHistoryBinding.shareChat.setOnClickListener { - val chatShareDialogBinding = ChatShareDialogBinding.inflate(LayoutInflater.from(context)) - var dialog: AlertDialog? = null - - expandableDetailList = getData() as HashMap> - expandableTitleList = ArrayList(expandableDetailList.keys) - expandableListAdapter = ExpandableListAdapter(context, expandableTitleList, expandableDetailList) - chatShareDialogBinding.listView.setAdapter(expandableListAdapter) - - chatShareDialogBinding.listView.setOnChildClickListener { _, _, groupPosition, childPosition, id -> - if (expandableTitleList[groupPosition] == "share with team/enterprise") { - val teamList = mRealm.where(RealmMyTeam::class.java) - .isEmpty("teamId").notEqualTo("status", "archived") - .equalTo("type", "team").findAll() - - val enterpriseList = mRealm.where(RealmMyTeam::class.java) - .isEmpty("teamId").notEqualTo("status", "archived") - .equalTo("type", "enterprise").findAll() - - if (expandableDetailList[expandableTitleList[groupPosition]]?.get(childPosition) == "teams") { - showGrandChildRecyclerView(teamList, "teams", filteredChatHistory[position]) - } else { - showGrandChildRecyclerView(enterpriseList, "enterprises", filteredChatHistory[position]) - } - } else { - settings = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE) - val sParentcode = settings?.getString("parentCode", "") - 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]) + val isInNewsList = newsList?.any { newsItem -> + newsItem.newsId == filteredChatHistory[position]._id + } ?: false + + if (isInNewsList) { + viewHolderChat.rowChatHistoryBinding.shareChat.setImageResource(R.drawable.baseline_check_24) + } else { + viewHolderChat.rowChatHistoryBinding.shareChat.setImageResource(R.drawable.baseline_share_24) + viewHolderChat.rowChatHistoryBinding.shareChat.setOnClickListener { + val chatShareDialogBinding = ChatShareDialogBinding.inflate(LayoutInflater.from(context)) + var dialog: AlertDialog? = null + + expandableDetailList = getData() as HashMap> + expandableTitleList = ArrayList(expandableDetailList.keys) + expandableListAdapter = ExpandableListAdapter(context, expandableTitleList, expandableDetailList) + chatShareDialogBinding.listView.setAdapter(expandableListAdapter) + + chatShareDialogBinding.listView.setOnChildClickListener { _, _, groupPosition, childPosition, _ -> + if (expandableTitleList[groupPosition] == "share with team/enterprise") { + val teamList = mRealm.where(RealmMyTeam::class.java) + .isEmpty("teamId").notEqualTo("status", "archived") + .equalTo("type", "team").findAll() + + val enterpriseList = mRealm.where(RealmMyTeam::class.java) + .isEmpty("teamId").notEqualTo("status", "archived") + .equalTo("type", "enterprise").findAll() + + if (expandableDetailList[expandableTitleList[groupPosition]]?.get(childPosition) == "teams") { + showGrandChildRecyclerView(teamList, "teams", filteredChatHistory[position]) + } else { + showGrandChildRecyclerView(enterpriseList, "enterprises", filteredChatHistory[position]) + } + } else { + settings = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE) + val sParentcode = settings?.getString("parentCode", "") + 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]) + } + dialog?.dismiss() + false } - dialog?.dismiss() - false - } - val builder = AlertDialog.Builder(context) - builder.setView(chatShareDialogBinding.root) - builder.setPositiveButton(context.getString(R.string.close)) { _, _ -> - dialog?.dismiss() + val builder = AlertDialog.Builder(context) + builder.setView(chatShareDialogBinding.root) + builder.setPositiveButton(context.getString(R.string.close)) { _, _ -> + dialog?.dismiss() + } + dialog = builder.create() + dialog.show() } - dialog = builder.create() - dialog.show() } } - private fun showGrandChildRecyclerView(items: List, section: String, realmChatHistory: RealmChatHistory) { + private fun showGrandChildRecyclerView(items: List, section: String, realmChatHistory: RealmChatHistory) { val grandChildDialogBinding = GrandChildRecyclerviewDialogBinding.inflate(LayoutInflater.from(context)) var dialog: AlertDialog? = null @@ -161,7 +183,7 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List dialog.show() } - private fun showEditTextAndShareButton(team: RealmMyTeam? = null, section: String, chatHistory: RealmChatHistory) { + private fun showEditTextAndShareButton(team: RealmMyTeam? = null, section: String, chatHistory: RealmChatHistory) { val addNoteDialogBinding = AddNoteDialogBinding.inflate(LayoutInflater.from(context)) val builder = AlertDialog.Builder(context) builder.setView(addNoteDialogBinding.root) @@ -187,6 +209,7 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List map["news"] = Gson().toJson(serializedMap) createNews(map, mRealm, user, null) + fragment.refreshChatHistoryList() dialog.dismiss() } builder.setNegativeButton(context.getString(R.string.cancel)) { dialog, _ -> @@ -196,14 +219,14 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List dialog.show() } - private fun serializeConversation(conversation: Conversation): HashMap { + private fun serializeConversation(conversation: Conversation): HashMap { val conversationMap = HashMap() conversationMap["query"] = conversation.query ?: "" conversationMap["response"] = conversation.response ?: "" return conversationMap } - private fun getData(): Map> { + private fun getData(): Map> { val expandableListDetail: MutableMap> = HashMap() val community: MutableList = ArrayList() community.add("community") @@ -214,9 +237,8 @@ class ChatHistoryListAdapter(var context: Context, private var chatHistory: List expandableListDetail["share with community"] = community expandableListDetail["share with team/enterprise"] = teams - return expandableListDetail } - class ViewHolderChat(val rowChatHistoryBinding: RowChatHistoryBinding) : RecyclerView.ViewHolder(rowChatHistoryBinding.root) - } + class ViewHolderChat(val rowChatHistoryBinding: RowChatHistoryBinding) : RecyclerView.ViewHolder(rowChatHistoryBinding.root) +} diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatHistoryListFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatHistoryListFragment.kt index eff4d21193..513b67e805 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatHistoryListFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/chat/ChatHistoryListFragment.kt @@ -67,7 +67,7 @@ class ChatHistoryListFragment : Fragment() { filteredHistoryList.add(model) } } - val adapter = ChatHistoryListAdapter(requireContext(), list) + val adapter = ChatHistoryListAdapter(requireContext(), list, this) adapter.setChatHistoryItemClickListener(object : ChatHistoryListAdapter.ChatHistoryItemClickListener { override fun onChatHistoryItemClicked(conversations: RealmList?, _id: String, _rev:String?) { conversations?.let { sharedViewModel.setSelectedChatHistory(it) } @@ -89,6 +89,16 @@ class ChatHistoryListFragment : Fragment() { override fun afterTextChanged(s: Editable?) {} }) } + + fun refreshChatHistoryList() { + val mRealm = DatabaseService(requireActivity()).realmInstance + val list = mRealm.where(RealmChatHistory::class.java).equalTo("user", user?.name) + .sort("id", Sort.DESCENDING) + .findAll() + + val adapter = fragmentChatHistoryListBinding.recyclerView.adapter as ChatHistoryListAdapter + adapter.updateChatHistory(list) + } } class ChatHistoryListOnBackPressedCallback(private val slidingPaneLayout: SlidingPaneLayout) : diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/news/NewsFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/news/NewsFragment.kt index 11471f4dfc..4da9cd7097 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/news/NewsFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/news/NewsFragment.kt @@ -103,7 +103,7 @@ class NewsFragment : BaseNewsFragment() { return@setOnClickListener } fragmentNewsBinding.etMessage.setText("") - val map = HashMap() // Changed to String, String + val map = HashMap() map["message"] = message map["viewInId"] = "${user?.planetCode ?: ""}@${user?.parentCode ?: ""}" map["viewInSection"] = "community" diff --git a/app/src/main/res/drawable/baseline_check_24.xml b/app/src/main/res/drawable/baseline_check_24.xml new file mode 100644 index 0000000000..8907cc0940 --- /dev/null +++ b/app/src/main/res/drawable/baseline_check_24.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/app/src/main/res/layout/row_chat_history.xml b/app/src/main/res/layout/row_chat_history.xml index 112eb601af..0cb4bebdfe 100644 --- a/app/src/main/res/layout/row_chat_history.xml +++ b/app/src/main/res/layout/row_chat_history.xml @@ -40,7 +40,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" - android:layout_marginEnd="@dimen/_4dp" + android:padding="10dp" android:background="?attr/selectableItemBackground" android:contentDescription="@string/share_chat" android:src="@drawable/baseline_share_24" From b8ff43653b6349ea80d8fe2e40e314c8f067b9a0 Mon Sep 17 00:00:00 2001 From: Elijah Whang <59347000+ewhang5@users.noreply.github.com> Date: Mon, 1 Jul 2024 13:38:20 -0500 Subject: [PATCH 16/17] all: smoother dialogs (fixes #3729) (#3730) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../java/org/ole/planet/myplanet/base/BaseDialogFragment.kt | 4 ++-- .../org/ole/planet/myplanet/ui/feedback/FeedbackFragment.kt | 2 +- .../org/ole/planet/myplanet/ui/rating/RatingFragment.kt | 3 +-- .../ole/planet/myplanet/ui/resources/CollectionsFragment.kt | 3 ++- app/src/main/res/layout/fragment_feedback.xml | 6 ++++-- app/src/main/res/values/dimens.xml | 2 ++ app/src/main/res/values/styles.xml | 6 ++++++ 8 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a1bbf24235..08e6e0922b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1638 - versionName "0.16.38" + versionCode 1639 + versionName "0.16.39" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/base/BaseDialogFragment.kt b/app/src/main/java/org/ole/planet/myplanet/base/BaseDialogFragment.kt index a6c2f8952f..298697e04f 100644 --- a/app/src/main/java/org/ole/planet/myplanet/base/BaseDialogFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/base/BaseDialogFragment.kt @@ -1,6 +1,6 @@ package org.ole.planet.myplanet.base -import android.R +import org.ole.planet.myplanet.R import android.os.Bundle import androidx.fragment.app.DialogFragment @@ -9,7 +9,7 @@ abstract class BaseDialogFragment : DialogFragment() { var id: String? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setStyle(STYLE_NO_TITLE, R.style.Theme_Holo_Light_Dialog_NoActionBar_MinWidth) + setStyle(STYLE_NO_TITLE, R.style.AppTheme_Dialog_NoActionBar_MinWidth) if (arguments != null) { id = requireArguments().getString(key) } diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/feedback/FeedbackFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/feedback/FeedbackFragment.kt index 882bb888f7..6b9ae244a9 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/feedback/FeedbackFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/feedback/FeedbackFragment.kt @@ -38,7 +38,7 @@ class FeedbackFragment : DialogFragment(), View.OnClickListener { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setStyle(STYLE_NO_TITLE, android.R.style.Theme_Holo_Light_Dialog_NoActionBar_MinWidth) + setStyle(STYLE_NO_TITLE, R.style.AppTheme_Dialog_NoActionBar_MinWidth) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/rating/RatingFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/rating/RatingFragment.kt index 71aaad47ac..641e98c6e9 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/rating/RatingFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/rating/RatingFragment.kt @@ -17,7 +17,6 @@ import org.ole.planet.myplanet.databinding.FragmentRatingBinding import org.ole.planet.myplanet.datamanager.DatabaseService import org.ole.planet.myplanet.model.RealmRating import org.ole.planet.myplanet.model.RealmUserModel -import org.ole.planet.myplanet.ui.sync.SyncActivity import org.ole.planet.myplanet.utilities.Constants.PREFS_NAME import org.ole.planet.myplanet.utilities.Utilities import java.util.Date @@ -40,7 +39,7 @@ class RatingFragment : DialogFragment() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setStyle(STYLE_NO_TITLE, android.R.style.Theme_Holo_Light_Dialog_NoActionBar_MinWidth) + setStyle(STYLE_NO_TITLE, R.style.AppTheme_Dialog_NoActionBar_MinWidth) if (arguments != null) { id = requireArguments().getString("id") type = requireArguments().getString("type") diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/resources/CollectionsFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/resources/CollectionsFragment.kt index 54f27f8907..ee34518792 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/resources/CollectionsFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/resources/CollectionsFragment.kt @@ -19,6 +19,7 @@ import kotlin.collections.ArrayList import kotlin.collections.HashMap import kotlin.collections.List import io.realm.Realm +import org.ole.planet.myplanet.R class CollectionsFragment : DialogFragment(), TagExpandableAdapter.OnClickTagItem, CompoundButton.OnCheckedChangeListener { private lateinit var fragmentCollectionsBinding: FragmentCollectionsBinding @@ -32,7 +33,7 @@ class CollectionsFragment : DialogFragment(), TagExpandableAdapter.OnClickTagIte override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setStyle(STYLE_NO_TITLE, android.R.style.Theme_Holo_Light_Dialog_NoActionBar_MinWidth) + setStyle(STYLE_NO_TITLE, R.style.AppTheme_Dialog_NoActionBar_MinWidth) dbType = arguments?.getString("dbType") } diff --git a/app/src/main/res/layout/fragment_feedback.xml b/app/src/main/res/layout/fragment_feedback.xml index 03c97168d4..1d229f045c 100644 --- a/app/src/main/res/layout/fragment_feedback.xml +++ b/app/src/main/res/layout/fragment_feedback.xml @@ -112,7 +112,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_cancel" - android:textSize="@dimen/text_size_mid" /> + android:textSize="@dimen/text_size_mid" + android:textColor="@color/primary" />