Skip to content

Commit

Permalink
feat: Click to hide for notifications (close #154)
Browse files Browse the repository at this point in the history
  • Loading branch information
deltazefiro committed Feb 12, 2025
1 parent 3c74ba5 commit 8b89dbb
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions app/src/main/java/deltazero/amarok/QuickHideService.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
import com.hjq.window.draggable.SpringBackDraggable;

import deltazero.amarok.receivers.ActionReceiver;
import deltazero.amarok.ui.MainActivity;

public class QuickHideService extends LifecycleService {

private EasyWindow<?> panicButton;
private ImageView ivPanicButton;

private PendingIntent activityPendingIntent;
private NotificationCompat.Action action;
private static final String CHANNEL_ID = "QUICK_HIDE_CHANNEL";
private static final int NOTIFICATION_ID = 1;

Expand All @@ -49,15 +47,7 @@ public void onCreate() {

Intent actionIntent = new Intent(this, ActionReceiver.class);
actionIntent.setAction("deltazero.amarok.HIDE");
PendingIntent actionPendingIntent = PendingIntent.getBroadcast(this, 1,
actionIntent, PendingIntent.FLAG_IMMUTABLE);
action = new NotificationCompat.Action.Builder(
R.drawable.ic_paw,
getString(R.string.hide), actionPendingIntent).build();

activityPendingIntent = PendingIntent.getActivity(this, 0,
new Intent(this, MainActivity.class), PendingIntent.FLAG_IMMUTABLE);

activityPendingIntent = PendingIntent.getBroadcast(this, 1, actionIntent, PendingIntent.FLAG_IMMUTABLE);
}

@Override
Expand All @@ -80,7 +70,6 @@ public int onStartCommand(Intent intent, int flags, int startId) {
.setSmallIcon(R.drawable.ic_paw)
.setContentIntent(activityPendingIntent)
.setOngoing(true)
.addAction(action)
.build();

if (Build.VERSION.SDK_INT >= 34) {
Expand Down

0 comments on commit 8b89dbb

Please sign in to comment.