EVWidgets: Add a dialpad lockscreen widget.

Change-Id: I136447705eb1b3f955d0f1e50dcdaed7d97426e6
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 8556bd7..35f92b3 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -22,6 +22,7 @@
     <uses-permission android:name="android.permission.CHANGE_4G_STATE" />
     <uses-permission android:name="android.permission.ACCESS_WIMAX_STATE" />
     <uses-permission android:name="android.permission.CHANGE_WIMAX_STATE" />
+    <uses-permission android:name="android.permission.CALL_PHONE" />
 
     <uses-sdk android:minSdkVersion="17"
               android:targetSdkVersion="17" />
@@ -130,6 +131,27 @@
             </intent-filter>
             <meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_wimax_info"/>
         </receiver>
-
+        <!-- Dialpad widget -->
+        <receiver android:name="com.evervolv.widgets.DialpadWidgetProvider"
+                android:label="@string/phone_lock_title"
+                android:enabled="@bool/config_hasTelephony">
+            <intent-filter>
+                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+                <action android:name="com.evervolv.widgets.DIALPAD_ONE" />
+                <action android:name="com.evervolv.widgets.DIALPAD_TWO" />
+                <action android:name="com.evervolv.widgets.DIALPAD_THREE" />
+                <action android:name="com.evervolv.widgets.DIALPAD_FOUR" />
+                <action android:name="com.evervolv.widgets.DIALPAD_FIVE" />
+                <action android:name="com.evervolv.widgets.DIALPAD_SIX" />
+                <action android:name="com.evervolv.widgets.DIALPAD_SEVEN" />
+                <action android:name="com.evervolv.widgets.DIALPAD_EIGHT" />
+                <action android:name="com.evervolv.widgets.DIALPAD_NINE" />
+                <action android:name="com.evervolv.widgets.DIALPAD_ZERO" />
+                <action android:name="com.evervolv.widgets.DIALPAD_STAR" />
+                <action android:name="com.evervolv.widgets.DIALPAD_HASH" />
+                <action android:name="com.evervolv.widgets.DIALPAD_DELETE" />
+            </intent-filter>
+            <meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_lock_phone" />
+        </receiver>
     </application>
 </manifest>
