// Path: AndroidClient/app/src/main/java/com/hufeiya/SignIn/helper/ViewUtils.java
// public class ViewUtils {
// 
//     /**
//      * Allows changes to the text size in transitions and animations.
//      * Using this with something else than {@link ChangeBounds}
//      * can result in a severe performance penalty due to layout passes.
//      */
//     public static final Property<TextView, Float> PROPERTY_TEXT_SIZE =
//             new FloatProperty<TextView>("textSize") {
//                 @Override
//                 public Float get(TextView view) {
//                     return view.getTextSize();
//                 }
// 
//                 @Override
//                 public void setValue(TextView view, float textSize) {
//                     view.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
//                 }
//             };
//     /**
//      * Allows making changes to the start padding of a view.
//      * Using this with something else than {@link ChangeBounds}
//      * can result in a severe performance penalty due to layout passes.
//      */
//     public static final Property<TextView, Integer> PROPERTY_TEXT_PADDING_START =
//             new IntProperty<TextView>("paddingStart") {
//                 @Override
//                 public Integer get(TextView view) {
//                     return ViewCompat.getPaddingStart(view);
//                 }
// 
//                 @Override
//                 public void setValue(TextView view, int paddingStart) {
//                     ViewCompat.setPaddingRelative(view, paddingStart, view.getPaddingTop(),
//                             ViewCompat.getPaddingEnd(view), view.getPaddingBottom());
//                 }
//             };
// 
//     private ViewUtils() {
//         //no instance
//     }
// 
//     public static void setPaddingStart(TextView target, int paddingStart) {
//         ViewCompat.setPaddingRelative(target, paddingStart, target.getPaddingTop(),
//                 ViewCompat.getPaddingEnd(target), target.getPaddingBottom());
//     }
// 
//     public static abstract class IntProperty<T> extends Property<T, Integer> {
// 
//         public IntProperty(String name) {
//             super(Integer.class, name);
//         }
// 
//         /**
//          * A type-specific override of the {@link #set(Object, Integer)} that is faster when
//          * dealing
//          * with fields of type <code>int</code>.
//          */
//         public abstract void setValue(T object, int value);
// 
//         @Override
//         final public void set(T object, Integer value) {
//             //noinspection UnnecessaryUnboxing
//             setValue(object, value.intValue());
//         }
//     }
// 
//     public static abstract class FloatProperty<T> extends Property<T, Float> {
// 
//         public FloatProperty(String name) {
//             super(Float.class, name);
//         }
// 
//         /**
//          * A type-specific override of the {@link #set(Object, Float)} that is faster when dealing
//          * with fields of type <code>int</code>.
//          */
//         public abstract void setValue(T object, float value);
// 
//         @Override
//         final public void set(T object, Float value) {
//             //noinspection UnnecessaryUnboxing
//             setValue(object, value.floatValue());
//         }
//     }
// 
// }


