Search in sources :

Example 1 with HorizontalItemAnimator

use of acr.browser.lightning.fragment.anim.HorizontalItemAnimator in project Lightning-Browser by anthonycr.

the class TabsFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view;
    final LayoutManager layoutManager;
    if (mShowInNavigationDrawer) {
        view = inflater.inflate(R.layout.tab_drawer, container, false);
        layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
        setupFrameLayoutButton(view, R.id.tab_header_button, R.id.plusIcon);
        setupFrameLayoutButton(view, R.id.new_tab_button, R.id.icon_plus);
        setupFrameLayoutButton(view, R.id.action_back, R.id.icon_back);
        setupFrameLayoutButton(view, R.id.action_forward, R.id.icon_forward);
        setupFrameLayoutButton(view, R.id.action_home, R.id.icon_home);
    } else {
        view = inflater.inflate(R.layout.tab_strip, container, false);
        layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false);
        ImageView newTab = (ImageView) view.findViewById(R.id.new_tab_button);
        newTab.setColorFilter(ThemeUtils.getIconDarkThemeColor(getActivity()));
        newTab.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mUiController.newTabButtonClicked();
            }
        });
    }
    mUnbinder = ButterKnife.bind(this, view);
    SimpleItemAnimator animator;
    if (mShowInNavigationDrawer) {
        animator = new VerticalItemAnimator();
    } else {
        animator = new HorizontalItemAnimator();
    }
    animator.setSupportsChangeAnimations(false);
    animator.setAddDuration(200);
    animator.setChangeDuration(0);
    animator.setRemoveDuration(200);
    animator.setMoveDuration(200);
    mRecyclerView.setLayerType(View.LAYER_TYPE_NONE, null);
    mRecyclerView.setItemAnimator(animator);
    mRecyclerView.setLayoutManager(layoutManager);
    mTabsAdapter = new LightningViewAdapter(mShowInNavigationDrawer);
    mRecyclerView.setAdapter(mTabsAdapter);
    mRecyclerView.setHasFixedSize(true);
    return view;
}
Also used : SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) LayoutManager(android.support.v7.widget.RecyclerView.LayoutManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) LightningView(acr.browser.lightning.view.LightningView) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) TabsView(acr.browser.lightning.browser.TabsView) HorizontalItemAnimator(acr.browser.lightning.fragment.anim.HorizontalItemAnimator) VerticalItemAnimator(acr.browser.lightning.fragment.anim.VerticalItemAnimator) Nullable(android.support.annotation.Nullable)

Aggregations

TabsView (acr.browser.lightning.browser.TabsView)1 HorizontalItemAnimator (acr.browser.lightning.fragment.anim.HorizontalItemAnimator)1 VerticalItemAnimator (acr.browser.lightning.fragment.anim.VerticalItemAnimator)1 LightningView (acr.browser.lightning.view.LightningView)1 Nullable (android.support.annotation.Nullable)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 LayoutManager (android.support.v7.widget.RecyclerView.LayoutManager)1 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1