Center name when no status.

Also shows the status if exists (not actually hooked up yet though).

Bug: 2138736
This commit is contained in:
Neel Parekh
2009-09-25 10:26:35 -07:00
parent 48c84052e2
commit 6ecacd40dd
4 changed files with 30 additions and 22 deletions

View File

@@ -174,6 +174,7 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
mPresenceView = (ImageView) findViewById(R.id.presence);
mStatusView = (TextView)findViewById(R.id.status);
setSocialSnippet(null);
// Set the photo with a random "no contact" image
long now = SystemClock.elapsedRealtime();
@@ -355,7 +356,12 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
* Manually set the social snippet text to display in the header.
*/
public void setSocialSnippet(CharSequence snippet) {
mStatusView.setText(snippet);
if (snippet == null) {
mStatusView.setVisibility(View.GONE);
} else {
mStatusView.setText(snippet);
mStatusView.setVisibility(View.VISIBLE);
}
}
/**

View File

@@ -4,9 +4,9 @@
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.
@@ -20,11 +20,11 @@
android:orientation="vertical"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content">
android:layout_height="fill_parent">
<TextView android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:singleLine="true"
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceMedium"

View File

@@ -4,9 +4,9 @@
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.
@@ -17,26 +17,26 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/banner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="@drawable/title_bar_medium"
android:paddingRight="5dip"
android:gravity="center_vertical">
android:paddingRight="5dip">
<android.widget.FasttrackBadgeWidget android:id="@+id/photo"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dip"
android:layout_marginLeft="10dip"
style="@*android:style/Widget.FasttrackBadgeWidget.WindowSmall" />
/>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="5dip"
android:orientation="vertical">
android:orientation="vertical"
android:layout_gravity="center_vertical" >
<LinearLayout
android:layout_width="fill_parent"
@@ -59,25 +59,26 @@
<TextView android:id="@+id/status"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:maxLines="2"
android:ellipsize="end"/>
</LinearLayout>
<ImageView
android:id="@+id/presence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="3dip"
android:paddingRight="6dip"/>
<CheckBox
android:id="@+id/star"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:visibility="gone"
style="?android:attr/starStyle" />

View File

@@ -4,9 +4,9 @@
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.
@@ -23,4 +23,5 @@
android:textStyle="bold"
android:singleLine="true"
android:ellipsize="end"
android:layout_gravity="center_vertical"
/>