mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 13:50:30 +05:30
Merge pull request #6269 from Bnyro/master
feat: improve about activity and device info dialog
This commit is contained in:
commit
5f4fc603fe
@ -1,10 +1,13 @@
|
||||
package com.github.libretube.ui.activities
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.content.res.Resources
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.core.text.parseAsHtml
|
||||
import com.github.libretube.BuildConfig
|
||||
import com.github.libretube.R
|
||||
import com.github.libretube.databinding.ActivityAboutBinding
|
||||
import com.github.libretube.helpers.ClipboardHelper
|
||||
@ -17,6 +20,7 @@ import com.google.android.material.snackbar.Snackbar
|
||||
class AboutActivity : BaseActivity() {
|
||||
private lateinit var binding: ActivityAboutBinding
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@ -34,6 +38,12 @@ class AboutActivity : BaseActivity() {
|
||||
startActivity(Intent.createChooser(sendIntent, null))
|
||||
}
|
||||
|
||||
val versionText = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})"
|
||||
binding.versionTv.text = versionText
|
||||
binding.versionCard.setOnClickListener {
|
||||
ClipboardHelper.save(this, text = versionText)
|
||||
}
|
||||
|
||||
setupCard(binding.donate, DONATE_URL)
|
||||
setupCard(binding.website, WEBSITE_URL)
|
||||
setupCard(binding.piped, PIPED_GITHUB_URL)
|
||||
@ -93,17 +103,22 @@ class AboutActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
private fun showDeviceInfo() {
|
||||
val metrics = Resources.getSystem().displayMetrics
|
||||
|
||||
val text = "Manufacturer: ${Build.MANUFACTURER}\n" +
|
||||
"Model: ${Build.MODEL}\n" +
|
||||
"SDK: ${Build.VERSION.SDK_INT}\n" +
|
||||
"Board: ${Build.BOARD}\n" +
|
||||
"OS: Android ${Build.VERSION.RELEASE}\n" +
|
||||
"Arch: ${Build.SUPPORTED_ABIS[0]}\n" +
|
||||
"Product: ${Build.PRODUCT}"
|
||||
"Board: ${Build.BOARD}\n" +
|
||||
"Arch: ${Build.SUPPORTED_ABIS[0]}\n" +
|
||||
"Android SDK: ${Build.VERSION.SDK_INT}\n" +
|
||||
"OS: Android ${Build.VERSION.RELEASE}\n" +
|
||||
"Display: ${metrics.widthPixels}x${metrics.heightPixels}\n" +
|
||||
"Font scale: ${Resources.getSystem().configuration.fontScale}"
|
||||
|
||||
MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.device_info)
|
||||
.setMessage(text)
|
||||
.setNegativeButton(R.string.copy_tooltip) { _, _ ->
|
||||
ClipboardHelper.save(this@AboutActivity, text = text)
|
||||
}
|
||||
.setPositiveButton(R.string.okay, null)
|
||||
.show()
|
||||
}
|
||||
|
@ -27,17 +27,43 @@
|
||||
app:tint="?attr/colorSecondary"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
android:layout_marginBottom="40dp">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
<TextView
|
||||
android:id="@+id/app_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/version_card"
|
||||
style="@style/Widget.Material3.CardView.Elevated"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="-40dp"
|
||||
android:layout_toEndOf="@id/app_name">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/version_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="6dp"
|
||||
android:layout_marginVertical="3dp"
|
||||
tools:text="1.0.0 (99)" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/donate"
|
||||
style="@style/AboutCard">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user