diff --git a/res/drawable-hdpi/dial_delete.png b/res/drawable-hdpi/dial_delete.png
new file mode 100644
index 0000000..62411c9
--- /dev/null
+++ b/res/drawable-hdpi/dial_delete.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_dial.png b/res/drawable-hdpi/dial_dial.png
new file mode 100644
index 0000000..9e26eda
--- /dev/null
+++ b/res/drawable-hdpi/dial_dial.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_0_no_plus.png b/res/drawable-hdpi/dial_num_0_no_plus.png
new file mode 100644
index 0000000..69849ec
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_0_no_plus.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_1_no_vm.png b/res/drawable-hdpi/dial_num_1_no_vm.png
new file mode 100644
index 0000000..af7ec42
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_1_no_vm.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_2.png b/res/drawable-hdpi/dial_num_2.png
new file mode 100644
index 0000000..2ae20ab
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_2.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_3.png b/res/drawable-hdpi/dial_num_3.png
new file mode 100644
index 0000000..991d5f3
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_3.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_4.png b/res/drawable-hdpi/dial_num_4.png
new file mode 100644
index 0000000..7aad3ef
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_4.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_5.png b/res/drawable-hdpi/dial_num_5.png
new file mode 100644
index 0000000..42a1d0b
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_5.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_6.png b/res/drawable-hdpi/dial_num_6.png
new file mode 100644
index 0000000..b03e019
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_6.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_7.png b/res/drawable-hdpi/dial_num_7.png
new file mode 100644
index 0000000..8b72fff
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_7.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_8.png b/res/drawable-hdpi/dial_num_8.png
new file mode 100644
index 0000000..822f21a
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_8.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_9.png b/res/drawable-hdpi/dial_num_9.png
new file mode 100644
index 0000000..2ee944b
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_9.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_pound.png b/res/drawable-hdpi/dial_num_pound.png
new file mode 100644
index 0000000..e10e57d
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_pound.png
Binary files differ
diff --git a/res/drawable-hdpi/dial_num_star.png b/res/drawable-hdpi/dial_num_star.png
new file mode 100644
index 0000000..1dfc111
--- /dev/null
+++ b/res/drawable-hdpi/dial_num_star.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_delete.png b/res/drawable-mdpi/dial_delete.png
new file mode 100644
index 0000000..b740053
--- /dev/null
+++ b/res/drawable-mdpi/dial_delete.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_dial.png b/res/drawable-mdpi/dial_dial.png
new file mode 100644
index 0000000..da15c33
--- /dev/null
+++ b/res/drawable-mdpi/dial_dial.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_0_no_plus.png b/res/drawable-mdpi/dial_num_0_no_plus.png
new file mode 100644
index 0000000..1d8b0e3
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_0_no_plus.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_1_no_vm.png b/res/drawable-mdpi/dial_num_1_no_vm.png
new file mode 100644
index 0000000..e253724
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_1_no_vm.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_2.png b/res/drawable-mdpi/dial_num_2.png
new file mode 100644
index 0000000..e311f4f
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_2.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_3.png b/res/drawable-mdpi/dial_num_3.png
new file mode 100644
index 0000000..f07324a
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_3.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_4.png b/res/drawable-mdpi/dial_num_4.png
new file mode 100644
index 0000000..cd8d33c
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_4.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_5.png b/res/drawable-mdpi/dial_num_5.png
new file mode 100644
index 0000000..a9f27dc
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_5.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_6.png b/res/drawable-mdpi/dial_num_6.png
new file mode 100644
index 0000000..2bdf08e
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_6.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_7.png b/res/drawable-mdpi/dial_num_7.png
new file mode 100644
index 0000000..6c1c599
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_7.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_8.png b/res/drawable-mdpi/dial_num_8.png
new file mode 100644
index 0000000..db0694c
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_8.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_9.png b/res/drawable-mdpi/dial_num_9.png
new file mode 100644
index 0000000..692fdb0
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_9.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_pound.png b/res/drawable-mdpi/dial_num_pound.png
new file mode 100644
index 0000000..f216d05
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_pound.png
Binary files differ
diff --git a/res/drawable-mdpi/dial_num_star.png b/res/drawable-mdpi/dial_num_star.png
new file mode 100644
index 0000000..f7e8e9f
--- /dev/null
+++ b/res/drawable-mdpi/dial_num_star.png
Binary files differ
diff --git a/res/drawable-nodpi/preview_dialpad.png b/res/drawable-nodpi/preview_dialpad.png
new file mode 100644
index 0000000..2192916
--- /dev/null
+++ b/res/drawable-nodpi/preview_dialpad.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_delete.png b/res/drawable-xhdpi/dial_delete.png
new file mode 100644
index 0000000..93e5418
--- /dev/null
+++ b/res/drawable-xhdpi/dial_delete.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_dial.png b/res/drawable-xhdpi/dial_dial.png
new file mode 100644
index 0000000..983d5d9
--- /dev/null
+++ b/res/drawable-xhdpi/dial_dial.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_0_no_plus.png b/res/drawable-xhdpi/dial_num_0_no_plus.png
new file mode 100644
index 0000000..11ca993
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_0_no_plus.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_1_no_vm.png b/res/drawable-xhdpi/dial_num_1_no_vm.png
new file mode 100644
index 0000000..8d2ac70
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_1_no_vm.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_2.png b/res/drawable-xhdpi/dial_num_2.png
new file mode 100644
index 0000000..12c4ab9
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_2.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_3.png b/res/drawable-xhdpi/dial_num_3.png
new file mode 100644
index 0000000..4353e8a
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_3.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_4.png b/res/drawable-xhdpi/dial_num_4.png
new file mode 100644
index 0000000..ccee5cc
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_4.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_5.png b/res/drawable-xhdpi/dial_num_5.png
new file mode 100644
index 0000000..f27f153
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_5.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_6.png b/res/drawable-xhdpi/dial_num_6.png
new file mode 100644
index 0000000..8966d13
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_6.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_7.png b/res/drawable-xhdpi/dial_num_7.png
new file mode 100644
index 0000000..b018810
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_7.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_8.png b/res/drawable-xhdpi/dial_num_8.png
new file mode 100644
index 0000000..7c7b4f8
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_8.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_9.png b/res/drawable-xhdpi/dial_num_9.png
new file mode 100644
index 0000000..23984f0
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_9.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_pound.png b/res/drawable-xhdpi/dial_num_pound.png
new file mode 100644
index 0000000..be21af8
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_pound.png
Binary files differ
diff --git a/res/drawable-xhdpi/dial_num_star.png b/res/drawable-xhdpi/dial_num_star.png
new file mode 100644
index 0000000..061a494
--- /dev/null
+++ b/res/drawable-xhdpi/dial_num_star.png
Binary files differ
diff --git a/res/drawable/dialpad_num_background.xml b/res/drawable/dialpad_num_background.xml
new file mode 100644
index 0000000..ca2af3e
--- /dev/null
+++ b/res/drawable/dialpad_num_background.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:exitFadeDuration="400">
+
+    <item android:state_window_focused="false" android:drawable="@color/transparent" />
+
+    <!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
+    <item android:state_focused="true"  android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_dark" />
+    <item android:state_focused="true"  android:state_enabled="false"                              android:drawable="@drawable/list_selector_disabled_holo_dark" />
+    <item android:state_focused="true"                                android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_holo_dark" />
+    <item android:state_focused="false"                               android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition_holo_dark" />
+    <item android:state_focused="true"                                                             android:drawable="@drawable/list_focused_holo" />
+    <item android:drawable="@drawable/widget_background" />
+</selector>
+
diff --git a/res/layout/phone_widget.xml b/res/layout/phone_widget.xml
new file mode 100644
index 0000000..1f5d8c0
--- /dev/null
+++ b/res/layout/phone_widget.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/dialpad"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <LinearLayout
+         android:layout_height="0px"
+         android:layout_width="match_parent"
+         android:layout_weight="1"
+         android:orientation="horizontal"
+         android:gravity="center">
+
+        <ImageButton android:id="@+id/dial"
+                    style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_dial"/>
+
+        <TextView
+            android:id="@+id/dialpad_text"
+            android:gravity="center"
+            android:layout_width="0px"
+            android:layout_height="wrap_content"
+            android:layout_weight="3"
+            android:singleLine="true"
+            android:scaleType="fitXY"
+            android:scrollHorizontally="true"
+            android:textSize="20sp"/>
+
+        <ImageButton android:id="@+id/delete"
+                    style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_delete"/>
+    </LinearLayout>
+
+    <LinearLayout
+         android:layout_height="0px"
+         android:layout_width="match_parent"
+         android:layout_weight="1"
+         android:orientation="horizontal"
+         android:gravity="center">
+
+        <ImageButton android:id="@+id/one" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_1_no_vm"/>
+        <ImageButton android:id="@+id/two" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_2"/>
+        <ImageButton android:id="@+id/three" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_3"/>
+
+    </LinearLayout>
+
+    <LinearLayout
+         android:layout_height="0px"
+         android:layout_width="match_parent"
+         android:layout_weight="1"
+         android:orientation="horizontal"
+         android:gravity="center">
+
+        <ImageButton android:id="@+id/four" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_4"/>
+        <ImageButton android:id="@+id/five" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_5" />
+        <ImageButton android:id="@+id/six" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_6" />
+    </LinearLayout>
+
+    <LinearLayout
+         android:layout_height="0px"
+         android:layout_width="match_parent"
+         android:layout_weight="1"
+         android:orientation="horizontal"
+         android:gravity="center">
+
+        <ImageButton android:id="@+id/seven" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_7"/>
+        <ImageButton android:id="@+id/eight"
+            style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_8" />
+        <ImageButton android:id="@+id/nine" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_9"/>
+    </LinearLayout>
+
+    <LinearLayout
+         android:layout_height="0px"
+         android:layout_width="match_parent"
+         android:layout_weight="1"
+         android:orientation="horizontal"
+         android:gravity="center">
+
+        <ImageButton android:id="@+id/star" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_star"/>
+        <ImageButton android:id="@+id/zero" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_0_no_plus"/>
+        <ImageButton android:id="@+id/hash" style="@style/DialpadButtonStyle"
+            android:src="@drawable/dial_num_pound"/>
+    </LinearLayout>
+</LinearLayout>
diff --git a/res/values/config.xml b/res/values/config.xml
index d161895..9fbcd68 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -5,4 +5,5 @@
     <bool name="config_has_wimax" translatable="false">false</bool>
     <bool name="config_has_bluetooth" translatable="false">true</bool>
     <bool name="config_has_mobile_data" translatable="false">true</bool>
