Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display app version in settings #67

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading