Search in sources :

Example 1 with StatisticsFragment

use of de.danoeh.antennapod.fragment.preferences.StatisticsFragment 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)

Aggregations

Context (android.content.Context)1 LightingColorFilter (android.graphics.LightingColorFilter)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 Nullable (androidx.annotation.Nullable)1 AppBarLayout (com.google.android.material.appbar.AppBarLayout)1 CollapsingToolbarLayout (com.google.android.material.appbar.CollapsingToolbarLayout)1 MainActivity (de.danoeh.antennapod.activity.MainActivity)1 StatisticsFragment (de.danoeh.antennapod.fragment.preferences.StatisticsFragment)1 ToolbarIconTintManager (de.danoeh.antennapod.view.ToolbarIconTintManager)1