Convert AccountFolderList to fat title bar style.
Also sharing fat title bar layout with MailboxList now.
This commit is contained in:
parent
9e5ee4589f
commit
9150b3005f
|
@ -103,7 +103,6 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".activity.AccountFolderList"
|
||||
android:label="@string/accounts_title"
|
||||
android:launchMode="singleTop" >
|
||||
</activity>
|
||||
|
||||
|
|
|
@ -14,13 +14,17 @@
|
|||
limitations under the License.
|
||||
-->
|
||||
|
||||
<FrameLayout
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/list_fat_title" />
|
||||
|
||||
<ExpandableListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
/>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
android:gravity="center_vertical">
|
||||
<TextView
|
||||
android:id="@+id/folder_name"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
@ -45,7 +45,7 @@
|
|||
android:id="@+id/new_message_count"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
android:id="@+id/new_message_count"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
<?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.
|
||||
-->
|
||||
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- fat title over list views -->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center" >
|
||||
<View
|
||||
android:id="@+id/chip"
|
||||
android:background="@drawable/appointment_indicator_leftside_1"
|
||||
android:layout_width="4dip"
|
||||
android:layout_height="56dip"
|
||||
android:layout_centerVertical="true" />
|
||||
<LinearLayout
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="8dip"
|
||||
android:orientation="vertical" >
|
||||
<TextView
|
||||
android:id="@+id/account_name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/account_status"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/button_compose"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@*android:drawable/ic_menu_compose" />
|
||||
<!-- TODO: Make refresh & progress take the same space so we can toggle them -->
|
||||
<Button
|
||||
android:id="@+id/button_refresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@*android:drawable/ic_menu_refresh" />
|
||||
<!-- heavy padding & margining is just to make it flicker less when
|
||||
swapping with button. totally non-final. -->
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginRight="4dip"
|
||||
android:visibility="gone"
|
||||
android:paddingLeft="14dip"
|
||||
android:paddingRight="14dip"
|
||||
style="?android:attr/progressBarStyleSmall" />
|
||||
</LinearLayout>
|
||||
</merge>
|
|
@ -20,56 +20,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<!-- TODO: #include a common fat title bar -->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center" >
|
||||
<View
|
||||
android:id="@+id/chip"
|
||||
android:background="@drawable/appointment_indicator_leftside_1"
|
||||
android:layout_width="4dip"
|
||||
android:layout_height="56dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="4dip" />
|
||||
<LinearLayout
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical" >
|
||||
<TextView
|
||||
android:id="@+id/account_name"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/account_status"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorTertiary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/button_compose"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@*android:drawable/ic_menu_compose" />
|
||||
<!-- TODO: Make refresh & progress take the same space so we can toggle them -->
|
||||
<Button
|
||||
android:id="@+id/button_refresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@*android:drawable/ic_menu_refresh" />
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:paddingRight="10dip" />
|
||||
</LinearLayout>
|
||||
<include layout="@layout/list_fat_title" />
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
android:id="@+id/mailbox_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<TextView
|
||||
android:id="@+id/mailbox_status"
|
||||
|
@ -48,7 +48,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:background="@drawable/text_box_light"
|
||||
android:paddingLeft="10px"
|
||||
|
|
|
@ -53,7 +53,9 @@ import android.view.Menu;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.CursorTreeAdapter;
|
||||
import android.widget.ExpandableListView;
|
||||
|
@ -61,7 +63,7 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
|
||||
|
||||
public class AccountFolderList extends ExpandableListActivity {
|
||||
public class AccountFolderList extends ExpandableListActivity implements OnClickListener {
|
||||
private static final int DIALOG_REMOVE_ACCOUNT = 1;
|
||||
/**
|
||||
* Key codes used to open a debug settings screen.
|
||||
|
@ -78,6 +80,9 @@ public class AccountFolderList extends ExpandableListActivity {
|
|||
private EmailContent.Account mSelectedContextAccount;
|
||||
|
||||
ExpandableListView mListView;
|
||||
private View mRefreshButton;
|
||||
private View mProgress;
|
||||
|
||||
AccountsAdapter mListAdapter;
|
||||
|
||||
LoadAccountsTask mLoadAccountsTask;
|
||||
|
@ -133,6 +138,9 @@ public class AccountFolderList extends ExpandableListActivity {
|
|||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.account_folder_list);
|
||||
mListView = getExpandableListView();
|
||||
mListView.setItemsCanFocus(false);
|
||||
|
@ -144,6 +152,16 @@ public class AccountFolderList extends ExpandableListActivity {
|
|||
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);
|
||||
|
||||
setupSummaryCursors();
|
||||
|
||||
// Called only for filling cache of specialMailboxDisplayName
|
||||
|
@ -196,6 +214,17 @@ public class AccountFolderList extends ExpandableListActivity {
|
|||
}
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.button_compose:
|
||||
onCompose();
|
||||
break;
|
||||
case R.id.button_refresh:
|
||||
onRefresh(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupExpand(int groupPosition) {
|
||||
super.onGroupExpand(groupPosition);
|
||||
|
@ -500,6 +529,7 @@ public class AccountFolderList extends ExpandableListActivity {
|
|||
} else {
|
||||
EmailContent.Account account =
|
||||
EmailContent.Account.restoreAccountWithId(this, accountId);
|
||||
mHandler.progress(true);
|
||||
Controller.getInstance(getApplication()).updateMailboxList(
|
||||
account, mControllerCallback);
|
||||
}
|
||||
|
@ -679,7 +709,14 @@ public class AccountFolderList extends ExpandableListActivity {
|
|||
public void handleMessage(android.os.Message msg) {
|
||||
switch (msg.what) {
|
||||
case MSG_PROGRESS:
|
||||
setProgressBarIndeterminateVisibility(msg.arg1 != 0);
|
||||
boolean showProgress = (msg.arg1 != 0);
|
||||
if (showProgress) {
|
||||
mRefreshButton.setVisibility(View.GONE);
|
||||
mProgress.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mRefreshButton.setVisibility(View.VISIBLE);
|
||||
mProgress.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
super.handleMessage(msg);
|
||||
|
|
|
@ -30,7 +30,6 @@ import android.app.ListActivity;
|
|||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -400,9 +399,6 @@ public class MailboxList extends ListActivity implements OnItemClickListener, On
|
|||
super(context, null);
|
||||
mContext = context;
|
||||
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
Resources resources = context.getResources();
|
||||
// TODO get mailbox typename strings here
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue