use of androidx.annotation.RequiresApi in project OneSignal-Android-SDK by OneSignal.
the class OneSignalNotificationManager method getActiveGrouplessNotifications.
/**
* Getter for obtaining any groupless notifications
* A groupless notification is:
* 1. Not a summary
* 2. A null group key or group key using assigned GROUPLESS_SUMMARY_KEY
*/
@RequiresApi(api = Build.VERSION_CODES.M)
static ArrayList<StatusBarNotification> getActiveGrouplessNotifications(Context context) {
ArrayList<StatusBarNotification> grouplessStatusBarNotifications = new ArrayList<>();
/* Iterate over all active notifications and add the groupless non-summary
* notifications to a ArrayList to be returned */
StatusBarNotification[] statusBarNotifications = getActiveNotifications(context);
for (StatusBarNotification statusBarNotification : statusBarNotifications) {
Notification notification = statusBarNotification.getNotification();
boolean isGroupSummary = NotificationLimitManager.isGroupSummary(statusBarNotification);
boolean isGroupless = notification.getGroup() == null || notification.getGroup().equals(OneSignalNotificationManager.getGrouplessSummaryKey());
if (!isGroupSummary && isGroupless)
grouplessStatusBarNotifications.add(statusBarNotification);
}
return grouplessStatusBarNotifications;
}
use of androidx.annotation.RequiresApi in project robolectric by robolectric.
the class ShadowActivityManager method addApplicationExitInfo.
/**
* Adds an {@link ApplicationExitInfo} with the given information
*
* @deprecated Prefer using overload with {@link ApplicationExitInfoBuilder}
*/
@Deprecated
@RequiresApi(api = R)
public void addApplicationExitInfo(String processName, int pid, int reason, int status) {
ApplicationExitInfo info = ApplicationExitInfoBuilder.newBuilder().setProcessName(processName).setPid(pid).setReason(reason).setStatus(status).build();
addApplicationExitInfo(info);
}
use of androidx.annotation.RequiresApi in project Douya by DreaminginCodeZH.
the class ResourcesFlusher method flushLollipop.
@MainThread
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
private static void flushLollipop(@NonNull Resources resources) {
if (!sDrawableCacheFieldInitialized) {
try {
// noinspection JavaReflectionMemberAccess
sDrawableCacheField = Resources.class.getDeclaredField("mDrawableCache");
sDrawableCacheField.setAccessible(true);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
sDrawableCacheFieldInitialized = true;
}
if (sDrawableCacheField == null) {
return;
}
Map drawableCache = null;
try {
drawableCache = (Map) sDrawableCacheField.get(resources);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
if (drawableCache == null) {
return;
}
drawableCache.clear();
}
use of androidx.annotation.RequiresApi in project Conversations by siacs.
the class FileBackend method cropCenterSquarePdf.
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private Bitmap cropCenterSquarePdf(final Uri uri, final int size) {
try {
ParcelFileDescriptor fileDescriptor = mXmppConnectionService.getContentResolver().openFileDescriptor(uri, "r");
final Bitmap bitmap = renderPdfDocument(fileDescriptor, size, false);
return cropCenterSquare(bitmap, size);
} catch (Exception e) {
final Bitmap placeholder = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
placeholder.eraseColor(0xff000000);
return placeholder;
}
}
use of androidx.annotation.RequiresApi in project Conversations by siacs.
the class FileBackend method renderPdfDocument.
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private Bitmap renderPdfDocument(ParcelFileDescriptor fileDescriptor, int targetSize, boolean fit) throws IOException {
final PdfRenderer pdfRenderer = new PdfRenderer(fileDescriptor);
final PdfRenderer.Page page = pdfRenderer.openPage(0);
final Dimensions dimensions = scalePdfDimensions(new Dimensions(page.getHeight(), page.getWidth()), targetSize, fit);
final Bitmap rendered = Bitmap.createBitmap(dimensions.width, dimensions.height, Bitmap.Config.ARGB_8888);
rendered.eraseColor(0xffffffff);
page.render(rendered, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
page.close();
pdfRenderer.close();
fileDescriptor.close();
return rendered;
}
Aggregations