package com.kickstarter.libs.utils;

import android.support.annotation.NonNull;
import android.support.v7.widget.SwitchCompat;
import android.view.View;

public final class SwitchCompatUtils {

  /**
   * Hide toggle animation when switch state is programmatically set to an initial emitted value.
   * http://stackoverflow.com/questions/27139262/change-switch-state-without-animation
   */
  public static void setCheckedWithoutAnimation(final @NonNull SwitchCompat switchCompat, final boolean checked) {
    switchCompat.setVisibility(View.INVISIBLE);
    switchCompat.setChecked(checked);
    switchCompat.setVisibility(View.VISIBLE);
  }
}

@@ -202,20 +202,19 @@
   * 
-Hide
+Set
  toggle 
 anim
@@ -213,166 +213,26 @@
 gle 
-animation when switch state is programmatically set to an initial emitted value.%0A   * http://stackoverflow.com/questions/27139262/change-switch-state-without-
+state without any 
 anim
@@ -236,16 +236,18 @@
 nimation
+s.
 %0A   */%0A 
@@ -364,56 +364,8 @@
 ) %7B%0A
-    switchCompat.setVisibility(View.INVISIBLE);%0A
     
@@ -419,34 +419,23 @@
 pat.
-setVisibility(View.VISIBLE
+clearAnimation(
 );%0A 

Set checked then clear animation, rather than toggling visibility