Search in sources :

Example 1 with MaterialRefreshLayout

use of com.cjj.MaterialRefreshLayout in project Android-MaterialRefreshLayout by android-cjj.

the class ScrollViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scrollview);
    materialRefreshLayout = (MaterialRefreshLayout) findViewById(R.id.refresh);
    materialRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {

        @Override
        public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
            materialRefreshLayout.postDelayed(new Runnable() {

                @Override
                public void run() {
                    materialRefreshLayout.finishRefresh();
                }
            }, 3000);
            materialRefreshLayout.finishRefreshLoadMore();
        }

        @Override
        public void onfinish() {
            Toast.makeText(ScrollViewActivity.this, "finish", Toast.LENGTH_LONG).show();
        }
    });
}
Also used : MaterialRefreshListener(com.cjj.MaterialRefreshListener) MaterialRefreshLayout(com.cjj.MaterialRefreshLayout)

Example 2 with MaterialRefreshLayout

use of com.cjj.MaterialRefreshLayout in project Android-MaterialRefreshLayout by android-cjj.

the class SimpleActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_simple);
    initsToolbar();
    materialRefreshLayout = (MaterialRefreshLayout) findViewById(R.id.refresh);
    materialRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {

        @Override
        public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
            materialRefreshLayout.postDelayed(new Runnable() {

                @Override
                public void run() {
                    materialRefreshLayout.finishRefresh();
                }
            }, 3000);
            materialRefreshLayout.finishRefreshLoadMore();
        }

        @Override
        public void onfinish() {
            Toast.makeText(SimpleActivity.this, "finish", Toast.LENGTH_LONG).show();
        }
    });
    RecyclerView rv = (RecyclerView) findViewById(R.id.recyclerview);
    setupRecyclerView(rv);
}
Also used : MaterialRefreshListener(com.cjj.MaterialRefreshListener) MaterialRefreshLayout(com.cjj.MaterialRefreshLayout) RecyclerView(android.support.v7.widget.RecyclerView)

Example 3 with MaterialRefreshLayout

use of com.cjj.MaterialRefreshLayout in project Android-MaterialRefreshLayout by android-cjj.

the class SunActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listview);
    String[] array = new String[50];
    for (int i = 0; i < array.length; i++) {
        array[i] = "啊哈哈哈哈哈 " + i;
    }
    final ListView listView = (ListView) findViewById(R.id.lv);
    listView.setAdapter(new android.widget.ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, array));
    materialRefreshLayout = (MaterialRefreshLayout) findViewById(R.id.refresh);
    materialRefreshLayout.setSunStyle(true);
    materialRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {

        @Override
        public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
            materialRefreshLayout.postDelayed(new Runnable() {

                @Override
                public void run() {
                    materialRefreshLayout.finishRefresh();
                }
            }, 3000);
        }

        @Override
        public void onfinish() {
            Toast.makeText(SunActivity.this, "finish", Toast.LENGTH_LONG).show();
        }
    });
}
Also used : ListView(android.widget.ListView) MaterialRefreshListener(com.cjj.MaterialRefreshListener) MaterialRefreshLayout(com.cjj.MaterialRefreshLayout)

Example 4 with MaterialRefreshLayout

use of com.cjj.MaterialRefreshLayout in project Android-MaterialRefreshLayout by android-cjj.

the class WaveActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_simple);
    initsToolbar();
    materialRefreshLayout = (MaterialRefreshLayout) findViewById(R.id.refresh);
    materialRefreshLayout.setWaveShow(true);
    materialRefreshLayout.setWaveColor(Color.parseColor("#60ff2020"));
    materialRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {

        @Override
        public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
            materialRefreshLayout.postDelayed(new Runnable() {

                @Override
                public void run() {
                    materialRefreshLayout.finishRefresh();
                }
            }, 3000);
            materialRefreshLayout.finishRefreshLoadMore();
        }

        @Override
        public void onfinish() {
            Toast.makeText(WaveActivity.this, "finish", Toast.LENGTH_LONG).show();
        }
    });
    RecyclerView rv = (RecyclerView) findViewById(R.id.recyclerview);
    setupRecyclerView(rv);
}
Also used : MaterialRefreshListener(com.cjj.MaterialRefreshListener) MaterialRefreshLayout(com.cjj.MaterialRefreshLayout) RecyclerView(android.support.v7.widget.RecyclerView)

Example 5 with MaterialRefreshLayout

use of com.cjj.MaterialRefreshLayout in project Android-MaterialRefreshLayout by android-cjj.

the class OverLayActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listview);
    String[] array = new String[50];
    for (int i = 0; i < array.length; i++) {
        array[i] = "啊哈哈哈哈哈 " + i;
    }
    final ListView listView = (ListView) findViewById(R.id.lv);
    listView.setAdapter(new android.widget.ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, array));
    materialRefreshLayout = (MaterialRefreshLayout) findViewById(R.id.refresh);
    materialRefreshLayout.setSunStyle(true);
    materialRefreshLayout.setIsOverLay(true);
    materialRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {

        @Override
        public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
            materialRefreshLayout.postDelayed(new Runnable() {

                @Override
                public void run() {
                    materialRefreshLayout.finishRefresh();
                }
            }, 3000);
        }

        @Override
        public void onfinish() {
            Toast.makeText(OverLayActivity.this, "finish", Toast.LENGTH_LONG).show();
        }
    });
}
Also used : ListView(android.widget.ListView) MaterialRefreshListener(com.cjj.MaterialRefreshListener) MaterialRefreshLayout(com.cjj.MaterialRefreshLayout)

Aggregations

MaterialRefreshLayout (com.cjj.MaterialRefreshLayout)7 MaterialRefreshListener (com.cjj.MaterialRefreshListener)7 RecyclerView (android.support.v7.widget.RecyclerView)3 ListView (android.widget.ListView)3