use of androidx.annotation.Nullable in project AntennaPod by AntennaPod.
the class PaletteBitmapTranscoder method transcode.
@Nullable
@Override
public Resource<PaletteBitmap> transcode(@NonNull Resource<Bitmap> toTranscode, @NonNull Options options) {
Bitmap bitmap = toTranscode.get();
Palette palette = null;
if (UserPreferences.shouldShowSubscriptionTitle()) {
palette = new Palette.Builder(bitmap).generate();
}
PaletteBitmap result = new PaletteBitmap(bitmap, palette);
return new PaletteBitmapResource(result);
}
use of androidx.annotation.Nullable in project AntennaPod by AntennaPod.
the class ImageResourceUtils method getFallbackImageLocation.
@Nullable
public static String getFallbackImageLocation(@NonNull Playable playable) {
if (playable instanceof FeedMedia) {
FeedMedia media = (FeedMedia) playable;
FeedItem item = media.getItem();
if (item != null && item.getFeed() != null) {
return item.getFeed().getImageUrl();
} else {
return null;
}
} else {
return playable.getImageLocation();
}
}
use of androidx.annotation.Nullable in project Douya by DreaminginCodeZH.
the class MovieIntroductionFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
ViewGroup contentLayout = view.findViewById(R.id.content);
View castAndCreditsView = inflater.inflate(R.layout.item_introduction_fragment_movie_cast_and_credits, contentLayout, false);
contentLayout.addView(castAndCreditsView, 1);
return view;
}
use of androidx.annotation.Nullable in project AntennaPod by AntennaPod.
the class DBReader method getNextInQueue.
/**
* Get next feed item in queue following a particular feeditem
*
* @param item The FeedItem
* @return The FeedItem next in queue or null if the FeedItem could not be found.
*/
@Nullable
public static FeedItem getNextInQueue(FeedItem item) {
Log.d(TAG, "getNextInQueue() called with: " + "itemId = [" + item.getId() + "]");
PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open();
try {
FeedItem nextItem = null;
try (Cursor cursor = adapter.getNextInQueue(item)) {
List<FeedItem> list = extractItemlistFromCursor(adapter, cursor);
if (!list.isEmpty()) {
nextItem = list.get(0);
loadAdditionalFeedItemListData(list);
}
return nextItem;
} catch (Exception e) {
return null;
}
} finally {
adapter.close();
}
}
use of androidx.annotation.Nullable in project AntennaPod by AntennaPod.
the class ShareDialog method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
if (getArguments() != null) {
ctx = getActivity();
item = (FeedItem) getArguments().getSerializable(ARGUMENT_FEED_ITEM);
prefs = getActivity().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
View content = View.inflate(ctx, R.layout.share_episode_dialog, null);
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
builder.setTitle(R.string.share_label);
builder.setView(content);
RadioGroup radioGroup = content.findViewById(R.id.share_dialog_radio_group);
radioGroup.setOnCheckedChangeListener((group, checkedId) -> checkBoxStartAt.setEnabled(checkedId != R.id.share_media_file_radio));
radioLinkToEpisode = content.findViewById(R.id.share_link_to_episode_radio);
radioMediaFile = content.findViewById(R.id.share_media_file_radio);
checkBoxStartAt = content.findViewById(R.id.share_start_at_timer_dialog);
setupOptions();
builder.setPositiveButton(R.string.share_label, (dialog, id) -> {
boolean includePlaybackPosition = checkBoxStartAt.isChecked();
if (radioLinkToEpisode.isChecked()) {
ShareUtils.shareFeedItemLinkWithDownloadLink(ctx, item, includePlaybackPosition);
} else if (radioMediaFile.isChecked()) {
ShareUtils.shareFeedItemFile(ctx, item.getMedia());
} else {
throw new IllegalStateException("Unknown share method");
}
prefs.edit().putBoolean(PREF_SHARE_EPISODE_START_AT, includePlaybackPosition).apply();
}).setNegativeButton(R.string.cancel_label, (dialog, id) -> dialog.dismiss());
return builder.create();
}
Aggregations