Feature: disable all notification bubbles

This commit is contained in:
luvletter2333 2022-01-20 23:07:24 +08:00
parent cf712d9641
commit 632b36170c
No known key found for this signature in database
GPG Key ID: A26A8880836E1978
4 changed files with 18 additions and 8 deletions

View File

@ -2963,14 +2963,16 @@ public class NotificationsController extends BaseController {
} else {
icon = IconCompat.createWithResource(ApplicationLoader.applicationContext, R.drawable.book_group);
}
NotificationCompat.BubbleMetadata.Builder bubbleBuilder =
new NotificationCompat.BubbleMetadata.Builder(
PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT),
icon);
bubbleBuilder.setSuppressNotification(openedDialogId == did);
bubbleBuilder.setAutoExpandBubble(false);
bubbleBuilder.setDesiredHeight(AndroidUtilities.dp(640));
builder.setBubbleMetadata(bubbleBuilder.build());
if (!NekoConfig.disableNotificationBubbles.Bool()) {
NotificationCompat.BubbleMetadata.Builder bubbleBuilder =
new NotificationCompat.BubbleMetadata.Builder(
PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT),
icon);
bubbleBuilder.setSuppressNotification(openedDialogId == did);
bubbleBuilder.setAutoExpandBubble(false);
bubbleBuilder.setDesiredHeight(AndroidUtilities.dp(640));
builder.setBubbleMetadata(bubbleBuilder.build());
}
return id;
} catch (Exception e) {
FileLog.e(e);

View File

@ -119,6 +119,8 @@ public class NekoConfig {
public static ConfigItem translateToLang = addConfig("TransToLang", configTypeString, ""); // "" -> translate to current language (MessageTrans.kt & Translator.kt)
public static ConfigItem translateInputLang = addConfig("TransInputToLang", configTypeString, "en");
public static ConfigItem disableNotificationBubbles = addConfig("disableNotificationBubbles", configTypeBool, false);
public static ConfigItem ccToLang = addConfig("opencc_to_lang", configTypeString, "");
public static ConfigItem ccInputLang = addConfig("opencc_input_to_lang", configTypeString, "");

View File

@ -108,6 +108,10 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
}, LocaleController.getString("UsernameEmpty", R.string.UsernameEmpty)));
private final AbstractConfigCell divider2 = cellGroup.appendCell(new ConfigCellDivider());
private final AbstractConfigCell header_notification = cellGroup.appendCell(new ConfigCellHeader(LocaleController.getString("NekoGeneralNotification")));
private final AbstractConfigCell disableNotificationBubblesRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.disableNotificationBubbles));
private final AbstractConfigCell divider_notification = cellGroup.appendCell(new ConfigCellDivider());
private final AbstractConfigCell header3 = cellGroup.appendCell(new ConfigCellHeader(LocaleController.getString("OpenKayChain")));
private final AbstractConfigCell pgpAppRow = cellGroup.appendCell(new ConfigCellCustom(CellGroup.ITEM_TYPE_TEXT_SETTINGS_CELL, true));
private final AbstractConfigCell keyRow = cellGroup.appendCell(new ConfigCellTextDetail(NekoConfig.openPGPKeyId, (view, position) -> {

View File

@ -133,5 +133,7 @@
<string name="SaveToDownloadCount_few">Saving %1$d files to downloads</string>
<string name="SaveToDownloadCount_many">Saving %1$d files to downloads</string>
<string name="SaveToDownloadCount_other">Saving %1$d files to downloads</string>
<string name="NekoGeneralNotification">Notification</string>
<string name="disableNotificationBubbles">Disable Bubbles in notification</string>
</resources>