Example usage for android.util FloatProperty FloatProperty

List of usage examples for android.util FloatProperty FloatProperty

Introduction

In this page you can find the example usage for android.util FloatProperty FloatProperty.

Prototype

public FloatProperty(String name) 

Source Link

Usage

From source file:com.bachhuberdesign.deckbuildergwent.util.AnimUtils.java

/**
 * The animation framework has an optimization for <code>Properties</code> of type
 * <code>float</code> but it was only made public in API24, so wrap the impl in our own type
 * and conditionally create the appropriate type, delegating the implementation.
 *//*www.j  a v  a2s .c o m*/
public static <T> Property<T, Float> createFloatProperty(final FloatProp<T> impl) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        return new FloatProperty<T>(impl.name) {
            @Override
            public Float get(T object) {
                return impl.get(object);
            }

            @Override
            public void setValue(T object, float value) {
                impl.set(object, value);
            }
        };
    } else {
        return new Property<T, Float>(Float.class, impl.name) {
            @Override
            public Float get(T object) {
                return impl.get(object);
            }

            @Override
            public void set(T object, Float value) {
                impl.set(object, value);
            }
        };
    }
}