Search in sources :

Example 1 with FeedbackRecord

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) FrameLayout(android.widget.FrameLayout) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) FeedbackRecord(com.inceptai.dobby.database.FeedbackRecord)

Example 2 with FeedbackRecord

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;
}
Also used : EditText(android.widget.EditText) RadioGroup(android.widget.RadioGroup) FeedbackRecord(com.inceptai.dobby.database.FeedbackRecord)

Example 3 with 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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) FeedbackRecord(com.inceptai.dobby.database.FeedbackRecord)

Aggregations

FeedbackRecord (com.inceptai.dobby.database.FeedbackRecord)3 AlertDialog (android.support.v7.app.AlertDialog)2 LayoutInflater (android.view.LayoutInflater)2 View (android.view.View)2 Button (android.widget.Button)2 ListView (android.widget.ListView)2 TextView (android.widget.TextView)2 EditText (android.widget.EditText)1 FrameLayout (android.widget.FrameLayout)1 RadioGroup (android.widget.RadioGroup)1