Search in sources :

Example 76 with LinearLayoutManager

use of android.support.v7.widget.LinearLayoutManager in project Reader by TheKeeperOfPie.

the class FragmentSearch method onCreateView.

// TODO: Remove/fix ResourceType warning
@SuppressWarnings("ResourceType")
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    view = bind(inflater.inflate(R.layout.fragment_search, container, false));
    listenerSearch = new ControllerSearch.Listener() {

        @Override
        public AdapterSearchSubreddits getAdapterSearchSubreddits() {
            return adapterSearchSubreddits;
        }

        @Override
        public AdapterSearchSubreddits getAdapterSearchSubredditsRecommended() {
            return adapterSearchSubredditsRecommended;
        }

        @Override
        public void scrollToLinks(int position) {
            layoutManagerLinks.scrollToPositionWithOffset(0, 0);
        }

        @Override
        public void scrollToLinksSubreddit(int position) {
            layoutManagerLinksSubreddit.scrollToPositionWithOffset(0, 0);
        }
    };
    int windowBackground = UtilsTheme.getAttributeColor(getContext(), android.R.attr.windowBackground, 0);
    setUpToolbar();
    adapterSearchSubreddits = new AdapterSearchSubreddits(getActivity(), new ControllerSearchBase() {

        @Override
        public Subreddit getSubreddit(int position) {
            return controllerSearch.getSubreddit(position);
        }

        @Override
        public int getSubredditCount() {
            return controllerSearch.getCountSubreddit();
        }
    }, new AdapterSearchSubreddits.ViewHolder.EventListener() {

        @Override
        public void onClickSubreddit(Subreddit subreddit) {
            controllerSearch.addViewedSubreddit(subreddit);
            controllerLinks.setParameters(subreddit.getDisplayName(), Sort.HOT, Time.ALL);
            closeKeyboard();
            mListener.onNavigationBackClick();
        }

        @Override
        public boolean supportsDrag() {
            return true;
        }

        @Override
        public void onStartDrag(AdapterSearchSubreddits.ViewHolder viewHolder) {
            itemTouchHelperSubreddits.startDrag(viewHolder);
        }

        @Override
        public void sendToTop(AdapterSearchSubreddits.ViewHolder viewHolder) {
            controllerSearch.moveSubreddit(viewHolder.getAdapterPosition(), 0);
            recyclerSearchSubreddits.postOnAnimationDelayed(() -> {
                if (layoutManagerSubreddits.findFirstVisibleItemPosition() <= 1) {
                    layoutManagerSubreddits.smoothScrollToPosition(recyclerSearchSubreddits, null, 0);
                }
            }, 150);
        }

        @Override
        public boolean isSubscriptionListShown() {
            return controllerSearch.isSubscriptionListShown();
        }
    });
    layoutManagerSubreddits = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    recyclerSearchSubreddits.setLayoutManager(layoutManagerSubreddits);
    recyclerSearchSubreddits.setAdapter(adapterSearchSubreddits);
    recyclerSearchSubreddits.addItemDecoration(new ItemDecorationDivider(getActivity(), ItemDecorationDivider.VERTICAL_LIST));
    itemTouchHelperSubreddits = new ItemTouchHelper(new SimpleCallbackBackground(0, 0, windowBackground) {

        @Override
        public int getDragDirs(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
            if (controllerSearch.isSubscriptionListShown()) {
                return ItemTouchHelper.UP | ItemTouchHelper.DOWN;
            }
            return super.getDragDirs(recyclerView, viewHolder);
        }

        @Override
        public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
            controllerSearch.moveSubreddit(viewHolder.getAdapterPosition(), target.getAdapterPosition());
            return true;
        }

        @Override
        public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
        }

        @Override
        public boolean isLongPressDragEnabled() {
            return false;
        }
    });
    itemTouchHelperSubreddits.attachToRecyclerView(recyclerSearchSubreddits);
    AdapterLink.ViewHolderLink.Listener listenerLink = new AdapterLink.ViewHolderLink.Listener() {

        @Override
        public void onSubmitComment(Link link, String text) {
        }

        @Override
        public void onDownloadImage(Link link) {
        }

        @Override
        public void onDownloadImage(Link link, String title, String fileName, String url) {
        }

        @Override
        public void onLoadUrl(Link link, boolean forceExternal) {
        }

        @Override
        public void onShowFullEditor(Link link) {
        }

        @Override
        public void onVote(Link link, AdapterLink.ViewHolderLink viewHolderLink, Likes vote) {
        }

        @Override
        public void onCopyText(Link link) {
        }

        @Override
        public void onEdit(Link link) {
        }

        @Override
        public void onDelete(Link link) {
        }

        @Override
        public void onReport(Link link) {
        }

        @Override
        public void onSave(Link link) {
        }

        @Override
        public void onShowComments(Link link, AdapterLink.ViewHolderLink viewHolderLink, Source source) {
        }

        @Override
        public void onShowError(String error) {
        }

        @Override
        public void onMarkNsfw(Link link) {
        }
    };
    adapterLinks = new AdapterSearchLinkList(getActivity(), new AdapterListener() {

        @Override
        public void requestMore() {
            controllerSearch.loadMoreLinks().subscribe(getReloadObserver());
        }

        @Override
        public void scrollAndCenter(int position, int height) {
            UtilsAnimation.scrollToPositionWithCentering(position, recyclerSearchLinks, false);
        }

        @Override
        public void hideToolbar() {
            AppBarLayout.Behavior behaviorAppBar = (AppBarLayout.Behavior) ((CoordinatorLayout.LayoutParams) layoutAppBar.getLayoutParams()).getBehavior();
            behaviorAppBar.onNestedFling(layoutCoordinator, layoutAppBar, null, 0, 1000, true);
        }

        @Override
        public void clearDecoration() {
            AppBarLayout.Behavior behaviorAppBar = (AppBarLayout.Behavior) ((CoordinatorLayout.LayoutParams) layoutAppBar.getLayoutParams()).getBehavior();
            behaviorAppBar.onNestedFling(layoutCoordinator, layoutAppBar, null, 0, 1000, true);
        }

        @Override
        public void requestDisallowInterceptTouchEventVertical(boolean disallow) {
            recyclerSearchLinks.requestDisallowInterceptTouchEvent(disallow);
            recyclerSearchLinksSubreddit.requestDisallowInterceptTouchEvent(disallow);
            pagerSearch.requestDisallowInterceptTouchEvent(disallow);
        }

        @Override
        public void requestDisallowInterceptTouchEventHorizontal(boolean disallow) {
        }
    }, new AdapterLink.ViewHolderHeader.EventListener() {

        @Override
        public void onClickSubmit(Reddit.PostType postType) {
        }

        @Override
        public void showSidebar() {
        }
    }, listenerLink, Source.SEARCH_LINKS);
    adapterLinksSubreddit = new AdapterSearchLinkList(getActivity(), new AdapterListener() {

        @Override
        public void requestMore() {
            controllerSearch.loadMoreLinksSubreddit().subscribe(getReloadObserver());
        }

        @Override
        public void scrollAndCenter(int position, int height) {
            UtilsAnimation.scrollToPositionWithCentering(position, recyclerSearchLinksSubreddit, false);
        }

        @Override
        public void hideToolbar() {
            AppBarLayout.Behavior behaviorAppBar = (AppBarLayout.Behavior) ((CoordinatorLayout.LayoutParams) layoutAppBar.getLayoutParams()).getBehavior();
            behaviorAppBar.onNestedFling(layoutCoordinator, layoutAppBar, null, 0, 1000, true);
        }

        @Override
        public void clearDecoration() {
            AppBarLayout.Behavior behaviorAppBar = (AppBarLayout.Behavior) ((CoordinatorLayout.LayoutParams) layoutAppBar.getLayoutParams()).getBehavior();
            behaviorAppBar.onNestedFling(layoutCoordinator, layoutAppBar, null, 0, 1000, true);
        }

        @Override
        public void requestDisallowInterceptTouchEventVertical(boolean disallow) {
            recyclerSearchLinks.requestDisallowInterceptTouchEvent(disallow);
            recyclerSearchLinksSubreddit.requestDisallowInterceptTouchEvent(disallow);
            pagerSearch.requestDisallowInterceptTouchEvent(disallow);
        }

        @Override
        public void requestDisallowInterceptTouchEventHorizontal(boolean disallow) {
        }
    }, new AdapterLink.ViewHolderHeader.EventListener() {

        @Override
        public void onClickSubmit(Reddit.PostType postType) {
        }

        @Override
        public void showSidebar() {
        }
    }, listenerLink, Source.SEARCH_LINKS_SUBREDDIT);
    layoutManagerLinks = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    recyclerSearchLinks.setLayoutManager(layoutManagerLinks);
    recyclerSearchLinks.setAdapter(adapterLinks);
    recyclerSearchLinks.addItemDecoration(new ItemDecorationDivider(getActivity(), ItemDecorationDivider.VERTICAL_LIST));
    layoutManagerLinksSubreddit = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    recyclerSearchLinksSubreddit.setLayoutManager(layoutManagerLinksSubreddit);
    recyclerSearchLinksSubreddit.setAdapter(adapterLinksSubreddit);
    recyclerSearchLinksSubreddit.addItemDecoration(new ItemDecorationDivider(getActivity(), ItemDecorationDivider.VERTICAL_LIST));
    adapterSearchSubredditsRecommended = new AdapterSearchSubreddits(getActivity(), new ControllerSearchBase() {

        @Override
        public Subreddit getSubreddit(int position) {
            return controllerSearch.getSubredditRecommended(position);
        }

        @Override
        public int getSubredditCount() {
            return controllerSearch.getCountSubredditRecommended();
        }
    }, new AdapterSearchSubreddits.ViewHolder.EventListener() {

        @Override
        public void onClickSubreddit(Subreddit subreddit) {
            controllerLinks.setParameters(subreddit.getDisplayName(), Sort.HOT, Time.ALL);
            closeKeyboard();
            mListener.onNavigationBackClick();
        }

        @Override
        public boolean supportsDrag() {
            return false;
        }

        @Override
        public void onStartDrag(AdapterSearchSubreddits.ViewHolder viewHolder) {
        }

        @Override
        public void sendToTop(AdapterSearchSubreddits.ViewHolder viewHolder) {
        }

        @Override
        public boolean isSubscriptionListShown() {
            return controllerSearch.isSubscriptionListShown();
        }
    });
    layoutManagerSubredditsRecommended = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    recyclerSearchSubredditsRecommended.setLayoutManager(layoutManagerSubredditsRecommended);
    recyclerSearchSubredditsRecommended.setAdapter(adapterSearchSubredditsRecommended);
    recyclerSearchSubredditsRecommended.addItemDecoration(new ItemDecorationDivider(getActivity(), ItemDecorationDivider.VERTICAL_LIST));
    pagerSearch.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            controllerSearch.setCurrentPage(position).subscribe(getReloadObserver());
            boolean sortSubredditsShown = controllerSearch.getCurrentPage() == ControllerSearch.PAGE_SUBREDDITS || controllerSearch.getCurrentPage() == ControllerSearch.PAGE_SUBREDDITS_RECOMMENDED;
            menu.findItem(R.id.item_sort_subreddits).setEnabled(sortSubredditsShown);
            menu.findItem(R.id.item_sort_subreddits).setVisible(sortSubredditsShown);
            menu.findItem(R.id.item_sort).setEnabled(!sortSubredditsShown);
            menu.findItem(R.id.item_sort).setVisible(!sortSubredditsShown);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });
    final int count = controllerLinks.isOnSpecificSubreddit() ? pagerSearch.getChildCount() : pagerSearch.getChildCount() - 1;
    pagerAdapter = new PagerAdapter() {

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            return pagerSearch.getChildAt(position);
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
        // No need to destroy the RecyclerViews since they'll be reused for a new query
        }

        @Override
        public CharSequence getPageTitle(int position) {
            switch(position) {
                case ControllerSearch.PAGE_SUBREDDITS:
                    return getString(R.string.subreddit);
                case ControllerSearch.PAGE_LINKS:
                    return getString(R.string.all);
                case ControllerSearch.PAGE_LINKS_SUBREDDIT:
                    return controllerLinks.getSubredditName();
                case ControllerSearch.PAGE_SUBREDDITS_RECOMMENDED:
                    return getString(R.string.recommended);
            }
            return super.getPageTitle(position);
        }

        @Override
        public int getCount() {
            return count;
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }
    };
    pagerSearch.setAdapter(pagerAdapter);
    layoutTabs.setTabMode(TabLayout.MODE_SCROLLABLE);
    layoutTabs.setTabTextColors(themer.getColorFilterTextMuted().getColor(), themer.getColorFilterPrimary().getColor());
    layoutTabs.setBackgroundColor(getResources().getColor(android.R.color.transparent));
    layoutTabs.setupWithViewPager(pagerSearch);
    pagerSearch.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(layoutTabs));
    return view;
}
Also used : ItemDecorationDivider(com.winsonchiu.reader.utils.ItemDecorationDivider) AdapterListener(com.winsonchiu.reader.adapter.AdapterListener) AdapterLink(com.winsonchiu.reader.links.AdapterLink) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) Source(com.winsonchiu.reader.comments.Source) PagerAdapter(android.support.v4.view.PagerAdapter) ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) TabLayout(android.support.design.widget.TabLayout) AppBarLayout(android.support.design.widget.AppBarLayout) SimpleCallbackBackground(com.winsonchiu.reader.utils.SimpleCallbackBackground) AdapterListener(com.winsonchiu.reader.adapter.AdapterListener) ViewGroup(android.view.ViewGroup) ViewPager(android.support.v4.view.ViewPager) SearchView(android.support.v7.widget.SearchView) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) RecyclerView(android.support.v7.widget.RecyclerView) Subreddit(com.winsonchiu.reader.data.reddit.Subreddit) Likes(com.winsonchiu.reader.data.reddit.Likes) AdapterLink(com.winsonchiu.reader.links.AdapterLink) Link(com.winsonchiu.reader.data.reddit.Link)

Example 77 with LinearLayoutManager

use of android.support.v7.widget.LinearLayoutManager in project Reader by TheKeeperOfPie.

the class FragmentHistory method resetAdapter.

private void resetAdapter(AdapterLink newAdapter) {
    RecyclerView.LayoutManager layoutManagerCurrent = recyclerHistory.getLayoutManager();
    int size = layoutManagerCurrent instanceof StaggeredGridLayoutManager ? ((StaggeredGridLayoutManager) layoutManagerCurrent).getSpanCount() : 1;
    int[] currentPosition = new int[size];
    if (layoutManagerCurrent instanceof LinearLayoutManager) {
        currentPosition[0] = ((LinearLayoutManager) layoutManagerCurrent).findFirstVisibleItemPosition();
    } else if (layoutManagerCurrent instanceof StaggeredGridLayoutManager) {
        ((StaggeredGridLayoutManager) layoutManagerCurrent).findFirstCompletelyVisibleItemPositions(currentPosition);
    }
    this.adapterLink = newAdapter;
    this.layoutManager = adapterLink.getLayoutManager();
    if (layoutManager instanceof LinearLayoutManager) {
        recyclerHistory.setPadding(0, 0, 0, 0);
    } else {
        int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
        recyclerHistory.setPadding(padding, 0, padding, 0);
    }
    /*
            Note that we must call setAdapter before setLayoutManager or the ViewHolders
            will not be properly recycled, leading to memory leaks.
         */
    recyclerHistory.setAdapter(adapterLink);
    recyclerHistory.setLayoutManager(layoutManager);
    recyclerHistory.scrollToPosition(currentPosition[0]);
    if (layoutManager instanceof LinearLayoutManager) {
        recyclerHistory.addItemDecoration(itemDecorationDivider);
    } else {
        recyclerHistory.removeItemDecoration(itemDecorationDivider);
    }
}
Also used : LayoutManager(android.support.v7.widget.RecyclerView.LayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 78 with LinearLayoutManager

use of android.support.v7.widget.LinearLayoutManager in project Reader by TheKeeperOfPie.

the class FragmentHeaders method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_headers, container, false);
    preferences = PreferenceManager.getDefaultSharedPreferences(activity);
    adapterHeaders = new AdapterHeaders(activity, new AdapterHeaders.EventListener() {

        @Override
        public void onClickHeader(Header header) {
            FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction().addToBackStack(null).hide(FragmentHeaders.this);
            switch(header) {
                case DISPLAY:
                    fragmentTransaction.add(R.id.frame_fragment, new FragmentDisplay());
                    break;
                case BEHAVIOR:
                    fragmentTransaction.add(R.id.frame_fragment, new FragmentBehavior());
                    break;
                case MAIL:
                    fragmentTransaction.add(R.id.frame_fragment, new FragmentMail());
                    break;
                case ABOUT:
                    fragmentTransaction.add(R.id.frame_fragment, new FragmentAbout());
                    break;
            }
            fragmentTransaction.addToBackStack(null).commit();
        }
    });
    recyclerHeaders = (RecyclerView) view.findViewById(R.id.recycler_headers);
    recyclerHeaders.setLayoutManager(new LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false));
    recyclerHeaders.setHasFixedSize(true);
    recyclerHeaders.setAdapter(adapterHeaders);
    recyclerHeaders.setItemAnimator(null);
    recyclerHeaders.addItemDecoration(new ItemDecorationDivider(activity, ItemDecorationDivider.VERTICAL_LIST));
    return view;
}
Also used : ItemDecorationDivider(com.winsonchiu.reader.utils.ItemDecorationDivider) FragmentTransaction(android.app.FragmentTransaction) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 79 with LinearLayoutManager

