Search in sources :

Example 1 with SimpleItemAnimator

use of android.support.v7.widget.SimpleItemAnimator in project actor-platform by actorapp.

the class GlobalSearchBaseFragment method showSearch.

private void showSearch() {
    if (isSearchVisible) {
        return;
    }
    isSearchVisible = true;
    searchDisplay = messenger().buildSearchDisplayList();
    searchDisplay.setBindHook(new BindedDisplayList.BindHook<SearchEntity>() {

        @Override
        public void onScrolledToEnd() {
            scrolledToEnd = true;
            checkGlobalSearch();
        }

        @Override
        public void onItemTouched(SearchEntity item) {
        }
    });
    searchAdapter = new SearchAdapter(getActivity(), searchDisplay, new OnItemClickedListener<SearchEntity>() {

        @Override
        public void onClicked(SearchEntity item) {
            onPeerPicked(item.getPeer());
            searchMenu.collapseActionView();
        }

        @Override
        public boolean onLongClicked(SearchEntity item) {
            return false;
        }
    });
    HeaderViewRecyclerAdapter recyclerAdapter = new HeaderViewRecyclerAdapter(searchAdapter);
    View header = new View(getActivity());
    header.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Screen.dp(0)));
    header.setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
    recyclerAdapter.addHeaderView(header);
    searchList.setAdapter(recyclerAdapter);
    RecyclerView.ItemAnimator animator = searchList.getItemAnimator();
    if (animator instanceof SimpleItemAnimator) {
        ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
    }
    searchDisplay.addListener(searchListener);
    showView(searchHintView, false);
    goneView(searchEmptyView, false);
    showView(searchContainer, false);
    Fragment parent = getParentFragment();
    if (parent != null && parent instanceof GlobalSearchStateDelegate) {
        ((GlobalSearchStateDelegate) parent).onGlobalSearchStarted();
    }
}
Also used : SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) SearchView(android.support.v7.widget.SearchView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) BaseFragment(im.actor.sdk.controllers.BaseFragment) Fragment(android.support.v4.app.Fragment) BindedDisplayList(im.actor.runtime.generic.mvvm.BindedDisplayList) HeaderViewRecyclerAdapter(im.actor.sdk.view.adapters.HeaderViewRecyclerAdapter) SearchEntity(im.actor.core.entity.SearchEntity) PeerSearchEntity(im.actor.core.entity.PeerSearchEntity) OnItemClickedListener(im.actor.sdk.view.adapters.OnItemClickedListener) FrameLayout(android.widget.FrameLayout) RecyclerView(android.support.v7.widget.RecyclerView)

Example 2 with SimpleItemAnimator

use of android.support.v7.widget.SimpleItemAnimator in project AntennaPod by AntennaPod.

the class AllEpisodesFragment method onCreateViewHelper.

protected View onCreateViewHelper(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, int fragmentResource) {
    super.onCreateView(inflater, container, savedInstanceState);
    View root = inflater.inflate(fragmentResource, container, false);
    recyclerView = (RecyclerView) root.findViewById(android.R.id.list);
    RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator();
    if (animator instanceof SimpleItemAnimator) {
        ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
    }
    layoutManager = new LinearLayoutManager(getActivity());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
    recyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(getActivity()).build());
    progLoading = (ProgressBar) root.findViewById(R.id.progLoading);
    if (!itemsLoaded) {
        progLoading.setVisibility(View.VISIBLE);
    }
    viewsCreated = true;
    if (itemsLoaded) {
        onFragmentLoaded();
    }
    return root;
}
Also used : SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SearchView(android.support.v7.widget.SearchView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Example 3 with SimpleItemAnimator

use of android.support.v7.widget.SimpleItemAnimator 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)

Example 4 with SimpleItemAnimator

use of android.support.v7.widget.SimpleItemAnimator in project apps-android-wikipedia by wikimedia.

the class RemoteCompilationsFragment 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_remote_compilations, container, false);
    unbinder = ButterKnife.bind(this, view);
    toolbarLayout.setExpandedTitleColor(Color.WHITE);
    toolbarLayout.setCollapsedTitleTextColor(Color.WHITE);
    getAppCompatActivity().setSupportActionBar(toolbar);
    getAppCompatActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getAppCompatActivity().getSupportActionBar().setTitle("");
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(adapter);
    recyclerView.addItemDecoration(new DrawableItemDecoration(getContext(), R.attr.list_separator_drawable));
    ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    errorView.setRetryClickListener((v) -> beginUpdate());
    errorView.setBackClickListener((v) -> getActivity().finish());
    beginUpdate();
    return view;
}
Also used : SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) DrawableItemDecoration(org.wikipedia.views.DrawableItemDecoration) 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) WikiErrorView(org.wikipedia.views.WikiErrorView) Nullable(android.support.annotation.Nullable)

Example 5 with SimpleItemAnimator

use of android.support.v7.widget.SimpleItemAnimator in project EhViewer by seven332.

the class DownloadsScene method onCreateView3.