import android.annotation.TargetApi;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.v4.app.SharedElementCallback;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.widget.TextView;
import com.hufeiya.SignIn.helper.ViewUtils;
import java.util.List;
/*
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hufeiya.SignIn.widget;




/**
 * This callback allows a shared TextView to resize text and start padding during transition.
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class TextSharedElementCallback extends SharedElementCallback {

    private static final String TAG = "TextResize";
    private final int mInitialPaddingStart;
    private final float mInitialTextSize;
    private float mTargetViewTextSize;
    private int mTargetViewPaddingStart;

    public TextSharedElementCallback(float initialTextSize, int initialPaddingStart) {
        mInitialTextSize = initialTextSize;
        mInitialPaddingStart = initialPaddingStart;
    }

    @Override
    public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements,
                                     List<View> sharedElementSnapshots) {
        TextView targetView = getTextView(sharedElements);
        if (targetView == null) {
            Log.w(TAG, "onSharedElementStart: No shared TextView, skipping.");
            return;
        }
        mTargetViewTextSize = targetView.getTextSize();
        mTargetViewPaddingStart = targetView.getPaddingStart();
        // Setup the TextView's start values.
        targetView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mInitialTextSize);
// Path: AndroidClient/app/src/main/java/com/hufeiya/SignIn/helper/ViewUtils.java
// public class ViewUtils {
// 
//     /**
//      * Allows changes to the text size in transitions and animations.
//      * Using this with something else than {@link ChangeBounds}
//      * can result in a severe performance penalty due to layout passes.
//      */
//     public static final Property<TextView, Float> PROPERTY_TEXT_SIZE =
//             new FloatProperty<TextView>("textSize") {
//                 @Override
//                 public Float get(TextView view) {
//                     return view.getTextSize();
//                 }
// 
//                 @Override
//                 public void setValue(TextView view, float textSize) {
//                     view.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
//                 }
//             };
//     /**
//      * Allows making changes to the start padding of a view.
//      * Using this with something else than {@link ChangeBounds}
//      * can result in a severe performance penalty due to layout passes.
//      */
//     public static final Property<TextView, Integer> PROPERTY_TEXT_PADDING_START =
//             new IntProperty<TextView>("paddingStart") {
//                 @Override
//                 public Integer get(TextView view) {
//                     return ViewCompat.getPaddingStart(view);
//                 }
// 
//                 @Override
//                 public void setValue(TextView view, int paddingStart) {
//                     ViewCompat.setPaddingRelative(view, paddingStart, view.getPaddingTop(),
//                             ViewCompat.getPaddingEnd(view), view.getPaddingBottom());
//                 }
//             };
// 
//     private ViewUtils() {
//         //no instance
//     }
// 
//     public static void setPaddingStart(TextView target, int paddingStart) {
//         ViewCompat.setPaddingRelative(target, paddingStart, target.getPaddingTop(),
//                 ViewCompat.getPaddingEnd(target), target.getPaddingBottom());
//     }
// 
//     public static abstract class IntProperty<T> extends Property<T, Integer> {
// 
//         public IntProperty(String name) {
//             super(Integer.class, name);
//         }
// 
//         /**
//          * A type-specific override of the {@link #set(Object, Integer)} that is faster when
//          * dealing
//          * with fields of type <code>int</code>.
//          */
//         public abstract void setValue(T object, int value);
// 
//         @Override
//         final public void set(T object, Integer value) {
//             //noinspection UnnecessaryUnboxing
//             setValue(object, value.intValue());
//         }
//     }
// 
//     public static abstract class FloatProperty<T> extends Property<T, Float> {
// 
//         public FloatProperty(String name) {
//             super(Float.class, name);
//         }
// 
//         /**
//          * A type-specific override of the {@link #set(Object, Float)} that is faster when dealing
//          * with fields of type <code>int</code>.
//          */
//         public abstract void setValue(T object, float value);
// 
//         @Override
//         final public void set(T object, Float value) {
//             //noinspection UnnecessaryUnboxing
//             setValue(object, value.floatValue());
//         }
//     }
// 
// }


// Path: AndroidClient/app/src/main/java/com/hufeiya/SignIn/widget/TextSharedElementCallback.java
import android.annotation.TargetApi;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.v4.app.SharedElementCallback;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.widget.TextView;
import com.hufeiya.SignIn.helper.ViewUtils;
import java.util.List;

/*
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hufeiya.SignIn.widget;




/**
 * This callback allows a shared TextView to resize text and start padding during transition.
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public class TextSharedElementCallback extends SharedElementCallback {

    private static final String TAG = "TextResize";
    private final int mInitialPaddingStart;
    private final float mInitialTextSize;
    private float mTargetViewTextSize;
    private int mTargetViewPaddingStart;

    public TextSharedElementCallback(float initialTextSize, int initialPaddingStart) {
        mInitialTextSize = initialTextSize;
        mInitialPaddingStart = initialPaddingStart;
    }

    @Override
    public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements,
                                     List<View> sharedElementSnapshots) {
        TextView targetView = getTextView(sharedElements);
        if (targetView == null) {
            Log.w(TAG, "onSharedElementStart: No shared TextView, skipping.");
            return;
        }
        mTargetViewTextSize = targetView.getTextSize();
        mTargetViewPaddingStart = targetView.getPaddingStart();
        // Setup the TextView's start values.
        targetView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mInitialTextSize);
        ViewUtils.setPaddingStart(targetView, mInitialPaddingStart);