Java Code Examples for android.support.v7.widget.DefaultItemAnimator

The following examples show how to use android.support.v7.widget.DefaultItemAnimator. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: storio   Source File: TweetsSQLiteFragment.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);

    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(tweetsAdapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setHasFixedSize(true);
    recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));

    uiStateController = new UiStateController.Builder()
            .withLoadingUi(view.findViewById(R.id.tweets_loading_ui))
            .withErrorUi(view.findViewById(R.id.tweets_error_ui))
            .withEmptyUi(view.findViewById(R.id.tweets_empty_ui))
            .withContentUi(recyclerView)
            .build();
}
 
Example 2
Source Project: EpisodeListView   Source File: EpisodeListView.java    License: Apache License 2.0 6 votes vote down vote up
private void init() {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(R.layout.episodelist_layout, this, true);

    mChildrenView = (RecyclerView) findViewById(R.id.episodes);
    mParentView = (RecyclerView) findViewById(R.id.groups);

    mEpisodesLayoutManager = new LinearLayoutManager(mContext, LinearLayout.HORIZONTAL, false);
    mGroupLayoutManager = new LinearLayoutManager(mContext, LinearLayout.HORIZONTAL, false);

    mChildrenView.setLayoutManager(mEpisodesLayoutManager);
    mParentView.setLayoutManager(mGroupLayoutManager);

    mChildrenView.setItemAnimator(new DefaultItemAnimator());
    mParentView.setItemAnimator(new DefaultItemAnimator());

    mChildrenView.setOnFocusChangeListener(this);
    mParentView.setOnFocusChangeListener(this);
    this.setOnFocusChangeListener(this);
}
 
Example 3
Source Project: PracticeDemo   Source File: HoriListFragment.java    License: Apache License 2.0 6 votes vote down vote up
protected void init(Bundle savedInstanceState) {

        mData = new ArrayList<>();
        mAdapter = new ListAdapter(getActivity(), mData, (view, position) -> {
            Snackbar.make(view, "点击了position:" + position, Snackbar.LENGTH_SHORT)
                    .setAction("删除该项目",v-> {
                        mData.remove(position);
                        mAdapter.notifyItemRemoved(position);
                    })
                    .show();
        });

        for (int i = 0; i < 20; i++) {
            mData.add("~~" + i);
        }

        mRvList.setItemAnimator(new DefaultItemAnimator());
        mRvList.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
        mRvList.setHasFixedSize(true);
        mRvList.setAdapter(mAdapter);
    }
 
Example 4
Source Project: okhttp-OkGo   Source File: NewsTabFragment.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void initData() {
    url = Urls.URL_GANK_BASE + fragmentTitle + "/" + PAGE_SIZE + "/";
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    newsAdapter = new NewsAdapter(null);
    newsAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
    newsAdapter.isFirstOnly(false);
    recyclerView.setAdapter(newsAdapter);

    refreshLayout.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN);
    refreshLayout.setOnRefreshListener(this);
    newsAdapter.setOnLoadMoreListener(this);

    //开启loading,获取数据
    setRefreshing(true);
    onRefresh();
}
 
Example 5
Source Project: aurora-imui   Source File: MessageList.java    License: MIT License 6 votes vote down vote up
/**
 * Set adapter for MessageList.
 *
 * @param adapter Adapter, extends MsgListAdapter.
 * @param         <MESSAGE> Message model extends IMessage.
 */
public <MESSAGE extends IMessage> void setAdapter(MsgListAdapter<MESSAGE> adapter) {
    mAdapter = adapter;
    SimpleItemAnimator itemAnimator = new DefaultItemAnimator();
    itemAnimator.setSupportsChangeAnimations(false);
    setItemAnimator(itemAnimator);

    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, true);
    layoutManager.setStackFromEnd(true);
    setLayoutManager(layoutManager);

    adapter.setLayoutManager(layoutManager);
    adapter.setStyle(mContext, mMsgListStyle);
    mScrollMoreListener = new ScrollMoreListener(layoutManager, adapter);
    addOnScrollListener(mScrollMoreListener);
    super.setAdapter(adapter);
}
 
