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)
buildConfigField(
"String",
"BUILDDATE",
"new java.text.SimpleDateFormat(\"yyyy-MM-dd HH:mm\").format(new java.util.Date(" + System.currentTimeMillis() + "L));"
"long",
"BUILD_DATE",
"${System.currentTimeMillis()}"
)
buildConfigField(
"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.toPx
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() {
companion object {
@ -180,12 +185,14 @@ class SettingsFragment : Fragment() {
val appVersion = getString(R.string.app_version)
val commitInfo = getString(R.string.commit_hash)
val buildDate = BuildConfig.BUILDDATE
val buildTimestamp = SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG,
Locale.getDefault()
).apply { timeZone = TimeZone.getTimeZone("UTC")
}.format(Date(BuildConfig.BUILD_DATE)).replace("UTC", "")
binding?.buildDate?.text = buildDate
binding?.appVersionInfo?.setOnLongClickListener{
clipboardHelper(txt(R.string.extension_version), "$appVersion $commitInfo")
binding?.buildDate?.text = buildTimestamp
binding?.appVersionInfo?.setOnLongClickListener {
clipboardHelper(txt(R.string.extension_version), "$appVersion $commitInfo $buildTimestamp")
true
}
}

View file

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