Add a link to the change log in app configuration (#975)

* Add a link to the change log in app configuration

* Review comments
This commit is contained in:
Daniel Shokouhi 2020-09-24 18:10:10 -07:00 committed by GitHub
parent f8f03c9ddd
commit 2a3d304674
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 0 deletions

View file

@ -1,7 +1,9 @@
package io.homeassistant.companion.android.settings
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.text.InputType
@ -125,6 +127,17 @@ class SettingsFragment : PreferenceFragmentCompat(), SettingsView {
return@setOnPreferenceClickListener true
}
findPreference<Preference>("changelog")?.let {
val link = if (BuildConfig.VERSION_NAME.startsWith("LOCAL"))
"https://github.com/home-assistant/android/releases"
else "https://github.com/home-assistant/android/releases/tag/${BuildConfig.VERSION_NAME}"
it.summary = link
val intent = Intent()
intent.action = "android.intent.action.VIEW"
intent.data = Uri.parse(link)
it.intent = intent
}
findPreference<Preference>("version")?.let {
it.isCopyingEnabled = true
it.summary = BuildConfig.VERSION_NAME

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/colorAccent"
android:pathData="M7,15h7v2L7,17zM7,11h10v2L7,13zM7,7h10v2L7,9zM19,3h-4.18C14.4,1.84 13.3,1 12,1c-1.3,0 -2.4,0.84 -2.82,2L5,3c-0.14,0 -0.27,0.01 -0.4,0.04 -0.39,0.08 -0.74,0.28 -1.01,0.55 -0.18,0.18 -0.33,0.4 -0.43,0.64 -0.1,0.23 -0.16,0.49 -0.16,0.77v14c0,0.27 0.06,0.54 0.16,0.78s0.25,0.45 0.43,0.64c0.27,0.27 0.62,0.47 1.01,0.55 0.13,0.02 0.26,0.03 0.4,0.03h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,2.75c0.41,0 0.75,0.34 0.75,0.75s-0.34,0.75 -0.75,0.75 -0.75,-0.34 -0.75,-0.75 0.34,-0.75 0.75,-0.75zM19,19L5,19L5,5h14v14z"/>
</vector>

View file

@ -60,6 +60,7 @@
<string name="biometric_title">Home Assistant is locked</string>
<string name="calendar">Calendar</string>
<string name="cancel">Cancel</string>
<string name="changelog">Change Log</string>
<string name="checking_with_home_assistant">Checking with Home Assistant</string>
<string name="config">Configuration</string>
<string name="configure_service_call">Configure Service Call</string>

View file

@ -87,6 +87,12 @@
</PreferenceCategory>
<PreferenceCategory
android:title="@string/app_version_info">
<Preference
android:key="changelog"
android:icon="@drawable/ic_changelog"
android:title="@string/changelog"
android:summary="https://github.com/home-assistant/android/releases"
app:enableCopying="true" />
<Preference
android:key="version"
android:icon="@drawable/app_icon"