11package com .guiying .girls .main ;
22
33import android .content .Context ;
4+ import android .support .v4 .content .ContextCompat ;
45import android .support .v4 .widget .SwipeRefreshLayout ;
56import android .support .v7 .widget .StaggeredGridLayoutManager ;
67import android .util .AttributeSet ;
@@ -52,14 +53,16 @@ private void initView() {
5253 inflate (getContext (), R .layout .view_girls_content , this );
5354 mNetworkErrorLayout = (ViewStub ) findViewById (R .id .network_error_layout );
5455 mGirlsRecyclerView = (EasyRecyclerView ) findViewById (R .id .girls_recycler_view );
55-
56- mData = new ArrayList <>();
5756 StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager (2 , StaggeredGridLayoutManager .VERTICAL );
5857 mGirlsRecyclerView .setLayoutManager (staggeredGridLayoutManager );
5958 mAdapter = new GirlsAdapter (getContext ());
6059
6160 mGirlsRecyclerView .setAdapterWithProgress (mAdapter );
62-
61+ mGirlsRecyclerView .setRefreshingColor (
62+ ContextCompat .getColor (getContext (), R .color .colorPrimary ),
63+ ContextCompat .getColor (getContext (), android .R .color .holo_blue_light ),
64+ ContextCompat .getColor (getContext (), android .R .color .holo_green_light )
65+ );
6366 mAdapter .setMore (R .layout .layout_load_more , this );
6467 mAdapter .setNoMore (R .layout .layout_load_no_more );
6568 mAdapter .setError (R .layout .layout_load_error );
@@ -72,6 +75,7 @@ public void onItemClick(int position, BaseViewHolder holder) {
7275
7376 mGirlsRecyclerView .setRefreshListener (this );
7477
78+ mData = new ArrayList <>();
7579 mActive = true ;
7680 }
7781
0 commit comments