Search in sources :

Example 31 with Nullable

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;
}
Also used : JSONArray(org.json.JSONArray) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification) Nullable(androidx.annotation.Nullable)

Example 32 with Nullable

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;
        }
    });
}
Also used : EditText(carbon.widget.EditText) ThemedActivity(tk.zielony.carbonsamples.ThemedActivity) Bundle(android.os.Bundle) Stream(com.annimon.stream.Stream) MultiSelectDialog(carbon.dialog.MultiSelectDialog) SampleAnnotation(tk.zielony.carbonsamples.SampleAnnotation) EditText(carbon.widget.EditText) ArrayList(java.util.ArrayList) List(java.util.List) Nullable(androidx.annotation.Nullable) SingleSelectDialog(carbon.dialog.SingleSelectDialog) R(tk.zielony.carbonsamples.R) DropDown(carbon.widget.DropDown) StringFruitGenerator(tk.zielony.randomdata.food.StringFruitGenerator) StringFruitGenerator(tk.zielony.randomdata.food.StringFruitGenerator) SingleSelectDialog(carbon.dialog.SingleSelectDialog) MultiSelectDialog(carbon.dialog.MultiSelectDialog) DropDown(carbon.widget.DropDown)

Example 33 with Nullable

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;
}
Also used : Typeface(android.graphics.Typeface) RestrictTo(androidx.annotation.RestrictTo) Nullable(androidx.annotation.Nullable)

Example 34 with Nullable

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;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PackageManager(android.content.pm.PackageManager) Intent(android.content.Intent) Nullable(androidx.annotation.Nullable)

Example 35 with Nullable

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;
}
Also used : Bundle(android.os.Bundle) ImageView(android.widget.ImageView) CropImageView(com.yalantis.ucrop.view.CropImageView) HorizontalProgressWheelView(com.yalantis.ucrop.view.widget.HorizontalProgressWheelView) View(android.view.View) AspectRatioTextView(com.yalantis.ucrop.view.widget.AspectRatioTextView) TransformImageView(com.yalantis.ucrop.view.TransformImageView) OverlayView(com.yalantis.ucrop.view.OverlayView) UCropView(com.yalantis.ucrop.view.UCropView) TextView(android.widget.TextView) GestureCropImageView(com.yalantis.ucrop.view.GestureCropImageView) Nullable(androidx.annotation.Nullable)

Aggregations

Nullable (androidx.annotation.Nullable)1206 View (android.view.View)207 Bundle (android.os.Bundle)118 IOException (java.io.IOException)106 ArrayList (java.util.ArrayList)104 TextView (android.widget.TextView)102 NonNull (androidx.annotation.NonNull)101 Context (android.content.Context)95 Cursor (android.database.Cursor)78 SuppressLint (android.annotation.SuppressLint)74 Uri (android.net.Uri)69 RecyclerView (androidx.recyclerview.widget.RecyclerView)64 List (java.util.List)63 ViewGroup (android.view.ViewGroup)60 Intent (android.content.Intent)58 Test (org.junit.Test)55 Recipient (org.thoughtcrime.securesms.recipients.Recipient)52 LayoutInflater (android.view.LayoutInflater)48 R (org.thoughtcrime.securesms.R)46 ImageView (android.widget.ImageView)45