Merge pull request #6745 from thundernest/change_log_snackbar

Change "recent changes" snackbar appearance and behavior
This commit is contained in:
cketti 2023-03-10 17:07:06 +01:00 committed by GitHub
commit 6f428c1642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

View file

@ -66,6 +66,7 @@ import timber.log.Timber
private const val MAXIMUM_MESSAGE_SORT_OVERRIDES = 3
private const val MINIMUM_CLICK_INTERVAL = 200L
private const val RECENT_CHANGES_SNACKBAR_DURATION = 10 * 1000
class MessageListFragment :
Fragment(),
@ -363,12 +364,12 @@ class MessageListFragment :
val coordinatorLayout = requireView().findViewById<View>(R.id.message_list_coordinator)
recentChangesSnackbar = Snackbar
.make(coordinatorLayout, R.string.changelog_snackbar_text, Snackbar.LENGTH_INDEFINITE)
.setAction(R.string.okay_action) { launchRecentChangesActivity() }
.make(coordinatorLayout, R.string.changelog_snackbar_text, RECENT_CHANGES_SNACKBAR_DURATION)
.setAction(R.string.changelog_snackbar_button_text) { launchRecentChangesActivity() }
.addCallback(
object : BaseCallback<Snackbar>() {
override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
if (event == DISMISS_EVENT_SWIPE) {
if (event == DISMISS_EVENT_SWIPE || event == DISMISS_EVENT_TIMEOUT) {
recentChangesViewModel.onRecentChangesHintDismissed()
}
}

View file

@ -29,7 +29,10 @@
<string name="changelog_version_title">Version %s</string>
<string name="changelog_recent_changes_title">What\'s new</string>
<string name="changelog_show_recent_changes">Show recent changes when app was updated</string>
<!-- Displayed in a "snack bar" at the bottom of the screen when the app was updated. -->
<string name="changelog_snackbar_text">Find out what\'s new in this release</string>
<!-- Button text of the "snack bar" that is displayed when the app was updated. -->
<string name="changelog_snackbar_button_text">View</string>
<!-- Welcome message -->

View file

@ -115,5 +115,9 @@
<item name="actionMenuTextColor">?android:attr/textColorSecondary</item>
</style>
<style name="Widget.K9.Button.Snackbar" parent="Widget.MaterialComponents.Button.TextButton.Snackbar">
<item name="android:textColor">?attr/colorSecondary</item>
</style>
</resources>

View file

@ -164,6 +164,8 @@
<item name="materialDrawerStyle">@style/Widget.MaterialDrawerStyle.K9.Light</item>
<item name="materialDrawerHeaderStyle">@style/Widget.MaterialDrawerHeaderStyle.K9.Light</item>
<item name="behindRecyclerView">#F0F0F0</item>
<item name="snackbarButtonStyle">@style/Widget.K9.Button.Snackbar</item>
</style>
<style name="Theme.K9.Light" parent="Theme.K9.Light.Common">
@ -330,6 +332,8 @@
<item name="materialDrawerHeaderStyle">@style/Widget.MaterialDrawerHeaderStyle.K9.Dark</item>
<item name="behindRecyclerView">#202020</item>
<item name="snackbarButtonStyle">@style/Widget.K9.Button.Snackbar</item>
</style>
<style name="Theme.K9.Dialog.Light" parent="Theme.K9.Light">