Merge pull request #1136 from Bnyro/master

add device info dialog
This commit is contained in:
Bnyro 2022-08-24 18:30:02 +02:00 committed by GitHub
commit 792b63c9d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 2 deletions

View File

@ -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)
}
@ -77,6 +88,10 @@ class AboutActivity : BaseActivity() {
onLongClick(LICENSE_URL)
true
}
binding.device.setOnClickListener {
showDeviceInfo()
}
}
private fun openLinkFromHref(link: String) {
@ -120,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()
}
}

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="48"
android:viewportHeight="48">
<path
android:fillColor="#FF000000"
android:pathData="M13,46q-1.2,0 -2.1,-0.9 -0.9,-0.9 -0.9,-2.1L10,5q0,-1.2 0.9,-2.1 0.9,-0.9 2.1,-0.9h22q1.2,0 2.1,0.9 0.9,0.9 0.9,2.1v38q0,1.2 -0.9,2.1 -0.9,0.9 -2.1,0.9ZM24,42.25q0.65,0 1.075,-0.425 0.425,-0.425 0.425,-1.075 0,-0.65 -0.425,-1.075 -0.425,-0.425 -1.075,-0.425 -0.65,0 -1.075,0.425 -0.425,0.425 -0.425,1.075 0,0.65 0.425,1.075 0.425,0.425 1.075,0.425ZM13,35.5h22v-26L13,9.5Z" />
</vector>

View File

@ -6,10 +6,11 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/appIcon"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
@ -23,7 +24,7 @@
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="40dp"
android:text="LibreTube"
android:text="@string/app_name"
android:textSize="24sp"
android:textStyle="bold" />
@ -135,6 +136,24 @@
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:id="@+id/device"
style="@style/AboutCard">
<LinearLayout style="@style/AboutItem">
<ImageView
style="@style/AboutImageView"
android:src="@drawable/ic_device" />
<TextView
style="@style/AboutTextView"
android:text="@string/device_info" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</ScrollView>

View File

@ -312,4 +312,5 @@
<string name="open_copied">Open</string>
<string name="break_reminder_time">Minutes before being reminded</string>
<string name="legacy_subscriptions">Legacy subscriptions view</string>
<string name="device_info">Device Info</string>
</resources>