Merge "Fix feedback from Email settings" into jb-ub-mail-ur10

This commit is contained in:
Paul Westbrook 2013-07-11 23:27:23 +00:00 committed by Android (Google) Code Review
commit e13d9f6ba5
2 changed files with 23 additions and 3 deletions

View File

@ -118,6 +118,8 @@ public class AccountSettings extends PreferenceActivity implements FeedbackEnabl
private long mDeletingAccountId = -1;
private boolean mShowDebugMenu;
private List<Header> 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);

View File

@ -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();