diff --git a/src/com/android/email/activity/setup/AccountSettings.java b/src/com/android/email/activity/setup/AccountSettings.java index 0d8a1f87c..fbea8586c 100644 --- a/src/com/android/email/activity/setup/AccountSettings.java +++ b/src/com/android/email/activity/setup/AccountSettings.java @@ -118,6 +118,8 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl private long mDeletingAccountId = -1; private boolean mShowDebugMenu; private List
mGeneratedHeaders; + private Uri mFeedbackUri; + private MenuItem mFeedbackMenuItem; // Async Tasks private LoadAccountListTask mLoadAccountListTask; @@ -223,6 +225,8 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl updateAccounts(); } }; + + mFeedbackUri = Utils.getValidUri(getString(R.string.email_feedback_uri)); } @Override @@ -268,9 +272,23 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.settings_menu, menu); + + mFeedbackMenuItem = menu.findItem(R.id.feedback_menu_item); return true; } + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + super.onPrepareOptionsMenu(menu); + + if (mFeedbackMenuItem != null) { + // We only want to enable the feedback menu item, if there is a valid feedback uri + mFeedbackMenuItem.setVisible(!Uri.EMPTY.equals(mFeedbackUri)); + } + return true; + } + + @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { @@ -285,8 +303,7 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl onAddNewAccount(); break; case R.id.feedback_menu_item: - final Uri feedbackUri = Utils.getValidUri(getString(R.string.email_feedback_uri)); - Utils.sendFeedback(this, feedbackUri, false /* reportingProblem */); + Utils.sendFeedback(this, mFeedbackUri, false /* reportingProblem */); break; default: return super.onOptionsItemSelected(item); diff --git a/src/com/android/email/provider/EmailProvider.java b/src/com/android/email/provider/EmailProvider.java index 1563fa879..e81f986f6 100644 --- a/src/com/android/email/provider/EmailProvider.java +++ b/src/com/android/email/provider/EmailProvider.java @@ -2036,7 +2036,10 @@ public class EmailProvider extends ContentProvider { final String feedbackUri = context.getString(R.string.email_feedback_uri); if (!TextUtils.isEmpty(feedbackUri)) { - builder.add(UIProvider.AccountColumns.SEND_FEEDBACK_INTENT_URI, feedbackUri); + // This string needs to be in single quotes, as it will be used as a constant + // in a sql expression + builder.add(UIProvider.AccountColumns.SEND_FEEDBACK_INTENT_URI, + "'" + feedbackUri + "'"); } sAccountListMap = builder.build();