Improve permission texts, privacy policy link and layouts.

This commit is contained in:
darken
2022-01-21 12:18:59 +01:00
parent 6d2c4ba8ca
commit 1d5e13cc24
12 changed files with 38 additions and 30 deletions
@@ -16,5 +16,6 @@ object BuildConfigWrap {
val VERSION_NAME: String = BuildConfig.VERSION_NAME
val GIT_SHA: String = BuildConfig.GITSHA
val VERSION_DESCRIPTION: String = "v$VERSION_NAME ($VERSION_CODE) [$GIT_SHA] ${FLAVOR}_$BUILD_TYPE"
val VERSION_DESCRIPTION_LONG: String = "v$VERSION_NAME ($VERSION_CODE) [$GIT_SHA] ${FLAVOR}_$BUILD_TYPE"
val VERSION_DESCRIPTION_SHORT: String = "v$VERSION_NAME [$GIT_SHA] $FLAVOR"
}
@@ -0,0 +1,5 @@
package eu.darken.capod.common
object PrivacyPolicy {
const val URL = "https://raw.githubusercontent.com/d4rken/capod-public/main/PRIVACY_POLICY.md"
}
@@ -58,7 +58,7 @@ class RecorderModule @Inject constructor(
context.startServiceCompat(Intent(context, RecorderService::class.java))
log(TAG, INFO) { "Build.Fingerprint: ${Build.FINGERPRINT}" }
log(TAG, INFO) { "BuildConfig.Versions: ${BuildConfigWrap.VERSION_DESCRIPTION}" }
log(TAG, INFO) { "BuildConfig.Versions: ${BuildConfigWrap.VERSION_DESCRIPTION_LONG}" }
copy(
recorder = newRecorder
@@ -89,7 +89,7 @@ class RecorderActivityVM @Inject constructor(
type = "application/zip"
addCategory(Intent.CATEGORY_DEFAULT)
putExtra(Intent.EXTRA_SUBJECT, "CAPod DebugLog - ${BuildConfigWrap.VERSION_DESCRIPTION})")
putExtra(Intent.EXTRA_SUBJECT, "CAPod DebugLog - ${BuildConfigWrap.VERSION_DESCRIPTION_LONG})")
putExtra(Intent.EXTRA_TEXT, "Your text here.")
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
@@ -116,9 +116,6 @@ class OverviewFragmentVM @Inject constructor(
PermissionCardVH.Item(
permission = perm,
onRequest = { requestPermissionEvent.postValue(it) },
onPPAction = {
webpageTool.open("https://raw.githubusercontent.com/d4rken/capod-public/main/PRIVACY_POLICY.md")
}
)
}
.run { items.addAll(this) }
@@ -1,7 +1,10 @@
package eu.darken.capod.main.ui.overview.cards
import android.text.Html
import android.text.method.LinkMovementMethod
import android.view.ViewGroup
import eu.darken.capod.R
import eu.darken.capod.common.PrivacyPolicy
import eu.darken.capod.common.lists.binding
import eu.darken.capod.common.lists.differ.DifferItem
import eu.darken.capod.common.permissions.Permission
@@ -25,15 +28,17 @@ class PermissionCardVH(parent: ViewGroup) :
permissionLabel.setText(item.permission.labelRes)
permissionDescription.setText(item.permission.descriptionRes)
grantAction.setOnClickListener { item.onRequest(item.permission) }
ppAction.setOnClickListener {
item.onPPAction()
privacyPolicy.apply {
movementMethod = LinkMovementMethod.getInstance()
val ppText = getString(R.string.settings_privacy_policy_label)
val ppLink = PrivacyPolicy.URL
text = Html.fromHtml("<html><a href=\"$ppLink\">$ppText</a></html>", 0)
}
}
data class Item(
val permission: Permission,
val onRequest: (Permission) -> Unit,
val onPPAction: () -> Unit
val onRequest: (Permission) -> Unit
) : OverviewAdapter.Item {
override val stableId: Long = permission.hashCode().toLong()
@@ -68,7 +68,7 @@ class SettingsFragment : Fragment2(R.layout.settings_fragment),
}
ui.toolbar.apply {
subtitle = BuildConfigWrap.VERSION_DESCRIPTION
subtitle = BuildConfigWrap.VERSION_DESCRIPTION_SHORT
setNavigationOnClickListener { requireActivity().onBackPressed() }
}
@@ -7,6 +7,7 @@ import dagger.hilt.android.AndroidEntryPoint
import eu.darken.androidstarter.common.preferences.Settings
import eu.darken.capod.R
import eu.darken.capod.common.BuildConfigWrap
import eu.darken.capod.common.PrivacyPolicy
import eu.darken.capod.common.WebpageTool
import eu.darken.capod.common.uix.PreferenceFragment2
import eu.darken.capod.main.core.GeneralSettings
@@ -34,7 +35,11 @@ class SettingsIndexFragment : PreferenceFragment2() {
}
override fun onPreferencesCreated() {
findPreference<Preference>("core.changelog")!!.summary = BuildConfigWrap.VERSION_DESCRIPTION
findPreference<Preference>("core.changelog")!!.summary = BuildConfigWrap.VERSION_DESCRIPTION_LONG
findPreference<Preference>("core.privacy")!!.setOnPreferenceClickListener {
webpageTool.open(PrivacyPolicy.URL)
true
}
super.onPreferencesCreated()
}
@@ -29,7 +29,7 @@ class SupportFragmentVM @Inject constructor(
bodyInfo.append("--- Infos for the developer ---\n")
bodyInfo.append("App version: ").append(BuildConfigWrap.VERSION_DESCRIPTION).append("\n")
bodyInfo.append("App version: ").append(BuildConfigWrap.VERSION_DESCRIPTION_LONG).append("\n")
bodyInfo.append("Device: ").append(Build.FINGERPRINT).append("\n")
bodyInfo.append("Install ID: ").append(installId.id).append("\n")
@@ -49,16 +49,15 @@
app:layout_constraintTop_toBottomOf="@id/permission_label"
tools:text="Lorem Ipsum" />
<com.google.android.material.button.MaterialButton
android:id="@+id/pp_action"
style="@style/Widget.MaterialComponents.Button.TextButton"
<com.google.android.material.textview.MaterialTextView
android:id="@+id/privacy_policy"
style="@style/TextAppearance.MaterialComponents.Tooltip"
android:layout_width="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="16dp"
android:layout_marginTop="4dp"
android:text="@string/settings_privacy_policy_label"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/permission_description" />
@@ -73,7 +72,7 @@
android:text="@string/general_grant_permission_action"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/permission_description" />
app:layout_constraintTop_toBottomOf="@id/privacy_policy" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
+1 -1
View File
@@ -33,7 +33,7 @@
<string name="permission_background_location_label">Background location access</string>
<string name="permission_background_location_description">CAPod uses \"background location access\" to enable features like \"Show popup\" and \"AutoConnect\" while the app is closed. Background location access allows the app to receive Bluetooth Low Energy data while it is in the background. This app will NOT use Bluetooth data to determine your location.</string>
<string name="permission_ignore_battery_optimizations_label">Disable battery optimizations</string>
<string name="permission_ignore_battery_optimizations_description">Battery optimizations prevent this app on some Android devices from receiving Bluetooth data while the app is in the background.</string>
<string name="permission_ignore_battery_optimizations_description">Battery optimizations prevent this app from reliably receiving Bluetooth data while the app is in the background.</string>
<string name="pods_single_basic_status_short">Headphones: %1$s</string>
<string name="pods_single_headphones_label">Headphones</string>
+6 -10
View File
@@ -20,16 +20,6 @@
app:title="@string/settings_support_label" />
<PreferenceCategory android:title="@string/settings_category_other_label">
<Preference
android:icon="@drawable/ic_baseline_book_24"
app:summary="@string/settings_privacy_policy_desc"
app:title="@string/settings_privacy_policy_label">
<intent
android:action="android.intent.action.VIEW"
android:data="https://raw.githubusercontent.com/d4rken/capod-public/main/PRIVACY_POLICY.md" />
</Preference>
<Preference
android:icon="@drawable/ic_changelog_onsurface"
android:key="core.changelog"
@@ -56,5 +46,11 @@
app:summary="@string/general_thank_you_label"
app:title="@string/settings_acknowledgements_label" />
<Preference
android:key="core.privacy"
android:icon="@drawable/ic_baseline_book_24"
app:summary="@string/settings_privacy_policy_desc"
app:title="@string/settings_privacy_policy_label" />
</PreferenceCategory>
</PreferenceScreen>