Example 6
Source Project: belvedere   Source File: ImageStreamUi.java    License: Apache License 2.0 6 votes vote down vote up
private void initRecycler(ImageStreamAdapter adapter) {
    final int columns = bottomSheet.getContext().getResources().getInteger(R.integer.belvedere_image_stream_column_count);
    final StaggeredGridLayoutManager staggeredGridLayoutManager =
            new StaggeredGridLayoutManager(columns, StaggeredGridLayoutManager.VERTICAL);

    imageList.setLayoutManager(staggeredGridLayoutManager);
    imageList.setHasFixedSize(true);
    imageList.setDrawingCacheEnabled(true);
    imageList.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);

    final DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
    defaultItemAnimator.setSupportsChangeAnimations(false);
    imageList.setItemAnimator(defaultItemAnimator);

    imageList.setAdapter(adapter);
}
 
Example 7
Source Project: myapplication   Source File: FindGankAty.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void handleMessage(Message msg) {
    String gankJsonStr = msg.obj.toString();
    Log.d("FindGankAty", " Json: " + gankJsonStr);

    Gson gson = new Gson();
    mSearchBean = gson.fromJson(gankJsonStr, SearchBean.class);
    if (!mSearchBean.getResults().isEmpty() && mSearchBean != null) {
        mDatas = mSearchBean.getResults();

        mFindSearchAdapter = new FindSearchAdapter(FindGankAty.this, mDatas);
        mLayoutManager = new LinearLayoutManager(FindGankAty.this,
                LinearLayoutManager.VERTICAL, false);
        mRecyclerView.setAdapter(mFindSearchAdapter);
        mRecyclerView.setLayoutManager(mLayoutManager);
        mRecyclerView.setItemAnimator(new DefaultItemAnimator());//默认动画
        mRecyclerView.setHasFixedSize(true);//效率最高
        mFindSearchAdapter.setOnItemClickListener(FindGankAty.this);
        mMaterialDialog.dismiss();
    } else {
        mMaterialDialog.dismiss();
        Toast.makeText(FindGankAty.this,
                "数据加载出错!",
                Toast.LENGTH_SHORT).show();
    }
}
 
Example 8
Source Project: enjoyshop   Source File: GoodsListActivity.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 展示数据
 */
private void showData() {

    if (datas != null && datas.size() > 0) {
        mTxtSummary.setText("共有" + datas.size() + "件商品");
    } else {
        mLlSummary.setVisibility(View.GONE);
        ToastUtils.showUiToast(GoodsListActivity.this,"暂无商品信息");
        return;
    }

    mAdatper = new HotGoodsAdapter(datas, this);
    mRecyclerview.setAdapter(mAdatper);
    if (actionType == ACTION_LIST) {
        mRecyclerview.setLayoutManager(new LinearLayoutManager(this));
    } else {
        mRecyclerview.setLayoutManager(new GridLayoutManager(this, 2));
    }

    mRecyclerview.setItemAnimator(new DefaultItemAnimator());
    mRecyclerview.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration
            .HORIZONTAL));

}
 
Example 9
Source Project: okhttp-OkGo   Source File: DownloadListActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_download_list);
    initToolBar(toolbar, true, "开始下载");

    initData();
    OkDownload.getInstance().setFolder(Environment.getExternalStorageDirectory().getAbsolutePath() + "/aaa/");
    OkDownload.getInstance().getThreadPool().setCorePoolSize(3);

    folder.setText(String.format("下载路径: %s", OkDownload.getInstance().getFolder()));
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));

    //从数据库中恢复数据
    List<Progress> progressList = DownloadManager.getInstance().getAll();
    OkDownload.restore(progressList);
    adapter = new DownloadListAdapter(this);
    recyclerView.setAdapter(adapter);

    checkSDCardPermission();
}
 
Example 10
Source Project: HHComicViewer   Source File: RecommendDetailsFragment.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_recommend_details, container, false);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
    Bundle bundle = getArguments();
    ComicTabList comicTabList = (ComicTabList) bundle.getSerializable("tab_list");
    if (comicTabList != null) {
        RecommendDetailsAdapter adapter = new RecommendDetailsAdapter(getActivity(), comicTabList);
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setAdapter(new ScaleInAnimationAdapter(adapter));
    }
    return view;
}
 
Example 11
Source Project: timecat   Source File: RoutinesListFragment.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void initView() {
    dataList = DB.routines().findAll();
    empty_icon.setImageResource(R.drawable.ic_routines_grey_24dp);
    empty_head.setText(R.string.empty_routines_head);
    empty_attention.setText(R.string.empty_routines);
    empty_long_press_routine.setVisibility(View.VISIBLE);
    empty_long_press_note.setVisibility(View.INVISIBLE);
    if (dataList == null || dataList.isEmpty()) {
        empty_view.setVisibility(View.VISIBLE);
        recyclerView.setVisibility(View.GONE);
    } else {
        empty_view.setVisibility(View.GONE);
        recyclerView.setVisibility(View.VISIBLE);
    }
    RoutineListAdapter adapter = new RoutineListAdapter(dataList, (Activity) getContext());
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(adapter);
    new Handler().postDelayed(()-> getPresenter().refreshData(), 500);
}
 
Example 12
Source Project: timecat   Source File: NoteListFragment.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void initView() {
    dataList = DB.notes().findAll();
    if (dataList == null || dataList.isEmpty()) {
        empty_view.setVisibility(View.VISIBLE);
        recyclerView.setVisibility(View.GONE);
    } else {
        empty_view.setVisibility(View.GONE);
        recyclerView.setVisibility(View.VISIBLE);
    }
    NoteListAdapter adapter = new NoteListAdapter(dataList, (Activity) getContext());
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(adapter);
    new Handler().postDelayed(()-> getPresenter().refreshData(), 500);
}
 
Example 13
Source Project: EasyAbout   Source File: AboutListItemView.java    License: MIT License 6 votes vote down vote up
private void init(Context context, String title, int titleColor) {
    inflate(getContext(), R.layout.ea_card_list, this);
    aboutItemList = new ArrayList<>();
    easyAboutAdapter = new EasyAboutAdapter(context, aboutItemList);
    RecyclerView recyclerView = findViewById(R.id.recycler_view);
    recyclerView.setNestedScrollingEnabled(false);
    ViewCompat.setNestedScrollingEnabled(recyclerView, false);
    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(easyAboutAdapter);
    TextView titleTv = findViewById(R.id.card_title);
    if (titleColor==0)
        titleColor = ColorUtils.getThemeAccentColor(context);
    titleTv.setTextColor(titleColor);
    if (title==null)
        titleTv.setVisibility(GONE);
    else titleTv.setText(title);

    int cardColor = ColorUtils.getThemeAttrColor(context, "aboutCardBackground");
    if (cardColor!= 0)
        ((CardView) findViewById(R.id.card_view)).setCardBackgroundColor(cardColor);
}
 
Example 14
Source Project: clb-quic-demo   Source File: QuicFragment.java    License: Apache License 2.0 6 votes vote down vote up
private void loadItems() {
    numberOfImages = 0;

    RecyclerView cronetView = (RecyclerView) view.findViewById(R.id.quic_images_view);
    GridLayoutManager gridLayoutManager =
            new GridLayoutManager(getActivity(), 3);

    viewAdapter = new com.tencent.samples.quic_sample.QuicViewAdapter(getActivity());
    // In order to enable Netlog, a Cronet logging system, enable write permissions.
    // Find more info about Netlog here:
    // https://www.chromium.org/developers/design-documents/network-stack/netlog
    enableWritingPermissionForLogging();

    cronetView.setLayoutManager(gridLayoutManager);
    cronetView.setAdapter(viewAdapter);
    cronetView.setItemAnimator(new DefaultItemAnimator());
    onItemsLoadComplete();

}
 
Example 15
Source Project: Travel-Mate   Source File: UtilitiesFragment.java    License: MIT License 6 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_utility, container, false);

    ButterKnife.bind(this, view);

    List<CardItemEntity> cardEntities = getUtilityItems();

    CardViewOptionsAdapter cardViewOptionsAdapter = new CardViewOptionsAdapter(this, cardEntities);
    RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(mActivity.getApplicationContext());
    mUtilityOptionsRecycleView.setLayoutManager(mLayoutManager);
    mUtilityOptionsRecycleView.setItemAnimator(new DefaultItemAnimator());
    mUtilityOptionsRecycleView.setAdapter(cardViewOptionsAdapter);

    PackageManager mManager = getActivity().getPackageManager();
    boolean hasAccelerometer = mManager.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER);
    boolean hasMagneticSensor = mManager.hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS);
    if (!hasAccelerometer || !hasMagneticSensor) {
        this.mHasMagneticSensor = false;
    }

    return view;
}
 
