Search in sources :

Example 56 with NonNull

use of androidx.annotation.NonNull in project OneSignal-Android-SDK by OneSignal.

the class GenerateNotificationRunner method launchURLMockPayloadBundle.

@NonNull
private static Bundle launchURLMockPayloadBundle() throws JSONException {
    Bundle bundle = new Bundle();
    bundle.putString("alert", "test");
    bundle.putString("custom", new JSONObject() {

        {
            put("i", "UUID");
            put("u", "https://google.com");
        }
    }.toString());
    return bundle;
}
Also used : JSONObject(org.json.JSONObject) Bundle(android.os.Bundle) FCMBroadcastReceiver_processBundle(com.onesignal.OneSignalPackagePrivateHelper.FCMBroadcastReceiver_processBundle) OneSignalPackagePrivateHelper.createInternalPayloadBundle(com.onesignal.OneSignalPackagePrivateHelper.createInternalPayloadBundle) NonNull(androidx.annotation.NonNull)

Example 57 with NonNull

use of androidx.annotation.NonNull in project robolectric by robolectric.

the class ShadowLauncherApps method getShortcuts.

/**
 * This method is an incomplete implementation of this API that only supports querying for pinned
 * dynamic shortcuts. It also doesn't not support {@link ShortcutQuery#setChangedSince(long)}.
 */
@Implementation(minSdk = N_MR1)
@Nullable
protected List<ShortcutInfo> getShortcuts(@NonNull ShortcutQuery query, @NonNull UserHandle user) {
    if (reflector(ReflectorShortcutQuery.class, query).getChangedSince() != 0) {
        throw new UnsupportedOperationException("Robolectric does not currently support ShortcutQueries that filter on time since" + " change.");
    }
    int flags = reflector(ReflectorShortcutQuery.class, query).getQueryFlags();
    if ((flags & ShortcutQuery.FLAG_MATCH_PINNED) == 0 || (flags & ShortcutQuery.FLAG_MATCH_DYNAMIC) == 0) {
        throw new UnsupportedOperationException("Robolectric does not currently support ShortcutQueries that match non-dynamic" + " Shortcuts.");
    }
    Iterable<ShortcutInfo> shortcutsItr = shortcuts;
    List<String> ids = reflector(ReflectorShortcutQuery.class, query).getShortcutIds();
    if (ids != null) {
        shortcutsItr = Iterables.filter(shortcutsItr, shortcut -> ids.contains(shortcut.getId()));
    }
    ComponentName activity = reflector(ReflectorShortcutQuery.class, query).getActivity();
    if (activity != null) {
        shortcutsItr = Iterables.filter(shortcutsItr, shortcut -> shortcut.getActivity().equals(activity));
    }
    String packageName = reflector(ReflectorShortcutQuery.class, query).getPackage();
    if (packageName != null && !packageName.isEmpty()) {
        shortcutsItr = Iterables.filter(shortcutsItr, shortcut -> shortcut.getPackage().equals(packageName));
    }
    return Lists.newArrayList(shortcutsItr);
}
Also used : Rect(android.graphics.Rect) Iterables(com.google.common.collect.Iterables) Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) Pair(android.util.Pair) Multimap(com.google.common.collect.Multimap) Process(android.os.Process) LOLLIPOP(android.os.Build.VERSION_CODES.LOLLIPOP) SessionInfo(android.content.pm.PackageInstaller.SessionInfo) ArrayList(java.util.ArrayList) Implements(org.robolectric.annotation.Implements) IntentSender(android.content.IntentSender) HashMultimap(com.google.common.collect.HashMultimap) Lists(com.google.common.collect.Lists) Accessor(org.robolectric.util.reflector.Accessor) ForType(org.robolectric.util.reflector.ForType) Handler(android.os.Handler) Looper(android.os.Looper) UserHandle(android.os.UserHandle) L(android.os.Build.VERSION_CODES.L) O(android.os.Build.VERSION_CODES.O) N(android.os.Build.VERSION_CODES.N) Executor(java.util.concurrent.Executor) Q(android.os.Build.VERSION_CODES.Q) ComponentName(android.content.ComponentName) ShortcutInfo(android.content.pm.ShortcutInfo) Predicate(java.util.function.Predicate) P(android.os.Build.VERSION_CODES.P) Collectors(java.util.stream.Collectors) Implementation(org.robolectric.annotation.Implementation) SessionCallback(android.content.pm.PackageInstaller.SessionCallback) LauncherApps(android.content.pm.LauncherApps) List(java.util.List) Nullable(androidx.annotation.Nullable) LauncherActivityInfo(android.content.pm.LauncherActivityInfo) Reflector.reflector(org.robolectric.util.reflector.Reflector.reflector) ShortcutQuery(android.content.pm.LauncherApps.ShortcutQuery) N_MR1(android.os.Build.VERSION_CODES.N_MR1) ShortcutInfo(android.content.pm.ShortcutInfo) ComponentName(android.content.ComponentName) Implementation(org.robolectric.annotation.Implementation) Nullable(androidx.annotation.Nullable)

