mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-22 14:01:28 +01:00
implement #102 - show version in settings and add bug report dialog
Some checks failed
Android CI / build (push) Has been cancelled
Some checks failed
Android CI / build (push) Has been cancelled
This commit is contained in:
parent
6d385e4e87
commit
23f8cfb70e
6 changed files with 131 additions and 9 deletions
|
@ -3,6 +3,8 @@ package de.jrpie.android.launcher
|
|||
import android.app.Activity
|
||||
import android.app.Service
|
||||
import android.app.role.RoleManager
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.LauncherApps
|
||||
|
@ -151,3 +153,21 @@ fun saveListActivityChoice(data: Intent?) {
|
|||
Gesture.byId(forGesture)?.let { Action.setActionForGesture(it, Action.fromIntent(data)) }
|
||||
}
|
||||
|
||||
|
||||
// used for the bug report button
|
||||
fun getDeviceInfo(): String {
|
||||
return """
|
||||
µLauncher version: ${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})
|
||||
Android version: ${Build.VERSION.RELEASE} (sdk ${Build.VERSION.SDK_INT})
|
||||
Model: ${Build.MODEL}
|
||||
Device: ${Build.DEVICE}
|
||||
Brand: ${Build.BRAND}
|
||||
Manufacturer: ${Build.MANUFACTURER}
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
fun copyToClipboard(context: Context, text: String) {
|
||||
val clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val clipData = ClipData.newPlainText("Debug Info", text)
|
||||
clipboardManager.setPrimaryClip(clipData);
|
||||
}
|
|
@ -7,9 +7,14 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import de.jrpie.android.launcher.BuildConfig
|
||||
import de.jrpie.android.launcher.R
|
||||
import de.jrpie.android.launcher.copyToClipboard
|
||||
import de.jrpie.android.launcher.databinding.SettingsMetaBinding
|
||||
import de.jrpie.android.launcher.getDeviceInfo
|
||||
import de.jrpie.android.launcher.openInBrowser
|
||||
import de.jrpie.android.launcher.preferences.resetPreferences
|
||||
import de.jrpie.android.launcher.ui.LegalInfoActivity
|
||||
|
@ -88,13 +93,37 @@ class SettingsFragmentMeta : Fragment(), UIObject {
|
|||
|
||||
// report a bug
|
||||
binding.settingsMetaButtonReportBug.setOnClickListener {
|
||||
openInBrowser(
|
||||
getString(R.string.settings_meta_report_bug_link),
|
||||
requireContext()
|
||||
)
|
||||
val deviceInfo = getDeviceInfo()
|
||||
AlertDialog.Builder(context, R.style.AlertDialogCustom).apply {
|
||||
setView(R.layout.dialog_report_bug)
|
||||
setTitle(R.string.dialog_report_bug_title)
|
||||
setPositiveButton(R.string.dialog_report_bug_create_report) { _, _ ->
|
||||
openInBrowser(
|
||||
getString(R.string.settings_meta_report_bug_link),
|
||||
requireContext()
|
||||
)
|
||||
}
|
||||
setNegativeButton(R.string.dialog_cancel) { _, _ -> }
|
||||
}.create().also { it.show() }.apply {
|
||||
val info = findViewById<TextView>(R.id.dialog_report_bug_device_info)
|
||||
val buttonClipboard = findViewById<Button>(R.id.dialog_report_bug_button_clipboard)
|
||||
val buttonSecurity = findViewById<Button>(R.id.dialog_report_bug_button_security)
|
||||
info.text = deviceInfo
|
||||
buttonClipboard.setOnClickListener {
|
||||
copyToClipboard(requireContext(), deviceInfo)
|
||||
}
|
||||
info.setOnClickListener {
|
||||
copyToClipboard(requireContext(), deviceInfo)
|
||||
}
|
||||
buttonSecurity.setOnClickListener {
|
||||
openInBrowser(
|
||||
getString(R.string.settings_meta_report_vulnerability_link),
|
||||
requireContext()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// join chat
|
||||
binding.settingsMetaButtonJoinChat.setOnClickListener {
|
||||
openInBrowser(
|
||||
|
@ -104,7 +133,6 @@ class SettingsFragmentMeta : Fragment(), UIObject {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// contact developer
|
||||
binding.settingsMetaButtonContact.setOnClickListener {
|
||||
openInBrowser(
|
||||
|
@ -134,5 +162,7 @@ class SettingsFragmentMeta : Fragment(), UIObject {
|
|||
startActivity(Intent(this.context, LegalInfoActivity::class.java))
|
||||
}
|
||||
|
||||
binding.settingsMetaTextVersion.text = BuildConfig.VERSION_NAME
|
||||
|
||||
}
|
||||
}
|
||||
|
|
53
app/src/main/res/layout/dialog_report_bug.xml
Normal file
53
app/src/main/res/layout/dialog_report_bug.xml
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/AlertDialogDanger"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_report_bug_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_report_bug_info" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_report_bug_device_info"
|
||||
android:padding="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Version: ?\nAndroid Version: ?" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/dialog_report_bug_button_clipboard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_report_bug_button_clipboard" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_report_bug_security_info"/>
|
||||
<Button
|
||||
android:id="@+id/dialog_report_bug_button_security"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_report_bug_button_security" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/settings_meta_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:context=".ui.settings.meta.SettingsFragmentMeta">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -91,5 +91,16 @@
|
|||
android:text="@string/settings_meta_licenses"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings_meta_text_version"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="textEnd"
|
||||
tools:text="v1.2.3" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -154,7 +154,8 @@
|
|||
-
|
||||
-->
|
||||
<string name="settings_meta_link_github" translatable="false">https://github.com/jrpie/Launcher</string>
|
||||
<string name="settings_meta_report_bug_link" translatable="false">https://github.com/jrpie/Launcher/issues/new/choose</string>
|
||||
<string name="settings_meta_report_bug_link" translatable="false">https://github.com/jrpie/Launcher/issues/new?template=bug_report.md</string>
|
||||
<string name="settings_meta_report_vulnerability_link" translatable="false">https://github.com/jrpie/Launcher/security/policy</string>
|
||||
<string name="settings_meta_fork_contact_url" translatable="false">https://s.jrpie.de/contact</string>
|
||||
<string name="settings_meta_privacy_url" translatable="false">https://s.jrpie.de/android-legal</string>
|
||||
<string name="settings_meta_contact_url" translatable="false">https://www.finnmglas.com/contact/</string>
|
||||
|
|
|
@ -169,6 +169,13 @@
|
|||
<string name="settings_meta_view_code">View source code</string>
|
||||
<string name="settings_meta_report_bug">Report a bug</string>
|
||||
|
||||
<string name="dialog_report_bug_title">Report a bug</string>
|
||||
<string name="dialog_report_bug_info">Thank you for helping to improve µLauncher!\nPlease consider adding the following information to your bug report:</string>
|
||||
<string name="dialog_report_bug_button_clipboard">Copy to clipboard</string>
|
||||
<string name="dialog_report_bug_security_info">Please do not report security vulnerabilities publicly on GitHub, but use the following instead:</string>
|
||||
<string name="dialog_report_bug_button_security">Report a security vulnerability</string>
|
||||
<string name="dialog_report_bug_create_report">Create report</string>
|
||||
|
||||
<string name="settings_meta_fork_contact">Contact the developer of the fork</string>
|
||||
<string name="settings_meta_join_chat">Join µLauncher chat</string>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue