use of com.inceptai.dobby.database.FeedbackRecord in project dobby-android by InceptAi.
the class WifiDocDialogFragment method createFeedbackFormDialog.
private Dialog createFeedbackFormDialog(Bundle bundle) {
final int parentViewId = bundle.getInt(PARENT_VIEW_ID);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
rootView = inflater.inflate(R.layout.feedback_dialog_fragment, null);
Button submitButton = (Button) rootView.findViewById(R.id.feedback_submit_button);
submitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//FrameLayout fl = (FrameLayout) getActivity().findViewById(R.id.wifi_doc_placeholder_fl);
FrameLayout fl = (FrameLayout) getActivity().findViewById(parentViewId);
Snackbar.make(fl, "Thanks for your feedback !", Snackbar.LENGTH_SHORT).show();
//Write the feedback to database
FeedbackRecord feedbackRecord = createFeedbackRecord(rootView);
feedbackDatabaseWriter.writeFeedbackToDatabase(feedbackRecord);
dismiss();
}
});
Button cancelButton = (Button) rootView.findViewById(R.id.feedback_cancel_button);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//FrameLayout fl = (FrameLayout) getActivity().findViewById(R.id.wifi_doc_placeholder_fl);
FrameLayout fl = (FrameLayout) getActivity().findViewById(parentViewId);
Snackbar.make(fl, "Feedback cancelled.", Snackbar.LENGTH_SHORT).show();
dismiss();
}
});
builder.setView(rootView);
return builder.create();
}
use of com.inceptai.dobby.database.FeedbackRecord in project dobby-android by InceptAi.
the class WifiDocDialogFragment method createFeedbackRecord.
private FeedbackRecord createFeedbackRecord(View rootView) {
FeedbackRecord feedbackRecord = new FeedbackRecord(((DobbyApplication) getActivity().getApplication()).getUserUuid());
RadioGroup helpfulRg = (RadioGroup) rootView.findViewById(R.id.helpful_rb);
int id = helpfulRg.getCheckedRadioButtonId();
switch(id) {
case R.id.radio_helpful_yes:
feedbackRecord.setHelpfulScore(FeedbackRecord.HelpfulScore.HELPFUL);
break;
case R.id.radio_helpful_maybe:
feedbackRecord.setHelpfulScore(FeedbackRecord.HelpfulScore.MAYBE);
break;
case R.id.radio_helpful_no:
feedbackRecord.setHelpfulScore(FeedbackRecord.HelpfulScore.NOT_HELPFUL);
break;
default:
feedbackRecord.setHelpfulScore(FeedbackRecord.HelpfulScore.UNKNOWN);
}
RadioGroup recommendRg = (RadioGroup) rootView.findViewById(R.id.recommend_rg);
id = recommendRg.getCheckedRadioButtonId();
switch(id) {
case R.id.radio_recommend_yes:
feedbackRecord.setPromotionScore(FeedbackRecord.PromotionScore.YES);
break;
case R.id.radio_recommend_maybe:
feedbackRecord.setPromotionScore(FeedbackRecord.PromotionScore.MAYBE);
break;
case R.id.radio_recommend_no:
feedbackRecord.setPromotionScore(FeedbackRecord.PromotionScore.NO);
break;
default:
feedbackRecord.setPromotionScore(FeedbackRecord.PromotionScore.UNKNOWN);
}
EditText commentsEt = (EditText) rootView.findViewById(R.id.detailed_comment_edittext);
String comments = commentsEt.getText().toString();
if (comments != null && !comments.isEmpty()) {
feedbackRecord.setUserFeedback(comments);
}
EditText userEmail = (EditText) rootView.findViewById(R.id.email_et);
String emailAddress = userEmail.getText().toString();
if (!emailAddress.isEmpty()) {
feedbackRecord.setEmailAddress(emailAddress);
}
return feedbackRecord;
}
use of com.inceptai.dobby.database.FeedbackRecord in project dobby-android by InceptAi.
the class WifiDocDialogFragment method createFeedbackFormDialogNoToast.
private Dialog createFeedbackFormDialogNoToast(Bundle bundle) {
final int parentViewId = bundle.getInt(PARENT_VIEW_ID);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
rootView = inflater.inflate(R.layout.feedback_dialog_fragment, null);
Button submitButton = (Button) rootView.findViewById(R.id.feedback_submit_button);
submitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Write the feedback to database
FeedbackRecord feedbackRecord = createFeedbackRecord(rootView);
feedbackDatabaseWriter.writeFeedbackToDatabase(feedbackRecord);
dismiss();
}
});
Button cancelButton = (Button) rootView.findViewById(R.id.feedback_cancel_button);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
builder.setView(rootView);
return builder.create();
}
Aggregations