Search in sources :

Example 6 with Nullable

use of androidx.annotation.Nullable in project butterknife by JakeWharton.

the class ButterKnife method parseOnItemLongClick.

@Nullable
private static Unbinder parseOnItemLongClick(final Object target, final Method method, View source) {
    OnItemLongClick onItemLongClick = method.getAnnotation(OnItemLongClick.class);
    if (onItemLongClick == null) {
        return null;
    }
    validateMember(method);
    final boolean propagateReturn = validateReturnType(method, boolean.class);
    final ArgumentTransformer argumentTransformer = createArgumentTransformer(method, ON_ITEM_LONG_CLICK_TYPES);
    List<AdapterView<?>> views = findViews(source, onItemLongClick.value(), isRequired(method), method.getName(), AdapterView.class);
    ViewCollections.set(views, ON_ITEM_LONG_CLICK, (parent, view, position, id) -> {
        Object value = tryInvoke(method, target, argumentTransformer.transform(parent, view, position, id));
        // noinspection SimplifiableConditionalExpression
        return propagateReturn ? (boolean) value : true;
    });
    return new ListenerUnbinder<>(views, ON_ITEM_LONG_CLICK);
}
Also used : AdapterView(android.widget.AdapterView) AccessibleObject(java.lang.reflect.AccessibleObject) Nullable(androidx.annotation.Nullable)

Example 7 with Nullable

use of androidx.annotation.Nullable in project samourai-wallet-android by Samourai-Wallet.

the class DecodeTask method decode.

@Nullable
@SuppressWarnings("SuspiciousNameCombination")
public Result decode(@NonNull final MultiFormatReader reader) throws ReaderException {
    int imageWidth = mImageSize.getX();
    int imageHeight = mImageSize.getY();
    final int orientation = mOrientation;
    final byte[] image = Utils.rotateYuv(mImage, imageWidth, imageHeight, orientation);
    if (orientation == 90 || orientation == 270) {
        final int width = imageWidth;
        imageWidth = imageHeight;
        imageHeight = width;
    }
    final Rect frameRect = Utils.getImageFrameRect(imageWidth, imageHeight, mViewFrameRect, mPreviewSize, mViewSize);
    final int frameWidth = frameRect.getWidth();
    final int frameHeight = frameRect.getHeight();
    if (frameWidth < 1 || frameHeight < 1) {
        return null;
    }
    return Utils.decodeLuminanceSource(reader, new PlanarYUVLuminanceSource(image, imageWidth, imageHeight, frameRect.getLeft(), frameRect.getTop(), frameWidth, frameHeight, mReverseHorizontal));
}
Also used : PlanarYUVLuminanceSource(com.google.zxing.PlanarYUVLuminanceSource) Nullable(androidx.annotation.Nullable)

Example 8 with Nullable

use of androidx.annotation.Nullable in project samourai-wallet-android by Samourai-Wallet.

the class BarcodeUtils method decodeRgb.

/**
 * Decode barcode from RGB pixels array
 *
 * @param pixels Colors in standard Android ARGB format
 * @param width  Image width
 * @param height Image height
 * @param hints  Decoder hints
 * @return Decode result, if barcode was decoded successfully, {@code null} otherwise
 * @see DecodeHintType
 * @see Color
 */
@Nullable
public static Result decodeRgb(@NonNull final int[] pixels, final int width, final int height, @Nullable final Map<DecodeHintType, ?> hints) {
    Objects.requireNonNull(pixels);
    final MultiFormatReader reader = createReader(hints);
    try {
        return Utils.decodeLuminanceSource(reader, new RGBLuminanceSource(width, height, pixels));
    } catch (final ReaderException e) {
        return null;
    }
}
Also used : MultiFormatReader(com.google.zxing.MultiFormatReader) RGBLuminanceSource(com.google.zxing.RGBLuminanceSource) ReaderException(com.google.zxing.ReaderException) Nullable(androidx.annotation.Nullable)

Example 9 with Nullable

use of androidx.annotation.Nullable in project WordPress-Login-Flow-Android by wordpress-mobile.

the class SiteUtils method getSiteByMatchingUrl.

@Nullable
private static SiteModel getSiteByMatchingUrl(List<SiteModel> siteModelList, String url) {
    if (siteModelList != null && !siteModelList.isEmpty()) {
        for (SiteModel siteModel : siteModelList) {
            String storedSiteUrl = UrlUtils.removeScheme(siteModel.getUrl()).replace("/", "");
            String incomingSiteUrl = UrlUtils.removeScheme(url).replace("/", "");
            if (storedSiteUrl.equalsIgnoreCase(incomingSiteUrl)) {
                return siteModel;
            }
        }
    }
    return null;
}
Also used : SiteModel(org.wordpress.android.fluxc.model.SiteModel) Nullable(androidx.annotation.Nullable)

Example 10 with Nullable

use of androidx.annotation.Nullable in project k-9 by k9mail.

the class AttachmentProvider method getAttachmentDataSource.

@Nullable
private OpenPgpDataSource getAttachmentDataSource(String accountUuid, String attachmentId) throws MessagingException {
    final Account account = Preferences.getPreferences(getContext()).getAccount(accountUuid);
    LocalStore localStore = DI.get(LocalStoreProvider.class).getInstance(account);
    return localStore.getAttachmentDataSource(attachmentId);
}
Also used : Account(com.fsck.k9.Account) LocalStore(com.fsck.k9.mailstore.LocalStore) LocalStoreProvider(com.fsck.k9.mailstore.LocalStoreProvider) 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