Search in sources :

Example 11 with DialogHelper

use of com.mnnyang.gzuclassschedule.utils.DialogHelper in project GzuClassSchedule by mnnyang.

the class ShowTermDialog method showSelectTimeTermDialog.

public void showSelectTimeTermDialog(Context context, String[] times, final TimeTermCallback callback) {
    if (times.length == 0) {
        return;
    }
    View dialogView = LayoutInflater.from(context).inflate(R.layout.layout_course_time_dialog, null);
    final RadioGroup rg = dialogView.findViewById(R.id.rg_course_time);
    int i = 1;
    for (String time : times) {
        AppCompatRadioButton tempButton = new AppCompatRadioButton(context);
        tempButton.setTextColor(ColorUtil.getColor(context, R.attr.colorPrimary));
        tempButton.setText(time);
        tempButton.setId(i);
        rg.addView(tempButton, LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        i++;
    }
    rg.invalidate();
    rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            AppCompatRadioButton arb = group.findViewById(checkedId);
            System.out.println("6:" + arb);
            callback.onTimeChanged(arb.getText().toString());
        }
    });
    RadioGroup termRg = dialogView.findViewById(R.id.rg_term);
    termRg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            AppCompatRadioButton arb = group.findViewById(checkedId);
            callback.onTermChanged(arb.getTag().toString());
        }
    });
    AppCompatRadioButton at = (AppCompatRadioButton) rg.getChildAt(0);
    if (at != null)
        at.setChecked(true);
    at = (AppCompatRadioButton) termRg.getChildAt(0);
    if (at != null)
        at.setChecked(true);
    DialogHelper helper = new DialogHelper();
    helper.showCustomDialog(context, dialogView, "", new DialogListener() {

        @Override
        public void onPositive(DialogInterface dialog, int which) {
            super.onPositive(dialog, which);
            dialog.dismiss();
            callback.onPositive(dialog, which);
        }
    });
}
Also used : AppCompatRadioButton(android.support.v7.widget.AppCompatRadioButton) RadioGroup(android.widget.RadioGroup) DialogHelper(com.mnnyang.gzuclassschedule.utils.DialogHelper) DialogInterface(android.content.DialogInterface) DialogListener(com.mnnyang.gzuclassschedule.utils.DialogListener) View(android.view.View)

Example 12 with DialogHelper

use of com.mnnyang.gzuclassschedule.utils.DialogHelper in project GzuClassSchedule by mnnyang.

the class CourseActivity method onLongClick.

@Override
public void onLongClick(final Course course, LinearLayout itemLayout) {
    DialogHelper dialogHelper = new DialogHelper();
    dialogHelper.showNormalDialog(this, getString(R.string.confirm_to_delete), "课程 【" + course.getName() + "】" + Constant.WEEK[course.getWeek()] + "第" + course.getNodes().get(0) + "节 " + "", new DialogListener() {

        @Override
        public void onPositive(DialogInterface dialog, int which) {
            super.onPositive(dialog, which);
            // delete
            mPresenter.deleteCourse(course.getCourseId());
        }
    });
}
Also used : DialogHelper(com.mnnyang.gzuclassschedule.utils.DialogHelper) DialogInterface(android.content.DialogInterface) DialogListener(com.mnnyang.gzuclassschedule.utils.DialogListener)

Example 13 with DialogHelper

use of com.mnnyang.gzuclassschedule.utils.DialogHelper in project GzuClassSchedule by mnnyang.

the class ImptActivity method showImpting.

@Override
public void showImpting() {
    mHelper = new DialogHelper();
    mHelper.showProgressDialog(this, "导入中", "请稍等...", false);
}
Also used : DialogHelper(com.mnnyang.gzuclassschedule.utils.DialogHelper)

Aggregations

DialogHelper (com.mnnyang.gzuclassschedule.utils.DialogHelper)13 DialogInterface (android.content.DialogInterface)11 DialogListener (com.mnnyang.gzuclassschedule.utils.DialogListener)11 View (android.view.View)5 RadioGroup (android.widget.RadioGroup)4 AppCompatRadioButton (android.support.v7.widget.AppCompatRadioButton)3 Intent (android.content.Intent)2 RecyclerView (android.support.v7.widget.RecyclerView)2 EditText (android.widget.EditText)2 ScrollView (android.widget.ScrollView)2 WheelView (com.mnnyang.gzuclassschedule.custom.WheelView)2 ArrayList (java.util.ArrayList)2 HorizontalScrollView (android.widget.HorizontalScrollView)1