+    <bool name="config_hasTelephony" translatable="false">true</bool>
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
new file mode 100644
index 0000000..d8c6b8d
--- /dev/null
+++ b/res/values/dimens.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+    <dimen name="min_dial_pad_width">160dip</dimen>
+    <dimen name="min_dial_pad_height">420dip</dimen>
+
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f5fedc3..31110ae 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -32,4 +32,19 @@
 
     <!-- Mobile Data Widget -->
     <string name="mobile_data_gadget_title">Mobile Data Toggle</string>
+
+    <!-- Lockscreen Dialpad Widget -->
+    <string name="phone_lock_title">Dialpad</string>
+    <string name="num_one">1</string>
+    <string name="num_two">2</string>
+    <string name="num_three">3</string>
+    <string name="num_four">4</string>
+    <string name="num_five">5</string>
+    <string name="num_six">6</string>
+    <string name="num_seven">7</string>
+    <string name="num_eight">8</string>
+    <string name="num_nine">9</string>
+    <string name="num_zero">0</string>
+    <string name="num_star">*</string>
+    <string name="num_hash">#</string>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
new file mode 100644
index 0000000..4f1a4d2
--- /dev/null
+++ b/res/values/styles.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <style name="DialpadButtonStyle">
+        <item name="android:layout_width">0dip</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:layout_weight">1</item>
+        <item name="android:gravity">center</item>
+        <item name="android:scaleType">fitXY</item>
+        <item name="android:layout_margin">1dp</item>
+        <item name="android:background">@drawable/dialpad_num_background</item>
+        <item name="android:soundEffectsEnabled">false</item>
+    </style>
+</resources>
diff --git a/res/xml/widget_lock_phone.xml b/res/xml/widget_lock_phone.xml
new file mode 100644
index 0000000..aa0346c
--- /dev/null
+++ b/res/xml/widget_lock_phone.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
+    android:minWidth="@dimen/min_dial_pad_width"
+    android:minHeight="@dimen/min_dial_pad_height"
+    android:updatePeriodMillis="0"
+    android:previewImage="@drawable/preview_dialpad"
+    android:initialLayout="@layout/phone_widget"
+    android:resizeMode="vertical|horizontal"
+    android:widgetCategory="keyguard"
+    >
+</appwidget-provider>
diff --git a/src/com/evervolv/widgets/DialpadWidgetProvider.java b/src/com/evervolv/widgets/DialpadWidgetProvider.java
new file mode 100644
index 0000000..729dafe
--- /dev/null
+++ b/src/com/evervolv/widgets/DialpadWidgetProvider.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2012 The Evervolv Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.evervolv.widgets;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import android.app.PendingIntent;
+import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProvider;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.util.Log;
+import android.widget.RemoteViews;
+
+import com.evervolv.widgets.R;
+
+public class DialpadWidgetProvider extends AppWidgetProvider {
+    private static final String TAG = "PhoneWidgetProvider";
+
+    public static String DIALPAD_ONE     = "com.evervolv.widgets.DIALPAD_ONE";
+    public static String DIALPAD_TWO     = "com.evervolv.widgets.DIALPAD_TWO";
+    public static String DIALPAD_THREE   = "com.evervolv.widgets.DIALPAD_THREE";
+    public static String DIALPAD_FOUR    = "com.evervolv.widgets.DIALPAD_FOUR";
+    public static String DIALPAD_FIVE    = "com.evervolv.widgets.DIALPAD_FIVE";
+    public static String DIALPAD_SIX     = "com.evervolv.widgets.DIALPAD_SIX";
+    public static String DIALPAD_SEVEN   = "com.evervolv.widgets.DIALPAD_SEVEN";
+    public static String DIALPAD_EIGHT   = "com.evervolv.widgets.DIALPAD_EIGHT";
+    public static String DIALPAD_NINE    = "com.evervolv.widgets.DIALPAD_NINE";
+    public static String DIALPAD_ZERO    = "com.evervolv.widgets.DIALPAD_ZERO";
+    public static String DIALPAD_STAR    = "com.evervolv.widgets.DIALPAD_STAR";
+    public static String DIALPAD_HASH    = "com.evervolv.widgets.DIALPAD_HASH";
+    public static String DIALPAD_DELETE  = "com.evervolv.widgets.DIALPAD_DELETE";
+    public static String DIALPAD_DIAL    = "com.evervolv.widgets.DIALPAD_DIAL";
+
+    public static String mCurrentNumber = "";
+
+    @Override
+    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
+        Log.d(TAG, "onUpdate!!!");
+        updateWidgets(context, false, null);
+    }
+
+    @Override
+    public void onReceive(Context context, Intent intent) {
+        super.onReceive(context, intent);
+        if (DIALPAD_ONE.equals(intent.getAction())){
+            updateWidgets(context, true, "1");
+        } else if (DIALPAD_TWO.equals(intent.getAction())){
+            updateWidgets(context, true, "2");
+        } else if (DIALPAD_THREE.equals(intent.getAction())){
+            updateWidgets(context, true, "3");
+        } else if (DIALPAD_FOUR.equals(intent.getAction())){
+            updateWidgets(context, true, "4");
+        } else if (DIALPAD_FIVE.equals(intent.getAction())){
+            updateWidgets(context, true, "5");
+        } else if (DIALPAD_SIX.equals(intent.getAction())){
+            updateWidgets(context, true, "6");
+        } else if (DIALPAD_SEVEN.equals(intent.getAction())){
+            updateWidgets(context, true, "7");
+        } else if (DIALPAD_EIGHT.equals(intent.getAction())){
+            updateWidgets(context, true, "8");
+        } else if (DIALPAD_NINE.equals(intent.getAction())){
+            updateWidgets(context, true, "9");
+        } else if (DIALPAD_ZERO.equals(intent.getAction())){
+            updateWidgets(context, true, "0");
+        } else if (DIALPAD_STAR.equals(intent.getAction())){
+            updateWidgets(context, true, "*");
+        } else if (DIALPAD_HASH.equals(intent.getAction())){
+            updateWidgets(context, true, "#");
+        } else if (DIALPAD_DELETE.equals(intent.getAction())){
+            updateWidgets(context, true, "del");
+        } else if (DIALPAD_DIAL.equals(intent.getAction())){
+            updateWidgets(context, true, "dial");
+        } else if (AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED
+                .equals(intent.getAction())) {
+            Log.d(TAG, "ACTION_APPWIDGET_OPTIONS_CHANGED");
+        }
+    }
+
+    private void updateWidgets(Context context, boolean click, String character) {
+        RemoteViews views = new RemoteViews(context.getPackageName(),
+                R.layout.phone_widget);
+
+        Intent intentOne = new Intent(context, DialpadWidgetProvider.class);
+        intentOne.setAction(DIALPAD_ONE);
+        PendingIntent onePendingIntent = PendingIntent.getBroadcast(context,0,intentOne,0);
+        views.setOnClickPendingIntent(R.id.one, onePendingIntent);
+
+        Intent intentTwo = new Intent(context, DialpadWidgetProvider.class);
+        intentTwo.setAction(DIALPAD_TWO);
+        PendingIntent twoPendingIntent = PendingIntent.getBroadcast(context,0,intentTwo,0);
+        views.setOnClickPendingIntent(R.id.two, twoPendingIntent);
+
+        Intent intentThree = new Intent(context, DialpadWidgetProvider.class);
+        intentThree.setAction(DIALPAD_THREE);
+        PendingIntent threePendingIntent = PendingIntent.getBroadcast(context,0,intentThree,0);
+        views.setOnClickPendingIntent(R.id.three, threePendingIntent);
+
+        Intent intentFour = new Intent(context, DialpadWidgetProvider.class);
+        intentFour.setAction(DIALPAD_FOUR);
+        PendingIntent fourPendingIntent = PendingIntent.getBroadcast(context,0,intentFour,0);
+        views.setOnClickPendingIntent(R.id.four, fourPendingIntent);
+
+        Intent intentFive = new Intent(context, DialpadWidgetProvider.class);
+        intentFive.setAction(DIALPAD_FIVE);
+        PendingIntent fivePendingIntent = PendingIntent.getBroadcast(context,0,intentFive,0);
+        views.setOnClickPendingIntent(R.id.five, fivePendingIntent);
+
+        Intent intentSix = new Intent(context, DialpadWidgetProvider.class);
+        intentSix.setAction(DIALPAD_SIX);
+        PendingIntent sixPendingIntent = PendingIntent.getBroadcast(context,0,intentSix,0);
+        views.setOnClickPendingIntent(R.id.six, sixPendingIntent);
+
+        Intent intentSeven = new Intent(context, DialpadWidgetProvider.class);
+        intentSeven.setAction(DIALPAD_SEVEN);
+        PendingIntent sevenPendingIntent = PendingIntent.getBroadcast(context,0,intentSeven,0);
+        views.setOnClickPendingIntent(R.id.seven, sevenPendingIntent);
+
+        Intent intentEight = new Intent(context, DialpadWidgetProvider.class);
+        intentEight.setAction(DIALPAD_EIGHT);
+        PendingIntent eightPendingIntent = PendingIntent.getBroadcast(context,0,intentEight,0);
+        views.setOnClickPendingIntent(R.id.eight, eightPendingIntent);
+
+        Intent intentNine = new Intent(context, DialpadWidgetProvider.class);
+        intentNine.setAction(DIALPAD_NINE);
+        PendingIntent ninePendingIntent = PendingIntent.getBroadcast(context,0,intentNine,0);
+        views.setOnClickPendingIntent(R.id.nine, ninePendingIntent);
+
+        Intent intentZero = new Intent(context, DialpadWidgetProvider.class);
+        intentZero.setAction(DIALPAD_ZERO);
+        PendingIntent zeroPendingIntent = PendingIntent.getBroadcast(context,0,intentZero,0);
+        views.setOnClickPendingIntent(R.id.zero, zeroPendingIntent);
+
+        Intent intentStar = new Intent(context, DialpadWidgetProvider.class);
+        intentStar.setAction(DIALPAD_STAR);
+        PendingIntent starPendingIntent = PendingIntent.getBroadcast(context,0,intentStar,0);
+        views.setOnClickPendingIntent(R.id.star, starPendingIntent);
+
+        Intent intentHash = new Intent(context, DialpadWidgetProvider.class);
+        intentHash.setAction(DIALPAD_HASH);
+        PendingIntent hashPendingIntent = PendingIntent.getBroadcast(context,0,intentHash,0);
+        views.setOnClickPendingIntent(R.id.hash, hashPendingIntent);
+
+        Intent intentDelete = new Intent(context, DialpadWidgetProvider.class);
+        intentDelete.setAction(DIALPAD_DELETE);
+        PendingIntent deletePendingIntent = PendingIntent.getBroadcast(context,0,intentDelete,0);
+        views.setOnClickPendingIntent(R.id.delete, deletePendingIntent);
+
+        Intent intentDial = new Intent(context, DialpadWidgetProvider.class);
+        intentDial.setAction(DIALPAD_DIAL);
+        PendingIntent dialPendingIntent = PendingIntent.getBroadcast(context,0,intentDial,0);
+        views.setOnClickPendingIntent(R.id.dial, dialPendingIntent);
+
+        if (click) {
+            if (mCurrentNumber == "") {
+                mCurrentNumber = character;
+            } else {
+                if (character.equals("del")) {
+                    if (mCurrentNumber.length() > 0) {
+                        mCurrentNumber = mCurrentNumber.substring(0, mCurrentNumber.length() - 1);
+                        if (mCurrentNumber.substring(mCurrentNumber
+                                .length()).equals("-")) {
+                            mCurrentNumber = mCurrentNumber.substring(0,
+                                    mCurrentNumber.length() - 1);
+                        }
+                    }
+                } else if (character.equals("dial")) {
+                    try {
+                        Intent intent = new Intent(Intent.ACTION_CALL,
+                                Uri.parse("tel:" + URLEncoder.encode(
+                                        mCurrentNumber, "UTF-8")));
+                        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                        context.startActivity(intent);
+                    } catch (UnsupportedEncodingException e) {
+                        e.printStackTrace();
+                    }
+                } else {
+                    if (mCurrentNumber.length() == 3 | mCurrentNumber.length() == 7) {
+                        mCurrentNumber += "-" + character ;
+                    } else {
+                        mCurrentNumber += character;
+                    }
+                }
+            }
+        } else {
+            mCurrentNumber = "";
+        }
+
+        views.setTextViewText(R.id.dialpad_text, mCurrentNumber);
+        ComponentName cn = new ComponentName(context, DialpadWidgetProvider.class);
+        AppWidgetManager.getInstance(context).updateAppWidget(cn, views);
+    }
+}
\ No newline at end of file