SponsorBlock: Changed normal app notification to be a simple toast notification

This commit is contained in:
polymorphicshade 2020-07-18 19:47:56 -06:00
parent abf9df36ad
commit 41479dc37c
2 changed files with 3 additions and 15 deletions

View file

@ -34,8 +34,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultRenderersFactory; import com.google.android.exoplayer2.DefaultRenderersFactory;
@ -678,18 +676,8 @@ public abstract class BasePlayer implements
seekTo(skipTo); seekTo(skipTo);
if (mPrefs.getBoolean(context.getString(R.string.sponsorblock_notifications), false)) { if (mPrefs.getBoolean(context.getString(R.string.sponsorblock_notifications), false)) {
NotificationCompat.Builder notificationBuilder = new NotificationCompat String toastText = context.getString(R.string.sponsorblock_skipped_sponsor);
.Builder(context, context.getString(R.string.notification_channel_id)) Toast.makeText(context, toastText, Toast.LENGTH_SHORT).show();
.setOngoing(false)
.setSmallIcon(R.drawable.ic_sponsor_block_white_96dp)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setContentTitle(context.getString(R.string.settings_category_sponsorblock))
.setContentText(context.getString(R.string.sponsorblock_skipped_sponsor)
+ " \uD83D\uDC4D");
NotificationManagerCompat notificationManager = NotificationManagerCompat
.from(App.getApp());
notificationManager.notify(0, notificationBuilder.build());
} }
if (DEBUG) { if (DEBUG) {

View file

@ -666,7 +666,7 @@
<string name="sponsorblock_custom_api_url_title">Custom API Url</string> <string name="sponsorblock_custom_api_url_title">Custom API Url</string>
<string name="sponsorblock_custom_api_url_summary">The url to use when querying the SponsorBlock API. Leave empty to use the default.</string> <string name="sponsorblock_custom_api_url_summary">The url to use when querying the SponsorBlock API. Leave empty to use the default.</string>
<string name="sponsorblock_notifications_title">Notify when sponsors are skipped</string> <string name="sponsorblock_notifications_title">Notify when sponsors are skipped</string>
<string name="sponsorblock_notifications_summary">Send a notification to your device when a sponsor is automatically skipped.</string> <string name="sponsorblock_notifications_summary">Show a toast notification when a sponsor is automatically skipped.</string>
<string name="sponsorblock_privacy_title">View Privacy Policy</string> <string name="sponsorblock_privacy_title">View Privacy Policy</string>
<string name="sponsorblock_privacy_summary">View the privacy policy of the SponsorBlock service.</string> <string name="sponsorblock_privacy_summary">View the privacy policy of the SponsorBlock service.</string>
</resources> </resources>