Search in sources :

Example 1 with OfflineLibraryFunnel

use of org.wikipedia.analytics.OfflineLibraryFunnel in project apps-android-wikipedia by wikimedia.

the class LocalCompilationsFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_local_compilations, container, false);
    unbinder = ButterKnife.bind(this, view);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(adapter);
    recyclerView.addItemDecoration(new DrawableItemDecoration(getContext(), R.attr.list_separator_drawable));
    ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    errorView.setBackClickListener(v -> getActivity().finish());
    emptyDescription.setMovementMethod(LinkMovementMethod.getInstance());
    emptyDescription.setText(StringUtil.fromHtml(getString(R.string.offline_library_empty_description_sideload)));
    RichTextUtil.removeUnderlinesFromLinks(emptyDescription);
    packsHint.setMovementMethod(LinkMovementMethod.getInstance());
    packsHint.setText(StringUtil.fromHtml(getString(R.string.offline_library_packs_hint)));
    RichTextUtil.removeUnderlinesFromLinks(packsHint);
    dataUsageHint.setMovementMethod(new LinkMovementMethodExt((url, titleString) -> {
        if (url.equals(UriUtil.LOCAL_URL_SETTINGS)) {
            startActivity(SettingsActivity.newIntent(getContext()));
        }
    }));
    dataUsageHint.setText(StringUtil.fromHtml(getString(R.string.offline_library_data_usage_hint)));
    RichTextUtil.removeUnderlinesFromLinks(dataUsageHint);
    funnel = new OfflineLibraryFunnel(WikipediaApp.getInstance(), 0);
    return view;
}
Also used : ShareCompat(android.support.v4.app.ShareCompat) Bundle(android.os.Bundle) ProgressBar(android.widget.ProgressBar) DrawableItemDecoration(org.wikipedia.views.DrawableItemDecoration) ButterKnife(butterknife.ButterKnife) Intent(android.content.Intent) NonNull(android.support.annotation.NonNull) LinkMovementMethod(android.text.method.LinkMovementMethod) DefaultViewHolder(org.wikipedia.views.DefaultViewHolder) ShareUtil(org.wikipedia.util.ShareUtil) PageItemView(org.wikipedia.views.PageItemView) OnClick(butterknife.OnClick) SettingsActivity(org.wikipedia.settings.SettingsActivity) ArrayList(java.util.ArrayList) BindView(butterknife.BindView) FileUtil.bytesToUserVisibleUnit(org.wikipedia.util.FileUtil.bytesToUserVisibleUnit) WikipediaApp(org.wikipedia.WikipediaApp) FragmentUtil(org.wikipedia.activity.FragmentUtil) StringUtil(org.wikipedia.util.StringUtil) View(android.view.View) SearchEmptyView(org.wikipedia.views.SearchEmptyView) Unbinder(butterknife.Unbinder) LinkMovementMethodExt(org.wikipedia.page.LinkMovementMethodExt) R(org.wikipedia.R) RichTextUtil(org.wikipedia.richtext.RichTextUtil) LayoutInflater(android.view.LayoutInflater) OfflineLibraryFunnel(org.wikipedia.analytics.OfflineLibraryFunnel) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) PopupMenu(android.support.v7.widget.PopupMenu) UriUtil(org.wikipedia.util.UriUtil) ViewGroup(android.view.ViewGroup) File(java.io.File) RecyclerView(android.support.v7.widget.RecyclerView) List(java.util.List) TextView(android.widget.TextView) WikiErrorView(org.wikipedia.views.WikiErrorView) ResourceUtil(org.wikipedia.util.ResourceUtil) Nullable(android.support.annotation.Nullable) DimenUtil(org.wikipedia.util.DimenUtil) DateUtil.getShortDateString(org.wikipedia.util.DateUtil.getShortDateString) SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) DrawableItemDecoration(org.wikipedia.views.DrawableItemDecoration) OfflineLibraryFunnel(org.wikipedia.analytics.OfflineLibraryFunnel) LinkMovementMethodExt(org.wikipedia.page.LinkMovementMethodExt) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) PageItemView(org.wikipedia.views.PageItemView) BindView(butterknife.BindView) View(android.view.View) SearchEmptyView(org.wikipedia.views.SearchEmptyView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) WikiErrorView(org.wikipedia.views.WikiErrorView) Nullable(android.support.annotation.Nullable)

Aggregations

Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1 Nullable (android.support.annotation.Nullable)1 ShareCompat (android.support.v4.app.ShareCompat)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 PopupMenu (android.support.v7.widget.PopupMenu)1 RecyclerView (android.support.v7.widget.RecyclerView)1 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)1 LinkMovementMethod (android.text.method.LinkMovementMethod)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 ProgressBar (android.widget.ProgressBar)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 ButterKnife (butterknife.ButterKnife)1 OnClick (butterknife.OnClick)1 Unbinder (butterknife.Unbinder)1 File (java.io.File)1