Search in sources :

Example 31 with RequiresApi

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();
}
Also used : RequiresApi(androidx.annotation.RequiresApi) SignalStore(org.thoughtcrime.securesms.keyvalue.SignalStore) Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) Uri(android.net.Uri) R(org.thoughtcrime.securesms.R) SafeNavigation(org.thoughtcrime.securesms.util.navigation.SafeNavigation) Locale(java.util.Locale) View(android.view.View) FullBackupImporter(org.thoughtcrime.securesms.backup.FullBackupImporter) Canvas(android.graphics.Canvas) AppInitialization(org.thoughtcrime.securesms.AppInitialization) BackupPassphrase(org.thoughtcrime.securesms.backup.BackupPassphrase) SQLiteDatabase(net.zetetic.database.sqlcipher.SQLiteDatabase) AsyncTask(android.os.AsyncTask) FullBackupBase(org.thoughtcrime.securesms.backup.FullBackupBase) ThreadMode(org.greenrobot.eventbus.ThreadMode) ViewGroup(android.view.ViewGroup) Log(org.signal.core.util.logging.Log) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) DateUtils(org.thoughtcrime.securesms.util.DateUtils) Paint(android.graphics.Paint) ReplacementSpan(android.text.style.ReplacementSpan) TextWatcher(android.text.TextWatcher) Context(android.content.Context) SignalDatabase(org.thoughtcrime.securesms.database.SignalDatabase) Spanned(android.text.Spanned) AlertDialog(androidx.appcompat.app.AlertDialog) CircularProgressButtonUtil.setSpinning(org.thoughtcrime.securesms.util.CircularProgressButtonUtil.setSpinning) Util(org.thoughtcrime.securesms.util.Util) Intent(android.content.Intent) MainThread(androidx.annotation.MainThread) Editable(android.text.Editable) LocalBackupListener(org.thoughtcrime.securesms.service.LocalBackupListener) InputMethodManager(android.view.inputmethod.InputMethodManager) SuppressLint(android.annotation.SuppressLint) NotificationChannels(org.thoughtcrime.securesms.notifications.NotificationChannels) Toast(android.widget.Toast) EventBus(org.greenrobot.eventbus.EventBus) Build(android.os.Build) NoExternalStorageException(org.thoughtcrime.securesms.database.NoExternalStorageException) SimpleTask(org.thoughtcrime.securesms.util.concurrent.SimpleTask) CircularProgressButton(com.dd.CircularProgressButton) RegistrationViewModel(org.thoughtcrime.securesms.registration.viewmodel.RegistrationViewModel) CircularProgressButtonUtil.cancelSpinning(org.thoughtcrime.securesms.util.CircularProgressButtonUtil.cancelSpinning) AttachmentSecretProvider(org.thoughtcrime.securesms.crypto.AttachmentSecretProvider) ViewModelProvider(androidx.lifecycle.ViewModelProvider) LayoutInflater(android.view.LayoutInflater) RegistrationViewDelegate.setDebugLogSubmitMultiTapView(org.thoughtcrime.securesms.registration.fragments.RegistrationViewDelegate.setDebugLogSubmitMultiTapView) IOException(java.io.IOException) BackupUtil(org.thoughtcrime.securesms.util.BackupUtil) Subscribe(org.greenrobot.eventbus.Subscribe) Navigation(androidx.navigation.Navigation) LoggingFragment(org.thoughtcrime.securesms.LoggingFragment) Activity(android.app.Activity) EditText(android.widget.EditText) Intent(android.content.Intent) RequiresApi(androidx.annotation.RequiresApi)

Example 32 with RequiresApi

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);
}
Also used : MediaExtractor(android.media.MediaExtractor) RequiresApi(androidx.annotation.RequiresApi) Nullable(androidx.annotation.Nullable)

Example 33 with RequiresApi

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;
}
Also used : SubscriptionInfo(android.telephony.SubscriptionInfo) LinkedHashMap(java.util.LinkedHashMap) NonNull(androidx.annotation.NonNull) RequiresApi(androidx.annotation.RequiresApi)

Example 34 with RequiresApi

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);
}
Also used : MediaMetadataRetriever(android.media.MediaMetadataRetriever) RequiresApi(androidx.annotation.RequiresApi) Nullable(androidx.annotation.Nullable)

Example 35 with RequiresApi

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);
    }
}
Also used : Window(android.view.Window) RequiresApi(androidx.annotation.RequiresApi)

Aggregations

RequiresApi (androidx.annotation.RequiresApi)161 NotificationChannel (android.app.NotificationChannel)20 Intent (android.content.Intent)16 NonNull (androidx.annotation.NonNull)16 SuppressLint (android.annotation.SuppressLint)14 Uri (android.net.Uri)14 NotificationManager (android.app.NotificationManager)13 IOException (java.io.IOException)13 StatusBarNotification (android.service.notification.StatusBarNotification)10 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)10 Context (android.content.Context)9 Rect (android.graphics.Rect)8 Notification (android.app.Notification)7 ByteBuffer (java.nio.ByteBuffer)7 ArrayList (java.util.ArrayList)7 SecretKey (javax.crypto.SecretKey)7 PendingIntent (android.app.PendingIntent)6 Bitmap (android.graphics.Bitmap)5 Point (android.graphics.Point)5 Build (android.os.Build)5