Search in sources :

Example 1 with TwinklingRefreshLayout

use of com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout in project TwinklingRefreshLayout by lcodecorex.

the class ScienceActivity method setupGridView.

private void setupGridView(GridView gridView) {
    final TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
    SinaRefreshView headerView = new SinaRefreshView(this);
    headerView.setArrowResource(R.drawable.arrow);
    headerView.setTextColor(0xff745D5C);
    //        TextHeaderView headerView = (TextHeaderView) View.inflate(this,R.layout.header_tv,null);
    refreshLayout.setHeaderView(headerView);
    LoadingView loadingView = new LoadingView(this);
    refreshLayout.setBottomView(loadingView);
    adapter = new ScienceAdapter();
    gridView.setAdapter(adapter);
    adapter.refreshCard();
    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            ToastUtil.show("item clicked!");
        }
    });
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

        @Override
        public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    adapter.refreshCard();
                    refreshLayout.finishRefreshing();
                }
            }, 2000);
        }

        @Override
        public void onLoadMore(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    adapter.loadMoreCard();
                    refreshLayout.finishLoadmore();
                }
            }, 2000);
        }
    });
}
Also used : SinaRefreshView(com.lcodecore.tkrefreshlayout.header.SinaRefreshView) ScienceAdapter(com.lcodecore.twinklingrefreshlayout.adapter.ScienceAdapter) Handler(android.os.Handler) GridView(android.widget.GridView) View(android.view.View) AdapterView(android.widget.AdapterView) SinaRefreshView(com.lcodecore.tkrefreshlayout.header.SinaRefreshView) LoadingView(com.lcodecore.tkrefreshlayout.footer.LoadingView) TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) RefreshListenerAdapter(com.lcodecore.tkrefreshlayout.RefreshListenerAdapter) LoadingView(com.lcodecore.tkrefreshlayout.footer.LoadingView) AdapterView(android.widget.AdapterView)

Example 2 with TwinklingRefreshLayout

use of com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout in project TwinklingRefreshLayout by lcodecorex.

the class StoryActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_story);
    TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
    //        ProgressLayout header = new ProgressLayout(this);
    //        refreshLayout.setHeaderView(header);
    //        refreshLayout.setFloatRefresh(true);
    refreshLayout.setOverScrollRefreshShow(false);
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

        @Override
        public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    refreshLayout.finishRefreshing();
                }
            }, 4000);
        }

        @Override
        public void onLoadMore(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    refreshLayout.finishLoadmore();
                }
            }, 4000);
        }
    });
}
Also used : TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) RefreshListenerAdapter(com.lcodecore.tkrefreshlayout.RefreshListenerAdapter) Handler(android.os.Handler)

Example 3 with TwinklingRefreshLayout

use of com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout in project TwinklingRefreshLayout by lcodecorex.

the class WebActivity method onCreate.

@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web);
    TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refreshLayout);
    ProgressLayout header = new ProgressLayout(this);
    refreshLayout.setHeaderView(header);
    refreshLayout.setFloatRefresh(true);
    refreshLayout.setOverScrollRefreshShow(false);
    refreshLayout.setHeaderHeight(140);
    refreshLayout.setMaxHeadHeight(240);
    refreshLayout.setOverScrollHeight(200);
    refreshLayout.setEnableLoadmore(false);
    header.setColorSchemeResources(R.color.Blue, R.color.Orange, R.color.Yellow, R.color.Green);
    //        header.setColorSchemeColors(0xff4674e7,0xff0ba62c);
    mWebView = (WebView) findViewById(R.id.webView);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl("https://dribbble.com/shots");
    refreshLayout.startRefresh();
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

        @Override
        public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    refreshLayout.finishRefreshing();
                }
            }, 4000);
        }
    });
}
Also used : TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) RefreshListenerAdapter(com.lcodecore.tkrefreshlayout.RefreshListenerAdapter) Handler(android.os.Handler) ProgressLayout(com.lcodecore.tkrefreshlayout.header.progresslayout.ProgressLayout) SuppressLint(android.annotation.SuppressLint)

