// Path: teslalib/src/main/java/com/eleks/tesla/teslalib/ApiPathConstants.java
// public interface ApiPathConstants {
//     /* Wear commands */
//     public static final String WEAR_GET_CAR_CONFIG = "/getCarConfig";
//     public static final String WEAR_GET_CHARGE_STATE = "/getChargeState";
//     public static final String WEAR_GET_CLIMATE_STATE = "/getClimateState";
//     public static final String WEAR_GET_DRIVE_STATE = "/getDriveState";
//     public static final String WEAR_GET_VEHICLE_STATE = "/getVehicleState";
//     public static final String WEAR_GET_LOCATION_MAP = "/getLocationMap";
//     public static final String WEAR_ACTION_HORN = "/actionHorn";
//     public static final String WEAR_ACTION_DOOR_LOCK = "/actionDoorLock";
//     public static final String WEAR_ACTION_DOOR_UNLOCK = "/actionDoorUnlock";
//     public static final String WEAR_ACTION_CHARGING_START = "/actionChargingStart";
//     public static final String WEAR_ACTION_CHARGING_STOP = "/actionChargingStop";
//     public static final String WEAR_ACTION_FLASHLIGHTS = "/actionFlashlights";
//     public static final String WEAR_ACTION_AUTO_CONDITIONING_START = "/actionAutoConditioningStart";
//     public static final String WEAR_ACTION_AUTO_CONDITIONING_STOP = "/actionAutoConditioningStop";
//     public static final String WEAR_SET_TEMPS = "/setTemps";
//     public static final String WEAR_SET_MAX_CHARGING = "/setMaxCharging";
//     public static final String WEAR_CLOSE_SUNROOF = "/closeSunRoof";
// 
//     /* Mobiles commands */
//     public static final String MOBILE_UPDATE_CAR_CONFIG = "/updateCarConfig";
//     public static final String MOBILE_UPDATE_CHARGE_STATE = "/updateChargeState";
//     public static final String MOBILE_UPDATE_CLIMATE_STATE= "/updateClimateState";
//     public static final String MOBILE_UPDATE_DRIVE_STATE= "/updateDriveState";
//     public static final String MOBILE_UPDATE_VEHICLE_STATE = "/updateVehicleState";
//     public static final String MOBILE_UPDATE_LOCATION_MAP = "/updateLocationMap";
//     public static final String MOBILE_SHOW_NOTIFICATION_BAD_WEATHER = "/notificationBadWeather";
//     public static final String MOBILE_SHOW_NOTIFICATION_UNEXPECTED_STOP_CHARGING = "/notificationUnexpectedStopCharge";
//     public static final String MOBILE_SHOW_NOTIFICATION_CAR_UNLOCKED = "/notificationCarUnlocked";
// }
// 
// Path: wear/src/main/java/com/eleks/tesla/events/LocationMapLoadedEvent.java
// public class LocationMapLoadedEvent {
//     private Bitmap mMapImage;
// 
//     public LocationMapLoadedEvent(Bitmap mapImage) {
//         this.mMapImage = mapImage;
//     }
// 
//     public Bitmap getMapImage() {
//         return mMapImage;
//     }
// }
// 
// Path: wear/src/main/java/com/eleks/tesla/events/ToHandHoldRequestEvent.java
// public class ToHandHoldRequestEvent {
//     private String mPath;
//     private Serializable mCommand;
// 
//     public ToHandHoldRequestEvent(String path) {
//         mPath = path;
//     }
// 
//     public ToHandHoldRequestEvent(String path, Serializable command) {
//         mPath = path;
//         mCommand = command;
//     }
// 
//     public String getPath() {
//         return mPath;
//     }
// 
//     public Serializable getCommand() {
//         return mCommand;
//     }
// }


import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.OvershootInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.eleks.tesla.teslalib.ApiPathConstants;
import com.eleks.tesla.R;
import com.eleks.tesla.events.LocationMapLoadedEvent;
import com.eleks.tesla.events.ToHandHoldRequestEvent;
import java.util.ArrayList;
import java.util.List;
import de.greenrobot.event.EventBus;
package com.eleks.tesla.mainApp;





/**
 * Created by maryan.melnychuk on 05.03.2015.
 */