Example 16
Source Project: music_player   Source File: searchActivity.java    License: Open Software License 3.0 6 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search);

        //动态注册广播
//        dismissReceiver = new DismissReceiver();
//        IntentFilter intentFilter = new IntentFilter();
//        intentFilter.addAction("dismiss_dialog");
//        registerReceiver(dismissReceiver, intentFilter);

        Toolbar search_toolbar = (Toolbar) findViewById(R.id.search_toolbar);
        search_toolbar.inflateMenu(R.menu.search_menu);
        search_toolbar.setTitle("搜索");
        setSupportActionBar(search_toolbar);//设置返回键可用
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        RecyclerView search_recycler_view = (RecyclerView) findViewById(R.id.search_RecyclerView);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        search_recycler_view.setLayoutManager(layoutManager);
        search_recycler_view.setItemAnimator(new DefaultItemAnimator());
        mSearchAdapter = new searchAdapter();
        search_recycler_view.setAdapter(mSearchAdapter);
    }
 
Example 17
Source Project: citrus   Source File: GroupPopularListFragment.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    String categoryName = GroupHelper.CATEGORY_POPULAR;
    RealmResults<Group> groups = GroupRepository.findAllByCategoryName(mUIThreadRealm, categoryName);
    mGroupListAdapter = new GroupListAdapter(groups, this);

    RecyclerView recyclerView = findById(view, R.id.group_list_recycler_view);
    recyclerView.addItemDecoration(
            new DividerItemDecoration(Utils.getDrawableResource(getActivity(), R.drawable.line)));
    final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(mGroupListAdapter);
}
 
Example 18
Source Project: FaceT   Source File: HongKongIslandFragment.java    License: Mozilla Public License 2.0 5 votes vote down vote up
public void setShopList (List<Shop> shopList_hk){
        shopList = shopList_hk;
        Log.d("FragmentHK_shopList_hk", ""+shopList_hk.size());
        Log.d("FragmentHK_shopList", ""+shopList.size());
        mAdapter = new ShopsAdapter(shopList, getActivity());
        RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(view.getContext());
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setAdapter(mAdapter);
//        mAdapter.notifyDataSetChanged();
    }
 
Example 19
Source Project: MaterialWeCenter   Source File: TopicFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    // 实例化刷新布局
    mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_light,
            android.R.color.holo_red_light,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light);
    TypedValue typed_value = new TypedValue();
    getActivity().getTheme().resolveAttribute(android.support.v7.appcompat.R.attr.actionBarSize, typed_value, true);
    mSwipeRefreshLayout.setProgressViewOffset(false, 0, getResources().getDimensionPixelSize(typed_value.resourceId));
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            // 下拉刷新
            new LoadTopicList().execute();
        }
    });
    mSwipeRefreshLayout.setRefreshing(true);
    // 实例化RecyclerView
    final LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new TopicViewAdapter(getActivity(), mList);
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    // 开始载入问题操作
    new LoadTopicList().execute();
}
 
Example 20
Source Project: CSDN   Source File: MainFragment.java    License: Apache License 2.0 5 votes vote down vote up
private void initView() {
    mSwipeRefresh = (SwipeRefreshLayout) getView().findViewById(R.id.id_swiperefresh);
    mSwipeRefresh.setColorSchemeResources(R.color.colorPrimary, R.color.colorPrimary,
            R.color.colorPrimary, R.color.colorPrimary);
    mRecycleView = (RecyclerView) getView().findViewById(R.id.id_recycleview);
    mManager = new LinearLayoutManager(getActivity());
    mRecycleView.setLayoutManager(mManager);
    mRecycleView.setItemAnimator(new DefaultItemAnimator());
}
 
Example 21
Source Project: FaceDetectCamera   Source File: FaceDetectRGBActivity.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the UI and initiates the creation of a face detector.
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    setContentView(R.layout.activity_camera_viewer);

    mView = (SurfaceView) findViewById(R.id.surfaceview);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    // Now create the OverlayView:
    mFaceView = new FaceOverlayView(this);
    addContentView(mFaceView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    // Create and Start the OrientationListener:

    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
    recyclerView.setLayoutManager(mLayoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());


    handler = new Handler();
    faces = new FaceResult[MAX_FACE];
    faces_previous = new FaceResult[MAX_FACE];
    for (int i = 0; i < MAX_FACE; i++) {
        faces[i] = new FaceResult();
        faces_previous[i] = new FaceResult();
    }


    getSupportActionBar().setDisplayShowTitleEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("Face Detect RGB");

    if (icicle != null)
        cameraId = icicle.getInt(BUNDLE_CAMERA_ID, 0);
}
 