Example 4 with TwinklingRefreshLayout

use of com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout in project TwinklingRefreshLayout by lcodecorex.

the class FoodActivity method setupRecyclerView.

private void setupRecyclerView(RecyclerView rv) {
    rv.setLayoutManager(new LinearLayoutManager(rv.getContext()));
    foodAdapter = new FoodAdapter();
    rv.setAdapter(foodAdapter);
    final TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
    //        ProgressLayout headerView = new ProgressLayout(getContext());
    BezierLayout headerView = new BezierLayout(this);
    refreshLayout.setHeaderView(headerView);
    //        refreshLayout.setFloatRefresh(false);
    refreshLayout.setPureScrollModeOn(true);
    //        refreshLayout.setEnableOverlayRefreshView(false);
    //        refreshLayout.setAutoLoadMore(true);
    refreshCard();
}
Also used : TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) FoodAdapter(com.lcodecore.twinklingrefreshlayout.adapter.FoodAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BezierLayout(com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout)

Example 5 with TwinklingRefreshLayout

use of com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout in project TwinklingRefreshLayout by lcodecorex.

the class MusicActivity method setupListView.

private void setupListView(ListView listView) {
    TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) findViewById(R.id.refresh);
    ProgressLayout headerView = new ProgressLayout(this);
    refreshLayout.setHeaderView(headerView);
    View exHeader = View.inflate(this, R.layout.header_music, null);
    refreshLayout.addFixedExHeader(exHeader);
    refreshLayout.setOverScrollRefreshShow(false);
    //        refreshLayout.setFloatRefresh(true);
    adapter = new MusicAdapter();
    listView.setAdapter(adapter);
    adapter.refreshCard();
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            ToastUtil.show("item clicked!");
        }
    });
    refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {

        @Override
        public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    adapter.refreshCard();
                    refreshLayout.finishRefreshing();
                }
            }, 2000);
        }

        @Override
        public void onLoadMore(final TwinklingRefreshLayout refreshLayout) {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    adapter.loadMoreCard();
                    refreshLayout.finishLoadmore();
                }
            }, 2000);
        }
    });
}
Also used : Handler(android.os.Handler) ProgressLayout(com.lcodecore.tkrefreshlayout.header.progresslayout.ProgressLayout) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) TwinklingRefreshLayout(com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout) RefreshListenerAdapter(com.lcodecore.tkrefreshlayout.RefreshListenerAdapter) MusicAdapter(com.lcodecore.twinklingrefreshlayout.adapter.MusicAdapter) AdapterView(android.widget.AdapterView)

Aggregations

TwinklingRefreshLayout (com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout)8 Handler (android.os.Handler)7 RefreshListenerAdapter (com.lcodecore.tkrefreshlayout.RefreshListenerAdapter)7 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)3 View (android.view.View)3 BezierLayout (com.lcodecore.tkrefreshlayout.header.bezierlayout.BezierLayout)3 ProgressLayout (com.lcodecore.tkrefreshlayout.header.progresslayout.ProgressLayout)3 PhotoAdapter (com.lcodecore.twinklingrefreshlayout.adapter.PhotoAdapter)3 AdapterView (android.widget.AdapterView)2 SuppressLint (android.annotation.SuppressLint)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 GridView (android.widget.GridView)1 ListView (android.widget.ListView)1 LoadingView (com.lcodecore.tkrefreshlayout.footer.LoadingView)1 SinaRefreshView (com.lcodecore.tkrefreshlayout.header.SinaRefreshView)1 FoodAdapter (com.lcodecore.twinklingrefreshlayout.adapter.FoodAdapter)1 MusicAdapter (com.lcodecore.twinklingrefreshlayout.adapter.MusicAdapter)1 ScienceAdapter (com.lcodecore.twinklingrefreshlayout.adapter.ScienceAdapter)1