forked from github/szkolny
[Dialog/EventManual] Add default type support and remove old dialog from the agenda fragment.
This commit is contained in:
parent
44fc1c4532
commit
13cdaadcf7
@ -177,6 +177,10 @@ class EventManualDialog(
|
||||
b.teacherDropdown.isEnabled = true
|
||||
b.typeDropdown.isEnabled = true
|
||||
|
||||
defaultType?.let {
|
||||
b.typeDropdown.select(it.toLong())
|
||||
}
|
||||
|
||||
b.typeDropdown.selected?.let { item ->
|
||||
customColor = (item.tag as EventType).color
|
||||
}
|
||||
@ -207,9 +211,11 @@ class EventManualDialog(
|
||||
customColor = null
|
||||
return@setOnChangeListener true
|
||||
}
|
||||
|
||||
(customColor ?: Event.COLOR_DEFAULT).let {
|
||||
b.typeColor.background.colorFilter = PorterDuffColorFilter(it, PorterDuff.Mode.SRC_ATOP)
|
||||
}
|
||||
|
||||
b.typeColor.onClick {
|
||||
val currentColor = (b.typeDropdown?.selected?.tag as EventType?)?.color ?: Event.COLOR_DEFAULT
|
||||
val colorPickerDialog = ColorPickerDialog.newBuilder()
|
||||
|
@ -16,7 +16,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.applandeo.materialcalendarview.CalendarView;
|
||||
import com.applandeo.materialcalendarview.EventDay;
|
||||
import com.github.tibolte.agendacalendarview.AgendaCalendarView;
|
||||
@ -44,7 +43,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.EventManualDialogOld;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialog;
|
||||
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;
|
||||
@ -107,20 +106,17 @@ public class AgendaFragment extends Fragment {
|
||||
.withIcon(SzkolnyFont.Icon.szf_calendar_plus_outline)
|
||||
.withOnClickListener(v3 -> {
|
||||
activity.getBottomSheet().close();
|
||||
new MaterialDialog.Builder(activity)
|
||||
.title(R.string.main_menu_add)
|
||||
.items(R.array.main_menu_add_options)
|
||||
.itemsCallback((dialog, itemView, position, text) -> {
|
||||
switch (position) {
|
||||
case 0:
|
||||
new EventManualDialogOld(activity).show(app, null, null, null, EventManualDialogOld.DIALOG_EVENT);
|
||||
break;
|
||||
case 1:
|
||||
new EventManualDialogOld(activity).show(app, null, null, null, EventManualDialogOld.DIALOG_HOMEWORK);
|
||||
break;
|
||||
}
|
||||
})
|
||||
.show();
|
||||
new EventManualDialog(
|
||||
activity,
|
||||
App.profileId,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
}),
|
||||
new BottomSheetPrimaryItem(true)
|
||||
.withTitle(R.string.menu_agenda_change_view)
|
||||
|
@ -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 {
|
||||
EventManualDialog(activity, App.profileId)
|
||||
EventManualDialog(activity, App.profileId, defaultType = Event.TYPE_HOMEWORK)
|
||||
})
|
||||
|
||||
activity.gainAttention()
|
||||
|
Loading…
x
Reference in New Issue
Block a user