Fix user recording dialog
Clicking the "include recording" checkbox in the user feedback dialog did nothing. The code was relying on the state of the checkbox, rather than keeping its own state. Fixing this addresses the bug. Change-Id: I559d57a4e11f869f6e6f5e5de7878f765531a203main
parent
3970352ea9
commit
fdc90d4a58
|
@ -81,10 +81,7 @@ public class FeedbackFragment extends Fragment implements OnClickListener {
|
||||||
public void onClick(final View view) {
|
public void onClick(final View view) {
|
||||||
final ResearchLogger researchLogger = ResearchLogger.getInstance();
|
final ResearchLogger researchLogger = ResearchLogger.getInstance();
|
||||||
if (view == mIncludingUserRecordingCheckBox) {
|
if (view == mIncludingUserRecordingCheckBox) {
|
||||||
if (hasUserRecording()) {
|
if (mIncludingUserRecordingCheckBox.isChecked()) {
|
||||||
// Remove the recording
|
|
||||||
setHasUserRecording(false);
|
|
||||||
} else {
|
|
||||||
final Bundle bundle = new Bundle();
|
final Bundle bundle = new Bundle();
|
||||||
onSaveInstanceState(bundle);
|
onSaveInstanceState(bundle);
|
||||||
|
|
||||||
|
@ -103,9 +100,9 @@ public class FeedbackFragment extends Fragment implements OnClickListener {
|
||||||
R.string.research_feedback_empty_feedback_error_message,
|
R.string.research_feedback_empty_feedback_error_message,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
final boolean isIncludingAccountName = isIncludingAccountName();
|
final boolean isIncludingAccountName = mIncludingAccountNameCheckBox.isChecked();
|
||||||
researchLogger.sendFeedback(feedbackContents,
|
researchLogger.sendFeedback(feedbackContents, false /* isIncludingHistory */,
|
||||||
false /* isIncludingHistory */, isIncludingAccountName, hasUserRecording());
|
isIncludingAccountName, mIncludingUserRecordingCheckBox.isChecked());
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
researchLogger.setFeedbackDialogBundle(null);
|
researchLogger.setFeedbackDialogBundle(null);
|
||||||
researchLogger.onLeavingSendFeedbackDialog();
|
researchLogger.onLeavingSendFeedbackDialog();
|
||||||
|
@ -125,29 +122,13 @@ public class FeedbackFragment extends Fragment implements OnClickListener {
|
||||||
final String savedFeedbackString = mEditText.getText().toString();
|
final String savedFeedbackString = mEditText.getText().toString();
|
||||||
|
|
||||||
bundle.putString(KEY_FEEDBACK_STRING, savedFeedbackString);
|
bundle.putString(KEY_FEEDBACK_STRING, savedFeedbackString);
|
||||||
bundle.putBoolean(KEY_INCLUDE_ACCOUNT_NAME, isIncludingAccountName());
|
bundle.putBoolean(KEY_INCLUDE_ACCOUNT_NAME, mIncludingAccountNameCheckBox.isChecked());
|
||||||
bundle.putBoolean(KEY_HAS_USER_RECORDING, hasUserRecording());
|
bundle.putBoolean(KEY_HAS_USER_RECORDING, mIncludingUserRecordingCheckBox.isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreState(final Bundle bundle) {
|
private void restoreState(final Bundle bundle) {
|
||||||
mEditText.setText(bundle.getString(KEY_FEEDBACK_STRING));
|
mEditText.setText(bundle.getString(KEY_FEEDBACK_STRING));
|
||||||
setIsIncludingAccountName(bundle.getBoolean(KEY_INCLUDE_ACCOUNT_NAME));
|
mIncludingAccountNameCheckBox.setChecked(bundle.getBoolean(KEY_INCLUDE_ACCOUNT_NAME));
|
||||||
setHasUserRecording(bundle.getBoolean(KEY_HAS_USER_RECORDING));
|
mIncludingUserRecordingCheckBox.setChecked(bundle.getBoolean(KEY_HAS_USER_RECORDING));
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasUserRecording() {
|
|
||||||
return mIncludingUserRecordingCheckBox.isChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setHasUserRecording(final boolean hasRecording) {
|
|
||||||
mIncludingUserRecordingCheckBox.setChecked(hasRecording);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isIncludingAccountName() {
|
|
||||||
return mIncludingAccountNameCheckBox.isChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setIsIncludingAccountName(final boolean isIncludingAccountName) {
|
|
||||||
mIncludingAccountNameCheckBox.setChecked(isIncludingAccountName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue