forked from github/szkolny
[Dialogs] Remove deprecated dialogs.
This commit is contained in:
parent
ddb1ecaa99
commit
44fc1c4532
@ -28,15 +28,15 @@ class EventAddTypeDialog(
|
||||
dialog = MaterialAlertDialogBuilder(activity)
|
||||
.setItems(R.array.main_menu_add_options) { dialog, which ->
|
||||
dialog.dismiss()
|
||||
EventManualDialog(activity, profileId)
|
||||
EventManualDialogOld(activity, profileId)
|
||||
.show(
|
||||
activity.application as App,
|
||||
null,
|
||||
date,
|
||||
time,
|
||||
when (which) {
|
||||
1 -> EventManualDialog.DIALOG_HOMEWORK
|
||||
else -> EventManualDialog.DIALOG_EVENT
|
||||
1 -> EventManualDialogOld.DIALOG_HOMEWORK
|
||||
else -> EventManualDialogOld.DIALOG_EVENT
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -41,7 +41,7 @@ class EventListAdapter(
|
||||
|
||||
holder.apply {
|
||||
b.eventListItemRoot.background.colorFilter = when (event.type) {
|
||||
Event.TYPE_HOMEWORK -> PorterDuffColorFilter((0xffffffff).toInt(), PorterDuff.Mode.CLEAR)
|
||||
Event.TYPE_HOMEWORK -> PorterDuffColorFilter(0xffffffff.toInt(), PorterDuff.Mode.CLEAR)
|
||||
else -> PorterDuffColorFilter(event.color, PorterDuff.Mode.MULTIPLY)
|
||||
}
|
||||
|
||||
@ -55,11 +55,11 @@ class EventListAdapter(
|
||||
b.eventListItemSharedBy.text = app.getString(R.string.event_shared_by_format, if (event.sharedBy == "self") app.getString(R.string.event_shared_by_self) else event.sharedByName)
|
||||
b.eventListItemSharedBy.visibility = if (event.sharedByName.isNullOrBlank()) View.GONE else View.VISIBLE
|
||||
|
||||
b.eventListItemEdit.visibility = if (event.addedManually) View.VISIBLE else View.GONE
|
||||
b.eventListItemEdit.visibility = if (event.addedManually && (event.sharedBy == null || event.sharedBy == "self")) View.VISIBLE else View.GONE
|
||||
b.eventListItemEdit.setOnClickListener {
|
||||
parentDialog.dismiss()
|
||||
|
||||
EventManualV2Dialog(
|
||||
EventManualDialog(
|
||||
context as MainActivity,
|
||||
event.profileId,
|
||||
editingEvent = event,
|
||||
|
@ -1,134 +0,0 @@
|
||||
package pl.szczodrzynski.edziennik.ui.dialogs.event;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mikepenz.iconics.view.IconicsImageView;
|
||||
import com.mikepenz.iconics.view.IconicsTextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pl.szczodrzynski.edziennik.App;
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull;
|
||||
import pl.szczodrzynski.edziennik.utils.Utils;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.bs;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.d;
|
||||
|
||||
public class EventListAdapterOld extends RecyclerView.Adapter<EventListAdapterOld.ViewHolder> {
|
||||
private static final String TAG = "EventListAdapterOld";
|
||||
private Context context;
|
||||
private List<EventFull> examList;
|
||||
private EventListDialogOld parentDialog;
|
||||
|
||||
//getting the context and product list with constructor
|
||||
public EventListAdapterOld(Context mCtx, List<EventFull> examList, EventListDialogOld parentDialog) {
|
||||
this.context = mCtx;
|
||||
this.examList = examList;
|
||||
this.parentDialog = parentDialog;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public EventListAdapterOld.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
//inflating and returning our view holder
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
View view = inflater.inflate(R.layout.row_dialog_event_list_item, parent, false);
|
||||
return new EventListAdapterOld.ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull EventListAdapterOld.ViewHolder holder, int position) {
|
||||
App app = (App) context.getApplicationContext();
|
||||
|
||||
EventFull event = examList.get(position);
|
||||
|
||||
if (event.type == TYPE_HOMEWORK) {
|
||||
holder.eventListItemRoot.getBackground().setColorFilter(new PorterDuffColorFilter(0xffffffff, PorterDuff.Mode.CLEAR));
|
||||
}
|
||||
else {
|
||||
holder.eventListItemRoot.getBackground().setColorFilter(new PorterDuffColorFilter(event.getColor(), PorterDuff.Mode.MULTIPLY));
|
||||
}
|
||||
|
||||
holder.eventListItemStartTime.setText(event.startTime == null ? app.getString(R.string.event_all_day) : event.startTime.getStringHM());
|
||||
//holder.examListItemEndTime.setText(event.endTime.getStringHM());
|
||||
holder.eventListItemTeamName.setText(Utils.bs(event.teamName));
|
||||
holder.eventListItemTeacherName.setText(bs(null, event.teacherFullName, "\n") + bs(event.subjectLongName));
|
||||
holder.eventListItemAddedDate.setText(Date.fromMillis(event.addedDate).getFormattedStringShort());
|
||||
holder.eventListItemType.setText(event.typeName);
|
||||
holder.eventListItemTopic.setText(event.topic);
|
||||
holder.eventListItemEdit.setVisibility((event.addedManually ? View.VISIBLE : View.GONE));
|
||||
holder.eventListItemHomework.setVisibility((event.type == Event.TYPE_HOMEWORK ? View.VISIBLE : View.GONE));
|
||||
holder.eventListItemEdit.setOnClickListener(v -> {
|
||||
if (parentDialog != null) {
|
||||
parentDialog.callDismissListener = false;
|
||||
parentDialog.dialog.dismiss();
|
||||
}
|
||||
d(TAG, "Event "+event);
|
||||
if (event.type == Event.TYPE_HOMEWORK) {
|
||||
new EventManualDialog(context, event.profileId)
|
||||
.withDismissListener(parentDialog::performDismiss)
|
||||
.show(app, event, null, null, EventManualDialog.DIALOG_HOMEWORK);
|
||||
}
|
||||
else {
|
||||
new EventManualDialog(context, event.profileId)
|
||||
.withDismissListener(parentDialog::performDismiss)
|
||||
.show(app, event, null, null, EventManualDialog.DIALOG_EVENT);
|
||||
}
|
||||
});
|
||||
|
||||
if (event.sharedBy == null) {
|
||||
holder.eventListItemSharedBy.setVisibility(View.GONE);
|
||||
}
|
||||
else if (event.sharedByName != null) {
|
||||
holder.eventListItemSharedBy.setText(app.getString(R.string.event_shared_by_format, (event.sharedBy.equals("self") ? app.getString(R.string.event_shared_by_self) : event.sharedByName)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return examList.size();
|
||||
}
|
||||
|
||||
class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
ConstraintLayout eventListItemRoot;
|
||||
TextView eventListItemStartTime;
|
||||
TextView eventListItemTeacherName;
|
||||
TextView eventListItemType;
|
||||
TextView eventListItemTopic;
|
||||
TextView eventListItemAddedDate;
|
||||
TextView eventListItemTeamName;
|
||||
IconicsImageView eventListItemEdit;
|
||||
IconicsImageView eventListItemHomework;
|
||||
IconicsTextView eventListItemSharedBy;
|
||||
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
eventListItemRoot = itemView.findViewById(R.id.eventListItemRoot);
|
||||
eventListItemStartTime = itemView.findViewById(R.id.eventListItemStartTime);
|
||||
eventListItemTeacherName = itemView.findViewById(R.id.eventListItemTeacherName);
|
||||
eventListItemType = itemView.findViewById(R.id.eventListItemType);
|
||||
eventListItemTopic = itemView.findViewById(R.id.eventListItemTopic);
|
||||
eventListItemAddedDate = itemView.findViewById(R.id.eventListItemAddedDate);
|
||||
eventListItemTeamName = itemView.findViewById(R.id.eventListItemTeamName);
|
||||
eventListItemEdit = itemView.findViewById(R.id.eventListItemEdit);
|
||||
eventListItemHomework = itemView.findViewById(R.id.eventListItemHomework);
|
||||
eventListItemSharedBy = itemView.findViewById(R.id.eventListItemSharedBy);
|
||||
}
|
||||
}
|
||||
}
|
@ -60,7 +60,7 @@ class EventListDialog(
|
||||
.setView(b.root)
|
||||
.setPositiveButton(R.string.close) { dialog, _ -> dialog.dismiss() }
|
||||
.setNeutralButton(R.string.add) { _, _ ->
|
||||
EventManualV2Dialog(
|
||||
EventManualDialog(
|
||||
activity,
|
||||
lesson?.profileId ?: profileId,
|
||||
lesson,
|
||||
|
@ -1,230 +0,0 @@
|
||||
package pl.szczodrzynski.edziennik.ui.dialogs.event;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.AsyncTask;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import pl.szczodrzynski.edziennik.App;
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.TeacherAbsenceFull;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.lessonchange.LessonChangeDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.teacherabsence.TeacherAbsenceDialog;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
|
||||
public class EventListDialogOld {
|
||||
private App app;
|
||||
private Context context;
|
||||
private int profileId;
|
||||
|
||||
public EventListDialogOld(Context context) {
|
||||
this.context = context;
|
||||
this.profileId = App.profileId;
|
||||
}
|
||||
public EventListDialogOld(Context context, int profileId) {
|
||||
this.context = context;
|
||||
this.profileId = profileId;
|
||||
}
|
||||
|
||||
public MaterialDialog dialog;
|
||||
private View dialogView;
|
||||
private RecyclerView examsView;
|
||||
private DialogInterface.OnDismissListener dismissListener;
|
||||
public boolean callDismissListener = true;
|
||||
private LessonFull lesson;
|
||||
|
||||
public EventListDialogOld withDismissListener(DialogInterface.OnDismissListener dismissListener) {
|
||||
this.dismissListener = dismissListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void performDismiss(DialogInterface dialogInterface) {
|
||||
if (callDismissListener && dismissListener != null) {
|
||||
dismissListener.onDismiss(dialogInterface);
|
||||
}
|
||||
callDismissListener = true;
|
||||
}
|
||||
|
||||
public void show(App _app, Date date)
|
||||
{
|
||||
show(_app, date, null);
|
||||
}
|
||||
public void show(App _app, Date date, Time time) {
|
||||
show(_app, date, time, false);
|
||||
}
|
||||
public void show(App _app, Date date, Time time, boolean noDefaultTimeWhenAdding) {
|
||||
if (!(context instanceof AppCompatActivity) || date == null)
|
||||
return;
|
||||
this.app = _app;
|
||||
|
||||
if (time != null) {
|
||||
AsyncTask.execute(() -> {
|
||||
this.lesson = app.db.lessonDao().getByDateTimeNow(profileId, date, time);
|
||||
((AppCompatActivity) context).runOnUiThread(() -> {
|
||||
actualShow(date, time, noDefaultTimeWhenAdding);
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
actualShow(date, null, noDefaultTimeWhenAdding);
|
||||
}
|
||||
|
||||
private void actualShow(Date date, Time time, boolean noDefaultTimeWhenAdding) {
|
||||
dialog = new MaterialDialog.Builder(context)
|
||||
.title((time == null ? date.getFormattedString() : (lesson != null ? lesson.getSubjectLongName() : date.getFormattedString())+", "+time.getStringHM()))
|
||||
.customView(R.layout.dialog_event_list, false)
|
||||
.neutralText(R.string.add)
|
||||
.positiveText(R.string.close)
|
||||
.autoDismiss(false)
|
||||
.onNeutral((dialog, which) -> {
|
||||
callDismissListener = false;
|
||||
dialog.dismiss();
|
||||
//performDismiss(dialog);
|
||||
//callDismissListener = true;
|
||||
new MaterialDialog.Builder(context)
|
||||
.title(R.string.main_menu_add)
|
||||
.items(R.array.main_menu_add_options)
|
||||
.autoDismiss(true)
|
||||
.itemsCallback((dialog1, itemView, position, text) -> {
|
||||
callDismissListener = false;
|
||||
//performDismiss(dialog1); // use if the main dialog is already dismissed
|
||||
//dialog1.dismiss();
|
||||
//callDismissListener = true;
|
||||
switch (position) {
|
||||
case 0:
|
||||
new EventManualDialog(context, profileId)
|
||||
.withDismissListener(this::performDismiss)
|
||||
.show(app, null, date, (noDefaultTimeWhenAdding ? null : time), EventManualDialog.DIALOG_EVENT);
|
||||
break;
|
||||
case 1:
|
||||
new EventManualDialog(context, profileId)
|
||||
.withDismissListener(this::performDismiss)
|
||||
.show(app, null, date, (noDefaultTimeWhenAdding ? null : time), EventManualDialog.DIALOG_HOMEWORK);
|
||||
break;
|
||||
}
|
||||
})
|
||||
.dismissListener((dialog1 -> {
|
||||
callDismissListener = false;
|
||||
performDismiss(dialog1);
|
||||
}))
|
||||
.show();
|
||||
})
|
||||
.onPositive((dialog, which) -> dialog.dismiss())
|
||||
.dismissListener(this::performDismiss)
|
||||
.show();
|
||||
|
||||
dialogView = dialog.getCustomView();
|
||||
assert dialogView != null;
|
||||
|
||||
LinearLayout eventListLessonDetails = dialogView.findViewById(R.id.eventListLessonDetails);
|
||||
eventListLessonDetails.setVisibility((lesson == null ? View.GONE : View.VISIBLE));
|
||||
if (lesson != null) {
|
||||
TextView eventListClassroom = dialogView.findViewById(R.id.eventListClassroom);
|
||||
TextView eventListTeacher = dialogView.findViewById(R.id.eventListTeacher);
|
||||
TextView eventListLessonChange = dialogView.findViewById(R.id.eventListLessonChange);
|
||||
((TextView)dialogView.findViewById(R.id.eventListLessonDate)).setText(app.getString(R.string.date_time_format, date.getFormattedString(), ""));
|
||||
|
||||
boolean lessonCancelled = false;
|
||||
if (lesson.changeId != 0 && lesson.changeType == LessonChange.TYPE_CANCELLED) {
|
||||
lessonCancelled = true;
|
||||
}
|
||||
|
||||
if (lessonCancelled) {
|
||||
eventListLessonChange.setText(R.string.lesson_cancelled);
|
||||
eventListLessonChange.setTypeface(null, Typeface.BOLD_ITALIC);
|
||||
eventListTeacher.setVisibility(View.GONE);
|
||||
eventListClassroom.setVisibility(View.GONE);
|
||||
eventListLessonChange.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
eventListLessonChange.setText(lesson.getSubjectLongName(true));
|
||||
if (lesson.changedSubjectLongName()) {
|
||||
eventListLessonChange.setTypeface(null, Typeface.ITALIC);
|
||||
} else {
|
||||
eventListLessonChange.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
eventListTeacher.setText(lesson.getTeacherFullName(true));
|
||||
eventListTeacher.setTypeface(null, lesson.changedTeacherFullName() ? Typeface.ITALIC : Typeface.NORMAL);
|
||||
|
||||
eventListClassroom.setText(lesson.getClassroomName(true));
|
||||
eventListClassroom.setTypeface(null, lesson.changedClassroomName() ? Typeface.ITALIC : Typeface.NORMAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//((TextView)dialogView.findViewById(R.id.textLessonDate)).setText(date.getFormattedString()+(time != null ? ", "+time.getStringHM() : ""));
|
||||
|
||||
examsView = dialogView.findViewById(R.id.eventListView);
|
||||
examsView.setHasFixedSize(false);
|
||||
examsView.setNestedScrollingEnabled(true);
|
||||
examsView.setLayoutManager(new LinearLayoutManager(context));
|
||||
|
||||
CardView lessonChangeContainer = dialogView.findViewById(R.id.lessonChangeContainer);
|
||||
CardView teacherAbsenceContainer = dialogView.findViewById(R.id.teacherAbsenceContainer);
|
||||
//lessonChangeContainer.setVisibility(View.GONE);
|
||||
if (time == null) {
|
||||
app.db.lessonChangeDao().getLessonChangeCounterByDate(App.profileId, date).observe((LifecycleOwner) context, counter -> {
|
||||
if (counter == null)
|
||||
return;
|
||||
if (counter.lessonChangeCount > 0) {
|
||||
lessonChangeContainer.setVisibility(View.VISIBLE);
|
||||
TextView lessonChangeCount = dialogView.findViewById(R.id.lessonChangeCount);
|
||||
lessonChangeCount.setText(String.valueOf(counter.lessonChangeCount));
|
||||
lessonChangeContainer.setCardBackgroundColor(0xff78909c);
|
||||
lessonChangeContainer.setOnClickListener((v -> {
|
||||
new LessonChangeDialog(context).show(app, date);
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
app.db.teacherAbsenceDao().getAllByDateFull(App.profileId, date).observe((LifecycleOwner) context, teacherAbsenceList -> {
|
||||
if (teacherAbsenceList == null)
|
||||
return;
|
||||
if (teacherAbsenceList.size() > 0) {
|
||||
int count = 0;
|
||||
for (TeacherAbsenceFull teacherAbsence : teacherAbsenceList) {
|
||||
Date dateFrom = teacherAbsence.getDateFrom();
|
||||
Date dateTo = teacherAbsence.getDateTo();
|
||||
|
||||
if (date.compareTo(dateFrom) >= 0 && date.compareTo(dateTo) <= 0) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
teacherAbsenceContainer.setVisibility(View.VISIBLE);
|
||||
TextView teacherAbsenceCount = dialogView.findViewById(R.id.teacherAbsenceCount);
|
||||
teacherAbsenceCount.setText(String.valueOf(count));
|
||||
teacherAbsenceContainer.setCardBackgroundColor(0xffff1744);
|
||||
teacherAbsenceContainer.setOnClickListener(( v -> {
|
||||
new TeacherAbsenceDialog(context).show(app, date);
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
app.db.eventDao().getAllByDateTime(profileId, date, time).observe((LifecycleOwner) context, events -> {
|
||||
if (events == null || events.size() == 0) {
|
||||
examsView.setVisibility(View.GONE);
|
||||
dialogView.findViewById(R.id.textNoEvents).setVisibility(View.VISIBLE);
|
||||
}
|
||||
else {
|
||||
EventListAdapterOld adapter = new EventListAdapterOld(context, events, this);
|
||||
examsView.setAdapter(adapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ import pl.szczodrzynski.edziennik.utils.models.Time
|
||||
import pl.szczodrzynski.edziennik.utils.models.Week
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
class EventManualV2Dialog(
|
||||
class EventManualDialog(
|
||||
val activity: AppCompatActivity,
|
||||
val profileId: Int,
|
||||
val defaultLesson: LessonFull? = null,
|
||||
@ -370,7 +370,7 @@ class EventManualV2Dialog(
|
||||
))
|
||||
loadHours()
|
||||
}
|
||||
show(this@EventManualV2Dialog.activity.supportFragmentManager, "MaterialDatePicker")
|
||||
show(this@EventManualDialog.activity.supportFragmentManager, "MaterialDatePicker")
|
||||
}
|
||||
|
||||
return@setOnChangeListener false
|
@ -41,6 +41,7 @@ import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventType;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.teachers.Teacher;
|
||||
@ -56,23 +57,22 @@ import static pl.szczodrzynski.edziennik.App.APP_URL;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.COLOR_DEFAULT;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_HOMEWORK;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.events.Event.TYPE_UNDEFINED;
|
||||
import static pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile.REGISTRATION_ENABLED;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.bs;
|
||||
import static pl.szczodrzynski.edziennik.utils.Utils.ns;
|
||||
|
||||
public class EventManualDialog {
|
||||
private static final String TAG = "EventManualDialog";
|
||||
public class EventManualDialogOld {
|
||||
private static final String TAG = "EventManualDialogOld";
|
||||
private App app;
|
||||
private Context context;
|
||||
private int profileId;
|
||||
private ProfileFull profile = null;
|
||||
|
||||
public EventManualDialog(Context context, int profileId) {
|
||||
public EventManualDialogOld(Context context, int profileId) {
|
||||
this.context = context;
|
||||
this.activity = (AppCompatActivity) context;
|
||||
this.profileId = profileId;
|
||||
}
|
||||
public EventManualDialog(Context context) {
|
||||
public EventManualDialogOld(Context context) {
|
||||
this.context = context;
|
||||
this.activity = (AppCompatActivity) context;
|
||||
this.profileId = App.profileId;
|
||||
@ -199,7 +199,7 @@ public class EventManualDialog {
|
||||
metadata.addedDate = editingEvent.addedDate;
|
||||
}
|
||||
if (registerEventManualShare.isChecked()) {
|
||||
if (profile.getRegistration() != REGISTRATION_ENABLED) {
|
||||
if (profile.getRegistration() != Profile.REGISTRATION_ENABLED) {
|
||||
new MaterialDialog.Builder(context)
|
||||
.title(R.string.dialog_event_manual_must_register_title)
|
||||
.content(R.string.dialog_event_manual_must_register_text)
|
||||
@ -207,7 +207,7 @@ public class EventManualDialog {
|
||||
.negativeText(R.string.no_thanks)
|
||||
.neutralText(R.string.more)
|
||||
.onPositive(((dialog1, which) -> {
|
||||
profile.setRegistration(REGISTRATION_ENABLED);
|
||||
profile.setRegistration(Profile.REGISTRATION_ENABLED);
|
||||
app.profileSaveAsync(profile);
|
||||
}))
|
||||
.onNeutral(((dialog1, which) -> {
|
||||
@ -372,7 +372,7 @@ public class EventManualDialog {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
activity.runOnUiThread(() -> {
|
||||
// TODO show error in EventManualDialog
|
||||
// TODO show error in EventManualDialogOld
|
||||
//app.apiEdziennik.guiShowErrorDialog(activity, new AppError(TAG, 379, CODE_OTHER, null, e), R.string.error_occured);
|
||||
});
|
||||
}
|
||||
@ -402,7 +402,7 @@ public class EventManualDialog {
|
||||
private DialogInterface.OnDismissListener dismissListener;
|
||||
private boolean callDismissListener = true;
|
||||
|
||||
public EventManualDialog withDismissListener(DialogInterface.OnDismissListener dismissListener) {
|
||||
public EventManualDialogOld withDismissListener(DialogInterface.OnDismissListener dismissListener) {
|
||||
this.dismissListener = dismissListener;
|
||||
return this;
|
||||
}
|
@ -14,7 +14,7 @@ import pl.szczodrzynski.edziennik.data.db.modules.timetable.Lesson
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.timetable.LessonFull
|
||||
import pl.szczodrzynski.edziennik.databinding.DialogLessonDetailsBinding
|
||||
import pl.szczodrzynski.edziennik.setText
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualV2Dialog
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialog
|
||||
import pl.szczodrzynski.edziennik.ui.modules.timetable.v2.TimetableFragment
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||
import pl.szczodrzynski.edziennik.utils.models.Week
|
||||
@ -43,7 +43,7 @@ class LessonDetailsDialog(
|
||||
dialog.dismiss()
|
||||
}
|
||||
.setNeutralButton(R.string.add) { _, _ ->
|
||||
EventManualV2Dialog(
|
||||
EventManualDialog(
|
||||
activity,
|
||||
lesson.profileId,
|
||||
lesson,
|
||||
@ -53,15 +53,15 @@ class LessonDetailsDialog(
|
||||
/*MaterialAlertDialogBuilder(activity)
|
||||
.setItems(R.array.main_menu_add_options) { dialog2, which ->
|
||||
dialog2.dismiss()
|
||||
EventManualDialog(activity, lesson.profileId)
|
||||
EventManualDialogOld(activity, lesson.profileId)
|
||||
.show(
|
||||
activity.application as App,
|
||||
null,
|
||||
lesson.displayDate,
|
||||
lesson.displayStartTime,
|
||||
when (which) {
|
||||
1 -> EventManualDialog.DIALOG_HOMEWORK
|
||||
else -> EventManualDialog.DIALOG_EVENT
|
||||
1 -> EventManualDialogOld.DIALOG_HOMEWORK
|
||||
else -> EventManualDialogOld.DIALOG_EVENT
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -44,7 +44,7 @@ import pl.szczodrzynski.edziennik.data.db.modules.teachers.TeacherAbsenceFull;
|
||||
import pl.szczodrzynski.edziennik.databinding.FragmentAgendaCalendarBinding;
|
||||
import pl.szczodrzynski.edziennik.databinding.FragmentAgendaDefaultBinding;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventListDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialogOld;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.lessonchange.LessonChangeDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.teacherabsence.TeacherAbsenceDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.agenda.lessonchange.LessonChangeCounter;
|
||||
@ -113,10 +113,10 @@ public class AgendaFragment extends Fragment {
|
||||
.itemsCallback((dialog, itemView, position, text) -> {
|
||||
switch (position) {
|
||||
case 0:
|
||||
new EventManualDialog(activity).show(app, null, null, null, EventManualDialog.DIALOG_EVENT);
|
||||
new EventManualDialogOld(activity).show(app, null, null, null, EventManualDialogOld.DIALOG_EVENT);
|
||||
break;
|
||||
case 1:
|
||||
new EventManualDialog(activity).show(app, null, null, null, EventManualDialog.DIALOG_HOMEWORK);
|
||||
new EventManualDialogOld(activity).show(app, null, null, null, EventManualDialogOld.DIALOG_HOMEWORK);
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
@ -20,7 +20,7 @@ import pl.szczodrzynski.edziennik.App;
|
||||
import pl.szczodrzynski.edziennik.MainActivity;
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualV2Dialog;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
|
||||
@ -94,7 +94,7 @@ public class HomeworkAdapter extends RecyclerView.Adapter<HomeworkAdapter.ViewHo
|
||||
|
||||
holder.homeworkItemEdit.setVisibility((homework.addedManually ? View.VISIBLE : View.GONE));
|
||||
holder.homeworkItemEdit.setOnClickListener(v -> {
|
||||
new EventManualV2Dialog(
|
||||
new EventManualDialog(
|
||||
(MainActivity) context,
|
||||
homework.profileId,
|
||||
null,
|
||||
|
@ -16,7 +16,7 @@ import pl.szczodrzynski.edziennik.R
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata
|
||||
import pl.szczodrzynski.edziennik.databinding.FragmentHomeworkBinding
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualV2Dialog
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialog
|
||||
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesFragment
|
||||
import pl.szczodrzynski.edziennik.utils.Themes
|
||||
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem
|
||||
@ -57,7 +57,7 @@ class HomeworkFragment : Fragment() {
|
||||
.withIcon(SzkolnyFont.Icon.szf_calendar_plus_outline)
|
||||
.withOnClickListener(View.OnClickListener {
|
||||
activity.bottomSheet.close()
|
||||
EventManualV2Dialog(activity, App.profileId, defaultType = Event.TYPE_HOMEWORK)
|
||||
EventManualDialog(activity, App.profileId, defaultType = Event.TYPE_HOMEWORK)
|
||||
}),
|
||||
BottomSheetSeparatorItem(true),
|
||||
BottomSheetPrimaryItem(true)
|
||||
@ -103,7 +103,7 @@ class HomeworkFragment : Fragment() {
|
||||
activity.navView.bottomBar.fabExtendedText = getString(R.string.add)
|
||||
activity.navView.bottomBar.fabIcon = CommunityMaterial.Icon2.cmd_plus
|
||||
activity.navView.setFabOnClickListener(View.OnClickListener {
|
||||
EventManualV2Dialog(activity, App.profileId)
|
||||
EventManualDialog(activity, App.profileId)
|
||||
})
|
||||
|
||||
activity.gainAttention()
|
||||
|
@ -28,7 +28,6 @@ import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventListDialogOld;
|
||||
import pl.szczodrzynski.edziennik.utils.SpannableHtmlTagHandler;
|
||||
import pl.szczodrzynski.edziennik.utils.Themes;
|
||||
import pl.szczodrzynski.edziennik.utils.Utils;
|
||||
@ -160,7 +159,7 @@ public class TimetableAdapter extends RecyclerView.Adapter<TimetableAdapter.View
|
||||
}
|
||||
}
|
||||
|
||||
holder.timetableItemCard.setOnClickListener(v -> new EventListDialogOld(context).show(app, lessonDate, lesson.startTime));
|
||||
// holder.timetableItemCard.setOnClickListener(v -> new EventListDialogOld(context).show(app, lessonDate, lesson.startTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,7 +51,7 @@ import pl.szczodrzynski.edziennik.MainActivity;
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
|
||||
import pl.szczodrzynski.edziennik.databinding.FragmentTimetableBinding;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialogOld;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.error.ErrorDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment;
|
||||
import pl.szczodrzynski.edziennik.utils.SpannableHtmlTagHandler;
|
||||
@ -113,10 +113,10 @@ public class TimetableFragment extends Fragment {
|
||||
.itemsCallback((dialog, itemView, position, text) -> {
|
||||
switch (position) {
|
||||
case 0:
|
||||
new EventManualDialog(activity).show(app, null, displayingDate, null, EventManualDialog.DIALOG_EVENT);
|
||||
new EventManualDialogOld(activity).show(app, null, displayingDate, null, EventManualDialogOld.DIALOG_EVENT);
|
||||
break;
|
||||
case 1:
|
||||
new EventManualDialog(activity).show(app, null, displayingDate, null, EventManualDialog.DIALOG_HOMEWORK);
|
||||
new EventManualDialogOld(activity).show(app, null, displayingDate, null, EventManualDialogOld.DIALOG_HOMEWORK);
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
@ -1,7 +1,5 @@
|
||||
package pl.szczodrzynski.edziennik.widgets.timetable;
|
||||
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
@ -13,8 +11,6 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import pl.szczodrzynski.edziennik.App;
|
||||
import pl.szczodrzynski.edziennik.MainActivity;
|
||||
import pl.szczodrzynski.edziennik.R;
|
||||
import pl.szczodrzynski.edziennik.WidgetTimetable;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventListDialogOld;
|
||||
import pl.szczodrzynski.edziennik.utils.Themes;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
@ -52,7 +48,7 @@ public class LessonDetailsActivity extends AppCompatActivity {
|
||||
Time startTime = Time.fromHms(extras.getString("startTime", "20181109"));
|
||||
//Time endTime = Time.fromHms(extras.getString("endTime", "20181109"));
|
||||
|
||||
new EventListDialogOld(this, profileId)
|
||||
/* new EventListDialogOld(this, profileId)
|
||||
.withDismissListener((dialog -> {
|
||||
finish();
|
||||
Intent intent = new Intent(app.getContext(), WidgetTimetable.class);
|
||||
@ -62,7 +58,7 @@ public class LessonDetailsActivity extends AppCompatActivity {
|
||||
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids);
|
||||
app.sendBroadcast(intent);
|
||||
}))
|
||||
.show(app, date, startTime);
|
||||
.show(app, date, startTime); */
|
||||
return;
|
||||
}
|
||||
Toast.makeText(app, R.string.error_reading_lesson_details, Toast.LENGTH_SHORT).show();
|
||||
|
Loading…
x
Reference in New Issue
Block a user