build.gradle:
allprojects {
repositories {
jcenter()
maven { url "https://github.com/Ifxcyr/ArcSlidingHelper/raw/master" }
}
}
app/build.gradle:
implementation 'com.wuyr:arcslidinghelper:1.0.1'
private ArcSlidingHelper mArcSlidingHelper;
private View mView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_main_view);
mView = findViewById(R.id.view);
mView.post(() -> {
//创建对象
mArcSlidingHelper = ArcSlidingHelper.create(mView,
angle -> mView.setRotation(mView.getRotation() + angle));
//开启惯性滚动
mArcSlidingHelper.enableInertialSliding(true);
});
getWindow().getDecorView().setOnTouchListener((v, event) -> {
//处理滑动事件
mArcSlidingHelper.handleMovement(event);
return true;
});
}
@Override
protected void onDestroy() {
super.onDestroy();
//释放资源
mArcSlidingHelper.release();
}