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.teacherDropdown.isEnabled = true
|
||||||
b.typeDropdown.isEnabled = true
|
b.typeDropdown.isEnabled = true
|
||||||
|
|
||||||
|
defaultType?.let {
|
||||||
|
b.typeDropdown.select(it.toLong())
|
||||||
|
}
|
||||||
|
|
||||||
b.typeDropdown.selected?.let { item ->
|
b.typeDropdown.selected?.let { item ->
|
||||||
customColor = (item.tag as EventType).color
|
customColor = (item.tag as EventType).color
|
||||||
}
|
}
|
||||||
@ -207,9 +211,11 @@ class EventManualDialog(
|
|||||||
customColor = null
|
customColor = null
|
||||||
return@setOnChangeListener true
|
return@setOnChangeListener true
|
||||||
}
|
}
|
||||||
|
|
||||||
(customColor ?: Event.COLOR_DEFAULT).let {
|
(customColor ?: Event.COLOR_DEFAULT).let {
|
||||||
b.typeColor.background.colorFilter = PorterDuffColorFilter(it, PorterDuff.Mode.SRC_ATOP)
|
b.typeColor.background.colorFilter = PorterDuffColorFilter(it, PorterDuff.Mode.SRC_ATOP)
|
||||||
}
|
}
|
||||||
|
|
||||||
b.typeColor.onClick {
|
b.typeColor.onClick {
|
||||||
val currentColor = (b.typeDropdown?.selected?.tag as EventType?)?.color ?: Event.COLOR_DEFAULT
|
val currentColor = (b.typeDropdown?.selected?.tag as EventType?)?.color ?: Event.COLOR_DEFAULT
|
||||||
val colorPickerDialog = ColorPickerDialog.newBuilder()
|
val colorPickerDialog = ColorPickerDialog.newBuilder()
|
||||||
|
@ -16,7 +16,6 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog;
|
|
||||||
import com.applandeo.materialcalendarview.CalendarView;
|
import com.applandeo.materialcalendarview.CalendarView;
|
||||||
import com.applandeo.materialcalendarview.EventDay;
|
import com.applandeo.materialcalendarview.EventDay;
|
||||||
import com.github.tibolte.agendacalendarview.AgendaCalendarView;
|
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.FragmentAgendaCalendarBinding;
|
||||||
import pl.szczodrzynski.edziennik.databinding.FragmentAgendaDefaultBinding;
|
import pl.szczodrzynski.edziennik.databinding.FragmentAgendaDefaultBinding;
|
||||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventListDialog;
|
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.lessonchange.LessonChangeDialog;
|
||||||
import pl.szczodrzynski.edziennik.ui.dialogs.teacherabsence.TeacherAbsenceDialog;
|
import pl.szczodrzynski.edziennik.ui.dialogs.teacherabsence.TeacherAbsenceDialog;
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.agenda.lessonchange.LessonChangeCounter;
|
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)
|
.withIcon(SzkolnyFont.Icon.szf_calendar_plus_outline)
|
||||||
.withOnClickListener(v3 -> {
|
.withOnClickListener(v3 -> {
|
||||||
activity.getBottomSheet().close();
|
activity.getBottomSheet().close();
|
||||||
new MaterialDialog.Builder(activity)
|
new EventManualDialog(
|
||||||
.title(R.string.main_menu_add)
|
activity,
|
||||||
.items(R.array.main_menu_add_options)
|
App.profileId,
|
||||||
.itemsCallback((dialog, itemView, position, text) -> {
|
null,
|
||||||
switch (position) {
|
null,
|
||||||
case 0:
|
null,
|
||||||
new EventManualDialogOld(activity).show(app, null, null, null, EventManualDialogOld.DIALOG_EVENT);
|
null,
|
||||||
break;
|
null,
|
||||||
case 1:
|
null,
|
||||||
new EventManualDialogOld(activity).show(app, null, null, null, EventManualDialogOld.DIALOG_HOMEWORK);
|
null
|
||||||
break;
|
);
|
||||||
}
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
}),
|
}),
|
||||||
new BottomSheetPrimaryItem(true)
|
new BottomSheetPrimaryItem(true)
|
||||||
.withTitle(R.string.menu_agenda_change_view)
|
.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.fabExtendedText = getString(R.string.add)
|
||||||
activity.navView.bottomBar.fabIcon = CommunityMaterial.Icon2.cmd_plus
|
activity.navView.bottomBar.fabIcon = CommunityMaterial.Icon2.cmd_plus
|
||||||
activity.navView.setFabOnClickListener(View.OnClickListener {
|
activity.navView.setFabOnClickListener(View.OnClickListener {
|
||||||
EventManualDialog(activity, App.profileId)
|
EventManualDialog(activity, App.profileId, defaultType = Event.TYPE_HOMEWORK)
|
||||||
})
|
})
|
||||||
|
|
||||||
activity.gainAttention()
|
activity.gainAttention()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user