[Rlog79a] Disallow empty feedback messages
Change-Id: I30f7c07606e466c3c9538adad94024d00f0901demain
parent
6b574f8056
commit
d3f718fccd
|
@ -23,4 +23,7 @@
|
||||||
<string name="research_splash_content" translatable="false"></string>
|
<string name="research_splash_content" translatable="false"></string>
|
||||||
<string name="research_account_type" translatable="false"></string>
|
<string name="research_account_type" translatable="false"></string>
|
||||||
<string name="research_allowed_account_domain" translatable="false"></string>
|
<string name="research_allowed_account_domain" translatable="false"></string>
|
||||||
|
<!-- Message informing the user that the feedback string must not be empty [CHAR LIMIT=100] -->
|
||||||
|
<!-- TODO: remove translatable=false attribute once text is stable -->
|
||||||
|
<string name="research_feedback_empty_feedback_error_message" translatable="false">The feedback field must not be empty.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.app.Activity;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -28,6 +29,7 @@ import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
|
|
||||||
|
@ -96,12 +98,18 @@ public class FeedbackFragment extends Fragment implements OnClickListener {
|
||||||
} else if (view == mSendButton) {
|
} else if (view == mSendButton) {
|
||||||
final Editable editable = mEditText.getText();
|
final Editable editable = mEditText.getText();
|
||||||
final String feedbackContents = editable.toString();
|
final String feedbackContents = editable.toString();
|
||||||
|
if (TextUtils.isEmpty(feedbackContents)) {
|
||||||
|
Toast.makeText(getActivity(),
|
||||||
|
R.string.research_feedback_empty_feedback_error_message,
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
} else {
|
||||||
final boolean isIncludingAccountName = isIncludingAccountName();
|
final boolean isIncludingAccountName = isIncludingAccountName();
|
||||||
researchLogger.sendFeedback(feedbackContents,
|
researchLogger.sendFeedback(feedbackContents,
|
||||||
false /* isIncludingHistory */, isIncludingAccountName, hasUserRecording());
|
false /* isIncludingHistory */, isIncludingAccountName, hasUserRecording());
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
researchLogger.setFeedbackDialogBundle(null);
|
researchLogger.setFeedbackDialogBundle(null);
|
||||||
researchLogger.onLeavingSendFeedbackDialog();
|
researchLogger.onLeavingSendFeedbackDialog();
|
||||||
|
}
|
||||||
} else if (view == mCancelButton) {
|
} else if (view == mCancelButton) {
|
||||||
Log.d(TAG, "Finishing");
|
Log.d(TAG, "Finishing");
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
|
|
Loading…
Reference in New Issue