Skip to content

Commit

Permalink
added in-app changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
sal0max committed Oct 27, 2020
1 parent 0c6711c commit 32fe7e0
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package de.salomax.currencies.view.preference

import android.app.Dialog
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDialogFragment
import de.salomax.currencies.R

class ChangelogDialog : AppCompatDialogFragment() {

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val view = View.inflate(context, R.layout.fragment_changelog, null)

return AlertDialog.Builder(requireContext())
.setPositiveButton(android.R.string.ok, null)
.setTitle(R.string.title_changelog)
.setView(view)
.create()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class PreferenceFragment: PreferenceFragmentCompat() {
val aboutPreference = findPreference<Preference>(getString(R.string.prefKey_about))!!
aboutPreference.title = getString(R.string.prefTitle_about, BuildConfig.VERSION_NAME)
aboutPreference.summary = getString(R.string.prefSummary_about, Calendar.getInstance().get(Calendar.YEAR))
aboutPreference.setOnPreferenceClickListener {
ChangelogDialog().show(childFragmentManager, null)
true
}
}

}
15 changes: 15 additions & 0 deletions app/src/main/res/layout/fragment_changelog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="@dimen/margin3x"
android:paddingTop="@dimen/margin2x"
android:paddingEnd="@dimen/margin3x"
android:scrollbars="none">

<TextView
style="@style/TextAppearance.AppCompat.Body1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/changelog" />
</ScrollView>
17 changes: 17 additions & 0 deletions app/src/main/res/values/changelog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="title_changelog">Changelog</string>

<string name="changelog">
<b><big>0.1.0</big></b>
\n
\n• More fail-proof updating of the currency rates
\n• Added a disclaimer
\n• Added this changelog
\n
\n<b><big>0.0.1</big></b>
\n
\n• Initial pre-release
</string>

</resources>

0 comments on commit 32fe7e0

Please sign in to comment.