// Path: app/src/main/java/com/demo/amazing/util/LogUtil.java
// public class LogUtil {
// 
//     public static void e(String msg) {
//         Log.e("free", msg);
//     }
// 
//     public static void d(String tag, String msg) {
//         Log.e("free", msg);
//     }
// }


import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.Scroller;
import com.demo.amazing.R;
import com.demo.amazing.util.LogUtil;
                switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                        downX = event.getRawX();
                        downY = event.getRawY();
                        break;
                    case MotionEvent.ACTION_MOVE:
                        curX = event.getRawX();
                        curY = event.getRawY();
                        onLayout();
                        downX = curX;
                        downY = curY;
                        break;
                    case MotionEvent.ACTION_UP:
                        onUp();
                        break;
                }
                return true;
            }
        });
        layout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                viewWidth = layout.getWidth();
                viewHeight = layout.getHeight();
            }
        });
    }

    private void onUp() {
        final int offsetX;
// Path: app/src/main/java/com/demo/amazing/util/LogUtil.java
// public class LogUtil {
// 
//     public static void e(String msg) {
//         Log.e("free", msg);
//     }
// 
//     public static void d(String tag, String msg) {
//         Log.e("free", msg);
//     }
// }


// Path: app/src/main/java/com/demo/amazing/activity/MoveActivity.java
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.Scroller;
import com.demo.amazing.R;
import com.demo.amazing.util.LogUtil;

                switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                        downX = event.getRawX();
                        downY = event.getRawY();
                        break;
                    case MotionEvent.ACTION_MOVE:
                        curX = event.getRawX();
                        curY = event.getRawY();
                        onLayout();
                        downX = curX;
                        downY = curY;
                        break;
                    case MotionEvent.ACTION_UP:
                        onUp();
                        break;
                }
                return true;
            }
        });
        layout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                viewWidth = layout.getWidth();
                viewHeight = layout.getHeight();
            }
        });
    }

    private void onUp() {
        final int offsetX;
        LogUtil.e("layout left=" + layout.getLeft() + " x=" + layout.getX());