use of me.dkzwm.widget.srl.sample.header.StoreHouseHeader in project SmoothRefreshLayout by dkzwm.
the class TestReleaseToRefreshActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_refresh);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle(R.string.release_to_refresh);
mTextView = findViewById(R.id.textView_test_refresh_desc);
mRefreshLayout = findViewById(R.id.smoothRefreshLayout_test_refresh);
mStoreHouseHeader = new StoreHouseHeader(this);
mStoreHouseHeader.initPathWithString("RELEASE TO REFRESH", PixelUtl.dp2px(this, 18), PixelUtl.dp2px(this, 24));
mStoreHouseHeader.setTextColor(Color.WHITE);
mStoreHouseHeader.setPadding(0, PixelUtl.dp2px(this, 20), 0, PixelUtl.dp2px(this, 20));
mRefreshLayout.setHeaderView(mStoreHouseHeader);
mRefreshLayout.setRatioToKeepHeader(1);
mRefreshLayout.setRatioOfHeaderToRefresh(1);
mRefreshLayout.setDisableLoadMore(true);
mRefreshLayout.setOnRefreshListener(new RefreshingListenerAdapter() {
@Override
public void onRefreshBegin(boolean isRefresh) {
mCount++;
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mRefreshLayout.refreshComplete();
String times = getString(R.string.number_of_refresh) + mCount;
mTextView.setText(times);
}
}, 2000);
}
});
mRefreshLayout.autoRefresh(false);
}
Aggregations