Example 58 with NonNull

use of androidx.annotation.NonNull in project AntennaPod by AntennaPod.

the class SpecialThanksFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    getListView().setDivider(null);
    getListView().setSelector(android.R.color.transparent);
    translatorsLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
        ArrayList<SimpleIconListAdapter.ListItem> translators = new ArrayList<>();
        BufferedReader reader = new BufferedReader(new InputStreamReader(getContext().getAssets().open("special_thanks.csv"), "UTF-8"));
        String line;
        while ((line = reader.readLine()) != null) {
            String[] info = line.split(";");
            translators.add(new SimpleIconListAdapter.ListItem(info[0], info[1], info[2]));
        }
        emitter.onSuccess(translators);
    }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(translators -> setListAdapter(new SimpleIconListAdapter<>(getContext(), translators)), error -> Toast.makeText(getContext(), error.getMessage(), Toast.LENGTH_LONG).show());
}
Also used : Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) Single(io.reactivex.Single) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) InputStreamReader(java.io.InputStreamReader) SimpleIconListAdapter(de.danoeh.antennapod.adapter.SimpleIconListAdapter) ArrayList(java.util.ArrayList) Disposable(io.reactivex.disposables.Disposable) Nullable(androidx.annotation.Nullable) Toast(android.widget.Toast) View(android.view.View) ListFragment(androidx.fragment.app.ListFragment) Schedulers(io.reactivex.schedulers.Schedulers) BufferedReader(java.io.BufferedReader) SingleOnSubscribe(io.reactivex.SingleOnSubscribe) InputStreamReader(java.io.InputStreamReader) ArrayList(java.util.ArrayList) BufferedReader(java.io.BufferedReader) SimpleIconListAdapter(de.danoeh.antennapod.adapter.SimpleIconListAdapter)

Example 59 with NonNull

use of androidx.annotation.NonNull in project AntennaPod by AntennaPod.

the class GpodderAuthenticationFragment method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
    AlertDialog.Builder dialog = new AlertDialog.Builder(getContext());
    dialog.setTitle(GpodnetService.DEFAULT_BASE_HOST);
    dialog.setNegativeButton(R.string.cancel_label, null);
    dialog.setCancelable(false);
    this.setCancelable(false);
    View root = View.inflate(getContext(), R.layout.gpodnetauth_dialog, null);
    viewFlipper = root.findViewById(R.id.viewflipper);
    advance();
    dialog.setView(root);
    return dialog.create();
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) View(android.view.View) TextView(android.widget.TextView) NonNull(androidx.annotation.NonNull)

Example 60 with NonNull

use of androidx.annotation.NonNull in project AntennaPod by AntennaPod.

the class FeedMenuHandler method showSortDialog.

private static void showSortDialog(Context context, Feed selectedFeed) {
    IntraFeedSortDialog sortDialog = new IntraFeedSortDialog(context, selectedFeed.getSortOrder(), selectedFeed.isLocalFeed()) {

        @Override
        protected void updateSort(@NonNull SortOrder sortOrder) {
            selectedFeed.setSortOrder(sortOrder);
            DBWriter.setFeedItemSortOrder(selectedFeed.getId(), sortOrder);
        }
    };
    sortDialog.openDialog();
}
Also used : NonNull(androidx.annotation.NonNull) SortOrder(de.danoeh.antennapod.model.feed.SortOrder) IntraFeedSortDialog(de.danoeh.antennapod.dialog.IntraFeedSortDialog)

Aggregations

NonNull (androidx.annotation.NonNull)1197 View (android.view.View)191 ArrayList (java.util.ArrayList)154 Context (android.content.Context)128 Nullable (androidx.annotation.Nullable)128 TextView (android.widget.TextView)117 Intent (android.content.Intent)115 List (java.util.List)110 Recipient (org.thoughtcrime.securesms.recipients.Recipient)109 IOException (java.io.IOException)103 Bundle (android.os.Bundle)102 WorkerThread (androidx.annotation.WorkerThread)94 LayoutInflater (android.view.LayoutInflater)89 RecipientId (org.thoughtcrime.securesms.recipients.RecipientId)82 AlertDialog (androidx.appcompat.app.AlertDialog)76 Log (org.signal.core.util.logging.Log)76 Cursor (android.database.Cursor)68 ViewGroup (android.view.ViewGroup)65 LinkedList (java.util.LinkedList)64 Stream (com.annimon.stream.Stream)62