refactor: format build date and time and make it copyable (#1002)

This commit is contained in:
IndusAryan 2024-03-25 05:29:55 +05:30 committed by GitHub
parent 650c7583af
commit 35e38a53ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 18 deletions

View file

@ -70,9 +70,9 @@ android {
val localProperties = gradleLocalProperties(rootDir) val localProperties = gradleLocalProperties(rootDir)
buildConfigField( buildConfigField(
"String", "long",
"BUILDDATE", "BUILD_DATE",
"new java.text.SimpleDateFormat(\"yyyy-MM-dd HH:mm\").format(new java.util.Date(" + System.currentTimeMillis() + "L));" "${System.currentTimeMillis()}"
) )
buildConfigField( buildConfigField(
"String", "String",

View file

@ -30,6 +30,11 @@ import com.lagradost.cloudstream3.utils.UIHelper.navigate
import com.lagradost.cloudstream3.utils.UIHelper.setImage import com.lagradost.cloudstream3.utils.UIHelper.setImage
import com.lagradost.cloudstream3.utils.UIHelper.toPx import com.lagradost.cloudstream3.utils.UIHelper.toPx
import java.io.File import java.io.File
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import java.util.TimeZone
class SettingsFragment : Fragment() { class SettingsFragment : Fragment() {
companion object { companion object {
@ -180,12 +185,14 @@ class SettingsFragment : Fragment() {
val appVersion = getString(R.string.app_version) val appVersion = getString(R.string.app_version)
val commitInfo = getString(R.string.commit_hash) val commitInfo = getString(R.string.commit_hash)
val buildDate = BuildConfig.BUILDDATE val buildTimestamp = SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG,
Locale.getDefault()
binding?.buildDate?.text = buildDate ).apply { timeZone = TimeZone.getTimeZone("UTC")
}.format(Date(BuildConfig.BUILD_DATE)).replace("UTC", "")
binding?.buildDate?.text = buildTimestamp
binding?.appVersionInfo?.setOnLongClickListener { binding?.appVersionInfo?.setOnLongClickListener {
clipboardHelper(txt(R.string.extension_version), "$appVersion $commitInfo") clipboardHelper(txt(R.string.extension_version), "$appVersion $commitInfo $buildTimestamp")
true true
} }
} }

View file

@ -112,9 +112,9 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/version_info"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp" android:padding="10dp"
android:text="@string/app_version" android:text="@string/app_version"
android:textColor="?attr/textColor" /> android:textColor="?attr/textColor" />
@ -123,8 +123,6 @@
android:id="@+id/delimiter0" android:id="@+id/delimiter0"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp"
android:text="•" android:text="•"
android:textColor="?attr/textColor" /> android:textColor="?attr/textColor" />
@ -132,7 +130,6 @@
android:id="@+id/commit_hash" android:id="@+id/commit_hash"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp" android:padding="10dp"
android:text="@string/commit_hash" android:text="@string/commit_hash"
android:textColor="?attr/textColor" /> android:textColor="?attr/textColor" />
@ -141,9 +138,6 @@
android:id="@+id/delimiter1" android:id="@+id/delimiter1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="10dp"
android:text="•" android:text="•"
android:textColor="?attr/textColor" /> android:textColor="?attr/textColor" />
@ -151,10 +145,9 @@
android:id="@+id/build_date" android:id="@+id/build_date"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="10dp" android:padding="10dp"
android:textColor="?attr/textColor" /> android:textColor="?attr/textColor"
tools:text="21/03/2024 09:02 pm"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>