use of me.dkzwm.widget.srl.extra.footer.ClassicFooter in project SmoothRefreshLayout by dkzwm.
the class TestQQActivityStyleActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_qq_activity_style);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle(R.string.test_qq_activity_style);
mRecyclerView = findViewById(R.id.recyclerView_test_qq_activity_style);
mRadioGroup = findViewById(R.id.radioGroup_test_qq_activity_style_container);
mRadioButtonNormal = findViewById(R.id.radioButton_test_qq_activity_style_normal);
mRadioButtonActivity = findViewById(R.id.radioButton_test_qq_activity_style_activity);
mRadioGroup.setOnCheckedChangeListener(this);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setHasFixedSize(true);
mAdapter = new RecyclerViewAdapter(this, getLayoutInflater());
mRecyclerView.setAdapter(mAdapter);
mRefreshLayout = findViewById(R.id.smoothRefreshLayout_test_qq_activity_style);
mClassicHeader = new ClassicHeader(this);
mClassicHeader.setLastUpdateTimeKey("header_last_update_time");
mClassicFooter = new ClassicFooter(this);
mClassicFooter.setLastUpdateTimeKey("footer_last_update_time");
mRefreshLayout.setHeaderView(mClassicHeader);
mRefreshLayout.setFooterView(mClassicFooter);
mRefreshLayout.setEnableKeepRefreshView(true);
mRefreshLayout.setDisableLoadMore(false);
mRefreshLayout.setOnRefreshListener(new RefreshingListenerAdapter() {
@Override
public void onRefreshing() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
List<String> list = DataUtil.createList(mCount, 20);
mCount = list.size();
mAdapter.updateData(list);
mRefreshLayout.refreshComplete();
}
}, 2000);
}
@Override
public void onLoadingMore() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
List<String> list = DataUtil.createList(mCount, 20);
mCount += list.size();
mAdapter.appendData(list);
mRefreshLayout.refreshComplete();
}
}, 2000);
}
});
mRefreshLayout.addOnUIPositionChangedListener(new SmoothRefreshLayout.OnUIPositionChangedListener() {
@Override
public void onChanged(byte status, IIndicator indicator) {
if (mRefreshLayout.getIndicator().isAlreadyHere(IIndicator.START_POS)) {
mRadioGroup.setEnabled(true);
mRadioButtonNormal.setEnabled(true);
mRadioButtonActivity.setEnabled(true);
} else {
mRadioGroup.setEnabled(false);
mRadioButtonNormal.setEnabled(false);
mRadioButtonActivity.setEnabled(false);
}
}
});
mRefreshLayout.autoRefresh(false);
}
use of me.dkzwm.widget.srl.extra.footer.ClassicFooter in project SmoothRefreshLayout by dkzwm.
the class DemoApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
SmoothRefreshLayout.setDefaultCreator(new IRefreshViewCreator() {
@Override
public IRefreshView<IIndicator> createHeader(SmoothRefreshLayout layout) {
ClassicHeader<IIndicator> header = new ClassicHeader<>(layout.getContext());
header.setLastUpdateTimeKey("header_last_update_time");
return header;
}
@Override
public IRefreshView<IIndicator> createFooter(SmoothRefreshLayout layout) {
ClassicFooter<IIndicator> footer = new ClassicFooter<>(layout.getContext());
footer.setLastUpdateTimeKey("footer_last_update_time");
return footer;
}
});
}
use of me.dkzwm.widget.srl.extra.footer.ClassicFooter in project SmoothRefreshLayout by dkzwm.
the class ClassicSmoothRefreshLayout method init.
@Override
protected void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super.init(context, attrs, defStyleAttr, defStyleRes);
mClassicHeader = new ClassicHeader(context);
setHeaderView(mClassicHeader);
mClassicFooter = new ClassicFooter(context);
setFooterView(mClassicFooter);
}
Aggregations