// Path: src/com/gotech/tv/launcher/util/Constant.java
// public class Constant {
// 
//     public static final int VIEW_PAGER_DURATION = 500;
//     public static final int MENU_HOME = 0;
//     public static final int MENU_APP = 1;
//     public static final int MENU_SETTING = 2;
//     public static final int TRAN_DUR_ANIM = 500;
//     public static final float APP_PAGE_SIZE = 12.0f;
//     public static final int APP_PAGE_COLUMNS = 4;
//     public static final int MOVE = 1;
//     public static final int PAGE_ITEM_NUM = 6;
//     public static final int DIALOG_AUTO_DISMISS = 0;
//     public static final int TIME_OUT = 5000;
// 
//     /**
//      * 加（解）密钥匙
//      */
//     public static final String DesEncryptKey = "TvLauncher";
// 
//     /**
//      * 存取用户IP和软件类型
//      **/
//     public static final String UserServerConfigTxt = "serverconfig.txt";
// 
//     /**
//      * 存用户名和密码文件
//      **/
//     public static final String UserDataTxt = "userpwd.txt";
// 
//     /**
//      * 软件类型
//      */
//     public static String SOFTWARE_TYPE = "TvLauncher";
// 
//     /**
//      * 默认分组号
//      * 默认：创维 999
//      */
//     public static String MAC_REGISTER_DEFAULT_CODE = "009";
// 
//     /**
//      * JSON数据格式错误
//      **/
//     public static int ParseData_FormatWrong = 2;
// 
//     /**
//      * 解析成功
//      **/
//     public static int ParseData_Success = 0;
// 
//     /**
//      * 用户访问超时 或 未登录
//      **/
//     public static int ParseData_TimeOut = 1;
// 
// }
// 
// Path: src/com/gotech/tv/launcher/util/DensityUtil.java
// public class DensityUtil {
// 
//     public static int dip2px(Context context, float dpValue) {
//         final float scale = context.getResources().getDisplayMetrics().density;
//         return (int) (dpValue * scale + 0.5f);
//     }
// 
//     public static int px2dip(Context context, float pxValue) {
//         final float scale = context.getResources().getDisplayMetrics().density;
//         return (int) (pxValue / scale + 0.5f);
//     }
// 
// }


import com.gotech.tv.launcher.util.Constant;
import com.gotech.tv.launcher.util.DensityUtil;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
    public void setSelectView(View view) {
        if (mSelectView != view) {
            mSelectView = view;

            runTranslateAnimation(mSelectView);
        }
    }

    private void runTranslateAnimation(View toView) {
        Rect fromRect = findLocationWithView(this);
        Rect toRect = findLocationWithView(toView);
        int x = toRect.left - fromRect.left;
        int y = toRect.top - fromRect.top;

        int deltaX = (toView.getWidth() - this.getWidth()) / 2;
        int deltaY = (toView.getHeight() - this.getHeight()) / 2;
        // tv
        if (isTvScreen) {
            x = DensityUtil.dip2px(this.getContext(), x + deltaX);
            y = DensityUtil.dip2px(this.getContext(), y + deltaY);
        } else {
            x = x + deltaX;
            y = y + deltaY;
        }
        flyWhiteBorder(x, y);

    }

    private void flyWhiteBorder(float x, float y) {

// Path: src/com/gotech/tv/launcher/util/Constant.java
// public class Constant {
// 
//     public static final int VIEW_PAGER_DURATION = 500;
//     public static final int MENU_HOME = 0;
//     public static final int MENU_APP = 1;
//     public static final int MENU_SETTING = 2;
//     public static final int TRAN_DUR_ANIM = 500;
//     public static final float APP_PAGE_SIZE = 12.0f;
//     public static final int APP_PAGE_COLUMNS = 4;
//     public static final int MOVE = 1;
//     public static final int PAGE_ITEM_NUM = 6;
//     public static final int DIALOG_AUTO_DISMISS = 0;
//     public static final int TIME_OUT = 5000;
// 
//     /**
//      * 加（解）密钥匙
//      */
//     public static final String DesEncryptKey = "TvLauncher";
// 
//     /**
//      * 存取用户IP和软件类型
//      **/
//     public static final String UserServerConfigTxt = "serverconfig.txt";
// 
//     /**
//      * 存用户名和密码文件
//      **/
//     public static final String UserDataTxt = "userpwd.txt";
// 
//     /**
//      * 软件类型
//      */
//     public static String SOFTWARE_TYPE = "TvLauncher";
// 
//     /**
//      * 默认分组号
//      * 默认：创维 999
//      */
//     public static String MAC_REGISTER_DEFAULT_CODE = "009";
// 
//     /**
//      * JSON数据格式错误
//      **/
//     public static int ParseData_FormatWrong = 2;
// 
//     /**
//      * 解析成功
//      **/
//     public static int ParseData_Success = 0;
// 
//     /**
//      * 用户访问超时 或 未登录
//      **/
//     public static int ParseData_TimeOut = 1;
// 
// }
// 
// Path: src/com/gotech/tv/launcher/util/DensityUtil.java
// public class DensityUtil {
// 
//     public static int dip2px(Context context, float dpValue) {
//         final float scale = context.getResources().getDisplayMetrics().density;
//         return (int) (dpValue * scale + 0.5f);
//     }
// 
//     public static int px2dip(Context context, float pxValue) {
//         final float scale = context.getResources().getDisplayMetrics().density;
//         return (int) (pxValue / scale + 0.5f);
//     }
// 
// }


// Path: src/com/gotech/tv/launcher/view/FlyBorderView.java
import com.gotech.tv.launcher.util.Constant;
import com.gotech.tv.launcher.util.DensityUtil;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;

    public void setSelectView(View view) {
        if (mSelectView != view) {
            mSelectView = view;

            runTranslateAnimation(mSelectView);
        }
    }

    private void runTranslateAnimation(View toView) {
        Rect fromRect = findLocationWithView(this);
        Rect toRect = findLocationWithView(toView);
        int x = toRect.left - fromRect.left;
        int y = toRect.top - fromRect.top;

        int deltaX = (toView.getWidth() - this.getWidth()) / 2;
        int deltaY = (toView.getHeight() - this.getHeight()) / 2;
        // tv
        if (isTvScreen) {
            x = DensityUtil.dip2px(this.getContext(), x + deltaX);
            y = DensityUtil.dip2px(this.getContext(), y + deltaY);
        } else {
            x = x + deltaX;
            y = y + deltaY;
        }
        flyWhiteBorder(x, y);

    }

    private void flyWhiteBorder(float x, float y) {

        animate().translationX(x).translationY(y).setDuration(Constant.TRAN_DUR_ANIM).setInterpolator(new DecelerateInterpolator()).start();