use of info.hxq.materialcalendar.fragment.CalendarFragment in project MaterialCalendar by Haoxiqiang.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.inject(this);
TabooProxy.init();
getSupportFragmentManager().beginTransaction().add(R.id.container, new CalendarFragment()).commit();
SpringSystem mSpringSystem = SpringSystem.create();
final Spring spring = mSpringSystem.createSpring();
spring.addListener(new SimpleSpringListener() {
@Override
public void onSpringUpdate(Spring spring) {
float mappedValue = (float) SpringUtil.mapValueFromRangeToRange(spring.getCurrentValue(), 0, 1, 1, 0.6);
ViewCompat.setScaleX(view, mappedValue);
ViewCompat.setScaleY(view, mappedValue);
}
});
view.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
// When pressed start solving the spring to 1.
spring.setEndValue(1);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
// When released start solving the spring to 0.
spring.setEndValue(0);
break;
}
return false;
}
});
}
Aggregations