Search in sources :

Example 56 with Nullable

use of androidx.annotation.Nullable in project AntennaPod by AntennaPod.

the class AddFeedFragment method onCreateView.

@Override
@Nullable
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    viewBinding = AddfeedBinding.inflate(getLayoutInflater());
    activity = (MainActivity) getActivity();
    Toolbar toolbar = viewBinding.toolbar;
    displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0;
    if (savedInstanceState != null) {
        displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW);
    }
    ((MainActivity) getActivity()).setupToolbarToggle(toolbar, displayUpArrow);
    viewBinding.searchItunesButton.setOnClickListener(v -> activity.loadChildFragment(OnlineSearchFragment.newInstance(ItunesPodcastSearcher.class)));
    viewBinding.searchFyydButton.setOnClickListener(v -> activity.loadChildFragment(OnlineSearchFragment.newInstance(FyydPodcastSearcher.class)));
    viewBinding.searchGPodderButton.setOnClickListener(v -> activity.loadChildFragment(new GpodnetMainFragment()));
    viewBinding.searchPodcastIndexButton.setOnClickListener(v -> activity.loadChildFragment(OnlineSearchFragment.newInstance(PodcastIndexPodcastSearcher.class)));
    viewBinding.combinedFeedSearchEditText.setOnEditorActionListener((v, actionId, event) -> {
        performSearch();
        return true;
    });
    viewBinding.addViaUrlButton.setOnClickListener(v -> showAddViaUrlDialog());
    viewBinding.opmlImportButton.setOnClickListener(v -> {
        try {
            chooseOpmlImportPathLauncher.launch("*/*");
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
            ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG);
        }
    });
    viewBinding.addLocalFolderButton.setOnClickListener(v -> {
        if (Build.VERSION.SDK_INT < 21) {
            return;
        }
        try {
            addLocalFolderLauncher.launch(null);
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
            ((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG);
        }
    });
    if (Build.VERSION.SDK_INT < 21) {
        viewBinding.addLocalFolderButton.setVisibility(View.GONE);
    }
    viewBinding.searchButton.setOnClickListener(view -> performSearch());
    return viewBinding.getRoot();
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) MainActivity(de.danoeh.antennapod.activity.MainActivity) Toolbar(androidx.appcompat.widget.Toolbar) GpodnetMainFragment(de.danoeh.antennapod.fragment.gpodnet.GpodnetMainFragment) Nullable(androidx.annotation.Nullable)

Example 57 with Nullable

use of androidx.annotation.Nullable in project AntennaPod by AntennaPod.

