Skip to content

Commit

Permalink
feat: add about section to setting
Browse files Browse the repository at this point in the history
  • Loading branch information
CastelJeremy committed Nov 3, 2023
1 parent c5b70b1 commit 9addb66
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/src/main/java/com/katiearose/sobriety/activities/Settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.text.InputType
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.preference.*
import com.katiearose.sobriety.BuildConfig
import com.katiearose.sobriety.R
import com.katiearose.sobriety.shared.CacheHandler
import com.katiearose.sobriety.utils.applyThemes
Expand Down Expand Up @@ -91,6 +92,15 @@ class Settings : AppCompatActivity() {
getImport.launch(arrayOf<String>("application/json"))
true
}

findPreference<Preference>("pref_app_version")?.summary = BuildConfig.VERSION_NAME

findPreference<Preference>("pref_app_issue_tracker")?.setOnPreferenceClickListener {
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(requireContext().getString(R.string.app_issue_url))
startActivity(i)
true
}
}
}
}
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name">Sobriety</string>
<string name="app_issue_url">https://github.com/KiARC/Sobriety/issues</string>
<string name="app_license">GPL v3.0</string>
<string name="prompt">To add an addiction to the tracker, press the \"+\" button in the bottom right corner.</string>
<string name="add_new_addiction">Add new addiction</string>
<string name="addiction_name">Addiction name</string>
Expand Down Expand Up @@ -132,6 +134,11 @@
<string name="data">Data</string>
<string name="data_export">Export</string>
<string name="data_import">Import</string>
<string name="about">About</string>
<string name="version">Version</string>
<string name="report_an_issue">Report an issue</string>
<string name="opens_issue_tracker">Opens issue tracker</string>
<string name="license">License</string>
<string name="average_attempts_window_pref">Number of Relapses (0 to disable)</string>
<string name="summary">Summary</string>
</resources>
25 changes: 25 additions & 0 deletions app/src/main/res/xml/root_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,29 @@

</PreferenceCategory>

<PreferenceCategory app:title="@string/about"
app:iconSpaceReserved="false">

<Preference
app:key="pref_app_version"
app:persistent="false"
app:title="@string/version"
app:iconSpaceReserved="false" />

<Preference
app:key="pref_app_issue_tracker"
app:persistent="false"
app:title="@string/report_an_issue"
app:summary="@string/opens_issue_tracker"
app:iconSpaceReserved="false" />

<Preference
app:key="pref_app_license"
app:persistent="false"
app:title="@string/license"
app:summary="@string/app_license"
app:iconSpaceReserved="false" />

</PreferenceCategory>

</PreferenceScreen>

0 comments on commit 9addb66

Please sign in to comment.