From 64af78dfaf9d81b526bbf28cb9c143bc3cb806cf Mon Sep 17 00:00:00 2001 From: Bnyro Date: Wed, 24 Aug 2022 18:06:43 +0200 Subject: [PATCH 1/2] allow sharing the app in about --- .../com/github/libretube/activities/AboutActivity.kt | 11 +++++++++++ app/src/main/res/layout/activity_about.xml | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/libretube/activities/AboutActivity.kt b/app/src/main/java/com/github/libretube/activities/AboutActivity.kt index 0f686b483..39d3101ad 100644 --- a/app/src/main/java/com/github/libretube/activities/AboutActivity.kt +++ b/app/src/main/java/com/github/libretube/activities/AboutActivity.kt @@ -30,6 +30,17 @@ class AboutActivity : BaseActivity() { binding = ActivityAboutBinding.inflate(layoutInflater) setContentView(binding.root) + binding.appIcon.setOnClickListener { + val sendIntent: Intent = Intent().apply { + action = Intent.ACTION_SEND + putExtra(Intent.EXTRA_TEXT, GITHUB_URL) + type = "text/plain" + } + + val shareIntent = Intent.createChooser(sendIntent, null) + startActivity(shareIntent) + } + binding.website.setOnClickListener { openLinkFromHref(WEBSITE_URL) } diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index e9c7e5914..e441f7de3 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -6,10 +6,11 @@ From 47a4187d5262bf968428a1094c545cdc75a3e96e Mon Sep 17 00:00:00 2001 From: Bnyro Date: Wed, 24 Aug 2022 18:29:39 +0200 Subject: [PATCH 2/2] add device info dialog --- .../libretube/activities/AboutActivity.kt | 20 +++++++++++++++++++ app/src/main/res/drawable/ic_device.xml | 10 ++++++++++ app/src/main/res/layout/activity_about.xml | 18 +++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 4 files changed, 49 insertions(+) create mode 100644 app/src/main/res/drawable/ic_device.xml diff --git a/app/src/main/java/com/github/libretube/activities/AboutActivity.kt b/app/src/main/java/com/github/libretube/activities/AboutActivity.kt index 39d3101ad..e02a1edd7 100644 --- a/app/src/main/java/com/github/libretube/activities/AboutActivity.kt +++ b/app/src/main/java/com/github/libretube/activities/AboutActivity.kt @@ -88,6 +88,10 @@ class AboutActivity : BaseActivity() { onLongClick(LICENSE_URL) true } + + binding.device.setOnClickListener { + showDeviceInfo() + } } private fun openLinkFromHref(link: String) { @@ -131,4 +135,20 @@ class AboutActivity : BaseActivity() { .create() .show() } + + private fun showDeviceInfo() { + 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}" + + MaterialAlertDialogBuilder(this) + .setTitle(R.string.device_info) + .setMessage(text) + .setPositiveButton(R.string.okay, null) + .show() + } } diff --git a/app/src/main/res/drawable/ic_device.xml b/app/src/main/res/drawable/ic_device.xml new file mode 100644 index 000000000..8ae0007a4 --- /dev/null +++ b/app/src/main/res/drawable/ic_device.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index e441f7de3..4999b4636 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -136,6 +136,24 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3613bada4..9fba8cc81 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -312,4 +312,5 @@ Open Minutes before being reminded Legacy subscriptions view + Device Info