use of androidx.annotation.RequiresApi in project Signal-Android by WhisperSystems.
the class RestoreBackupFragment method displayConfirmationDialog.
@RequiresApi(29)
private void displayConfirmationDialog(@NonNull Context context) {
new AlertDialog.Builder(context).setTitle(R.string.RestoreBackupFragment__restore_complete).setMessage(R.string.RestoreBackupFragment__to_continue_using_backups_please_choose_a_folder).setPositiveButton(R.string.RestoreBackupFragment__choose_folder, (dialog, which) -> {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivityForResult(intent, OPEN_DOCUMENT_TREE_RESULT_CODE);
}).setNegativeButton(R.string.RestoreBackupFragment__not_now, (dialog, which) -> {
BackupPassphrase.set(context, null);
dialog.dismiss();
SafeNavigation.safeNavigate(Navigation.findNavController(requireView()), RestoreBackupFragmentDirections.actionBackupRestored());
}).setCancelable(false).show();
}
use of androidx.annotation.RequiresApi in project Signal-Android by WhisperSystems.
the class VideoTrackConverter method create.
@RequiresApi(23)
@Nullable
static VideoTrackConverter create(@NonNull final MediaInput input, final long timeFrom, final long timeTo, final int videoResolution, final int videoBitrate, @NonNull final String videoCodec) throws IOException, TranscodingException {
final MediaExtractor videoExtractor = input.createExtractor();
final int videoInputTrack = getAndSelectVideoTrackIndex(videoExtractor);
if (videoInputTrack == -1) {
videoExtractor.release();
return null;
}
return new VideoTrackConverter(videoExtractor, videoInputTrack, timeFrom, timeTo, videoResolution, videoBitrate, videoCodec);
}
use of androidx.annotation.RequiresApi in project Signal-Android by WhisperSystems.
the class SubscriptionManagerCompat method getActiveSubscriptionInfoMap.
@RequiresApi(api = 22)
@NonNull
private Map<Integer, SubscriptionInfoCompat> getActiveSubscriptionInfoMap(boolean excludeUnreadySubscriptions) {
List<SubscriptionInfo> subscriptionInfos = getActiveSubscriptionInfoList();
if (subscriptionInfos.isEmpty()) {
return Collections.emptyMap();
}
Map<SubscriptionInfo, CharSequence> descriptions = getDescriptionsFor(subscriptionInfos);
Map<Integer, SubscriptionInfoCompat> map = new LinkedHashMap<>();
for (SubscriptionInfo subscriptionInfo : subscriptionInfos) {
if (!excludeUnreadySubscriptions || isReady(subscriptionInfo)) {
map.put(subscriptionInfo.getSubscriptionId(), new SubscriptionInfoCompat(subscriptionInfo.getSubscriptionId(), descriptions.get(subscriptionInfo), subscriptionInfo.getMcc(), subscriptionInfo.getMnc()));
}
}
return map;
}
use of androidx.annotation.RequiresApi in project Signal-Android by WhisperSystems.
the class MediaUtil method extractFrame.
@RequiresApi(23)
@Nullable
private static Bitmap extractFrame(@Nullable MediaDataSource dataSource, long timeUs) throws IOException {
if (dataSource == null) {
return null;
}
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
MediaMetadataRetrieverUtil.setDataSource(mediaMetadataRetriever, dataSource);
return mediaMetadataRetriever.getFrameAtTime(timeUs);
}
use of androidx.annotation.RequiresApi in project Signal-Android by WhisperSystems.
the class ConversationReactionOverlay method updateSystemUiOnShow.
@RequiresApi(api = 21)
private void updateSystemUiOnShow(@NonNull Activity activity) {
Window window = activity.getWindow();
int barColor = ContextCompat.getColor(getContext(), R.color.conversation_item_selected_system_ui);
originalStatusBarColor = window.getStatusBarColor();
WindowUtil.setStatusBarColor(window, barColor);
originalNavigationBarColor = window.getNavigationBarColor();
WindowUtil.setNavigationBarColor(window, barColor);
if (!ThemeUtil.isDarkTheme(getContext())) {
WindowUtil.clearLightStatusBar(window);
WindowUtil.clearLightNavigationBar(window);
}
}
Aggregations