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