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;
}
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);
}
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());
}
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();
}
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();
}
Aggregations