Merge change 21093

* changes:
  Refreshed UI of Mailbox list
This commit is contained in:
Android (Google) Code Review 2009-08-13 19:43:45 -07:00
commit cb23b7c68f
3 changed files with 20 additions and 3 deletions

View File

@ -22,11 +22,18 @@
android:gravity="center_vertical"
android:paddingLeft="8dip"
android:paddingRight="8dip" >
<View
android:id="@+id/chip"
android:background="@drawable/appointment_indicator_leftside_1"
android:layout_width="4px"
android:layout_height="56px"
android:layout_centerVertical="true" />
<ImageView
android:id="@+id/folder_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/expander_ic_folder_minimized" />
android:src="@drawable/expander_ic_folder_minimized"
android:paddingLeft="2dip"/>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"

View File

@ -15,6 +15,8 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/open"
android:title="@string/open_action" />
<item android:id="@+id/refresh"
android:title="@string/refresh_action" />
</menu>

View File

@ -31,6 +31,7 @@ import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
@ -258,6 +259,9 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
case R.id.refresh:
onRefresh(info.id);
break;
case R.id.open:
onOpenMailbox(info.id);
break;
}
return super.onContextItemSelected(item);
}
@ -419,8 +423,8 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
public void bindView(View view, Context context, Cursor cursor) {
// TODO translation by mailbox type
String text = cursor.getString(COLUMN_DISPLAY_NAME);
TextView nameView = (TextView) view.findViewById(R.id.mailbox_name);
if (text != null) {
TextView nameView = (TextView) view.findViewById(R.id.mailbox_name);
nameView.setText(text);
}
@ -433,7 +437,9 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
} else {
statusView.setVisibility(View.GONE);
}
View chipView = view.findViewById(R.id.chip);
int chipResId = mColorChipResIds[(int)mAccountId % mColorChipResIds.length];
chipView.setBackgroundResource(chipResId);
// TODO do we use a different count for special mailboxes (total count vs. unread)
int count = -1;
text = cursor.getString(COLUMN_UNREAD_COUNT);
@ -443,9 +449,11 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
TextView countView = (TextView) view.findViewById(R.id.new_message_count);
// If the unread count is zero, not to show countView.
if (count > 0) {
nameView.setTypeface(Typeface.DEFAULT_BOLD);
countView.setVisibility(View.VISIBLE);
countView.setText(text);
} else {
nameView.setTypeface(Typeface.DEFAULT);
countView.setVisibility(View.GONE);
}