Update Title bar to use custom titles
BUG: 2050630 * remove fat title bar * show new titles by using custom title bar
This commit is contained in:
parent
d382107bdc
commit
95993a4b84
@ -20,8 +20,6 @@
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/list_fat_title" />
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
|
50
res/layout/list_title.xml
Normal file
50
res/layout/list_title.xml
Normal file
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2009 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.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/screen"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<TextView android:id="@+id/title_left_text"
|
||||
android:gravity="center_vertical|left"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView android:id="@+id/title_right_text"
|
||||
android:gravity="center_vertical|right"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:textColor="#ffffffff"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ProgressBar android:id="@+id/title_progress_icon"
|
||||
style="?android:attr/progressBarStyleSmallTitle"
|
||||
android:visibility="gone"
|
||||
android:minWidth="10px"
|
||||
android:paddingRight="1dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
@ -20,8 +20,6 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<include layout="@layout/list_fat_title" />
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -63,8 +63,8 @@
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:background="@drawable/text_box_light"
|
||||
android:paddingLeft="10px"
|
||||
android:paddingRight="10px"
|
||||
android:minWidth="64px"
|
||||
android:paddingLeft="10dip"
|
||||
android:paddingRight="10dip"
|
||||
android:minWidth="64dip"
|
||||
android:gravity="right" />
|
||||
</LinearLayout>
|
||||
|
@ -172,6 +172,9 @@
|
||||
<!-- The summary section entry in the AccountFolder list to display all outboxes -->
|
||||
<string name="account_folder_list_summary_outbox">Outbox</string>
|
||||
|
||||
<!-- Title of the screen that shows a list of mailboxes for an account -->
|
||||
<string name="mailbox_list_title">Mailbox</string>
|
||||
|
||||
<!-- Appears at the bottom of list of messages; user selects to load more messages from that folder. -->
|
||||
<string name="message_list_load_more_messages_action">Load more messages</string>
|
||||
<!-- Appears at the bottom of list of messages of outbox;
|
||||
@ -375,9 +378,6 @@
|
||||
<string name="account_setup_options_default_label">Send email from this account by default.</string>
|
||||
<!-- In Account setup options & Account Settings screens, check box for new-mail notification -->
|
||||
<string name="account_setup_options_notify_label">Notify me when email arrives.</string>
|
||||
<!-- In Account setup options & Account Settings screens, optional check box to also sync
|
||||
contacts -->
|
||||
<string name="account_setup_options_sync_contacts_label">Sync contacts from this account.</string>
|
||||
<!-- Dialog title when "setup" could not finish -->
|
||||
<string name="account_setup_failed_dlg_title">Setup could not finish</string>
|
||||
<!-- In Account setup options screen, label for email check frequency selector -->
|
||||
|
@ -59,6 +59,7 @@ import android.view.View.OnClickListener;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.CursorAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
@ -81,8 +82,7 @@ public class AccountFolderList extends ListActivity
|
||||
private EmailContent.Account mSelectedContextAccount;
|
||||
|
||||
private ListView mListView;
|
||||
private View mRefreshButton;
|
||||
private View mProgress;
|
||||
private ProgressBar mProgressIcon;
|
||||
|
||||
AccountsAdapter mListAdapter;
|
||||
|
||||
@ -157,9 +157,13 @@ public class AccountFolderList extends ListActivity
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
||||
setContentView(R.layout.account_folder_list);
|
||||
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
|
||||
R.layout.list_title);
|
||||
|
||||
mProgressIcon = (ProgressBar) findViewById(R.id.title_progress_icon);
|
||||
|
||||
mListView = getListView();
|
||||
mListView.setItemsCanFocus(false);
|
||||
mListView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET);
|
||||
@ -171,19 +175,11 @@ public class AccountFolderList extends ListActivity
|
||||
mSelectedContextAccount = (Account) icicle.getParcelable(ICICLE_SELECTED_ACCOUNT);
|
||||
}
|
||||
|
||||
// Set up fat title bar elements
|
||||
findViewById(R.id.chip).setVisibility(View.GONE);
|
||||
findViewById(R.id.button_compose).setOnClickListener(this);
|
||||
mRefreshButton = findViewById(R.id.button_refresh);
|
||||
mRefreshButton.setOnClickListener(this);
|
||||
((TextView) findViewById(R.id.account_name)).setText(R.string.accounts_title);
|
||||
findViewById(R.id.account_status).setVisibility(View.GONE);
|
||||
mProgress = findViewById(R.id.progress);
|
||||
mProgress.setVisibility(View.GONE);
|
||||
|
||||
// Called only for filling cache of specialMailboxDisplayName
|
||||
getSpecialMailboxDisplayName(this, 0);
|
||||
|
||||
((TextView) findViewById(R.id.title_left_text)).setText(R.string.app_name);
|
||||
|
||||
mLoadAccountsTask = (LoadAccountsTask) new LoadAccountsTask().execute();
|
||||
}
|
||||
|
||||
@ -586,11 +582,9 @@ public class AccountFolderList extends ListActivity
|
||||
case MSG_PROGRESS:
|
||||
boolean showProgress = (msg.arg1 != 0);
|
||||
if (showProgress) {
|
||||
mRefreshButton.setVisibility(View.GONE);
|
||||
mProgress.setVisibility(View.VISIBLE);
|
||||
mProgressIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mRefreshButton.setVisibility(View.VISIBLE);
|
||||
mProgress.setVisibility(View.GONE);
|
||||
mProgressIcon.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -49,6 +49,7 @@ import android.widget.AdapterView;
|
||||
import android.widget.CursorAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
|
||||
@ -62,10 +63,7 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
|
||||
+ " AND " + MailboxColumns.FLAG_VISIBLE + "=1";
|
||||
// UI support
|
||||
private ListView mListView;
|
||||
private TextView mAccountNameView;
|
||||
private TextView mAccountStatusView;
|
||||
private View mRefreshButton;
|
||||
private View mProgress;
|
||||
private ProgressBar mProgressIcon;
|
||||
|
||||
private MailboxListAdapter mListAdapter;
|
||||
private MailboxListHandler mHandler = new MailboxListHandler();
|
||||
@ -115,16 +113,15 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
||||
setContentView(R.layout.mailbox_list);
|
||||
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
|
||||
R.layout.list_title);
|
||||
|
||||
// Custom TItle
|
||||
mProgressIcon = (ProgressBar) findViewById(R.id.title_progress_icon);
|
||||
|
||||
mListView = getListView();
|
||||
findViewById(R.id.button_compose).setOnClickListener(this);
|
||||
mRefreshButton = findViewById(R.id.button_refresh);
|
||||
mRefreshButton.setOnClickListener(this);
|
||||
mAccountNameView = (TextView) findViewById(R.id.account_name);
|
||||
mAccountStatusView = (TextView) findViewById(R.id.account_status);
|
||||
mProgress = findViewById(R.id.progress);
|
||||
|
||||
mListView.setOnItemClickListener(this);
|
||||
mListView.setItemsCanFocus(false);
|
||||
@ -141,11 +138,7 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
|
||||
finish();
|
||||
}
|
||||
|
||||
// setup fat fitle - color chip, name, status, refresh/progress
|
||||
int chipResId = mColorChipResIds[(int)mAccountId % mColorChipResIds.length];
|
||||
findViewById(R.id.chip).setBackgroundResource(chipResId);
|
||||
mAccountStatusView.setVisibility(View.GONE);
|
||||
mProgress.setVisibility(View.GONE);
|
||||
((TextView)findViewById(R.id.title_left_text)).setText(R.string.mailbox_list_title);
|
||||
|
||||
// Go to the database for the account name
|
||||
new AsyncTask<Void, Void, String>() {
|
||||
@ -171,7 +164,7 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
|
||||
// something is wrong with this account
|
||||
finish();
|
||||
}
|
||||
mAccountNameView.setText(result);
|
||||
((TextView)findViewById(R.id.title_right_text)).setText(result);
|
||||
}
|
||||
|
||||
}.execute();
|
||||
@ -340,11 +333,9 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
|
||||
case MSG_PROGRESS:
|
||||
boolean showProgress = (msg.arg1 != 0);
|
||||
if (showProgress) {
|
||||
mRefreshButton.setVisibility(View.GONE);
|
||||
mProgress.setVisibility(View.VISIBLE);
|
||||
mProgressIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mRefreshButton.setVisibility(View.VISIBLE);
|
||||
mProgress.setVisibility(View.GONE);
|
||||
mProgressIcon.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -43,6 +43,7 @@ import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
@ -57,6 +58,7 @@ import android.widget.AdapterView;
|
||||
import android.widget.CursorAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
@ -101,6 +103,9 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
||||
private MessageListHandler mHandler = new MessageListHandler();
|
||||
private Controller mController = Controller.getInstance(getApplication());
|
||||
private ControllerResults mControllerCallback = new ControllerResults();
|
||||
private TextView mLeftTitle;
|
||||
private TextView mRightTitle;
|
||||
private ProgressBar mProgressIcon;
|
||||
|
||||
private static final int[] mColorChipResIds = new int[] {
|
||||
R.drawable.appointment_indicator_leftside_1,
|
||||
@ -145,9 +150,9 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
||||
};
|
||||
|
||||
private static final int MAILBOX_DISPLAY_NAME_COLUMN_ID = 0;
|
||||
private static final int MAILBOX_ACCOUNT_KEY_ID = 1;
|
||||
private static final int MAILBOX_ACCOUNT_KEY_COLUMN_ID = 1;
|
||||
private static final String[] MAILBOX_NAME_PROJECTION = new String[] {
|
||||
MailboxColumns.DISPLAY_NAME, MailboxColumns.ACCOUNT_KEY };
|
||||
MailboxColumns.DISPLAY_NAME, MailboxColumns.ACCOUNT_KEY};
|
||||
|
||||
private static final int ACCOUNT_DISPLAY_NAME_COLUMN_ID = 0;
|
||||
private static final String[] ACCOUNT_NAME_PROJECTION = new String[] {
|
||||
@ -223,15 +228,21 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
||||
setContentView(R.layout.message_list);
|
||||
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
|
||||
R.layout.list_title);
|
||||
|
||||
mListView = getListView();
|
||||
mMultiSelectPanel = findViewById(R.id.footer_organize);
|
||||
mReadUnreadButton = findViewById(R.id.btn_read_unread);
|
||||
mFavoriteButton = findViewById(R.id.btn_multi_favorite);
|
||||
mDeleteButton = findViewById(R.id.btn_multi_delete);
|
||||
|
||||
mLeftTitle = (TextView) findViewById(R.id.title_left_text);
|
||||
mRightTitle = (TextView) findViewById(R.id.title_right_text);
|
||||
mProgressIcon = (ProgressBar) findViewById(R.id.title_progress_icon);
|
||||
|
||||
mReadUnreadButton.setOnClickListener(this);
|
||||
mFavoriteButton.setOnClickListener(this);
|
||||
mDeleteButton.setOnClickListener(this);
|
||||
@ -515,7 +526,7 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
||||
* @param selectedSet The current list of selected items
|
||||
*/
|
||||
private void onMultiToggleRead(Set<Long> selectedSet) {
|
||||
int numChanged = toggleMultiple(selectedSet, new MultiToggleHelper() {
|
||||
toggleMultiple(selectedSet, new MultiToggleHelper() {
|
||||
|
||||
public boolean getField(long messageId, Cursor c) {
|
||||
return c.getInt(MessageListAdapter.COLUMN_READ) == 0;
|
||||
@ -538,7 +549,7 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
||||
* @param selectedSet The current list of selected items
|
||||
*/
|
||||
private void onMultiToggleFavorite(Set<Long> selectedSet) {
|
||||
int numChanged = toggleMultiple(selectedSet, new MultiToggleHelper() {
|
||||
toggleMultiple(selectedSet, new MultiToggleHelper() {
|
||||
|
||||
public boolean getField(long messageId, Cursor c) {
|
||||
return c.getInt(MessageListAdapter.COLUMN_FAVORITE) != 0;
|
||||
@ -951,6 +962,20 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
||||
|
||||
@Override
|
||||
protected String[] doInBackground(Void... params) {
|
||||
// Check special Mailboxes
|
||||
if (mMailboxKey == MessageList.QUERY_ALL_INBOXES) {
|
||||
return new String[] {null,
|
||||
getString(R.string.account_folder_list_summary_inbox)};
|
||||
} else if (mMailboxKey == MessageList.QUERY_ALL_FAVORITES) {
|
||||
return new String[] {null,
|
||||
getString(R.string.account_folder_list_summary_favorite)};
|
||||
} else if (mMailboxKey == MessageList.QUERY_ALL_DRAFTS) {
|
||||
return new String[] {null,
|
||||
getString(R.string.account_folder_list_summary_drafts)};
|
||||
} else if (mMailboxKey == MessageList.QUERY_ALL_OUTBOX) {
|
||||
return new String[] {null,
|
||||
getString(R.string.account_folder_list_summary_outbox)};
|
||||
}
|
||||
String accountName = null;
|
||||
String mailboxName = null;
|
||||
String accountKey = null;
|
||||
@ -960,7 +985,7 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
||||
try {
|
||||
if (c.moveToFirst()) {
|
||||
mailboxName = c.getString(MAILBOX_DISPLAY_NAME_COLUMN_ID);
|
||||
accountKey = c.getString(MAILBOX_ACCOUNT_KEY_ID);
|
||||
accountKey = c.getString(MAILBOX_ACCOUNT_KEY_COLUMN_ID);
|
||||
}
|
||||
} finally {
|
||||
c.close();
|
||||
@ -982,9 +1007,12 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String[] names) {
|
||||
if (names[0] != null && names[1] != null) {
|
||||
MessageList.this.setTitle(getString(R.string.message_list_title, names[0],
|
||||
names[1]));
|
||||
Log.d("MessageList", "ACCOUNT:" + names[0] + "MAILBOX" + names[1]);
|
||||
if (names[0] != null) {
|
||||
mRightTitle.setText(names[0]);
|
||||
}
|
||||
if (names[1] != null) {
|
||||
mLeftTitle.setText(names[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1001,7 +1029,11 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
|
||||
switch (msg.what) {
|
||||
case MSG_PROGRESS:
|
||||
boolean visible = (msg.arg1 != 0);
|
||||
setProgressBarIndeterminateVisibility(visible);
|
||||
if (visible) {
|
||||
mProgressIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mProgressIcon.setVisibility(View.GONE);
|
||||
}
|
||||
if (mListFooterProgress != null) {
|
||||
mListFooterProgress.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user