forked from github/wulkanowy-mirror
Remove deprecations (#1170)
This commit is contained in:
parent
963caadced
commit
412057b512
@ -4,6 +4,7 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.fragment.app.FragmentPagerAdapter
|
||||
|
||||
//TODO Use ViewPager2
|
||||
class BaseFragmentPagerAdapter(private val fragmentManager: FragmentManager) :
|
||||
FragmentPagerAdapter(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
|
||||
|
||||
|
@ -42,10 +42,8 @@ class ErrorDialog : BaseDialogFragment<DialogErrorBinding>() {
|
||||
companion object {
|
||||
private const val ARGUMENT_KEY = "Data"
|
||||
|
||||
fun newInstance(error: Throwable): ErrorDialog {
|
||||
return ErrorDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, error) }
|
||||
}
|
||||
fun newInstance(error: Throwable) = ErrorDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, error) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,12 +55,14 @@ class ErrorDialog : BaseDialogFragment<DialogErrorBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
return DialogErrorBinding.inflate(inflater).apply { binding = this }.root
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
) = DialogErrorBinding.inflate(inflater).apply { binding = this }.root
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val stringWriter = StringWriter().apply {
|
||||
error.printStackTrace(PrintWriter(this))
|
||||
|
@ -18,12 +18,11 @@ class AttendanceDialog : DialogFragment() {
|
||||
private lateinit var attendance: Attendance
|
||||
|
||||
companion object {
|
||||
|
||||
private const val ARGUMENT_KEY = "Item"
|
||||
|
||||
fun newInstance(exam: Attendance): AttendanceDialog {
|
||||
return AttendanceDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, exam) }
|
||||
}
|
||||
fun newInstance(exam: Attendance) = AttendanceDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, exam) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,12 +34,14 @@ class AttendanceDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return DialogAttendanceBinding.inflate(inflater).apply { binding = this }.root
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
) = DialogAttendanceBinding.inflate(inflater).apply { binding = this }.root
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
with(binding) {
|
||||
attendanceDialogSubject.text = attendance.subject
|
||||
|
@ -17,12 +17,11 @@ class ExamDialog : DialogFragment() {
|
||||
private lateinit var exam: Exam
|
||||
|
||||
companion object {
|
||||
|
||||
private const val ARGUMENT_KEY = "Item"
|
||||
|
||||
fun newInstance(exam: Exam): ExamDialog {
|
||||
return ExamDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, exam) }
|
||||
}
|
||||
fun newInstance(exam: Exam) = ExamDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, exam) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,12 +33,14 @@ class ExamDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return DialogExamBinding.inflate(inflater).apply { binding = this }.root
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
) = DialogExamBinding.inflate(inflater).apply { binding = this }.root
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
with(binding) {
|
||||
examDialogSubjectValue.text = exam.subject
|
||||
|
@ -24,17 +24,18 @@ class GradeDetailsDialog : DialogFragment() {
|
||||
private lateinit var colorScheme: String
|
||||
|
||||
companion object {
|
||||
|
||||
private const val ARGUMENT_KEY = "Item"
|
||||
|
||||
private const val COLOR_SCHEME_KEY = "Scheme"
|
||||
|
||||
fun newInstance(grade: Grade, colorScheme: String): GradeDetailsDialog {
|
||||
return GradeDetailsDialog().apply {
|
||||
fun newInstance(grade: Grade, colorScheme: String) =
|
||||
GradeDetailsDialog().apply {
|
||||
arguments = Bundle().apply {
|
||||
putSerializable(ARGUMENT_KEY, grade)
|
||||
putString(COLOR_SCHEME_KEY, colorScheme)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@ -46,12 +47,14 @@ class GradeDetailsDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return DialogGradeBinding.inflate(inflater).apply { binding = this }.root
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
) = DialogGradeBinding.inflate(inflater).apply { binding = this }.root
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
with(binding) {
|
||||
gradeDialogSubject.text = grade.subject
|
||||
|
@ -28,12 +28,11 @@ class HomeworkDetailsDialog : BaseDialogFragment<DialogHomeworkBinding>(), Homew
|
||||
private lateinit var homework: Homework
|
||||
|
||||
companion object {
|
||||
|
||||
private const val ARGUMENT_KEY = "Item"
|
||||
|
||||
fun newInstance(homework: Homework): HomeworkDetailsDialog {
|
||||
return HomeworkDetailsDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, homework) }
|
||||
}
|
||||
fun newInstance(homework: Homework) = HomeworkDetailsDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, homework) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,19 +44,22 @@ class HomeworkDetailsDialog : BaseDialogFragment<DialogHomeworkBinding>(), Homew
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return DialogHomeworkBinding.inflate(inflater).apply { binding = this }.root
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
) = DialogHomeworkBinding.inflate(inflater).apply { binding = this }.root
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
presenter.onAttachView(this)
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun initView() {
|
||||
with(binding) {
|
||||
homeworkDialogRead.text = view?.context?.getString(if (homework.isDone) R.string.homework_mark_as_undone else R.string.homework_mark_as_done)
|
||||
homeworkDialogRead.text =
|
||||
view?.context?.getString(if (homework.isDone) R.string.homework_mark_as_undone else R.string.homework_mark_as_done)
|
||||
homeworkDialogRead.setOnClickListener { presenter.toggleDone(homework) }
|
||||
homeworkDialogClose.setOnClickListener { dismiss() }
|
||||
}
|
||||
@ -87,7 +89,8 @@ class HomeworkDetailsDialog : BaseDialogFragment<DialogHomeworkBinding>(), Homew
|
||||
}
|
||||
|
||||
override fun updateMarkAsDoneLabel(isDone: Boolean) {
|
||||
binding.homeworkDialogRead.text = view?.context?.getString(if (isDone) R.string.homework_mark_as_undone else R.string.homework_mark_as_done)
|
||||
binding.homeworkDialogRead.text =
|
||||
view?.context?.getString(if (isDone) R.string.homework_mark_as_undone else R.string.homework_mark_as_done)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
@ -52,6 +52,8 @@ class LoginActivity : BaseActivity<LoginPresenter, ActivityLoginBinding>(), Logi
|
||||
updateHelper.onResume(this)
|
||||
}
|
||||
|
||||
//https://developer.android.com/guide/playcore/in-app-updates#status_callback
|
||||
@Suppress("DEPRECATION")
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
updateHelper.onActivityResult(requestCode, resultCode)
|
||||
@ -65,13 +67,15 @@ class LoginActivity : BaseActivity<LoginPresenter, ActivityLoginBinding>(), Logi
|
||||
|
||||
with(loginAdapter) {
|
||||
containerId = binding.loginViewpager.id
|
||||
addFragments(listOf(
|
||||
LoginFormFragment.newInstance(),
|
||||
LoginSymbolFragment.newInstance(),
|
||||
LoginStudentSelectFragment.newInstance(),
|
||||
LoginAdvancedFragment.newInstance(),
|
||||
LoginRecoverFragment.newInstance()
|
||||
))
|
||||
addFragments(
|
||||
listOf(
|
||||
LoginFormFragment.newInstance(),
|
||||
LoginSymbolFragment.newInstance(),
|
||||
LoginStudentSelectFragment.newInstance(),
|
||||
LoginAdvancedFragment.newInstance(),
|
||||
LoginRecoverFragment.newInstance()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
with(binding.loginViewpager) {
|
||||
@ -99,14 +103,20 @@ class LoginActivity : BaseActivity<LoginPresenter, ActivityLoginBinding>(), Logi
|
||||
}
|
||||
|
||||
override fun notifyInitSymbolFragment(loginData: Triple<String, String, String>) {
|
||||
(loginAdapter.getFragmentInstance(1) as? LoginSymbolFragment)?.onParentInitSymbolFragment(loginData)
|
||||
(loginAdapter.getFragmentInstance(1) as? LoginSymbolFragment)?.onParentInitSymbolFragment(
|
||||
loginData
|
||||
)
|
||||
}
|
||||
|
||||
override fun notifyInitStudentSelectFragment(studentsWithSemesters: List<StudentWithSemesters>) {
|
||||
(loginAdapter.getFragmentInstance(2) as? LoginStudentSelectFragment)?.onParentInitStudentSelectFragment(studentsWithSemesters)
|
||||
(loginAdapter.getFragmentInstance(2) as? LoginStudentSelectFragment)
|
||||
?.onParentInitStudentSelectFragment(studentsWithSemesters)
|
||||
}
|
||||
|
||||
fun onFormFragmentAccountLogged(studentsWithSemesters: List<StudentWithSemesters>, loginData: Triple<String, String, String>) {
|
||||
fun onFormFragmentAccountLogged(
|
||||
studentsWithSemesters: List<StudentWithSemesters>,
|
||||
loginData: Triple<String, String, String>
|
||||
) {
|
||||
presenter.onFormViewAccountLogged(studentsWithSemesters, loginData)
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,11 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
||||
initialize(startMenuIndex, savedInstanceState)
|
||||
pushFragment(moreMenuFragments[startMenuMoreIndex])
|
||||
}
|
||||
|
||||
if (appInfo.systemVersion >= Build.VERSION_CODES.N_MR1) {
|
||||
initShortcuts()
|
||||
}
|
||||
|
||||
updateHelper.checkAndInstallUpdates(this)
|
||||
}
|
||||
|
||||
@ -130,11 +135,11 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
||||
updateHelper.onResume(this)
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
//https://developer.android.com/guide/playcore/in-app-updates#status_callback
|
||||
@Suppress("DEPRECATION")
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
updateHelper.onActivityResult(requestCode, resultCode)
|
||||
if (appInfo.systemVersion >= Build.VERSION_CODES.N_MR1) initShortcuts()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N_MR1)
|
||||
@ -161,11 +166,6 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
||||
getString(R.string.timetable_title),
|
||||
R.drawable.ic_shortcut_timetable,
|
||||
MainView.Section.TIMETABLE
|
||||
),
|
||||
Triple(
|
||||
getString(R.string.message_title),
|
||||
R.drawable.ic_shortcut_message,
|
||||
MainView.Section.MESSAGE
|
||||
)
|
||||
).forEach { (title, icon, enum) ->
|
||||
shortcutsList.add(
|
||||
|
@ -20,13 +20,15 @@ import io.github.wulkanowy.ui.base.BaseDialogFragment
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MobileDeviceTokenDialog : BaseDialogFragment<DialogMobileDeviceBinding>(), MobileDeviceTokenVIew {
|
||||
class MobileDeviceTokenDialog : BaseDialogFragment<DialogMobileDeviceBinding>(),
|
||||
MobileDeviceTokenVIew {
|
||||
|
||||
@Inject
|
||||
lateinit var presenter: MobileDeviceTokenPresenter
|
||||
|
||||
companion object {
|
||||
fun newInstance(): MobileDeviceTokenDialog = MobileDeviceTokenDialog()
|
||||
|
||||
fun newInstance() = MobileDeviceTokenDialog()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@ -34,12 +36,14 @@ class MobileDeviceTokenDialog : BaseDialogFragment<DialogMobileDeviceBinding>(),
|
||||
setStyle(STYLE_NO_TITLE, 0)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return DialogMobileDeviceBinding.inflate(inflater).apply { binding = this }.root
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
) = DialogMobileDeviceBinding.inflate(inflater).apply { binding = this }.root
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
presenter.onAttachView(this)
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,11 @@ class NoteDialog : DialogFragment() {
|
||||
private lateinit var note: Note
|
||||
|
||||
companion object {
|
||||
|
||||
private const val ARGUMENT_KEY = "Item"
|
||||
|
||||
fun newInstance(exam: Note): NoteDialog {
|
||||
return NoteDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, exam) }
|
||||
}
|
||||
fun newInstance(exam: Note) = NoteDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, exam) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,13 +38,15 @@ class NoteDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return DialogNoteBinding.inflate(inflater).apply { binding = this }.root
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
) = DialogNoteBinding.inflate(inflater).apply { binding = this }.root
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
with(binding) {
|
||||
noteDialogDate.text = note.date.toFormattedString()
|
||||
@ -57,11 +58,19 @@ class NoteDialog : DialogFragment() {
|
||||
if (note.isPointsShow) {
|
||||
with(binding.noteDialogPoints) {
|
||||
text = "${if (note.points > 0) "+" else ""}${note.points}"
|
||||
setTextColor(when (NoteCategory.getByValue(note.categoryType)) {
|
||||
NoteCategory.POSITIVE -> ContextCompat.getColor(requireContext(), R.color.note_positive)
|
||||
NoteCategory.NEGATIVE -> ContextCompat.getColor(requireContext(), R.color.note_negative)
|
||||
else -> requireContext().getThemeAttrColor(android.R.attr.textColorPrimary)
|
||||
})
|
||||
setTextColor(
|
||||
when (NoteCategory.getByValue(note.categoryType)) {
|
||||
NoteCategory.POSITIVE -> ContextCompat.getColor(
|
||||
requireContext(),
|
||||
R.color.note_positive
|
||||
)
|
||||
NoteCategory.NEGATIVE -> ContextCompat.getColor(
|
||||
requireContext(),
|
||||
R.color.note_negative
|
||||
)
|
||||
else -> requireContext().getThemeAttrColor(android.R.attr.textColorPrimary)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package io.github.wulkanowy.ui.modules.settings
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
@ -49,7 +50,10 @@ class SettingsFragment : PreferenceFragmentCompat(),
|
||||
}
|
||||
}
|
||||
findPreference<Preference>(getString(R.string.pref_key_notifications_fix_issues))?.run {
|
||||
isVisible = AppKillerManager.isDeviceSupported() && AppKillerManager.isAnyActionAvailable(requireContext())
|
||||
isVisible =
|
||||
AppKillerManager.isDeviceSupported() && AppKillerManager.isAnyActionAvailable(
|
||||
requireContext()
|
||||
)
|
||||
setOnPreferenceClickListener {
|
||||
presenter.onFixSyncIssuesClicked()
|
||||
true
|
||||
@ -57,14 +61,15 @@ class SettingsFragment : PreferenceFragmentCompat(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
presenter.onAttachView(this)
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.scheme_preferences, rootKey)
|
||||
findPreference<Preference>(getString(R.string.pref_key_notification_debug))?.isVisible = appInfo.isDebug
|
||||
findPreference<Preference>(getString(R.string.pref_key_notification_debug))?.isVisible =
|
||||
appInfo.isDebug
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
|
||||
|
@ -24,12 +24,11 @@ class TimetableDialog : DialogFragment() {
|
||||
private lateinit var lesson: Timetable
|
||||
|
||||
companion object {
|
||||
|
||||
private const val ARGUMENT_KEY = "Item"
|
||||
|
||||
fun newInstance(exam: Timetable): TimetableDialog {
|
||||
return TimetableDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, exam) }
|
||||
}
|
||||
fun newInstance(exam: Timetable) = TimetableDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, exam) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,12 +40,14 @@ class TimetableDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return DialogTimetableBinding.inflate(inflater).apply { binding = this }.root
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
) = DialogTimetableBinding.inflate(inflater).apply { binding = this }.root
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
with(lesson) {
|
||||
setInfo(info, teacher, canceled, changes)
|
||||
@ -76,15 +77,24 @@ class TimetableDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
private fun setInfo(info: String, teacher: String, canceled: Boolean, changes: Boolean) {
|
||||
with(binding) {
|
||||
when {
|
||||
info.isNotBlank() -> {
|
||||
if (canceled) {
|
||||
timetableDialogChangesTitle.setTextColor(requireContext().getThemeAttrColor(R.attr.colorPrimary))
|
||||
timetableDialogChangesTitle.setTextColor(
|
||||
requireContext().getThemeAttrColor(
|
||||
R.attr.colorPrimary
|
||||
)
|
||||
)
|
||||
timetableDialogChanges.setTextColor(requireContext().getThemeAttrColor(R.attr.colorPrimary))
|
||||
} else {
|
||||
timetableDialogChangesTitle.setTextColor(requireContext().getThemeAttrColor(R.attr.colorTimetableChange))
|
||||
timetableDialogChangesTitle.setTextColor(
|
||||
requireContext().getThemeAttrColor(
|
||||
R.attr.colorTimetableChange
|
||||
)
|
||||
)
|
||||
timetableDialogChanges.setTextColor(requireContext().getThemeAttrColor(R.attr.colorTimetableChange))
|
||||
}
|
||||
|
||||
@ -167,6 +177,7 @@ class TimetableDialog : DialogFragment() {
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun setTime(start: LocalDateTime, end: LocalDateTime) {
|
||||
binding.timetableDialogTime.text = "${start.toFormattedString("HH:mm")} - ${end.toFormattedString("HH:mm")}"
|
||||
binding.timetableDialogTime.text =
|
||||
"${start.toFormattedString("HH:mm")} - ${end.toFormattedString("HH:mm")}"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.github.wulkanowy.ui.modules.timetable.completed
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -17,12 +16,11 @@ class CompletedLessonDialog : DialogFragment() {
|
||||
private lateinit var completedLesson: CompletedLesson
|
||||
|
||||
companion object {
|
||||
|
||||
private const val ARGUMENT_KEY = "Item"
|
||||
|
||||
fun newInstance(exam: CompletedLesson): CompletedLessonDialog {
|
||||
return CompletedLessonDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, exam) }
|
||||
}
|
||||
fun newInstance(exam: CompletedLesson) = CompletedLessonDialog().apply {
|
||||
arguments = Bundle().apply { putSerializable(ARGUMENT_KEY, exam) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,13 +32,14 @@ class CompletedLessonDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return DialogLessonCompletedBinding.inflate(inflater).apply { binding = this }.root
|
||||
}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
) = DialogLessonCompletedBinding.inflate(inflater).apply { binding = this }.root
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
with(binding) {
|
||||
completedLessonDialogSubject.text = completedLesson.subject
|
||||
|
Loading…
x
Reference in New Issue
Block a user