Skip to content

Commit

Permalink
Show snackbar
Browse files Browse the repository at this point in the history
  • Loading branch information
MiSikora committed Feb 25, 2025
1 parent bf5cd55 commit b3c6bbf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.ProgressBar
import android.widget.TextView
import android.widget.Toast
import androidx.annotation.ColorInt
import androidx.annotation.FloatRange
import androidx.annotation.MenuRes
Expand Down Expand Up @@ -610,7 +609,13 @@ class PodcastFragment : BaseFragment() {

private val onNotificationsClicked: (Podcast, Boolean) -> Unit = { podcast, show ->
viewModel.showNotifications(podcast.uuid, show)
Toast.makeText(context, if (show) LR.string.podcast_notifications_on else LR.string.podcast_notifications_off, Toast.LENGTH_SHORT).show()
currentSnackBar?.dismiss()
if (show) {
showSnackBar(
message = getString(LR.string.notifications_enabled_message, podcast.title),
duration = 3000,
)
}
}

private val onSettingsClicked: () -> Unit = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package au.com.shiftyjelly.pocketcasts.podcasts.viewmodel

import android.content.Context
import android.content.res.Resources
import android.widget.Toast
import androidx.annotation.StringRes
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
Expand Down
2 changes: 2 additions & 0 deletions modules/services/localization/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@
<item quantity="one">second</item>
<item quantity="other">seconds</item>
</plurals>
<!-- %1$s is a podcast's title -->
<string name="notifications_enabled_message">We’ll notify you with new episodes of %1$s</string>

<!-- Give Rating -->

Expand Down

0 comments on commit b3c6bbf

Please sign in to comment.