@Nullable
@Override
public View onCreateView3(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.scene_download, container, false);
    View content = ViewUtils.$$(view, R.id.content);
    mRecyclerView = (EasyRecyclerView) ViewUtils.$$(content, R.id.recycler_view);
    FastScroller fastScroller = (FastScroller) ViewUtils.$$(content, R.id.fast_scroller);
    mFabLayout = (FabLayout) ViewUtils.$$(view, R.id.fab_layout);
    TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
    mViewTransition = new ViewTransition(content, tip);
    Context context = getContext2();
    Assert.assertNotNull(content);
    Resources resources = context.getResources();
    Drawable drawable = DrawableManager.getDrawable(context, R.drawable.big_download);
    drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
    tip.setCompoundDrawables(null, drawable, null, null);
    mAdapter = new DownloadAdapter();
    mAdapter.setHasStableIds(true);
    mRecyclerView.setAdapter(mAdapter);
    mLayoutManager = new AutoStaggeredGridLayoutManager(0, StaggeredGridLayoutManager.VERTICAL);
    mLayoutManager.setColumnSize(resources.getDimensionPixelOffset(Settings.getDetailSizeResId()));
    mLayoutManager.setStrategy(AutoStaggeredGridLayoutManager.STRATEGY_MIN_SIZE);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, false));
    mRecyclerView.setDrawSelectorOnTop(true);
    mRecyclerView.hasFixedSize();
    mRecyclerView.setClipToPadding(false);
    mRecyclerView.setOnItemClickListener(this);
    mRecyclerView.setOnItemLongClickListener(this);
    mRecyclerView.setChoiceMode(EasyRecyclerView.CHOICE_MODE_MULTIPLE_CUSTOM);
    mRecyclerView.setCustomCheckedListener(new DownloadChoiceListener());
    // Cancel change animation
    RecyclerView.ItemAnimator itemAnimator = mRecyclerView.getItemAnimator();
    if (itemAnimator instanceof SimpleItemAnimator) {
        ((SimpleItemAnimator) itemAnimator).setSupportsChangeAnimations(false);
    }
    int interval = resources.getDimensionPixelOffset(R.dimen.gallery_list_interval);
    int paddingH = resources.getDimensionPixelOffset(R.dimen.gallery_list_margin_h);
    int paddingV = resources.getDimensionPixelOffset(R.dimen.gallery_list_margin_v);
    MarginItemDecoration decoration = new MarginItemDecoration(interval, paddingH, paddingV, paddingH, paddingV);
    mRecyclerView.addItemDecoration(decoration);
    decoration.applyPaddings(mRecyclerView);
    if (mInitPosition >= 0) {
        mRecyclerView.scrollToPosition(mInitPosition);
        mInitPosition = -1;
    }
    fastScroller.attachToRecyclerView(mRecyclerView);
    HandlerDrawable handlerDrawable = new HandlerDrawable();
    handlerDrawable.setColor(ResourcesUtils.getAttrColor(context, R.attr.colorAccent));
    fastScroller.setHandlerDrawable(handlerDrawable);
    fastScroller.setOnDragHandlerListener(this);
    mFabLayout.setExpanded(false, false);
    mFabLayout.setHidePrimaryFab(true);
    mFabLayout.setAutoCancel(false);
    mFabLayout.setOnClickFabListener(this);
    addAboveSnackView(mFabLayout);
    updateView();
    guide();
    return view;
}
Also used : Context(android.content.Context) SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) ViewTransition(com.hippo.view.ViewTransition) HandlerDrawable(com.hippo.easyrecyclerview.HandlerDrawable) Drawable(android.graphics.drawable.Drawable) FastScroller(com.hippo.easyrecyclerview.FastScroller) MarginItemDecoration(com.hippo.easyrecyclerview.MarginItemDecoration) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) View(android.view.View) AdapterView(android.widget.AdapterView) SimpleRatingView(com.hippo.ehviewer.widget.SimpleRatingView) LoadImageView(com.hippo.widget.LoadImageView) TextView(android.widget.TextView) ListView(android.widget.ListView) RecyclerView(android.support.v7.widget.RecyclerView) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point) AutoStaggeredGridLayoutManager(com.hippo.widget.recyclerview.AutoStaggeredGridLayoutManager) TextView(android.widget.TextView) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) Resources(android.content.res.Resources) HandlerDrawable(com.hippo.easyrecyclerview.HandlerDrawable) Nullable(android.support.annotation.Nullable)

Aggregations

SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)31 RecyclerView (android.support.v7.widget.RecyclerView)27 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)22 View (android.view.View)19 Toolbar (android.support.v7.widget.Toolbar)9 TextView (android.widget.TextView)9 Nullable (android.support.annotation.Nullable)7 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)5 UIHandler (com.cpjd.roblu.ui.UIHandler)5 Context (android.content.Context)4 Intent (android.content.Intent)4 GridLayoutManager (android.support.v7.widget.GridLayoutManager)4 Drawable (android.graphics.drawable.Drawable)3 Bundle (android.os.Bundle)3 FloatingActionButton (android.support.design.widget.FloatingActionButton)3 BindView (butterknife.BindView)3 IO (com.cpjd.roblu.io.IO)3 ArrayList (java.util.ArrayList)3 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)2 ActionBar (android.support.v7.app.ActionBar)2