Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Set bubble height to full screen #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.drawable.Icon;
import android.media.AudioAttributes;
import android.net.Uri;
Expand All @@ -45,6 +46,7 @@
import android.os.SharedMemory;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.Log;

import androidx.annotation.ColorInt;
Expand Down Expand Up @@ -259,7 +261,11 @@ private void setBubbleMetadata(final MutableNotification n, final Conversation c
final BubbleMetadata.Builder builder = SDK_INT > Q && shortcut_id != null ? new BubbleMetadata.Builder(shortcut_id) // WeChat does not met the requirement of bubble on Android Q: "documentLaunchMode=always"
: new BubbleMetadata.Builder().setIcon(IconHelper.convertToAdaptiveIcon(this, conversation.icon))
.setIntent(SDK_INT > Q ? n.contentIntent : buildBubblePendingIntent(n.contentIntent, shortcut_id));
n.setBubbleMetadata(builder.setDesiredHeight(512).build());
Resources resources = getApplicationContext().getResources();
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
float dpHeight = displayMetrics.heightPixels / displayMetrics.density;

n.setBubbleMetadata(builder.setDesiredHeight((int) dpHeight).build());
}

private PendingIntent buildBubblePendingIntent(final PendingIntent target, final String locusId) {
Expand Down