@@ -0,0 +1,2149 @@
+package org.nativescript.widgets;%0A%0Aimport android.view.View;%0Aimport java.util.WeakHashMap;%0A%0A/**%0A * A class encapsulating the logic of setting an origin point.%0A * The origin acts as a pivot point but is relative to the View size,%0A * Where 0 is the left or top of the view, 0.5 is at the middle and 1 is right or bottom.%0A * Under the hood the pivot point is set but is updated when the View's layout is changed.%0A */%0Apublic class OriginPoint %7B%0A    private static WeakHashMap%3CView, PivotSetter%3E layoutListeners;%0A%0A    public static void setX(View view, float x) %7B%0A        getSetter(view).setOriginX(view, x);%0A    %7D%0A%0A    public static void setY(View view, float y) %7B%0A        getSetter(view).setOriginY(view, y);%0A    %7D%0A%0A    private static PivotSetter getSetter(View view) %7B%0A        PivotSetter setter = null;%0A%0A        if (layoutListeners == null) %7B%0A            layoutListeners = new WeakHashMap%3C%3E();%0A        %7D else %7B%0A            setter = layoutListeners.get(view);%0A        %7D%0A%0A        if (setter == null) %7B%0A            setter = new PivotSetter();%0A            view.addOnLayoutChangeListener(setter);%0A            layoutListeners.put(view, setter);%0A        %7D%0A%0A        return setter;%0A    %7D%0A%0A    private static class PivotSetter implements View.OnLayoutChangeListener %7B%0A        private float originX;%0A        private float originY;%0A%0A        public PivotSetter() %7B%0A            originX = 0.5f;%0A            originY = 0.5f;%0A        %7D%0A%0A        public void setOriginX(View view, float x) %7B%0A            originX = x;%0A            updateX(view, view.getWidth());%0A        %7D%0A%0A        public void setOriginY(View view, float y) %7B%0A            originY = y;%0A            updateY(view, view.getHeight());%0A        %7D%0A%0A        public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) %7B%0A            updateX(view, right - left);%0A            updateY(view, bottom - top);%0A        %7D%0A%0A        private void updateX(View view, int width) %7B%0A            view.setPivotX(originX * width);%0A        %7D%0A%0A        private void updateY(View view, int height) %7B%0A            view.setPivotY(originY * height);%0A        %7D%0A    %7D%0A%7D%0A

Add OriginPoint that will recalculate the pivot point on layout cange