Skip to content

Commit

Permalink
[settings] add app version text
Browse files Browse the repository at this point in the history
  • Loading branch information
capcom6 committed May 13, 2024
1 parent bc860c1 commit c0c20e3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/src/main/java/me/capcom/smsgateway/ui/SettingsFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.core.content.edit
import androidx.preference.EditTextPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import me.capcom.smsgateway.BuildConfig
import me.capcom.smsgateway.R
import me.capcom.smsgateway.modules.gateway.GatewaySettings

Expand Down Expand Up @@ -45,6 +46,9 @@ class SettingsFragment : PreferenceFragmentCompat() {
}
return@setSummaryProvider hostname
}

findPreference<Preference>("transient.app_version")?.summary =
"${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})"
}

override fun onDisplayPreferenceDialog(preference: Preference) {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@
<string name="minimum">Minimum</string>
<string name="maximum">Maximum</string>
<string name="set_maximum_value_to_activate">Set maximum value to activate</string>
<string name="information">Information</string>
<string name="app_version_build">App version (build)</string>
</resources>
8 changes: 8 additions & 0 deletions app/src/main/res/xml/root_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,12 @@
app:useSimpleSummaryProvider="true" />
</PreferenceCategory>

<PreferenceCategory app:title="@string/information">
<Preference
android:key="transient.app_version"
android:title="@string/app_version_build"
app:persistent="false"
app:selectable="false" />
</PreferenceCategory>

</PreferenceScreen>

0 comments on commit c0c20e3

Please sign in to comment.