the class FeedInfoFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.feedinfo, null);
    toolbar = root.findViewById(R.id.toolbar);
    toolbar.setTitle("");
    toolbar.inflateMenu(R.menu.feedinfo);
    toolbar.setNavigationOnClickListener(v -> getParentFragmentManager().popBackStack());
    toolbar.setOnMenuItemClickListener(this);
    refreshToolbarState();
    AppBarLayout appBar = root.findViewById(R.id.appBar);
    CollapsingToolbarLayout collapsingToolbar = root.findViewById(R.id.collapsing_toolbar);
    ToolbarIconTintManager iconTintManager = new ToolbarIconTintManager(getContext(), toolbar, collapsingToolbar) {

        @Override
        protected void doTint(Context themedContext) {
            toolbar.getMenu().findItem(R.id.visit_website_item).setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_web));
            toolbar.getMenu().findItem(R.id.share_parent).setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_share));
        }
    };
    iconTintManager.updateTint();
    appBar.addOnOffsetChangedListener(iconTintManager);
    imgvCover = root.findViewById(R.id.imgvCover);
    txtvTitle = root.findViewById(R.id.txtvTitle);
    txtvAuthorHeader = root.findViewById(R.id.txtvAuthor);
    imgvBackground = root.findViewById(R.id.imgvBackground);
    header = root.findViewById(R.id.headerContainer);
    infoContainer = root.findViewById(R.id.infoContainer);
    root.findViewById(R.id.butShowInfo).setVisibility(View.INVISIBLE);
    root.findViewById(R.id.butShowSettings).setVisibility(View.INVISIBLE);
    // https://github.com/bumptech/glide/issues/529
    imgvBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000));
    txtvDescription = root.findViewById(R.id.txtvDescription);
    txtvUrl = root.findViewById(R.id.txtvUrl);
    lblSupport = root.findViewById(R.id.lblSupport);
    txtvFundingUrl = root.findViewById(R.id.txtvFundingUrl);
    txtvUrl.setOnClickListener(copyUrlToClipboard);
    long feedId = getArguments().getLong(EXTRA_FEED_ID);
    getParentFragmentManager().beginTransaction().replace(R.id.statisticsFragmentContainer, FeedStatisticsFragment.newInstance(feedId, false), "feed_statistics_fragment").commitAllowingStateLoss();
    root.findViewById(R.id.btnvOpenStatistics).setOnClickListener(view -> {
        StatisticsFragment fragment = new StatisticsFragment();
        ((MainActivity) getActivity()).loadChildFragment(fragment, TransitionEffect.SLIDE);
    });
    return root;
}
Also used : Context(android.content.Context) StatisticsFragment(de.danoeh.antennapod.fragment.preferences.StatisticsFragment) LightingColorFilter(android.graphics.LightingColorFilter) CollapsingToolbarLayout(com.google.android.material.appbar.CollapsingToolbarLayout) AppBarLayout(com.google.android.material.appbar.AppBarLayout) MainActivity(de.danoeh.antennapod.activity.MainActivity) ToolbarIconTintManager(de.danoeh.antennapod.view.ToolbarIconTintManager) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable)

Example 58 with Nullable

use of androidx.annotation.Nullable in project AntennaPod by AntennaPod.

the class FeedStatisticsFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    feedId = getArguments().getLong(EXTRA_FEED_ID);
    viewBinding = FeedStatisticsBinding.inflate(inflater);
    if (!getArguments().getBoolean(EXTRA_DETAILED)) {
        for (int i = 0; i < viewBinding.getRoot().getChildCount(); i++) {
            View child = viewBinding.getRoot().getChildAt(i);
            if ("detailed".equals(child.getTag())) {
                child.setVisibility(View.GONE);
            }
        }
    }
    loadStatistics();
    return viewBinding.getRoot();
}
Also used : View(android.view.View) Nullable(androidx.annotation.Nullable)

Example 59 with Nullable

use of androidx.annotation.Nullable in project AntennaPod by AntennaPod.

the class FeedItemlistFragment method loadData.

@Nullable
private Feed loadData() {
    Feed feed = DBReader.getFeed(feedID, true);
    if (feed == null) {
        return null;
    }
    DBReader.loadAdditionalFeedItemListData(feed.getItems());
    if (feed.getSortOrder() != null) {
        List<FeedItem> feedItems = feed.getItems();
        FeedItemPermutors.getPermutor(feed.getSortOrder()).reorder(feedItems);
        feed.setItems(feedItems);
    }
    return feed;
}
Also used : FeedItem(de.danoeh.antennapod.model.feed.FeedItem) Feed(de.danoeh.antennapod.model.feed.Feed) Nullable(androidx.annotation.Nullable)

Example 60 with Nullable

use of androidx.annotation.Nullable in project Douya by DreaminginCodeZH.

the class ImageTypeUriRequestBody method contentType.

@Nullable
@Override
public MediaType contentType() {
    MediaType superType = super.contentType();
    if (superType != null) {
        return superType;
    }
    String mimeType = UriUtils.getType(mUri, mContentResolver);
    if (TextUtils.isEmpty(mimeType)) {
        try (InputStream inputStream = mContentResolver.openInputStream(mUri)) {
            mimeType = FileTypeUtils.getImageMimeType(inputStream);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    if (!TextUtils.isEmpty(mimeType)) {
        return MediaType.parse(mimeType);
    }
    return null;
}
Also used : InputStream(java.io.InputStream) MediaType(okhttp3.MediaType) Nullable(androidx.annotation.Nullable)

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