add device info dialog

This commit is contained in:
Bnyro 2022-08-24 18:29:39 +02:00
parent 64af78dfaf
commit 47a4187d52
4 changed files with 49 additions and 0 deletions

View File

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

@ -136,6 +136,24 @@
</com.google.android.material.card.MaterialCardView> </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> </LinearLayout>
</ScrollView> </ScrollView>

View File

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