package info.nightscout.androidaps.interaction.utils;

import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import android.support.wearable.view.WearableListView;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import info.nightscout.androidaps.R;

/**
 * Created by adrian on 08/02/17.
 */

public class WearableListItemLayout extends LinearLayout
        implements WearableListView.OnCenterProximityListener {

    //private ImageView mCircle;
    private TextView mName;

    private final float mFadedTextAlpha;
    private final int mFadedCircleColor;
    private final int mChosenCircleColor;

    public WearableListItemLayout(Context context) {
        this(context, null);
    }

    public WearableListItemLayout(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public WearableListItemLayout(Context context, AttributeSet attrs,
                                  int defStyle) {
        super(context, attrs, defStyle);

        mFadedTextAlpha = 40 / 100f;
        mFadedCircleColor = getResources().getColor(R.color.grey);
        mChosenCircleColor = getResources().getColor(R.color.blue);
    }

    // Get references to the icon and text in the item layout definition
    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        //mCircle = (ImageView) findViewById(R.id.circle);
        mName = findViewById(R.id.actionitem);
    }

    @Override
    public void onCenterPosition(boolean animate) {
        mName.setAlpha(1f);
        //((GradientDrawable) mCircle.getDrawable()).setColor(mChosenCircleColor);
    }

    @Override
    public void onNonCenterPosition(boolean animate) {
        //((GradientDrawable) mCircle.getDrawable()).setColor(mFadedCircleColor);
        mName.setAlpha(mFadedTextAlpha);
    }
}

@@ -84,59 +84,8 @@
 xt;%0A
-import android.graphics.drawable.GradientDrawable;%0A
 impo
@@ -173,41 +173,8 @@
 et;%0A
-import android.widget.ImageView;%0A
 impo
@@ -547,91 +547,8 @@
 pha;
-%0A    private final int mFadedCircleColor;%0A    private final int mChosenCircleColor;
 %0A%0A  
@@ -951,143 +951,8 @@
 0f;%0A
-        mFadedCircleColor = getResources().getColor(R.color.grey);%0A        mChosenCircleColor = getResources().getColor(R.color.blue);%0A
     
@@ -1117,67 +1117,8 @@
 ();%0A
-        //mCircle = (ImageView) findViewById(R.id.circle);%0A
     
@@ -1269,244 +1269,79 @@
     
-    //((GradientDrawable) mCircle.getDrawable()).setColor(mChosenCircleColor);%0A    %7D%0A%0A    @Override%0A    public void onNonCenterPosition(boolean animate) %7B%0A        //((GradientDrawable) mCircle.getDrawable()).setColor(mFadedCircleColor);
+%7D%0A%0A    @Override%0A    public void onNonCenterPosition(boolean animate) %7B
 %0A   

fix for wearableVersion update