Beispiel #1
0
 @Override
 public void onRestoreInstanceState(Parcelable state) {
   if (!(state instanceof WheelSavedState)) {
     super.onRestoreInstanceState(state);
     return;
   }
   WheelSavedState ss = (WheelSavedState) state;
   super.onRestoreInstanceState(ss.getSuperState());
   this.mProgress = ss.mProgress;
   this.mTargetProgress = ss.mTargetProgress;
   this.isSpinning = ss.isSpinning;
   this.spinSpeed = ss.spinSpeed;
   this.barWidth = ss.barWidth;
   this.barColor = ss.barColor;
   this.rimWidth = ss.rimWidth;
   this.rimColor = ss.rimColor;
   this.circleRadius = ss.circleRadius;
   this.linearProgress = ss.linearProgress;
   this.fillRadius = ss.fillRadius;
   this.lastTimeAnimated = SystemClock.uptimeMillis();
 }
Beispiel #2
0
 // Great way to save a view's state
 // http://stackoverflow.com/a/7089687/1991053
 @Override
 public Parcelable onSaveInstanceState() {
   Parcelable superState = super.onSaveInstanceState();
   WheelSavedState ss = new WheelSavedState(superState);
   // We save everything that can be changed at runtime
   ss.mProgress = this.mProgress;
   ss.mTargetProgress = this.mTargetProgress;
   ss.isSpinning = this.isSpinning;
   ss.spinSpeed = this.spinSpeed;
   ss.barWidth = this.barWidth;
   ss.barColor = this.barColor;
   ss.rimWidth = this.rimWidth;
   ss.rimColor = this.rimColor;
   ss.circleRadius = this.circleRadius;
   ss.linearProgress = this.linearProgress;
   ss.fillRadius = this.fillRadius;
   return ss;
 }