use of androidx.annotation.Nullable in project kdeconnect-android by KDE.
the class NotificationsPlugin method extractActions.
@Nullable
private JSONArray extractActions(Notification notification, String key) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || ArrayUtils.isEmpty(notification.actions)) {
return null;
}
JSONArray jsonArray = new JSONArray();
for (Notification.Action action : notification.actions) {
if (null == action.title)
continue;
// Check whether it is a reply action. We have special treatment for them
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH && ArrayUtils.isNotEmpty(action.getRemoteInputs()))
continue;
jsonArray.put(action.title.toString());
// A list is automatically created if it doesn't already exist.
actions.put(key, action);
}
return jsonArray;
}
use of androidx.annotation.Nullable in project Carbon by ZieIony.
the class SelectDialogActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initToolbar();
EditText titleText = findViewById(R.id.titleText);
DropDown dropDown = findViewById(R.id.dropDown);
dropDown.setItems(new String[] { "Single select", "Multi select" });
StringFruitGenerator generator = new StringFruitGenerator();
List<String> items = Stream.generate(generator::next).limit(5).toList();
selectedItem = items.get(0);
selectedItems = new ArrayList<>();
selectedItems.add(selectedItem);
findViewById(R.id.button).setOnClickListener(view -> {
switch(dropDown.getSelectedIndex()) {
case 0:
{
SingleSelectDialog<String> dialog = new SingleSelectDialog<>(this);
if (titleText.length() > 0)
dialog.setTitle(titleText.getText());
dialog.setItems(items);
dialog.setOnDismissListener(dialogInterface -> selectedItem = dialog.getSelectedItem());
dialog.setSelectedItem(selectedItem);
dialog.show();
}
break;
case 1:
{
MultiSelectDialog<String> dialog = new MultiSelectDialog<>(this);
if (titleText.length() > 0)
dialog.setTitle(titleText.getText());
dialog.setItems(items);
dialog.addButton("ok", null);
dialog.setOnDismissListener(dialogInterface -> selectedItems = dialog.getSelectedItems());
dialog.setSelectedItems(selectedItems);
dialog.show();
}
break;
}
});
}
use of androidx.annotation.Nullable in project Carbon by ZieIony.
the class TypefaceCompat method createFromResourcesFontFile.
/**
* Used by Resources to load a font resource of type font file.
*
* @hide
*/
@Nullable
@RestrictTo(LIBRARY_GROUP_PREFIX)
public static Typeface createFromResourcesFontFile(@NonNull Context context, @NonNull Resources resources, int id, String path, boolean italic, int weight) {
Typeface typeface = sTypefaceCompatImpl.createFromResourcesFontFile(context, resources, id, path, 0);
if (typeface != null) {
final String resourceUid = createResourceUid(resources, id, italic, weight);
sTypefaceCache.put(resourceUid, typeface);
}
return typeface;
}
use of androidx.annotation.Nullable in project materialistic by hidroh.
the class CustomTabsDelegate method getDefaultBrowser.
/**
* Returns the package name of the default browser on the device
*
* @param context Context
* @return The package name of the default browser
*/
@Nullable
private static String getDefaultBrowser(Context context) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://example.com/"));
PackageManager pm = context.getPackageManager();
ResolveInfo resolveInfo = pm.resolveActivity(browserIntent, PackageManager.MATCH_DEFAULT_ONLY);
if (resolveInfo == null) {
// If no default browser could be found
return null;
}
return resolveInfo.activityInfo.packageName;
}
use of androidx.annotation.Nullable in project uCrop by Yalantis.
the class UCropFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.ucrop_fragment_photobox, container, false);
Bundle args = getArguments();
setupViews(rootView, args);
setImageData(args);
setInitialState();
addBlockingView(rootView);
return rootView;
}
Aggregations