Search in sources :

Example 51 with Nullable

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

Example 52 with Nullable

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();
    }
}
Also used : FeedItem(de.danoeh.antennapod.model.feed.FeedItem) FeedMedia(de.danoeh.antennapod.model.feed.FeedMedia) Nullable(androidx.annotation.Nullable)

Example 53 with Nullable

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;
}
Also used : ViewGroup(android.view.ViewGroup) BindView(butterknife.BindView) View(android.view.View) Nullable(androidx.annotation.Nullable)

Example 54 with Nullable

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();
    }
}
Also used : FeedItem(de.danoeh.antennapod.model.feed.FeedItem) Cursor(android.database.Cursor) Nullable(androidx.annotation.Nullable)

Example 55 with Nullable

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();
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) Context(android.content.Context) Bundle(android.os.Bundle) AlertDialog(androidx.appcompat.app.AlertDialog) NonNull(androidx.annotation.NonNull) R(de.danoeh.antennapod.R) RadioButton(android.widget.RadioButton) FeedItem(de.danoeh.antennapod.model.feed.FeedItem) Dialog(android.app.Dialog) RadioGroup(android.widget.RadioGroup) Nullable(androidx.annotation.Nullable) SharedPreferences(android.content.SharedPreferences) CheckBox(android.widget.CheckBox) ShareUtils(de.danoeh.antennapod.core.util.ShareUtils) View(android.view.View) DialogFragment(androidx.fragment.app.DialogFragment) RadioGroup(android.widget.RadioGroup) View(android.view.View) NonNull(androidx.annotation.NonNull)

Aggregations

Nullable (androidx.annotation.Nullable)1124 View (android.view.View)188 Bundle (android.os.Bundle)111 IOException (java.io.IOException)99 NonNull (androidx.annotation.NonNull)96 ArrayList (java.util.ArrayList)95 Context (android.content.Context)93 TextView (android.widget.TextView)92 Cursor (android.database.Cursor)71 SuppressLint (android.annotation.SuppressLint)69 Uri (android.net.Uri)66 RecyclerView (androidx.recyclerview.widget.RecyclerView)59 List (java.util.List)58 ViewGroup (android.view.ViewGroup)56 Test (org.junit.Test)55 Intent (android.content.Intent)53 Recipient (org.thoughtcrime.securesms.recipients.Recipient)52 R (org.thoughtcrime.securesms.R)46 LayoutInflater (android.view.LayoutInflater)45 ImageView (android.widget.ImageView)43