Some notification history fixes

- Update header count when item swiped away
- Clean up container when last notification is swiped away
- Long pressing on the top two section brings you to settings to
modify notification behavior
- Show more notification content

Test: manual
Bug: 157547283
Change-Id: I1d43cacca7a0f22f83cef9187cf288839e0d5795
This commit is contained in:
Julia Reynolds
2020-05-27 09:45:32 -04:00
parent ec156b7035
commit ef4c044053
5 changed files with 34 additions and 4 deletions

View File

@@ -20,12 +20,16 @@ import static android.app.Notification.COLOR_DEFAULT;
import static android.content.pm.PackageManager.MATCH_ANY_USER;
import static android.content.pm.PackageManager.NameNotFoundException;
import static android.os.UserHandle.USER_ALL;
import static android.provider.Settings.EXTRA_APP_PACKAGE;
import static android.provider.Settings.EXTRA_CHANNEL_ID;
import static android.provider.Settings.EXTRA_CONVERSATION_ID;
import android.annotation.ColorInt;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.Notification;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
@@ -33,6 +37,7 @@ import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.Log;
@@ -113,6 +118,15 @@ public class NotificationSbnAdapter extends
holder.setProfileBadge(mUserBadgeCache.get(userId));
holder.addOnClick(sbn.getPackageName(), sbn.getUserId(),
sbn.getNotification().contentIntent);
holder.itemView.setOnLongClickListener(v -> {
Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
.putExtra(EXTRA_APP_PACKAGE, sbn.getPackageName())
.putExtra(EXTRA_CHANNEL_ID, sbn.getNotification().getChannelId())
.putExtra(EXTRA_CONVERSATION_ID, sbn.getNotification().getShortcutId());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
holder.itemView.getContext().startActivityAsUser(intent, UserHandle.of(userId));
return true;
});
} else {
Slog.w(TAG, "null entry in list at position " + position);
}