New widget design
Bug:3129772
Change-Id: I34df2c43833e636ab72a623f56bbfc6c0ccd8452
diff --git a/res/drawable-hdpi/photo_frame_widget_holo_light.9.png b/res/drawable-hdpi/photo_frame_widget_holo_light.9.png
new file mode 100644
index 0000000..bb7fe92
--- /dev/null
+++ b/res/drawable-hdpi/photo_frame_widget_holo_light.9.png
Binary files differ
diff --git a/res/drawable-hdpi/statusbox_widget_holo_light.9.png b/res/drawable-hdpi/statusbox_widget_holo_light.9.png
new file mode 100644
index 0000000..383aab8
--- /dev/null
+++ b/res/drawable-hdpi/statusbox_widget_holo_light.9.png
Binary files differ
diff --git a/res/drawable-mdpi/photo_frame_widget_holo_light.9.png b/res/drawable-mdpi/photo_frame_widget_holo_light.9.png
new file mode 100644
index 0000000..021a7b3
--- /dev/null
+++ b/res/drawable-mdpi/photo_frame_widget_holo_light.9.png
Binary files differ
diff --git a/res/drawable-mdpi/statusbox_widget_holo_light.9.png b/res/drawable-mdpi/statusbox_widget_holo_light.9.png
new file mode 100644
index 0000000..00c6ba5
--- /dev/null
+++ b/res/drawable-mdpi/statusbox_widget_holo_light.9.png
Binary files differ
diff --git a/res/layout/social_widget.xml b/res/layout/social_widget.xml
index b6d662b..7b5a144 100644
--- a/res/layout/social_widget.xml
+++ b/res/layout/social_widget.xml
@@ -18,19 +18,22 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:background="#ff222222"
+ android:background="#00000000"
>
<ImageView
android:id="@+id/image"
- android:layout_width="72dip"
- android:layout_height="72dip"
- android:layout_marginRight="8dip" />
+ android:background="@drawable/photo_frame_widget_holo_light"
+ android:layout_width="96dip"
+ android:layout_height="96dip" />
<LinearLayout
android:layout_width="0dip"
- android:layout_height="wrap_content"
+ android:layout_height="90dip"
android:layout_weight="1"
+ android:background="@drawable/statusbox_widget_holo_light"
android:orientation="vertical"
- android:layout_gravity="center_vertical" >
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="-8dip"
+ android:paddingLeft="24dip" >
<TextView android:id="@+id/name"
android:layout_width="match_parent"
@@ -39,38 +42,25 @@
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
- android:shadowColor="#BB000000"
- android:shadowRadius="2.75"
+ android:layout_marginTop="2dip"
/>
- <TextView android:id="@+id/phonetic_name"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:singleLine="true"
- android:ellipsize="end"
- android:layout_marginTop="-2dip"
- android:visibility="gone"
- />
-
<TextView android:id="@+id/status"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0px"
+ android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:singleLine="true"
- android:ellipsize="end"
- android:layout_marginTop="-2dip"
+ android:maxLines="2"
android:visibility="gone"
/>
<TextView android:id="@+id/status_date"
android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
+ android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="12sp"
- android:layout_marginTop="-2dip"
android:visibility="gone"
+ android:layout_marginBottom="2dip"
/>
</LinearLayout>
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e515002..037af20 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1385,4 +1385,7 @@
<!-- Button to close without add a phone number to contacts [CHAR LIMIT=25] -->
<string name="non_phone_close">Close</string>
+
+ <!-- Format string that combines the name and the phonetic name for the widget. if the phonetic name is empty, only the display name is used instead [CHAR LIMIT=25] -->
+ <string name="widget_name_and_phonetic"><xliff:g id="display_name" example="John Huber">%1$s</xliff:g> (<xliff:g id="phonetic_name">%2$s</xliff:g>)</string>
</resources>
diff --git a/res/xml/social_widget_info.xml b/res/xml/social_widget_info.xml
index 330ddc7..43b1922 100644
--- a/res/xml/social_widget_info.xml
+++ b/res/xml/social_widget_info.xml
@@ -15,7 +15,7 @@
-->
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
- android:minWidth="294dip"
+ android:minWidth="220dip"
android:minHeight="72dip"
android:updatePeriodMillis="3600000"
android:initialLayout="@layout/social_widget"
diff --git a/src/com/android/contacts/socialwidget/SocialWidgetProvider.java b/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
index 32bbffb..f2641fa 100644
--- a/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
+++ b/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
@@ -107,12 +107,13 @@
*/
private void setDisplayName(RemoteViews views, CharSequence displayName,
CharSequence phoneticName) {
- views.setTextViewText(R.id.name, displayName);
if (TextUtils.isEmpty(phoneticName)) {
- views.setViewVisibility(R.id.phonetic_name, View.GONE);
+ views.setTextViewText(R.id.name, displayName);
} else {
- views.setTextViewText(R.id.phonetic_name, phoneticName);
- views.setViewVisibility(R.id.phonetic_name, View.VISIBLE);
+ final String combinedName =
+ context.getString(R.string.widget_name_and_phonetic,
+ displayName, phoneticName);
+ views.setTextViewText(R.id.name, combinedName);
}
}