ActionBar for AccountFolderList
Displays actionbar properly, and the two buttons work. Submitting with one open issue: 1. The indeterminate progress indicator is not directly supported in the ActionBar. We're waiting for a UI call or framework support. Until then there is a placeholder using an incorrect icon to show progress. Change-Id: Iaf1546931376cc5b540820cd0fc020ebd176dabf
This commit is contained in:
parent
d6d874f8c6
commit
0d6ce631a1
|
@ -143,7 +143,8 @@
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.AccountFolderList"
|
android:name=".activity.AccountFolderList"
|
||||||
android:launchMode="singleTop" >
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@android:style/Theme.WithActionBar" >
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
|
|
@ -15,15 +15,17 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:id="@+id/check_mail"
|
|
||||||
android:alphabeticShortcut="r"
|
|
||||||
android:title="@string/refresh_action"
|
|
||||||
android:icon="@drawable/ic_menu_refresh"
|
|
||||||
/>
|
|
||||||
<item android:id="@+id/compose"
|
<item android:id="@+id/compose"
|
||||||
android:alphabeticShortcut="c"
|
android:alphabeticShortcut="c"
|
||||||
android:title="@string/compose_action"
|
android:title="@string/compose_action"
|
||||||
android:icon="@drawable/ic_menu_compose"
|
android:icon="@drawable/ic_menu_compose"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
/>
|
||||||
|
<item android:id="@+id/check_mail"
|
||||||
|
android:alphabeticShortcut="r"
|
||||||
|
android:title="@string/refresh_action"
|
||||||
|
android:icon="@drawable/ic_menu_refresh"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
/>
|
/>
|
||||||
<item android:id="@+id/add_new_account"
|
<item android:id="@+id/add_new_account"
|
||||||
android:title="@string/add_account_action"
|
android:title="@string/add_account_action"
|
||||||
|
|
|
@ -41,10 +41,7 @@ import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ProgressBar;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class AccountFolderList extends Activity implements AccountFolderListFragment.Callback {
|
public class AccountFolderList extends Activity implements AccountFolderListFragment.Callback {
|
||||||
|
@ -62,7 +59,7 @@ public class AccountFolderList extends Activity implements AccountFolderListFrag
|
||||||
private EmailContent.Account mSelectedContextAccount;
|
private EmailContent.Account mSelectedContextAccount;
|
||||||
|
|
||||||
// UI Support
|
// UI Support
|
||||||
private ProgressBar mProgressIcon;
|
private boolean mProgressRunning;
|
||||||
private AccountFolderListFragment mListFragment;
|
private AccountFolderListFragment mListFragment;
|
||||||
|
|
||||||
private Controller.Result mControllerCallback;
|
private Controller.Result mControllerCallback;
|
||||||
|
@ -81,14 +78,12 @@ public class AccountFolderList extends Activity implements AccountFolderListFrag
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
|
|
||||||
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
// STOPSHIP make progress work properly - temporarily missing from ActionBar
|
||||||
|
// requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); // this disables ActionBar
|
||||||
setContentView(R.layout.account_folder_list);
|
setContentView(R.layout.account_folder_list);
|
||||||
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
|
|
||||||
R.layout.list_title);
|
|
||||||
|
|
||||||
mControllerCallback = new ControllerResultUiThreadWrapper<ControllerResults>(
|
mControllerCallback = new ControllerResultUiThreadWrapper<ControllerResults>(
|
||||||
new Handler(), new ControllerResults());
|
new Handler(), new ControllerResults());
|
||||||
mProgressIcon = (ProgressBar) findViewById(R.id.title_progress_icon);
|
|
||||||
mListFragment =
|
mListFragment =
|
||||||
(AccountFolderListFragment) findFragmentById(R.id.account_folder_list_fragment);
|
(AccountFolderListFragment) findFragmentById(R.id.account_folder_list_fragment);
|
||||||
mListFragment.bindActivityInfo(this);
|
mListFragment.bindActivityInfo(this);
|
||||||
|
@ -97,7 +92,7 @@ public class AccountFolderList extends Activity implements AccountFolderListFrag
|
||||||
mSelectedContextAccount = (Account) icicle.getParcelable(ICICLE_SELECTED_ACCOUNT);
|
mSelectedContextAccount = (Account) icicle.getParcelable(ICICLE_SELECTED_ACCOUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
((TextView) findViewById(R.id.title_left_text)).setText(R.string.app_name);
|
mProgressRunning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -270,6 +265,20 @@ public class AccountFolderList extends Activity implements AccountFolderListFrag
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// STOPSHIP - this is a placeholder if/until there's support for progress in actionbar
|
||||||
|
// Remove it, or replace with a better icon
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
|
super.onPrepareOptionsMenu(menu);
|
||||||
|
MenuItem item = menu.findItem(R.id.check_mail);
|
||||||
|
if (mProgressRunning) {
|
||||||
|
item.setIcon(android.R.drawable.progress_indeterminate_horizontal);
|
||||||
|
} else {
|
||||||
|
item.setIcon(R.drawable.ic_menu_refresh);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
|
@ -292,7 +301,11 @@ public class AccountFolderList extends Activity implements AccountFolderListFrag
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showProgressIcon(boolean show) {
|
private void showProgressIcon(boolean show) {
|
||||||
mProgressIcon.setVisibility(show ? View.VISIBLE : View.GONE);
|
// STOPSHIP: This doesn't work, pending fix is bug b/2802962
|
||||||
|
//setProgressBarIndeterminateVisibility(show);
|
||||||
|
// STOPSHIP: This is a hack used to replace the refresh icon with a spinner
|
||||||
|
mProgressRunning = show;
|
||||||
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue