Merge "Add in settings menu in Welcome."

This commit is contained in:
Ben Komalo 2011-07-25 13:41:48 -07:00 committed by Android (Google) Code Review
commit 50f4fbf2f6
2 changed files with 52 additions and 0 deletions

27
res/menu/welcome.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->
<!-- Menu items for the "Welcome" screen when the user is waiting for initial
sync -->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/account_settings"
android:title="@string/settings_action"
android:icon="@android:drawable/ic_menu_preferences"
/>
</menu>

View File

@ -24,11 +24,14 @@ import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.LayoutParams;
import com.android.email.Email; import com.android.email.Email;
import com.android.email.R; import com.android.email.R;
import com.android.email.activity.setup.AccountSettings;
import com.android.email.activity.setup.AccountSetupBasics; import com.android.email.activity.setup.AccountSetupBasics;
import com.android.email.service.EmailServiceUtils; import com.android.email.service.EmailServiceUtils;
import com.android.email.service.MailService; import com.android.email.service.MailService;
@ -197,6 +200,27 @@ public class Welcome extends Activity {
Email.setNotifyUiAccountsChanged(false); Email.setNotifyUiAccountsChanged(false);
} }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Only create the menu if we had to stop and show a loading spinner - otherwise
// this is a transient activity with no UI.
if (mInboxFinder == null) {
return super.onCreateOptionsMenu(menu);
}
getMenuInflater().inflate(R.menu.welcome, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.account_settings) {
AccountSettings.actionSettings(this, mAccountId);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override @Override
protected void onStop() { protected void onStop() {
// Cancel all running tasks. // Cancel all running tasks.
@ -258,6 +282,7 @@ public class Welcome extends Activity {
R.layout.waiting_for_sync_message, null); R.layout.waiting_for_sync_message, null);
addContentView(mWaitingForSyncView, new LayoutParams( addContentView(mWaitingForSyncView, new LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
invalidateOptionsMenu();
} }
/** /**