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