InCallUI: Add transparency to Glowpad background [1/3]

this adds transparency to the glowpad view background so the incoming caller's entire picture can be seen.
PS8:making it a preference.

PS16: Permissions

Change-Id: I33bfdc6ed641770a4e0ceb7841e0908581256757
diff --git a/res/layout/incall_screen.xml b/res/layout/incall_screen.xml
index 892f917..5a93c0c 100644
--- a/res/layout/incall_screen.xml
+++ b/res/layout/incall_screen.xml
@@ -19,8 +19,24 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:background="@color/incall_button_background"
     android:id="@+id/main">
 
+    <RelativeLayout
+         android:id="@+id/in_call_card_container"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:layout_weight="1">
+
+        <fragment
+            android:name="com.android.incallui.CallCardFragment"
+            android:id="@+id/callCardFragment"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_alignParentTop="true"
+            android:layout_alignParentStart="true" />
+    </RelativeLayout>
+
     <LinearLayout
         android:id="@+id/in_call_and_button_container"
         android:layout_width="match_parent"
@@ -34,13 +50,6 @@
              android:layout_weight="1">
 
             <fragment
-                android:name="com.android.incallui.CallCardFragment"
-                android:id="@+id/callCardFragment"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:layout_alignParentTop="true"
-                android:layout_alignParentStart="true" />
-            <fragment
                 android:name="com.android.incallui.DialpadFragment"
                 android:id="@+id/dialpadFragment"
                 android:layout_width="match_parent"
diff --git a/res/values-holodark/colors.xml b/res/values-holodark/colors.xml
index c0e10fd..f975b22 100644
--- a/res/values-holodark/colors.xml
+++ b/res/values-holodark/colors.xml
@@ -19,9 +19,11 @@
 
     <!-- In-call UI -->
     <color name="incall_callTypeSip">#99CE3F</color> <!-- green -->
-    <color name="incall_call_banner_background">#A0000000</color> <!-- semitransparent black -->
-    <color name="incall_secondary_info_background">#80000000</color> <!-- semitransparent blueish grey -->
+    <color name="incall_call_banner_background">#80000000</color> <!-- semitransparent black -->
+    <color name="incall_secondary_info_background">#7033b5e5</color> <!-- semitransparent blueish grey -->
     <color name="incall_call_banner_text_color">#FFFFFF</color> <!-- white -->
+    <color name="incall_button_background">#2A2A2A</color>
+    <color name="transparent_glowpad_background">#40000000</color>
 
     <!-- DTMF Dialer -->
     <color name="dtmf_dialer_display_text">#FFFFFF</color> <!-- white -->
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 002c7cd..145ca70 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -19,9 +19,11 @@
 
     <!-- In-call UI -->
     <color name="incall_callTypeSip">#99CE3F</color> <!-- green -->
-    <color name="incall_call_banner_background">#A0000000</color> <!-- semitransparent black -->
-    <color name="incall_secondary_info_background">#80000000</color> <!-- semitransparent blueish grey -->
+    <color name="incall_call_banner_background">#80000000</color> <!-- semitransparent black -->
+    <color name="incall_secondary_info_background">#7033b5e5</color> <!-- semitransparent blueish grey -->
     <color name="incall_call_banner_text_color">#FFFFFF</color> <!-- white -->
+    <color name="incall_button_background">#2A2A2A</color>
+    <color name="transparent_glowpad_background">#40000000</color>
 
     <!-- DTMF Dialer -->
     <color name="dtmf_dialer_display_text">#FFFFFF</color> <!-- white -->
diff --git a/src/com/android/incallui/CallButtonFragment.java b/src/com/android/incallui/CallButtonFragment.java
index ed76903..f6a95f0 100644
--- a/src/com/android/incallui/CallButtonFragment.java
+++ b/src/com/android/incallui/CallButtonFragment.java
@@ -190,11 +190,8 @@
     }
 
     @Override
-    public void setEnabled(boolean isEnabled) {
-        View view = getView();
-        if (view.getVisibility() != View.VISIBLE) {
-            view.setVisibility(View.VISIBLE);
-        }
+    public void setEnabled(boolean isEnabled, boolean isVisible) {
+		getView().setVisibility(isVisible ? View.VISIBLE : View.INVISIBLE);
 
         // The main end-call button spanning across the screen.
         mEndCallButton.setEnabled(isEnabled);
diff --git a/src/com/android/incallui/CallButtonPresenter.java b/src/com/android/incallui/CallButtonPresenter.java
index be25737..89a1ad0 100644
--- a/src/com/android/incallui/CallButtonPresenter.java
+++ b/src/com/android/incallui/CallButtonPresenter.java
@@ -219,7 +219,7 @@
         final boolean isEnabled = state.isConnectingOrConnected() &&
                 !state.isIncoming() && call != null;
 
-        ui.setEnabled(isEnabled);
+        ui.setEnabled(isEnabled, !state.isIncoming());
 
         Log.d(this, "Updating call UI for call: ", call);
 
@@ -330,7 +330,7 @@
     }
 
     public interface CallButtonUi extends Ui {
-        void setEnabled(boolean on);
+        void setEnabled(boolean on, boolean visible);
         void setMute(boolean on);
         void enableMute(boolean enabled);
         void setHold(boolean on);
diff --git a/src/com/android/incallui/widget/multiwaveview/GlowPadView.java b/src/com/android/incallui/widget/multiwaveview/GlowPadView.java
index a346ba5..45a34d5 100644
--- a/src/com/android/incallui/widget/multiwaveview/GlowPadView.java
+++ b/src/com/android/incallui/widget/multiwaveview/GlowPadView.java
@@ -32,6 +32,7 @@
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Vibrator;
+import android.provider.Settings;
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.util.Log;
@@ -236,6 +237,13 @@
 
         TypedValue outValue = new TypedValue();
 
+        final boolean transparent = Settings.System.getInt(
+                context.getContentResolver(),
+                Settings.System.INCALL_GLOWPAD_TRANSPARENCY, 0) == 1;
+        if (transparent) {
+            this.setBackgroundResource(R.color.transparent_glowpad_background);
+        }
+
         // Read array of target drawables
         if (a.getValue(R.styleable.GlowPadView_targetDrawables, outValue)) {
             internalSetTargetResources(outValue.resourceId);