Merge "b/5613906 Don't show account picker for 0 or 1 account" into ics-mr1

This commit is contained in:
RoboErik 2011-11-15 10:05:03 -08:00 committed by Android (Google) Code Review
commit 438a54a900

View File

@ -16,6 +16,13 @@
package com.android.email.activity; package com.android.email.activity;
import com.android.email.R;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent.AccountColumns;
import com.android.emailcommon.provider.EmailContent.MailboxColumns;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.provider.Mailbox;
import android.app.Activity; import android.app.Activity;
import android.app.FragmentTransaction; import android.app.FragmentTransaction;
import android.app.ListFragment; import android.app.ListFragment;
@ -37,13 +44,6 @@ import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView; import android.widget.ListView;
import android.widget.SimpleCursorAdapter; import android.widget.SimpleCursorAdapter;
import com.android.email.R;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent.AccountColumns;
import com.android.emailcommon.provider.EmailContent.MailboxColumns;
import com.android.emailcommon.provider.HostAuth;
import com.android.emailcommon.provider.Mailbox;
/** /**
* Fragment containing a list of accounts to show during shortcut creation. * Fragment containing a list of accounts to show during shortcut creation.
* <p> * <p>
@ -165,6 +165,7 @@ public abstract class ShortcutPickerFragment extends ListFragment
/** Account picker */ /** Account picker */
public static class AccountShortcutPickerFragment extends ShortcutPickerFragment { public static class AccountShortcutPickerFragment extends ShortcutPickerFragment {
private volatile Boolean mLoadFinished = new Boolean(false);
private final static String[] ACCOUNT_FROM_COLUMNS = new String[] { private final static String[] ACCOUNT_FROM_COLUMNS = new String[] {
AccountColumns.DISPLAY_NAME, AccountColumns.DISPLAY_NAME,
}; };
@ -173,6 +174,9 @@ public abstract class ShortcutPickerFragment extends ListFragment
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
getActivity().setTitle(R.string.account_shortcut_picker_title); getActivity().setTitle(R.string.account_shortcut_picker_title);
if (!mLoadFinished) {
getActivity().setVisible(false);
}
} }
@Override @Override
@ -201,6 +205,8 @@ public abstract class ShortcutPickerFragment extends ListFragment
return; return;
} }
super.onLoadFinished(loader, data); super.onLoadFinished(loader, data);
mLoadFinished = true;
getActivity().setVisible(true);
} }
@Override @Override
@ -312,6 +318,7 @@ public abstract class ShortcutPickerFragment extends ListFragment
/** Selection for just the INBOX of an account */ /** Selection for just the INBOX of an account */
private final static String INBOX_ONLY_SELECTION = ALL_MAILBOX_SELECTION + private final static String INBOX_ONLY_SELECTION = ALL_MAILBOX_SELECTION +
" AND " + MailboxColumns.TYPE + " = " + Mailbox.TYPE_INBOX; " AND " + MailboxColumns.TYPE + " = " + Mailbox.TYPE_INBOX;
private volatile Boolean mLoadFinished = new Boolean(false);
/** The currently selected account */ /** The currently selected account */
private Account mAccount; private Account mAccount;
/** The filter values; default to allow all mailboxes */ /** The filter values; default to allow all mailboxes */
@ -350,6 +357,9 @@ public abstract class ShortcutPickerFragment extends ListFragment
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
getActivity().setTitle(R.string.mailbox_shortcut_picker_title); getActivity().setTitle(R.string.mailbox_shortcut_picker_title);
if (!mLoadFinished) {
getActivity().setVisible(false);
}
} }
@Override @Override
@ -400,6 +410,8 @@ public abstract class ShortcutPickerFragment extends ListFragment
return; return;
} }
super.onLoadFinished(loader, data); super.onLoadFinished(loader, data);
mLoadFinished = true;
getActivity().setVisible(true);
} }
@Override @Override