Exemple #1
0
 @Override
 public void onRestoreInstanceState(Parcelable state) {
   GifViewSavedState ss = (GifViewSavedState) state;
   super.onRestoreInstanceState(ss.getSuperState());
   ss.restoreState(getDrawable(), 0);
   ss.restoreState(getBackground(), 1);
 }
Exemple #2
0
  @Override
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
  public void onRestoreInstanceState(Parcelable state) {
    GifViewSavedState ss = (GifViewSavedState) state;
    super.onRestoreInstanceState(ss.getSuperState());

    Drawable[] compoundDrawables = getCompoundDrawables();
    ss.restoreState(compoundDrawables[0], 0);
    ss.restoreState(compoundDrawables[1], 1);
    ss.restoreState(compoundDrawables[2], 2);
    ss.restoreState(compoundDrawables[3], 3);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
      Drawable[] compoundDrawablesRelative = getCompoundDrawablesRelative();
      ss.restoreState(compoundDrawablesRelative[0], 4);
      ss.restoreState(compoundDrawablesRelative[2], 5);
    }
    ss.restoreState(getBackground(), 6);
  }