public class LocationActivity extends Activity {
    public static final int ANIMATION_DURATION = 800;
    private ImageView mMapImageView;
    private ImageView mPinImageView;
    protected int mImageSideSize;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_location);

        mMapImageView = (ImageView) findViewById(R.id.map_image);
        mPinImageView = (ImageView) findViewById(R.id.pin_image);

        EventBus.getDefault().post(new ToHandHoldRequestEvent(ApiPathConstants.WEAR_GET_LOCATION_MAP));
        EventBus.getDefault().registerSticky(this);

        final ViewGroup root = (ViewGroup) findViewById(R.id.root);
        root.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                setUpPinImage(root.getWidth());
                root.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
        });
    }

    private void setUpPinImage(int width) {
// Path: teslalib/src/main/java/com/eleks/tesla/teslalib/ApiPathConstants.java
// public interface ApiPathConstants {
//     /* Wear commands */
//     public static final String WEAR_GET_CAR_CONFIG = "/getCarConfig";
//     public static final String WEAR_GET_CHARGE_STATE = "/getChargeState";
//     public static final String WEAR_GET_CLIMATE_STATE = "/getClimateState";
//     public static final String WEAR_GET_DRIVE_STATE = "/getDriveState";
//     public static final String WEAR_GET_VEHICLE_STATE = "/getVehicleState";
//     public static final String WEAR_GET_LOCATION_MAP = "/getLocationMap";
//     public static final String WEAR_ACTION_HORN = "/actionHorn";
//     public static final String WEAR_ACTION_DOOR_LOCK = "/actionDoorLock";
//     public static final String WEAR_ACTION_DOOR_UNLOCK = "/actionDoorUnlock";
//     public static final String WEAR_ACTION_CHARGING_START = "/actionChargingStart";
//     public static final String WEAR_ACTION_CHARGING_STOP = "/actionChargingStop";
//     public static final String WEAR_ACTION_FLASHLIGHTS = "/actionFlashlights";
//     public static final String WEAR_ACTION_AUTO_CONDITIONING_START = "/actionAutoConditioningStart";
//     public static final String WEAR_ACTION_AUTO_CONDITIONING_STOP = "/actionAutoConditioningStop";
//     public static final String WEAR_SET_TEMPS = "/setTemps";
//     public static final String WEAR_SET_MAX_CHARGING = "/setMaxCharging";
//     public static final String WEAR_CLOSE_SUNROOF = "/closeSunRoof";
// 
//     /* Mobiles commands */
//     public static final String MOBILE_UPDATE_CAR_CONFIG = "/updateCarConfig";
//     public static final String MOBILE_UPDATE_CHARGE_STATE = "/updateChargeState";
//     public static final String MOBILE_UPDATE_CLIMATE_STATE= "/updateClimateState";
//     public static final String MOBILE_UPDATE_DRIVE_STATE= "/updateDriveState";
//     public static final String MOBILE_UPDATE_VEHICLE_STATE = "/updateVehicleState";
//     public static final String MOBILE_UPDATE_LOCATION_MAP = "/updateLocationMap";
//     public static final String MOBILE_SHOW_NOTIFICATION_BAD_WEATHER = "/notificationBadWeather";
//     public static final String MOBILE_SHOW_NOTIFICATION_UNEXPECTED_STOP_CHARGING = "/notificationUnexpectedStopCharge";
//     public static final String MOBILE_SHOW_NOTIFICATION_CAR_UNLOCKED = "/notificationCarUnlocked";
// }
// 
// Path: wear/src/main/java/com/eleks/tesla/events/LocationMapLoadedEvent.java
// public class LocationMapLoadedEvent {
//     private Bitmap mMapImage;
// 
//     public LocationMapLoadedEvent(Bitmap mapImage) {
//         this.mMapImage = mapImage;
//     }
// 
//     public Bitmap getMapImage() {
//         return mMapImage;
//     }
// }
// 
// Path: wear/src/main/java/com/eleks/tesla/events/ToHandHoldRequestEvent.java
// public class ToHandHoldRequestEvent {
//     private String mPath;
//     private Serializable mCommand;
// 
//     public ToHandHoldRequestEvent(String path) {
//         mPath = path;
//     }
// 
//     public ToHandHoldRequestEvent(String path, Serializable command) {
//         mPath = path;
//         mCommand = command;
//     }
// 
//     public String getPath() {
//         return mPath;
//     }
// 
//     public Serializable getCommand() {
//         return mCommand;
//     }
// }


// Path: wear/src/main/java/com/eleks/tesla/mainApp/LocationActivity.java
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.OvershootInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.eleks.tesla.teslalib.ApiPathConstants;
import com.eleks.tesla.R;
import com.eleks.tesla.events.LocationMapLoadedEvent;
import com.eleks.tesla.events.ToHandHoldRequestEvent;
import java.util.ArrayList;
import java.util.List;
import de.greenrobot.event.EventBus;

package com.eleks.tesla.mainApp;





/**
 * Created by maryan.melnychuk on 05.03.2015.
 */
public class LocationActivity extends Activity {
    public static final int ANIMATION_DURATION = 800;
    private ImageView mMapImageView;
    private ImageView mPinImageView;
    protected int mImageSideSize;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_location);

        mMapImageView = (ImageView) findViewById(R.id.map_image);
        mPinImageView = (ImageView) findViewById(R.id.pin_image);

        EventBus.getDefault().post(new ToHandHoldRequestEvent(ApiPathConstants.WEAR_GET_LOCATION_MAP));
        EventBus.getDefault().registerSticky(this);

        final ViewGroup root = (ViewGroup) findViewById(R.id.root);
        root.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                setUpPinImage(root.getWidth());
                root.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            }
        });
    }

    private void setUpPinImage(int width) {
        mImageSideSize = (int) (width / 6 * 0.8f);