Example 22
Source Project: SprintNBA   Source File: NewsListFragment.java    License: Apache License 2.0 5 votes vote down vote up
private void initView() {
    adapter = new NewsAdapter(list, mActivity);
    adapter.setOnItemClickListener(new OnListItemClickListener<NewsItem.NewsItemBean>() {
        @Override
        public void onItemClick(View view, int position, NewsItem.NewsItemBean data) {
            Intent intent;
            switch (newsType) {
                case VIDEO:
                case DEPTH:
                case HIGHLIGHT:
                    BaseWebActivity.start(mActivity, data.url, data.title, true, true);
                    break;
                case BANNER:
                case NEWS:
                default:
                    NewsDetailActivity.start(mActivity, data.title, data.index);
                    break;

            }
        }
    });
    recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
    recyclerView.setAdapter(adapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemDecoration(new SpaceItemDecoration(DimenUtils.dpToPxInt(5)));
    materialRefreshLayout.setMaterialRefreshListener(new RefreshListener());
}
 
Example 23
Source Project: YTPlayer   Source File: SearchActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onPostExecute(Void aVoid) {
    if (showTrend)
        trendingText.setText("TOP HIT ON SPOTIFY");
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    adapter = new SongAdapter(discoverModels,activity);
    recyclerView.setAdapter(adapter);
    progressBar.setVisibility(View.GONE);
    trendingText.setVisibility(View.VISIBLE);
    super.onPostExecute(aVoid);
}
 
Example 24
Source Project: AdvancedMaterialDrawer   Source File: MenuFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.recycleview_layout, container, false);

    mRecyclerView = (RecyclerView) v.findViewById(R.id.recycler);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    createAdapter(mRecyclerView);

    return v;
}
 
Example 25
Source Project: TestChat   Source File: HappyContentFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
        public void initData() {
                display.setLayoutManager( new LinearLayoutManager(getActivity()));
                display.addItemDecoration(new ListViewDecoration(getActivity()));
//                display.setHasFixedSize(true);
                display.setItemAnimator(new DefaultItemAnimator());
                mHappyPresenter = new HappyContentPresenter();
                mHappyContentModel=new HappyContentModel();
                mHappyPresenter.setViewAndModel(this,mHappyContentModel);
                mHappyAdapter = new HappyContentAdapter(data, R.layout.fragment_happy_content_item_layout);
                display.addOnItemTouchListener(new OnBaseItemChildClickListener() {
                        @Override
                        protected void onItemChildClick(BaseWrappedViewHolder baseWrappedViewHolder, int id, View view, int position) {
                                if (id == R.id.iv_fragment_happy_content_item_share) {
                                        HappyContentBean bean = mHappyAdapter.getData(position);
                                        Intent intent = new Intent(getActivity(), EditShareMessageActivity.class);
                                        intent.setAction(Intent.ACTION_SEND);
                                        intent.putExtra(Intent.EXTRA_TEXT, bean.getContent());
                                        intent.putExtra("share_info", bean);
                                        intent.putExtra("type", "happy_content");
                                        intent.putExtra("destination", "url");
                                        intent.setType("text/plain");
                                        startActivity(intent);
                                }
                        }
                });
                mHappyAdapter.setOnLoadMoreDataListener(new OnLoadMoreDataListener() {
                        @Override
                        public void onLoadMoreData() {
                               loadMoreData(currentPage);
                        }
                },display);

                display.setAdapter(mHappyAdapter);
        }
 
Example 26
Source Project: Gank.io   Source File: GankActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void initGankView() {
  list = new ArrayList<>();
  adapter = new GankAdapter(list, this);
  rvGank.setLayoutManager(new LinearLayoutManager(this));
  rvGank.setItemAnimator(new DefaultItemAnimator());
  rvGank.setAdapter(adapter);
  setTitle(DateUtil.toDateString(meizi.publishedAt));
  ivHead.setImageDrawable(ShareElement.shareDrawable);
  ViewCompat.setTransitionName(ivHead, PanConfig.TRANSLATE_GIRL_VIEW);
  fab.setClickable(false);
}
 
