format build date and time and make it copyable

This commit is contained in:
IndusAryan 2024-03-21 19:43:03 +05:30
parent 1ff0b5dccd
commit b205907e62
2 changed files with 15 additions and 14 deletions

View file

@ -30,6 +30,8 @@ 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.SimpleDateFormat
import java.util.Locale
class SettingsFragment : Fragment() {
companion object {
@ -181,11 +183,17 @@ class SettingsFragment : Fragment() {
val appVersion = getString(R.string.app_version)
val commitInfo = getString(R.string.commit_hash)
val buildDate = BuildConfig.BUILDDATE
val formattedDate = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault())
.parse(buildDate)?.let { date ->
SimpleDateFormat("dd/MM/yy hh:mm a", Locale.getDefault()).format(date)
}
binding?.buildDate?.text = buildDate
binding?.appVersionInfo?.setOnLongClickListener{
clipboardHelper(txt(R.string.extension_version), "$appVersion $commitInfo")
binding?.buildDate?.text = formattedDate
binding?.appVersionInfo?.setOnLongClickListener {
clipboardHelper(
txt(R.string.extension_version),
"$appVersion $commitInfo $formattedDate"
)
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 19:01"/>
</LinearLayout>
</LinearLayout>