use of android.support.v7.widget.LinearLayoutManager in project BoomMenu by Nightonke.

the class RecyclerViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recycler_view);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    assert recyclerView != null;
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(new RecyclerViewAdapter());
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 80 with LinearLayoutManager

use of android.support.v7.widget.LinearLayoutManager in project CoCoin by Nightonke.

the class AccountBookMonthViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.activity_account_book_month_view);
    userName = (TextView) findViewById(R.id.user_name);
    userEmail = (TextView) findViewById(R.id.user_email);
    userName.setTypeface(CoCoinUtil.typefaceLatoRegular);
    userEmail.setTypeface(CoCoinUtil.typefaceLatoLight);
    User user = BmobUser.getCurrentUser(CoCoinApplication.getAppContext(), User.class);
    if (user != null) {
        userName.setText(user.getUsername());
        userEmail.setText(user.getEmail());
    }
    mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);
    View view = mViewPager.getRootView();
    TextView title = (TextView) view.findViewById(R.id.logo_white);
    title.setTypeface(CoCoinUtil.typefaceLatoLight);
    title.setText(SettingManager.getInstance().getAccountBookName());
    mViewPager.getPagerTitleStrip().setTypeface(CoCoinUtil.GetTypeface(), Typeface.NORMAL);
    setTitle("");
    toolbar = mViewPager.getToolbar();
    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (toolbar != null) {
        setSupportActionBar(toolbar);
        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayShowTitleEnabled(true);
            actionBar.setDisplayUseLogoEnabled(false);
            actionBar.setHomeButtonEnabled(true);
        }
    }
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawer, 0, 0);
    mDrawer.setDrawerListener(mDrawerToggle);
    View logo = findViewById(R.id.logo_white);
    if (logo != null) {
        logo.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mViewPager.notifyHeaderChanged();
            }
        });
    }
    monthModeAdapter = new MonthViewFragmentAdapter(getSupportFragmentManager());
    mViewPager.getViewPager().setOffscreenPageLimit(monthModeAdapter.getCount());
    mViewPager.getViewPager().setAdapter(monthModeAdapter);
    mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());
    if (monthModeAdapter.getCount() == 1) {
        mViewPager.getPagerTitleStrip().setVisibility(View.INVISIBLE);
    }
    mViewPager.setMaterialViewPagerListener(new MaterialViewPager.Listener() {

        @Override
        public HeaderDesign getHeaderDesign(int page) {
            return HeaderDesign.fromColorAndDrawable(CoCoinUtil.GetTagColor(RecordManager.TAGS.get(page).getId()), CoCoinUtil.GetTagDrawable(-3));
        }
    });
    recyclerView = (RecyclerView) mDrawer.findViewById(R.id.recycler_view);
    drawerMonthViewRecyclerViewAdapter = new DrawerMonthViewRecyclerViewAdapter(mContext);
    recyclerView.setAdapter(drawerMonthViewRecyclerViewAdapter);
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    drawerMonthViewRecyclerViewAdapter.SetOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            mViewPager.getViewPager().setCurrentItem(position);
            final Handler handler = new Handler();
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    mDrawer.closeDrawers();
                }
            }, 700);
        }
    });
    profileImage = (CircleImageView) mDrawer.findViewById(R.id.profile_image);
    profileImage.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (SettingManager.getInstance().getLoggenOn()) {
                CoCoinUtil.showToast(mContext, R.string.change_logo_tip);
            } else {
                CoCoinUtil.showToast(mContext, R.string.login_tip);
            }
        }
    });
    mDemoSlider = (SliderLayout) findViewById(R.id.slider);
    HashMap<String, Integer> urls = CoCoinUtil.GetDrawerTopUrl();
    for (String name : urls.keySet()) {
        CustomSliderView customSliderView = new CustomSliderView(this);
        // initialize a SliderLayout
        customSliderView.image(urls.get(name)).setScaleType(BaseSliderView.ScaleType.Fit);
        mDemoSlider.addSlider(customSliderView);
    }
    mDemoSlider.setPresetTransformer(SliderLayout.Transformer.ZoomOut);
    mDemoSlider.setCustomAnimation(new DescriptionAnimation());
    mDemoSlider.setDuration(4000);
    mDemoSlider.setCustomIndicator((PagerIndicator) findViewById(R.id.custom_indicator));
    loadLogo();
}
Also used : MaterialViewPager(com.github.florent37.materialviewpager.MaterialViewPager) DrawerMonthViewRecyclerViewAdapter(com.nightonke.saver.adapter.DrawerMonthViewRecyclerViewAdapter) User(com.nightonke.saver.model.User) BmobUser(cn.bmob.v3.BmobUser) OnItemClickListener(com.nightonke.saver.adapter.DrawerMonthViewRecyclerViewAdapter.OnItemClickListener) HeaderDesign(com.github.florent37.materialviewpager.header.HeaderDesign) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) Handler(android.os.Handler) CustomSliderView(com.nightonke.saver.ui.CustomSliderView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) CustomSliderView(com.nightonke.saver.ui.CustomSliderView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) BaseSliderView(com.daimajia.slider.library.SliderTypes.BaseSliderView) MonthViewFragmentAdapter(com.nightonke.saver.adapter.MonthViewFragmentAdapter) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) DescriptionAnimation(com.daimajia.slider.library.Animations.DescriptionAnimation) TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1976 RecyclerView (android.support.v7.widget.RecyclerView)1085 View (android.view.View)822 TextView (android.widget.TextView)352 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)235 ArrayList (java.util.ArrayList)204 ImageView (android.widget.ImageView)186 Intent (android.content.Intent)150 Toolbar (android.support.v7.widget.Toolbar)134 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)131 GridLayoutManager (android.support.v7.widget.GridLayoutManager)125 BindView (butterknife.BindView)124 Bundle (android.os.Bundle)109 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)105 Nullable (android.support.annotation.Nullable)98 ViewGroup (android.view.ViewGroup)82 Context (android.content.Context)81 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)80 AdapterView (android.widget.AdapterView)70 List (java.util.List)69