Skip to content

Commit 5a93c1b

Browse files
committed
Fix Bugs
1 parent 6296873 commit 5a93c1b

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

app/src/main/java/io/github/ratul/topactivity/model/NotificationMonitor.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public static void showNotification(Context context, boolean isPaused) {
6565
mChannel.enableLights(false);
6666
mChannel.enableVibration(false);
6767
mChannel.setShowBadge(false);
68+
mChannel.setImportance(NotificationManager.IMPORTANCE_MAX);
6869
notifManager.createNotificationChannel(mChannel);
6970
}
7071

@@ -78,8 +79,12 @@ public static void showNotification(Context context, boolean isPaused) {
7879
.setContentTitle(context.getString(R.string.is_running, context.getString(R.string.app_name)))
7980
.setSmallIcon(R.drawable.ic_shortcut).setPriority(NotificationCompat.PRIORITY_HIGH)
8081
.setContentText(context.getString(R.string.touch_to_open))
81-
.setColor(context.getColor(R.color.layerColor)).setVisibility(NotificationCompat.VISIBILITY_SECRET)
82-
.setOngoing(!isPaused);
82+
.setColor(context.getColor(R.color.layerColor))
83+
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
84+
.setPriority(NotificationCompat.PRIORITY_MAX)
85+
.setOngoing(!isPaused)
86+
.setContentIntent(pIntent)
87+
.build();
8388

8489
builder.addAction(R.drawable.ic_launcher_foreground, context.getString(R.string.noti_action_stop),
8590
getPendingIntent(context, ACTION_STOP)).setContentIntent(pIntent);
@@ -88,15 +93,13 @@ public static void showNotification(Context context, boolean isPaused) {
8893
}
8994

9095
public static PendingIntent getPendingIntent(Context context, int command) {
91-
Intent intent = new Intent(context, NotificationMonitor.class);
92-
intent.setAction("io.github.ratul.topactivity.ACTION_NOTIFICATION_RECEIVER");
96+
Intent intent = new Intent("io.github.ratul.topactivity.ACTION_NOTIFICATION_RECEIVER");
9397
intent.putExtra(EXTRA_NOTIFICATION_ACTION, command);
9498
return PendingIntent.getBroadcast(context, 0, intent, 0);
9599
}
96100

97101
public static void cancelNotification(Context context) {
98-
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
99-
nm.cancel(NOTIFICATION_ID);
102+
notifManager.cancel(NOTIFICATION_ID);
100103
}
101104

102105
@Override

app/src/main/res/layout/window_tasks.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
android:layout_marginTop="1dp"
2323
android:background="#60111111"
2424
android:clickable="true"
25-
android:padding="8dp"
25+
android:paddingTop="8dp"
26+
android:paddingLeft="8dp"
27+
android:paddingBottom="8dp"
2628
android:singleLine="true"
2729
android:ellipsize="end"
2830
android:textColor="#FFFFFF"
@@ -33,7 +35,9 @@
3335
android:layout_width="wrap_content"
3436
android:layout_height="wrap_content"
3537
android:gravity="center_vertical"
36-
android:padding="8dp"
38+
android:paddingTop="8dp"
39+
android:paddingBottom="8dp"
40+
android:paddingRight="8dp"
3741
android:text="-Activity Info"
3842
android:textColor="#FFFFFF"
3943
android:textSize="12sp" />

0 commit comments

Comments
 (0)