Java Code Examples for android.util.Property#of()

The following examples show how to use android.util.Property#of() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewRouter.java    From android-router with MIT License 5 votes vote down vote up
private <T extends View> T createView(Class<T> cls, Map<String, String> props) {
	try {
		T v = cls.getConstructor(Context.class).newInstance(mParent.getContext());
		// copy parsed uri params into the view properties 
		for (Map.Entry<String, String> p : props.entrySet()) {
			Property<T, String> property = Property.of(cls, String.class, p.getKey());
			property.set(v, p.getValue());
		}
		return v;
	} catch (NoSuchMethodException|InstantiationException|
			IllegalAccessException|InvocationTargetException e) {
		throw new RuntimeException(e);
	}
}
 
Example 2
Source File: MarkerAnimation.java    From osmdroid with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public static ObjectAnimator animateMarkerToICS(final MapView map, Marker marker, GeoPoint finalPosition, final GeoPointInterpolator GeoPointInterpolator) {
    TypeEvaluator<GeoPoint> typeEvaluator = new TypeEvaluator<GeoPoint>() {
        @Override
        public GeoPoint evaluate(float fraction, GeoPoint startValue, GeoPoint endValue) {
            return GeoPointInterpolator.interpolate(fraction, startValue, endValue);
        }
    };
    Property<Marker, GeoPoint> property = Property.of(Marker.class, GeoPoint.class, "position");
    ObjectAnimator animator = ObjectAnimator.ofObject(marker, property, typeEvaluator, finalPosition);
    animator.setDuration(3000);
    animator.start();
    return animator;
}