use of me.dkzwm.widget.srl.SmoothRefreshLayout in project SmoothRefreshLayout by dkzwm.
the class TestHorizontalScaleEffectActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_horizontal_scale_effect);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle(R.string.test_horizontal_scale_effect);
SmoothRefreshLayout refreshLayout = findViewById(R.id.smoothRefreshLayout_test_horizontal_scale_effect);
refreshLayout.setDisableLoadMore(false);
refreshLayout.setDurationToClose(800);
refreshLayout.setLayoutManager(new HScaleLayoutManager());
Interpolator interpolator = new Interpolator() {
@Override
public float getInterpolation(float input) {
return (float) (--input * input * ((1.7 + 1f) * input + 1.7) + 1f);
}
};
refreshLayout.setSpringBackInterpolator(interpolator);
}
use of me.dkzwm.widget.srl.SmoothRefreshLayout in project SmoothRefreshLayout by dkzwm.
the class TestScaleEffectActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_scale_effect);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle(R.string.test_scale_effect);
ListView listView = findViewById(R.id.listView_test_scale_effect);
ListViewAdapter adapter = new ListViewAdapter(this, getLayoutInflater());
List<String> list = DataUtil.createList(0, 40);
adapter.updateData(list);
listView.setAdapter(adapter);
SmoothRefreshLayout refreshLayout = findViewById(R.id.smoothRefreshLayout_test_scale_effect);
refreshLayout.setDisableLoadMore(false);
refreshLayout.setLayoutManager(new VScaleLayoutManager());
refreshLayout.setDurationToClose(550);
Interpolator interpolator = new Interpolator() {
@Override
public float getInterpolation(float input) {
return (float) (--input * input * ((1.7 + 1f) * input + 1.7) + 1f);
}
};
refreshLayout.setSpringBackInterpolator(interpolator);
}
use of me.dkzwm.widget.srl.SmoothRefreshLayout 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.SmoothRefreshLayout in project SmoothRefreshLayout by dkzwm.
the class TestInMotionLayoutSceneActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_inner_motionscene_start);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle(R.string.test_inner_motionlayout_scene);
RecyclerView recyclerView = findViewById(R.id.recyclerView_test_motionLayout_scene);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
RecyclerViewAdapter adapter = new RecyclerViewAdapter(this, getLayoutInflater());
recyclerView.setAdapter(adapter);
adapter.updateData(DataUtil.createList(0, 100));
mMotionLayout = findViewById(R.id.motionLayout_test_motionLayout_scene);
mRefreshLayout = findViewById(R.id.smoothRefreshLayout_test_motionLayout_scene);
mRefreshLayout.setOnHeaderEdgeDetectCallBack(new SmoothRefreshLayout.OnHeaderEdgeDetectCallBack() {
@Override
public boolean isNotYetInEdgeCannotMoveHeader(SmoothRefreshLayout parent, @Nullable View child, @Nullable IRefreshView header) {
return mMotionLayout.getProgress() != 0f || (child != null && child.canScrollVertically(-1));
}
});
mRefreshLayout.setOnRefreshListener(new RefreshingListenerAdapter() {
@Override
public void onRefreshing() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mRefreshLayout.refreshComplete();
}
}, 1000);
}
});
}
use of me.dkzwm.widget.srl.SmoothRefreshLayout in project SmoothRefreshLayout by dkzwm.
the class TestMotionLayoutSceneActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_motionscene_start);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle(R.string.test_motionlayout_scene);
RecyclerView recyclerView = findViewById(R.id.recyclerView_test_motionLayout_scene);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
RecyclerViewAdapter adapter = new RecyclerViewAdapter(this, getLayoutInflater());
recyclerView.setAdapter(adapter);
adapter.updateData(DataUtil.createList(0, 100));
mMotionLayout = findViewById(R.id.motionLayout_test_motionLayout_scene);
mRefreshLayout = findViewById(R.id.smoothRefreshLayout_test_motionLayout_scene);
mRefreshLayout.setOnHeaderEdgeDetectCallBack(new SmoothRefreshLayout.OnHeaderEdgeDetectCallBack() {
@Override
public boolean isNotYetInEdgeCannotMoveHeader(SmoothRefreshLayout parent, @Nullable View child, @Nullable IRefreshView header) {
return mMotionLayout.getProgress() != 0f || (child != null && child.canScrollVertically(-1));
}
});
mRefreshLayout.setOnRefreshListener(new RefreshingListenerAdapter() {
@Override
public void onRefreshing() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mRefreshLayout.refreshComplete();
}
}, 1000);
}
});
}
Aggregations