From 7a4635d87346a2dcbe7032d7d9d956c1bb12a30f Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 23 Jul 2024 17:30:35 +0200 Subject: [PATCH 1/3] feat: possibility to copy device info in about dialog --- .../java/com/github/libretube/ui/activities/AboutActivity.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt index 6e6ab42f2..20b9f3c5f 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt @@ -104,6 +104,9 @@ class AboutActivity : BaseActivity() { 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() } From 3cc8c8be88a415a49f6c9adedc50f60637b07310 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 23 Jul 2024 17:35:43 +0200 Subject: [PATCH 2/3] feat: include display size and font scale in device info dialog --- .../libretube/ui/activities/AboutActivity.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt index 20b9f3c5f..fd466640a 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt @@ -1,6 +1,7 @@ package com.github.libretube.ui.activities import android.content.Intent +import android.content.res.Resources import android.os.Build import android.os.Bundle import androidx.core.text.HtmlCompat @@ -93,13 +94,15 @@ 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) From 315aa4f5c5fa23c545ed2bf50d461cea6c66fa1c Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 23 Jul 2024 17:51:36 +0200 Subject: [PATCH 3/3] feat: display copyable version number in about activity --- .../libretube/ui/activities/AboutActivity.kt | 9 ++++ app/src/main/res/layout/activity_about.xml | 42 +++++++++++++++---- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt index fd466640a..4cb1edb39 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt @@ -1,11 +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 @@ -18,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) @@ -35,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) diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index fed0e0c26..87ef9fa58 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -27,17 +27,43 @@ app:tint="?attr/colorSecondary" tools:ignore="ContentDescription" /> - + android:layout_marginBottom="40dp"> - + + + + + + + + + +