From 2a30643d5e9b6c8a195dfe51bfa30d239efb52d7 Mon Sep 17 00:00:00 2001 From: IndusAryan Date: Fri, 8 Mar 2024 13:44:54 +0530 Subject: [PATCH] make version copyable and fix my stupidity --- .../cloudstream3/ui/settings/SettingsFragment.kt | 10 ++++++++++ .../cloudstream3/ui/settings/SettingsUpdates.kt | 2 -- .../java/com/lagradost/cloudstream3/utils/UIHelper.kt | 4 ++-- app/src/main/res/layout/main_settings.xml | 5 +++-- app/src/main/res/values/strings.xml | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt index 37c71134..c183621c 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsFragment.kt @@ -24,6 +24,8 @@ import com.lagradost.cloudstream3.databinding.MainSettingsBinding import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.accountManagers import com.lagradost.cloudstream3.ui.home.HomeFragment +import com.lagradost.cloudstream3.ui.result.txt +import com.lagradost.cloudstream3.utils.UIHelper.clipboardHelper import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar import com.lagradost.cloudstream3.utils.UIHelper.navigate import com.lagradost.cloudstream3.utils.UIHelper.setImage @@ -230,5 +232,13 @@ class SettingsFragment : Fragment() { settingsGeneral.requestFocus() } } + + val appVersion = getString(R.string.app_version) + val commitInfo = getString(R.string.commit_hash) + + binding?.appVersionInfo?.setOnLongClickListener{ + clipboardHelper(txt(R.string.extension_version), "$appVersion $commitInfo") + true + } } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsUpdates.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsUpdates.kt index e0ec7601..fb24c185 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsUpdates.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsUpdates.kt @@ -1,7 +1,6 @@ package com.lagradost.cloudstream3.ui.settings import android.os.Bundle -import android.os.TransactionTooLargeException import android.view.View import android.widget.Toast import androidx.appcompat.app.AlertDialog @@ -17,7 +16,6 @@ import com.lagradost.cloudstream3.databinding.LogcatBinding import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.network.initClient import com.lagradost.cloudstream3.services.BackupWorkManager -import com.lagradost.cloudstream3.ui.result.UiText import com.lagradost.cloudstream3.ui.result.txt import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setPaddingBottom diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt index 60773a0d..5a852be1 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt @@ -137,7 +137,7 @@ object UIHelper { ctx.getSystemService()?.setPrimaryClip(clip) if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) { - showToast("$label $labelSuffix") + showToast("${label.asString(ctx)} $labelSuffix") } } } catch (t: Throwable) { @@ -152,7 +152,7 @@ object UIHelper { } else -> { - showToast(R.string.unexpected_error, LENGTH_LONG) + showToast(R.string.clipboard_unknown_error, LENGTH_LONG) } } } diff --git a/app/src/main/res/layout/main_settings.xml b/app/src/main/res/layout/main_settings.xml index 387f98fa..53db7e47 100644 --- a/app/src/main/res/layout/main_settings.xml +++ b/app/src/main/res/layout/main_settings.xml @@ -105,9 +105,10 @@ android:text="@string/extensions" /> Show skip popups for opening/ending Too much text. Unable to save to clipboard. Error accessing Clipboard, Please try again. - Error copying content, Please copy logcat and contact app support. + Error copying, Please copy logcat and contact app support. Mark as watched Remove from watched Are you sure you want to exit\?