Example 27
Source Project: candybar-library   Source File: IconsSearchFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setHasOptionsMenu(true);

    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(),
            getActivity().getResources().getInteger(R.integer.icons_column_count)));
    mFastScroll.attachRecyclerView(mRecyclerView);
    setFastScrollColor(mFastScroll);

    mAsyncTask = new IconsLoader().execute();
}
 
Example 28
Source Project: andela-med-manager   Source File: SearchMedsActivity.java    License: Apache License 2.0 5 votes vote down vote up
public void setListData(final List<Medicine> medicineList) {
    this.medicineList = medicineList;

    if (medicineList.isEmpty()) {
        layout_empty.setVisibility(View.VISIBLE);
    }

    monthlyIntakeAdapter = new MonthlyIntakeAdapter(this, medicineList, (v, position) -> {
        Medicine medicine = medicineList.get(position);
        Intent intent = new Intent(getApplicationContext(), MedicineActivity.class);
        Bundle b = new Bundle();

        b.putString("name", medicine.getName());
        b.putString("description", medicine.getDescription());
        b.putString("interval", medicine.getInterval());
        b.putString("pills", medicine.getPills());
        b.putString("pillsTaken", medicine.getPillsTaken());
        b.putBoolean("true", medicine.isHasNotification());
        b.putString("startDate", String.valueOf(medicine.getStartDate()));
        b.putString("endDate", String.valueOf(medicine.getEndDate()));
        b.putInt("days", medicine.getDays());
        intent.putExtras(b);
        startActivity(intent);

    });
    LinearLayoutManager mLayoutManager =
            new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(mLayoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemDecoration(
            new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
    recyclerView.setAdapter(monthlyIntakeAdapter);
}
 
Example 29
Source Project: openshop.io-android   Source File: BannersFragment.java    License: MIT License 5 votes vote down vote up
/**
 * Prepares views and listeners associated with content.
 *
 * @param view       fragment root view.
 * @param freshStart indicates when everything should be recreated.
 */
private void prepareContentViews(View view, boolean freshStart) {
    bannersRecycler = view.findViewById(R.id.banners_recycler);
    if (freshStart) {
        bannersRecyclerAdapter = new BannersRecyclerAdapter(getActivity(), new BannersRecyclerInterface() {
            @Override
            public void onBannerSelected(Banner banner) {
                Activity activity = getActivity();
                if (activity instanceof MainActivity) {
                    ((MainActivity) activity).onBannerSelected(banner);
                }
            }
        });
    }
    LinearLayoutManager layoutManager = new LinearLayoutManager(bannersRecycler.getContext());
    bannersRecycler.setLayoutManager(layoutManager);
    bannersRecycler.setItemAnimator(new DefaultItemAnimator());
    bannersRecycler.setHasFixedSize(true);
    bannersRecycler.setAdapter(bannersRecyclerAdapter);
    endlessRecyclerScrollListener = new EndlessRecyclerScrollListener(layoutManager) {
        @Override
        public void onLoadMore(int currentPage) {
            if (bannersMetadata != null && bannersMetadata.getLinks() != null && bannersMetadata.getLinks().getNext() != null) {
                loadBanners(bannersMetadata.getLinks().getNext());
            } else {
                Timber.d("CustomLoadMoreDataFromApi NO MORE DATA");
            }
        }
    };
    bannersRecycler.addOnScrollListener(endlessRecyclerScrollListener);
}
 
Example 30
Source Project: Insta-Downloader   Source File: InstaDownloader.java    License: MIT License 5 votes vote down vote up
public void get(String input) {
    inDialog = new ProgressDialog(inContext);
    inDialog.setMessage("Please wait...");
    inDialog.setCancelable(false);
    inDialog.show();
    inAdapter.clear();

    new InstaUrl().execute(input);

    LinearLayoutManager inLayout = new LinearLayoutManager(inContext, LinearLayoutManager.VERTICAL, false);
    inRv.setLayoutManager(inLayout);
    inRv.setItemAnimator(new DefaultItemAnimator());
    inRv.setAdapter(inAdapter);
}