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);
}
});
}
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());
}
});
}
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);
}
Aggregations