forked from github/wulkanowy-mirror
Update project to Android SDK 31 (#1570)
This commit is contained in:
parent
f88d44f0ec
commit
007d62e61d
@ -15,17 +15,16 @@ apply from: 'sonarqube.gradle'
|
||||
apply from: 'hooks.gradle'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
compileSdkVersion 31
|
||||
|
||||
defaultConfig {
|
||||
applicationId "io.github.wulkanowy"
|
||||
testApplicationId "io.github.tests.wulkanowy"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
targetSdkVersion 31
|
||||
versionCode 97
|
||||
versionName "1.3.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
|
||||
resValue "string", "app_name", "Wulkanowy"
|
||||
|
||||
@ -166,7 +165,7 @@ huaweiPublish {
|
||||
}
|
||||
|
||||
ext {
|
||||
work_manager = "2.6.0"
|
||||
work_manager = "2.7.0"
|
||||
android_hilt = "1.0.0"
|
||||
room = "2.3.0"
|
||||
chucker = "3.5.2"
|
||||
@ -183,9 +182,9 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"
|
||||
|
||||
implementation "androidx.core:core-ktx:1.6.0"
|
||||
implementation 'androidx.core:core-splashscreen:1.0.0-alpha02'
|
||||
implementation "androidx.activity:activity-ktx:1.3.1"
|
||||
implementation "androidx.appcompat:appcompat:1.3.1"
|
||||
implementation "androidx.appcompat:appcompat-resources:1.3.1"
|
||||
implementation "androidx.appcompat:appcompat:1.4.0-beta01"
|
||||
implementation "androidx.fragment:fragment-ktx:1.3.6"
|
||||
implementation "androidx.annotation:annotation:1.2.0"
|
||||
|
||||
|
@ -42,7 +42,6 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="false"
|
||||
android:theme="@style/WulkanowyTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
|
||||
<activity
|
||||
android:name=".ui.modules.splash.SplashActivity"
|
||||
|
@ -22,11 +22,14 @@ class SharedPrefProvider @Inject constructor(
|
||||
|
||||
fun getString(key: String) = sharedPref.getString(key, null)
|
||||
|
||||
fun getString(key: String, defaultValue: String): String = sharedPref.getString(key, defaultValue) ?: defaultValue
|
||||
fun getString(key: String, defaultValue: String): String =
|
||||
sharedPref.getString(key, defaultValue) ?: defaultValue
|
||||
|
||||
fun getBoolean(key: String, defaultValue: Boolean): Boolean = sharedPref.getBoolean(key, defaultValue)
|
||||
fun getBoolean(key: String, defaultValue: Boolean): Boolean =
|
||||
sharedPref.getBoolean(key, defaultValue)
|
||||
|
||||
fun putBoolean(key: String, value: Boolean, sync: Boolean = false) = sharedPref.edit(sync) { putBoolean(key, value) }
|
||||
fun putBoolean(key: String, value: Boolean, sync: Boolean = false) =
|
||||
sharedPref.edit(sync) { putBoolean(key, value) }
|
||||
|
||||
fun putString(key: String, value: String?, sync: Boolean = false) {
|
||||
sharedPref.edit(sync) { putString(key, value) }
|
||||
|
@ -1,7 +1,6 @@
|
||||
package io.github.wulkanowy.services.alarm
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.app.PendingIntent.FLAG_UPDATE_CURRENT
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
@ -16,7 +15,8 @@ import io.github.wulkanowy.data.repositories.StudentRepository
|
||||
import io.github.wulkanowy.services.HiltBroadcastReceiver
|
||||
import io.github.wulkanowy.services.sync.channels.UpcomingLessonsChannel.Companion.CHANNEL_ID
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.PendingIntentCompat
|
||||
import io.github.wulkanowy.utils.flowWithResource
|
||||
import io.github.wulkanowy.utils.getCompatColor
|
||||
import io.github.wulkanowy.utils.toLocalDateTime
|
||||
@ -138,8 +138,8 @@ class TimetableNotificationReceiver : HiltBroadcastReceiver() {
|
||||
PendingIntent.getActivity(
|
||||
context,
|
||||
NOTIFICATION_ID,
|
||||
MainActivity.getStartIntent(context, Destination.Timetable(), true),
|
||||
FLAG_UPDATE_CURRENT
|
||||
SplashActivity.getStartIntent(context, Destination.Timetable(), true),
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||
)
|
||||
)
|
||||
.build()
|
||||
|
@ -3,7 +3,6 @@ package io.github.wulkanowy.services.alarm
|
||||
import android.app.AlarmManager
|
||||
import android.app.AlarmManager.RTC_WAKEUP
|
||||
import android.app.PendingIntent
|
||||
import android.app.PendingIntent.FLAG_UPDATE_CURRENT
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.core.app.AlarmManagerCompat
|
||||
@ -26,6 +25,7 @@ import io.github.wulkanowy.services.alarm.TimetableNotificationReceiver.Companio
|
||||
import io.github.wulkanowy.services.alarm.TimetableNotificationReceiver.Companion.STUDENT_ID
|
||||
import io.github.wulkanowy.services.alarm.TimetableNotificationReceiver.Companion.STUDENT_NAME
|
||||
import io.github.wulkanowy.utils.DispatchersProvider
|
||||
import io.github.wulkanowy.utils.PendingIntentCompat
|
||||
import io.github.wulkanowy.utils.nickOrName
|
||||
import io.github.wulkanowy.utils.toTimestamp
|
||||
import kotlinx.coroutines.withContext
|
||||
@ -72,8 +72,14 @@ class TimetableNotificationSchedulerHelper @Inject constructor(
|
||||
|
||||
private fun cancelScheduledTo(range: ClosedRange<LocalDateTime>, requestCode: Int) {
|
||||
if (now() in range) cancelNotification()
|
||||
|
||||
alarmManager.cancel(
|
||||
PendingIntent.getBroadcast(context, requestCode, Intent(), FLAG_UPDATE_CURRENT)
|
||||
PendingIntent.getBroadcast(
|
||||
context,
|
||||
requestCode,
|
||||
Intent(),
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -156,7 +162,7 @@ class TimetableNotificationSchedulerHelper @Inject constructor(
|
||||
alarmManager, RTC_WAKEUP, time.toTimestamp(),
|
||||
PendingIntent.getBroadcast(context, getRequestCode(time, studentId), intent.also {
|
||||
it.putExtra(LESSON_TYPE, notificationType)
|
||||
}, FLAG_UPDATE_CURRENT)
|
||||
}, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE)
|
||||
)
|
||||
Timber.d(
|
||||
"TimetableNotification scheduled: type: $notificationType, subject: ${
|
||||
|
@ -8,7 +8,7 @@ import androidx.core.graphics.drawable.IconCompat
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@ -35,7 +35,7 @@ class ShortcutsHelper @Inject constructor(@ApplicationContext private val contex
|
||||
.setShortLabel(context.getString(R.string.grade_title))
|
||||
.setLongLabel(context.getString(R.string.grade_title))
|
||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_grade))
|
||||
.setIntent(MainActivity.getStartIntent(context, startNewTask = true)
|
||||
.setIntent(SplashActivity.getStartIntent(context, startNewTask = true)
|
||||
.apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "grade")
|
||||
@ -47,7 +47,7 @@ class ShortcutsHelper @Inject constructor(@ApplicationContext private val contex
|
||||
.setShortLabel(context.getString(R.string.attendance_title))
|
||||
.setLongLabel(context.getString(R.string.attendance_title))
|
||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_attendance))
|
||||
.setIntent(MainActivity.getStartIntent(context, startNewTask = true)
|
||||
.setIntent(SplashActivity.getStartIntent(context, startNewTask = true)
|
||||
.apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "attendance")
|
||||
@ -59,7 +59,7 @@ class ShortcutsHelper @Inject constructor(@ApplicationContext private val contex
|
||||
.setShortLabel(context.getString(R.string.exam_title))
|
||||
.setLongLabel(context.getString(R.string.exam_title))
|
||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_exam))
|
||||
.setIntent(MainActivity.getStartIntent(context, startNewTask = true)
|
||||
.setIntent(SplashActivity.getStartIntent(context, startNewTask = true)
|
||||
.apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "exam")
|
||||
@ -71,7 +71,7 @@ class ShortcutsHelper @Inject constructor(@ApplicationContext private val contex
|
||||
.setShortLabel(context.getString(R.string.timetable_title))
|
||||
.setLongLabel(context.getString(R.string.timetable_title))
|
||||
.setIcon(IconCompat.createWithResource(context, R.drawable.ic_shortcut_timetable))
|
||||
.setIntent(MainActivity.getStartIntent(context, startNewTask = true)
|
||||
.setIntent(SplashActivity.getStartIntent(context, startNewTask = true)
|
||||
.apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
putExtra(EXTRA_SHORTCUT_DESTINATION_ID, "timetable")
|
||||
|
@ -13,6 +13,7 @@ import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.data.repositories.NotificationRepository
|
||||
import io.github.wulkanowy.utils.PendingIntentCompat
|
||||
import io.github.wulkanowy.utils.getCompatBitmap
|
||||
import io.github.wulkanowy.utils.getCompatColor
|
||||
import io.github.wulkanowy.utils.nickOrName
|
||||
@ -45,7 +46,7 @@ class AppNotificationManager @Inject constructor(
|
||||
context,
|
||||
Random.nextInt(),
|
||||
notificationData.intentToStart,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||
)
|
||||
)
|
||||
.setContentTitle(notificationData.title)
|
||||
@ -86,7 +87,7 @@ class AppNotificationManager @Inject constructor(
|
||||
context,
|
||||
Random.nextInt(),
|
||||
notificationData.intentToStart,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||
)
|
||||
)
|
||||
.setContentTitle(notificationData.title)
|
||||
@ -134,7 +135,7 @@ class AppNotificationManager @Inject constructor(
|
||||
context,
|
||||
Random.nextInt(),
|
||||
groupNotificationData.intentToStart,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||
)
|
||||
)
|
||||
.setLocalOnly(true)
|
||||
|
@ -8,7 +8,7 @@ import io.github.wulkanowy.data.db.entities.Timetable
|
||||
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.getPlural
|
||||
import io.github.wulkanowy.utils.toFormattedString
|
||||
import java.time.LocalDate
|
||||
@ -32,7 +32,7 @@ class ChangeTimetableNotification @Inject constructor(
|
||||
1
|
||||
),
|
||||
content = it,
|
||||
intentToStart = MainActivity.getStartIntent(
|
||||
intentToStart = SplashActivity.getStartIntent(
|
||||
context = context,
|
||||
destination = Destination.Timetable(date),
|
||||
startNewTask = true
|
||||
@ -54,7 +54,7 @@ class ChangeTimetableNotification @Inject constructor(
|
||||
changedLessons.size,
|
||||
changedLessons.size
|
||||
),
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Timetable(), true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Timetable(), true),
|
||||
type = NotificationType.CHANGE_TIMETABLE
|
||||
)
|
||||
|
||||
|
@ -8,7 +8,7 @@ import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.descriptionRes
|
||||
import io.github.wulkanowy.utils.getPlural
|
||||
import io.github.wulkanowy.utils.toFormattedString
|
||||
@ -31,7 +31,7 @@ class NewAttendanceNotification @Inject constructor(
|
||||
NotificationData(
|
||||
title = context.getPlural(R.plurals.attendance_notify_new_items_title, 1),
|
||||
content = it,
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Attendance, true)
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Attendance, true)
|
||||
)
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ class NewAttendanceNotification @Inject constructor(
|
||||
notificationDataList.size,
|
||||
notificationDataList.size
|
||||
),
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Attendance, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Attendance, true),
|
||||
type = NotificationType.NEW_ATTENDANCE
|
||||
)
|
||||
|
||||
|
@ -8,7 +8,7 @@ import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.getPlural
|
||||
import io.github.wulkanowy.utils.toFormattedString
|
||||
import java.time.LocalDateTime
|
||||
@ -31,7 +31,7 @@ class NewConferenceNotification @Inject constructor(
|
||||
NotificationData(
|
||||
title = context.getPlural(R.plurals.conference_notify_new_item_title, 1),
|
||||
content = it,
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Conference, true)
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Conference, true)
|
||||
)
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ class NewConferenceNotification @Inject constructor(
|
||||
lines.size,
|
||||
lines.size
|
||||
),
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Conference, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Conference, true),
|
||||
type = NotificationType.NEW_CONFERENCE
|
||||
)
|
||||
|
||||
|
@ -8,7 +8,7 @@ import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.getPlural
|
||||
import io.github.wulkanowy.utils.toFormattedString
|
||||
import java.time.LocalDate
|
||||
@ -31,7 +31,7 @@ class NewExamNotification @Inject constructor(
|
||||
NotificationData(
|
||||
title = context.getPlural(R.plurals.exam_notify_new_item_title, 1),
|
||||
content = it,
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Exam, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Exam, true),
|
||||
)
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ class NewExamNotification @Inject constructor(
|
||||
lines.size,
|
||||
lines.size
|
||||
),
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Exam, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Exam, true),
|
||||
type = NotificationType.NEW_EXAM
|
||||
)
|
||||
|
||||
|
@ -9,7 +9,7 @@ import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.getPlural
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -23,7 +23,7 @@ class NewGradeNotification @Inject constructor(
|
||||
NotificationData(
|
||||
title = context.getPlural(R.plurals.grade_new_items, 1),
|
||||
content = "${it.subject}: ${it.entry}",
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Grade, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
||||
)
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ class NewGradeNotification @Inject constructor(
|
||||
notificationDataList = notificationDataList,
|
||||
title = context.getPlural(R.plurals.grade_new_items, items.size),
|
||||
content = context.getPlural(R.plurals.grade_notify_new_items, items.size, items.size),
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Grade, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
||||
type = NotificationType.NEW_GRADE_DETAILS
|
||||
)
|
||||
|
||||
@ -43,7 +43,7 @@ class NewGradeNotification @Inject constructor(
|
||||
NotificationData(
|
||||
title = context.getPlural(R.plurals.grade_new_items_predicted, 1),
|
||||
content = "${it.subject}: ${it.predictedGrade}",
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Grade, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
||||
)
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ class NewGradeNotification @Inject constructor(
|
||||
items.size,
|
||||
items.size
|
||||
),
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Grade, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
||||
type = NotificationType.NEW_GRADE_PREDICTED
|
||||
)
|
||||
|
||||
@ -67,7 +67,7 @@ class NewGradeNotification @Inject constructor(
|
||||
NotificationData(
|
||||
title = context.getPlural(R.plurals.grade_new_items_final, 1),
|
||||
content = "${it.subject}: ${it.finalGrade}",
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Grade, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
||||
)
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ class NewGradeNotification @Inject constructor(
|
||||
items.size,
|
||||
items.size
|
||||
),
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Grade, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Grade, true),
|
||||
type = NotificationType.NEW_GRADE_FINAL
|
||||
)
|
||||
|
||||
|
@ -8,7 +8,7 @@ import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.getPlural
|
||||
import io.github.wulkanowy.utils.toFormattedString
|
||||
import java.time.LocalDate
|
||||
@ -31,7 +31,7 @@ class NewHomeworkNotification @Inject constructor(
|
||||
NotificationData(
|
||||
title = context.getPlural(R.plurals.homework_notify_new_item_title, 1),
|
||||
content = it,
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Homework, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Homework, true),
|
||||
)
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ class NewHomeworkNotification @Inject constructor(
|
||||
lines.size,
|
||||
lines.size
|
||||
),
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Homework, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Homework, true),
|
||||
type = NotificationType.NEW_HOMEWORK,
|
||||
notificationDataList = notificationDataList
|
||||
)
|
||||
|
@ -7,7 +7,7 @@ import io.github.wulkanowy.data.db.entities.LuckyNumber
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import javax.inject.Inject
|
||||
|
||||
class NewLuckyNumberNotification @Inject constructor(
|
||||
@ -22,7 +22,7 @@ class NewLuckyNumberNotification @Inject constructor(
|
||||
R.string.lucky_number_notify_new_item,
|
||||
item.luckyNumber.toString()
|
||||
),
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.LuckyNumber, true)
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.LuckyNumber, true)
|
||||
)
|
||||
|
||||
appNotificationManager.sendSingleNotification(
|
||||
|
@ -8,7 +8,7 @@ import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.getPlural
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -22,7 +22,7 @@ class NewMessageNotification @Inject constructor(
|
||||
NotificationData(
|
||||
title = context.getPlural(R.plurals.message_new_items, 1),
|
||||
content = "${it.sender}: ${it.subject}",
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Message, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Message, true),
|
||||
)
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ class NewMessageNotification @Inject constructor(
|
||||
notificationDataList = notificationDataList,
|
||||
title = context.getPlural(R.plurals.message_new_items, items.size),
|
||||
content = context.getPlural(R.plurals.message_notify_new_items, items.size, items.size),
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Message, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Message, true),
|
||||
type = NotificationType.NEW_MESSAGE
|
||||
)
|
||||
|
||||
|
@ -9,7 +9,7 @@ import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.getPlural
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -29,13 +29,13 @@ class NewNoteNotification @Inject constructor(
|
||||
NotificationData(
|
||||
title = context.getPlural(titleRes, 1),
|
||||
content = "${it.teacher}: ${it.category}",
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Note, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Note, true),
|
||||
)
|
||||
}
|
||||
|
||||
val groupNotificationData = GroupNotificationData(
|
||||
notificationDataList = notificationDataList,
|
||||
intentToStart = MainActivity.getStartIntent(context, Destination.Note, true),
|
||||
intentToStart = SplashActivity.getStartIntent(context, Destination.Note, true),
|
||||
title = context.getPlural(R.plurals.note_new_items, items.size),
|
||||
content = context.getPlural(R.plurals.note_notify_new_items, items.size, items.size),
|
||||
type = NotificationType.NEW_NOTE
|
||||
|
@ -8,7 +8,7 @@ import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.pojos.GroupNotificationData
|
||||
import io.github.wulkanowy.data.pojos.NotificationData
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.getPlural
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -20,7 +20,7 @@ class NewSchoolAnnouncementNotification @Inject constructor(
|
||||
suspend fun notify(items: List<SchoolAnnouncement>, student: Student) {
|
||||
val notificationDataList = items.map {
|
||||
NotificationData(
|
||||
intentToStart = MainActivity.getStartIntent(
|
||||
intentToStart = SplashActivity.getStartIntent(
|
||||
context = context,
|
||||
destination = Destination.SchoolAnnouncement,
|
||||
startNewTask = true
|
||||
@ -34,7 +34,7 @@ class NewSchoolAnnouncementNotification @Inject constructor(
|
||||
}
|
||||
val groupNotificationData = GroupNotificationData(
|
||||
type = NotificationType.NEW_ANNOUNCEMENT,
|
||||
intentToStart = MainActivity.getStartIntent(
|
||||
intentToStart = SplashActivity.getStartIntent(
|
||||
context = context,
|
||||
destination = Destination.SchoolAnnouncement,
|
||||
startNewTask = true
|
||||
|
@ -1,14 +1,11 @@
|
||||
package io.github.wulkanowy.ui.base
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.snackbar.Snackbar.LENGTH_LONG
|
||||
@ -40,7 +37,6 @@ abstract class BaseActivity<T : BasePresenter<out BaseView>, VB : ViewBinding> :
|
||||
themeManager.applyActivityTheme(this)
|
||||
super.onCreate(savedInstanceState)
|
||||
supportFragmentManager.registerFragmentLifecycleCallbacks(fragmentLifecycleLogger, true)
|
||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
setTaskDescription(
|
||||
@ -83,8 +79,8 @@ abstract class BaseActivity<T : BasePresenter<out BaseView>, VB : ViewBinding> :
|
||||
}
|
||||
|
||||
override fun openClearLoginView() {
|
||||
startActivity(LoginActivity.getStartIntent(this)
|
||||
.apply { addFlags(FLAG_ACTIVITY_CLEAR_TASK or FLAG_ACTIVITY_NEW_TASK) })
|
||||
startActivity(LoginActivity.getStartIntent(this))
|
||||
finishAffinity()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
@ -20,7 +20,7 @@ open class BasePresenter<T : BaseView>(
|
||||
) {
|
||||
private val job = SupervisorJob()
|
||||
|
||||
protected val presenterScope = CoroutineScope(job + Dispatchers.Main)
|
||||
protected val presenterScope = CoroutineScope(job + Dispatchers.Main.immediate)
|
||||
|
||||
private val childrenJobs = mutableMapOf<String, Job>()
|
||||
|
||||
|
@ -41,14 +41,15 @@ class ThemeManager @Inject constructor(private val preferencesRepository: Prefer
|
||||
)
|
||||
}
|
||||
|
||||
private fun isThemeApplicable(activity: AppCompatActivity): Boolean {
|
||||
return activity.packageManager
|
||||
private fun isThemeApplicable(activity: AppCompatActivity) =
|
||||
activity.packageManager
|
||||
.getPackageInfo(activity.packageName, GET_ACTIVITIES)
|
||||
.activities.singleOrNull { it.name == activity::class.java.canonicalName }
|
||||
?.theme.let {
|
||||
.activities
|
||||
.singleOrNull { it.name == activity::class.java.canonicalName }
|
||||
?.theme
|
||||
.let {
|
||||
it == R.style.WulkanowyTheme_Black || it == R.style.WulkanowyTheme_NoActionBar
|
||||
|| it == R.style.WulkanowyTheme_Login || it == R.style.WulkanowyTheme_Login_Black
|
||||
|| it == R.style.WulkanowyTheme_MessageSend || it == R.style.WulkanowyTheme_MessageSend_Black
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,10 @@ import java.time.LocalDate
|
||||
|
||||
sealed interface Destination : Serializable {
|
||||
|
||||
/*
|
||||
Type in children classes have to be as getter to avoid null in enums
|
||||
https://stackoverflow.com/questions/68866453/kotlin-enum-val-is-returning-null-despite-being-set-at-compile-time
|
||||
*/
|
||||
val type: Type
|
||||
|
||||
val fragment: Fragment
|
||||
@ -41,91 +45,91 @@ sealed interface Destination : Serializable {
|
||||
|
||||
object Dashboard : Destination {
|
||||
|
||||
override val type = Type.DASHBOARD
|
||||
override val type get() = Type.DASHBOARD
|
||||
|
||||
override val fragment get() = DashboardFragment.newInstance()
|
||||
}
|
||||
|
||||
object Grade : Destination {
|
||||
|
||||
override val type = Type.GRADE
|
||||
override val type get() = Type.GRADE
|
||||
|
||||
override val fragment get() = GradeFragment.newInstance()
|
||||
}
|
||||
|
||||
object Attendance : Destination {
|
||||
|
||||
override val type = Type.ATTENDANCE
|
||||
override val type get() = Type.ATTENDANCE
|
||||
|
||||
override val fragment get() = AttendanceFragment.newInstance()
|
||||
}
|
||||
|
||||
object Exam : Destination {
|
||||
|
||||
override val type = Type.EXAM
|
||||
override val type get() = Type.EXAM
|
||||
|
||||
override val fragment get() = ExamFragment.newInstance()
|
||||
}
|
||||
|
||||
data class Timetable(val date: LocalDate? = null) : Destination {
|
||||
|
||||
override val type = Type.TIMETABLE
|
||||
override val type get() = Type.TIMETABLE
|
||||
|
||||
override val fragment get() = TimetableFragment.newInstance(date)
|
||||
}
|
||||
|
||||
object Homework : Destination {
|
||||
|
||||
override val type = Type.HOMEWORK
|
||||
override val type get() = Type.HOMEWORK
|
||||
|
||||
override val fragment get() = HomeworkFragment.newInstance()
|
||||
}
|
||||
|
||||
object Note : Destination {
|
||||
|
||||
override val type = Type.NOTE
|
||||
override val type get() = Type.NOTE
|
||||
|
||||
override val fragment get() = NoteFragment.newInstance()
|
||||
}
|
||||
|
||||
object Conference : Destination {
|
||||
|
||||
override val type = Type.CONFERENCE
|
||||
override val type get() = Type.CONFERENCE
|
||||
|
||||
override val fragment get() = ConferenceFragment.newInstance()
|
||||
}
|
||||
|
||||
object SchoolAnnouncement : Destination {
|
||||
|
||||
override val type = Type.SCHOOL_ANNOUNCEMENT
|
||||
override val type get() = Type.SCHOOL_ANNOUNCEMENT
|
||||
|
||||
override val fragment get() = SchoolAnnouncementFragment.newInstance()
|
||||
}
|
||||
|
||||
object School : Destination {
|
||||
|
||||
override val type = Type.SCHOOL
|
||||
override val type get() = Type.SCHOOL
|
||||
|
||||
override val fragment get() = SchoolFragment.newInstance()
|
||||
}
|
||||
|
||||
object LuckyNumber : Destination {
|
||||
|
||||
override val type = Type.LUCKY_NUMBER
|
||||
override val type get() = Type.LUCKY_NUMBER
|
||||
|
||||
override val fragment get() = LuckyNumberFragment.newInstance()
|
||||
}
|
||||
|
||||
object More : Destination {
|
||||
|
||||
override val type = Type.MORE
|
||||
override val type get() = Type.MORE
|
||||
|
||||
override val fragment get() = MoreFragment.newInstance()
|
||||
}
|
||||
|
||||
object Message : Destination {
|
||||
|
||||
override val type = Type.MESSAGE
|
||||
override val type get() = Type.MESSAGE
|
||||
|
||||
override val fragment get() = MessageFragment.newInstance()
|
||||
}
|
||||
|
@ -3,12 +3,9 @@ package io.github.wulkanowy.ui.modules.account.accountedit
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.graphics.drawable.RippleDrawable
|
||||
import android.graphics.drawable.StateListDrawable
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
@ -52,30 +49,13 @@ class AccountEditColorAdapter @Inject constructor() :
|
||||
}
|
||||
}
|
||||
|
||||
private fun Int.createForegroundDrawable(): Drawable =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
val mask = GradientDrawable().apply {
|
||||
shape = GradientDrawable.OVAL
|
||||
setColor(Color.BLACK)
|
||||
}
|
||||
RippleDrawable(ColorStateList.valueOf(this.rippleColor), null, mask)
|
||||
} else {
|
||||
val foreground = StateListDrawable().apply {
|
||||
alpha = 80
|
||||
setEnterFadeDuration(250)
|
||||
setExitFadeDuration(250)
|
||||
}
|
||||
|
||||
val mask = GradientDrawable().apply {
|
||||
shape = GradientDrawable.OVAL
|
||||
setColor(this@createForegroundDrawable.rippleColor)
|
||||
}
|
||||
|
||||
foreground.apply {
|
||||
addState(intArrayOf(android.R.attr.state_pressed), mask)
|
||||
addState(intArrayOf(), ColorDrawable(Color.TRANSPARENT))
|
||||
}
|
||||
private fun Int.createForegroundDrawable(): Drawable {
|
||||
val mask = GradientDrawable().apply {
|
||||
shape = GradientDrawable.OVAL
|
||||
setColor(Color.BLACK)
|
||||
}
|
||||
return RippleDrawable(ColorStateList.valueOf(this.rippleColor), null, mask)
|
||||
}
|
||||
|
||||
private inline val Int.rippleColor: Int
|
||||
get() {
|
||||
|
@ -121,9 +121,7 @@ class AttendanceFragment : BaseFragment<FragmentAttendanceBinding>(R.layout.frag
|
||||
attendanceSwipe.setOnRefreshListener(presenter::onSwipeRefresh)
|
||||
attendanceSwipe.setColorSchemeColors(requireContext().getThemeAttrColor(R.attr.colorPrimary))
|
||||
attendanceSwipe.setProgressBackgroundColorSchemeColor(
|
||||
requireContext().getThemeAttrColor(
|
||||
R.attr.colorSwipeRefresh
|
||||
)
|
||||
requireContext().getThemeAttrColor(R.attr.colorSwipeRefresh)
|
||||
)
|
||||
attendanceErrorRetry.setOnClickListener { presenter.onRetry() }
|
||||
attendanceErrorDetails.setOnClickListener { presenter.onDetailsClick() }
|
||||
@ -134,7 +132,7 @@ class AttendanceFragment : BaseFragment<FragmentAttendanceBinding>(R.layout.frag
|
||||
|
||||
attendanceExcuseButton.setOnClickListener { presenter.onExcuseButtonClick() }
|
||||
|
||||
attendanceNavContainer.setElevationCompat(requireContext().dpToPx(8f))
|
||||
attendanceNavContainer.elevation = requireContext().dpToPx(8f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class AttendanceSummaryFragment :
|
||||
setOnItemSelectedListener<TextView> { presenter.onSubjectSelected(it?.text?.toString()) }
|
||||
}
|
||||
|
||||
binding.attendanceSummarySubjectsContainer.setElevationCompat(requireContext().dpToPx(1f))
|
||||
binding.attendanceSummarySubjectsContainer.elevation = requireContext().dpToPx(1f)
|
||||
}
|
||||
|
||||
override fun updateSubjects(data: ArrayList<String>) {
|
||||
|
@ -64,7 +64,7 @@ class ExamFragment : BaseFragment<FragmentExamBinding>(R.layout.fragment_exam),
|
||||
examPreviousButton.setOnClickListener { presenter.onPreviousWeek() }
|
||||
examNextButton.setOnClickListener { presenter.onNextWeek() }
|
||||
|
||||
examNavContainer.setElevationCompat(requireContext().dpToPx(8f))
|
||||
examNavContainer.elevation = requireContext().dpToPx(8f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,9 +96,7 @@ class GradeFragment : BaseFragment<FragmentGradeBinding>(R.layout.fragment_grade
|
||||
TabLayoutMediator(binding.gradeTabLayout, binding.gradeViewPager, this).attach()
|
||||
}
|
||||
|
||||
with(binding.gradeTabLayout) {
|
||||
setElevationCompat(context.dpToPx(4f))
|
||||
}
|
||||
binding.gradeTabLayout.elevation = requireContext().dpToPx(4f)
|
||||
|
||||
with(binding) {
|
||||
gradeErrorRetry.setOnClickListener { presenter.onRetry() }
|
||||
|
@ -68,7 +68,7 @@ class GradeStatisticsFragment :
|
||||
}
|
||||
|
||||
with(binding) {
|
||||
gradeStatisticsSubjectsContainer.setElevationCompat(requireContext().dpToPx(1f))
|
||||
gradeStatisticsSubjectsContainer.elevation = requireContext().dpToPx(1f)
|
||||
|
||||
gradeStatisticsSwipe.setOnRefreshListener(presenter::onSwipeRefresh)
|
||||
gradeStatisticsSwipe.setColorSchemeColors(requireContext().getThemeAttrColor(R.attr.colorPrimary))
|
||||
|
@ -67,7 +67,7 @@ class HomeworkFragment : BaseFragment<FragmentHomeworkBinding>(R.layout.fragment
|
||||
|
||||
openAddHomeworkButton.setOnClickListener { presenter.onHomeworkAddButtonClicked() }
|
||||
|
||||
homeworkNavContainer.setElevationCompat(requireContext().dpToPx(8f))
|
||||
homeworkNavContainer.elevation = requireContext().dpToPx(8f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,13 +35,13 @@ class LoginActivity : BaseActivity<LoginPresenter, ActivityLoginBinding>(), Logi
|
||||
@Inject
|
||||
lateinit var updateHelper: UpdateHelper
|
||||
|
||||
override val currentViewIndex get() = binding.loginViewpager.currentItem
|
||||
|
||||
companion object {
|
||||
|
||||
fun getStartIntent(context: Context) = Intent(context, LoginActivity::class.java)
|
||||
}
|
||||
|
||||
override val currentViewIndex get() = binding.loginViewpager.currentItem
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(ActivityLoginBinding.inflate(layoutInflater).apply { binding = this }.root)
|
||||
|
@ -66,14 +66,8 @@ class LoginStudentSelectFragment :
|
||||
}
|
||||
|
||||
override fun openMainView() {
|
||||
activity?.let {
|
||||
startActivity(
|
||||
MainActivity.getStartIntent(
|
||||
context = it,
|
||||
startNewTask = true
|
||||
)
|
||||
)
|
||||
}
|
||||
startActivity(MainActivity.getStartIntent(requireContext()))
|
||||
requireActivity().finish()
|
||||
}
|
||||
|
||||
override fun showProgress(show: Boolean) {
|
||||
@ -115,7 +109,8 @@ class LoginStudentSelectFragment :
|
||||
chooserTitle = requireContext().getString(R.string.login_email_intent_title),
|
||||
email = "wulkanowyinc@gmail.com",
|
||||
subject = requireContext().getString(R.string.login_email_subject),
|
||||
body = requireContext().getString(R.string.login_email_text, appInfo.systemModel,
|
||||
body = requireContext().getString(
|
||||
R.string.login_email_text, appInfo.systemModel,
|
||||
appInfo.systemVersion.toString(),
|
||||
appInfo.versionName,
|
||||
"Select users to log in",
|
||||
|
@ -65,7 +65,7 @@ class LuckyNumberHistoryFragment :
|
||||
luckyNumberHistoryPreviousButton.setOnClickListener { presenter.onPreviousWeek() }
|
||||
luckyNumberHistoryNextButton.setOnClickListener { presenter.onNextWeek() }
|
||||
|
||||
luckyNumberHistoryNavContainer.setElevationCompat(requireContext().dpToPx(8f))
|
||||
luckyNumberHistoryNavContainer.elevation = requireContext().dpToPx(8f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package io.github.wulkanowy.ui.modules.luckynumberwidget
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.app.PendingIntent.FLAG_UPDATE_CURRENT
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.appwidget.AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT
|
||||
import android.appwidget.AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH
|
||||
@ -19,7 +18,8 @@ import io.github.wulkanowy.data.exceptions.NoCurrentStudentException
|
||||
import io.github.wulkanowy.data.repositories.LuckyNumberRepository
|
||||
import io.github.wulkanowy.data.repositories.StudentRepository
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.PendingIntentCompat
|
||||
import io.github.wulkanowy.utils.toFirstResult
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import timber.log.Timber
|
||||
@ -62,8 +62,8 @@ class LuckyNumberWidgetProvider : AppWidgetProvider() {
|
||||
val appIntent = PendingIntent.getActivity(
|
||||
context,
|
||||
LUCKY_NUMBER_PENDING_INTENT_ID,
|
||||
MainActivity.getStartIntent(context, Destination.LuckyNumber, true),
|
||||
FLAG_UPDATE_CURRENT
|
||||
SplashActivity.getStartIntent(context, Destination.LuckyNumber, true),
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
val remoteView =
|
||||
|
@ -3,8 +3,6 @@ package io.github.wulkanowy.ui.modules.main
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import android.os.Build.VERSION_CODES.P
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
@ -23,7 +21,6 @@ import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.data.db.entities.StudentWithSemesters
|
||||
import io.github.wulkanowy.databinding.ActivityMainBinding
|
||||
import io.github.wulkanowy.services.shortcuts.ShortcutsHelper
|
||||
import io.github.wulkanowy.ui.base.BaseActivity
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.account.accountquick.AccountQuickDialog
|
||||
@ -59,9 +56,6 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
||||
@Inject
|
||||
lateinit var appInfo: AppInfo
|
||||
|
||||
@Inject
|
||||
lateinit var shortcutsHelper: ShortcutsHelper
|
||||
|
||||
private var accountMenu: MenuItem? = null
|
||||
|
||||
private val overlayProvider by lazy { ElevationOverlayProvider(this) }
|
||||
@ -76,13 +70,8 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
||||
fun getStartIntent(
|
||||
context: Context,
|
||||
destination: Destination? = null,
|
||||
startNewTask: Boolean = false
|
||||
) = Intent(context, MainActivity::class.java).apply {
|
||||
putExtra(EXTRA_START_DESTINATION, destination)
|
||||
|
||||
if (startNewTask) {
|
||||
flags = FLAG_ACTIVITY_NEW_TASK or FLAG_ACTIVITY_CLEAR_TASK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +98,6 @@ class MainActivity : BaseActivity<MainPresenter, ActivityMainBinding>(), MainVie
|
||||
updateHelper.messageContainer = binding.mainFragmentContainer
|
||||
|
||||
val destination = intent.getSerializableExtra(EXTRA_START_DESTINATION) as Destination?
|
||||
?: shortcutsHelper.getDestination(intent)
|
||||
|
||||
presenter.onAttachView(this, destination)
|
||||
updateHelper.checkAndInstallUpdates(this)
|
||||
|
@ -77,9 +77,8 @@ class MessageFragment : BaseFragment<FragmentMessageBinding>(R.layout.fragment_m
|
||||
TabLayoutMediator(binding.messageTabLayout, binding.messageViewPager, this).attach()
|
||||
}
|
||||
|
||||
with(binding.messageTabLayout) {
|
||||
setElevationCompat(context.dpToPx(4f))
|
||||
}
|
||||
binding.messageTabLayout.elevation = requireContext().dpToPx(4f)
|
||||
|
||||
|
||||
binding.openSendMessageButton.setOnClickListener { presenter.onSendMessageButtonClicked() }
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.github.wulkanowy.ui.modules.message.preview
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.print.PrintAttributes
|
||||
import android.print.PrintManager
|
||||
@ -13,7 +12,6 @@ import android.view.View.VISIBLE
|
||||
import android.webkit.WebResourceRequest
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
@ -25,7 +23,6 @@ import io.github.wulkanowy.ui.base.BaseFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import io.github.wulkanowy.ui.modules.message.send.SendMessageActivity
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
import io.github.wulkanowy.utils.shareText
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -40,9 +37,6 @@ class MessagePreviewFragment :
|
||||
@Inject
|
||||
lateinit var previewAdapter: MessagePreviewAdapter
|
||||
|
||||
@Inject
|
||||
lateinit var appInfo: AppInfo
|
||||
|
||||
private var menuReplyButton: MenuItem? = null
|
||||
|
||||
private var menuForwardButton: MenuItem? = null
|
||||
@ -140,7 +134,7 @@ class MessagePreviewFragment :
|
||||
menuForwardButton?.isVisible = show
|
||||
menuDeleteButton?.isVisible = show
|
||||
menuShareButton?.isVisible = show
|
||||
menuPrintButton?.isVisible = show && appInfo.systemVersion >= Build.VERSION_CODES.LOLLIPOP
|
||||
menuPrintButton?.isVisible = show
|
||||
}
|
||||
|
||||
override fun setDeletedOptionsLabels() {
|
||||
@ -175,7 +169,6 @@ class MessagePreviewFragment :
|
||||
context?.shareText(text, subject)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
override fun printDocument(html: String, jobName: String) {
|
||||
val webView = WebView(requireContext())
|
||||
webView.webViewClient = object : WebViewClient() {
|
||||
@ -190,7 +183,6 @@ class MessagePreviewFragment :
|
||||
webView.loadDataWithBaseURL("file:///android_asset/", html, "text/HTML", "UTF-8", null)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private fun createWebPrintJob(webView: WebView, jobName: String) {
|
||||
activity?.getSystemService<PrintManager>()?.let { printManager ->
|
||||
val printAdapter = webView.createPrintDocumentAdapter(jobName)
|
||||
|
@ -1,7 +1,6 @@
|
||||
package io.github.wulkanowy.ui.modules.message.preview
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Build
|
||||
import io.github.wulkanowy.data.Status
|
||||
import io.github.wulkanowy.data.db.entities.Message
|
||||
import io.github.wulkanowy.data.db.entities.MessageAttachment
|
||||
@ -11,7 +10,6 @@ import io.github.wulkanowy.data.repositories.StudentRepository
|
||||
import io.github.wulkanowy.ui.base.BasePresenter
|
||||
import io.github.wulkanowy.ui.base.ErrorHandler
|
||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
import io.github.wulkanowy.utils.afterLoading
|
||||
import io.github.wulkanowy.utils.flowWithResource
|
||||
import io.github.wulkanowy.utils.flowWithResourceIn
|
||||
@ -24,8 +22,7 @@ class MessagePreviewPresenter @Inject constructor(
|
||||
errorHandler: ErrorHandler,
|
||||
studentRepository: StudentRepository,
|
||||
private val messageRepository: MessageRepository,
|
||||
private val analytics: AnalyticsHelper,
|
||||
private var appInfo: AppInfo
|
||||
private val analytics: AnalyticsHelper
|
||||
) : BasePresenter<MessagePreviewView>(errorHandler, studentRepository) {
|
||||
|
||||
var message: Message? = null
|
||||
@ -112,10 +109,11 @@ class MessagePreviewPresenter @Inject constructor(
|
||||
|
||||
fun onShare(): Boolean {
|
||||
message?.let {
|
||||
var text = "Temat: ${it.subject.ifBlank { view?.messageNoSubjectString.orEmpty() }}\n" + when (it.sender.isNotEmpty()) {
|
||||
true -> "Od: ${it.sender}\n"
|
||||
false -> "Do: ${it.recipient}\n"
|
||||
} + "Data: ${it.date.toFormattedString("yyyy-MM-dd HH:mm:ss")}\n\n${it.content}"
|
||||
var text =
|
||||
"Temat: ${it.subject.ifBlank { view?.messageNoSubjectString.orEmpty() }}\n" + when (it.sender.isNotEmpty()) {
|
||||
true -> "Od: ${it.sender}\n"
|
||||
false -> "Do: ${it.recipient}\n"
|
||||
} + "Data: ${it.date.toFormattedString("yyyy-MM-dd HH:mm:ss")}\n\n${it.content}"
|
||||
|
||||
attachments?.let { attachments ->
|
||||
if (attachments.isNotEmpty()) {
|
||||
@ -127,7 +125,10 @@ class MessagePreviewPresenter @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
view?.shareText(text, "FW: ${it.subject.ifBlank { view?.messageNoSubjectString.orEmpty() }}")
|
||||
view?.shareText(
|
||||
text,
|
||||
"FW: ${it.subject.ifBlank { view?.messageNoSubjectString.orEmpty() }}"
|
||||
)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -135,7 +136,6 @@ class MessagePreviewPresenter @Inject constructor(
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
fun onPrint(): Boolean {
|
||||
if (appInfo.systemVersion < Build.VERSION_CODES.LOLLIPOP) return false
|
||||
message?.let {
|
||||
val dateString = it.date.toFormattedString("yyyy-MM-dd HH:mm:ss")
|
||||
val infoContent = "<div><h4>Data wysłania</h4>$dateString</div>" + when {
|
||||
@ -154,7 +154,9 @@ class MessagePreviewPresenter @Inject constructor(
|
||||
|
||||
view?.apply {
|
||||
val html = printHTML
|
||||
.replace("%SUBJECT%", it.subject.ifBlank { view?.messageNoSubjectString.orEmpty() })
|
||||
.replace(
|
||||
"%SUBJECT%",
|
||||
it.subject.ifBlank { view?.messageNoSubjectString.orEmpty() })
|
||||
.replace("%CONTENT%", messageContent)
|
||||
.replace("%INFO%", infoContent)
|
||||
printDocument(html, jobName)
|
||||
|
@ -1,7 +1,5 @@
|
||||
package io.github.wulkanowy.ui.modules.message.preview
|
||||
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import io.github.wulkanowy.data.db.entities.Message
|
||||
import io.github.wulkanowy.data.db.entities.MessageWithAttachment
|
||||
import io.github.wulkanowy.ui.base.BaseView
|
||||
@ -42,8 +40,7 @@ interface MessagePreviewView : BaseView {
|
||||
|
||||
fun shareText(text: String, subject: String)
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
fun printDocument(html: String, jobName: String)
|
||||
|
||||
fun popView()
|
||||
|
||||
fun printDocument(html: String, jobName: String)
|
||||
}
|
||||
|
@ -127,10 +127,13 @@ class MessageTabPresenter @Inject constructor(
|
||||
onlyUnread,
|
||||
onlyWithAttachments
|
||||
)
|
||||
val newItems = listOf(MessageTabDataItem.Header) + filteredData.map {
|
||||
MessageTabDataItem.MessageItem(it)
|
||||
val messageItems = filteredData.map { message ->
|
||||
MessageTabDataItem.MessageItem(message)
|
||||
}
|
||||
updateData(newItems, folder.id == MessageFolder.SENT.id)
|
||||
val messageItemsWithHeader =
|
||||
listOf(MessageTabDataItem.Header) + messageItems
|
||||
|
||||
updateData(messageItemsWithHeader, folder.id == MessageFolder.SENT.id)
|
||||
notifyParentDataLoaded()
|
||||
}
|
||||
}
|
||||
|
@ -77,9 +77,7 @@ class SchoolAndTeachersFragment :
|
||||
).attach()
|
||||
}
|
||||
|
||||
with(binding.schoolandteachersTabLayout) {
|
||||
setElevationCompat(context.dpToPx(4f))
|
||||
}
|
||||
binding.schoolandteachersTabLayout.elevation = requireContext().dpToPx(4f)
|
||||
}
|
||||
|
||||
override fun showContent(show: Boolean) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.github.wulkanowy.ui.modules.settings.notifications
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
@ -152,7 +151,6 @@ class NotificationsFragment : PreferenceFragmentCompat(),
|
||||
.show()
|
||||
}
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
override fun openSystemSettings() {
|
||||
val intent = if (appInfo.systemVersion >= Build.VERSION_CODES.O) {
|
||||
Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply {
|
||||
|
@ -1,29 +1,60 @@
|
||||
package io.github.wulkanowy.ui.modules.splash
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import android.widget.Toast.LENGTH_LONG
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.github.wulkanowy.services.shortcuts.ShortcutsHelper
|
||||
import io.github.wulkanowy.ui.base.BaseActivity
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.utils.AppInfo
|
||||
import io.github.wulkanowy.utils.openInternetBrowser
|
||||
import javax.inject.Inject
|
||||
|
||||
@SuppressLint("CustomSplashScreen")
|
||||
@AndroidEntryPoint
|
||||
class SplashActivity : BaseActivity<SplashPresenter, ViewBinding>(), SplashView {
|
||||
|
||||
@Inject
|
||||
lateinit var appInfo: AppInfo
|
||||
override lateinit var presenter: SplashPresenter
|
||||
|
||||
@Inject
|
||||
override lateinit var presenter: SplashPresenter
|
||||
lateinit var shortcutsHelper: ShortcutsHelper
|
||||
|
||||
companion object {
|
||||
|
||||
private const val EXTRA_START_DESTINATION = "start_destination"
|
||||
|
||||
private const val EXTRA_EXTERNAL_URL = "external_url"
|
||||
|
||||
fun getStartIntent(
|
||||
context: Context,
|
||||
destination: Destination? = null,
|
||||
startNewTask: Boolean = false
|
||||
) = Intent(context, SplashActivity::class.java).apply {
|
||||
putExtra(EXTRA_START_DESTINATION, destination)
|
||||
|
||||
if (startNewTask) {
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
presenter.onAttachView(this, intent?.getStringExtra("external_url"))
|
||||
installSplashScreen().setKeepVisibleCondition { true }
|
||||
|
||||
val externalLink = intent?.getStringExtra(EXTRA_EXTERNAL_URL)
|
||||
val startDestination = intent?.getSerializableExtra(EXTRA_START_DESTINATION) as Destination?
|
||||
?: shortcutsHelper.getDestination(intent)
|
||||
|
||||
presenter.onAttachView(this, externalLink, startDestination)
|
||||
}
|
||||
|
||||
override fun openLoginView() {
|
||||
@ -31,8 +62,8 @@ class SplashActivity : BaseActivity<SplashPresenter, ViewBinding>(), SplashView
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun openMainView() {
|
||||
startActivity(MainActivity.getStartIntent(this))
|
||||
override fun openMainView(destination: Destination?) {
|
||||
startActivity(MainActivity.getStartIntent(this, destination))
|
||||
finish()
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
package io.github.wulkanowy.ui.modules.splash
|
||||
|
||||
import io.github.wulkanowy.data.Status
|
||||
import io.github.wulkanowy.data.repositories.StudentRepository
|
||||
import io.github.wulkanowy.ui.base.BasePresenter
|
||||
import io.github.wulkanowy.ui.base.ErrorHandler
|
||||
import io.github.wulkanowy.utils.flowWithResource
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import timber.log.Timber
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
class SplashPresenter @Inject constructor(
|
||||
@ -14,7 +12,7 @@ class SplashPresenter @Inject constructor(
|
||||
studentRepository: StudentRepository,
|
||||
) : BasePresenter<SplashView>(errorHandler, studentRepository) {
|
||||
|
||||
fun onAttachView(view: SplashView, externalUrl: String?) {
|
||||
fun onAttachView(view: SplashView, externalUrl: String?, startDestination: Destination?) {
|
||||
super.onAttachView(view)
|
||||
|
||||
if (!externalUrl.isNullOrBlank()) {
|
||||
@ -22,15 +20,16 @@ class SplashPresenter @Inject constructor(
|
||||
return
|
||||
}
|
||||
|
||||
flowWithResource { studentRepository.isCurrentStudentSet() }.onEach {
|
||||
when (it.status) {
|
||||
Status.LOADING -> Timber.d("Is current user set check started")
|
||||
Status.SUCCESS -> {
|
||||
if (it.data!!) view.openMainView()
|
||||
else view.openLoginView()
|
||||
presenterScope.launch {
|
||||
runCatching { studentRepository.isCurrentStudentSet() }
|
||||
.onFailure(errorHandler::dispatch)
|
||||
.onSuccess {
|
||||
if (it) {
|
||||
view.openMainView(startDestination)
|
||||
} else {
|
||||
view.openLoginView()
|
||||
}
|
||||
}
|
||||
Status.ERROR -> errorHandler.dispatch(it.error!!)
|
||||
}
|
||||
}.launch()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
package io.github.wulkanowy.ui.modules.splash
|
||||
|
||||
import io.github.wulkanowy.ui.base.BaseView
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
|
||||
interface SplashView : BaseView {
|
||||
|
||||
fun openLoginView()
|
||||
|
||||
fun openMainView()
|
||||
fun openMainView(destination: Destination?)
|
||||
|
||||
fun openExternalUrlAndFinish(url: String)
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ class TimetableFragment : BaseFragment<FragmentTimetableBinding>(R.layout.fragme
|
||||
timetableNavDate.setOnClickListener { presenter.onPickDate() }
|
||||
timetableNextButton.setOnClickListener { presenter.onNextDay() }
|
||||
|
||||
timetableNavContainer.setElevationCompat(requireContext().dpToPx(8f))
|
||||
timetableNavContainer.elevation = requireContext().dpToPx(8f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ class AdditionalLessonsFragment :
|
||||
additionalLessonsNavDate.setOnClickListener { presenter.onPickDate() }
|
||||
additionalLessonsNextButton.setOnClickListener { presenter.onNextDay() }
|
||||
|
||||
additionalLessonsNavContainer.setElevationCompat(requireContext().dpToPx(8f))
|
||||
additionalLessonsNavContainer.elevation = requireContext().dpToPx(8f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ class CompletedLessonsFragment :
|
||||
completedLessonsNavDate.setOnClickListener { presenter.onPickDate() }
|
||||
completedLessonsNextButton.setOnClickListener { presenter.onNextDay() }
|
||||
|
||||
completedLessonsNavContainer.setElevationCompat(requireContext().dpToPx(8f))
|
||||
completedLessonsNavContainer.elevation = requireContext().dpToPx(8f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package io.github.wulkanowy.ui.modules.timetablewidget
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.PendingIntent
|
||||
import android.app.PendingIntent.FLAG_UPDATE_CURRENT
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.appwidget.AppWidgetManager.ACTION_APPWIDGET_DELETED
|
||||
import android.appwidget.AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||
@ -25,8 +24,9 @@ import io.github.wulkanowy.data.repositories.StudentRepository
|
||||
import io.github.wulkanowy.services.HiltBroadcastReceiver
|
||||
import io.github.wulkanowy.services.widgets.TimetableWidgetService
|
||||
import io.github.wulkanowy.ui.modules.Destination
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.splash.SplashActivity
|
||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||
import io.github.wulkanowy.utils.PendingIntentCompat
|
||||
import io.github.wulkanowy.utils.capitalise
|
||||
import io.github.wulkanowy.utils.createNameInitialsDrawable
|
||||
import io.github.wulkanowy.utils.getCompatColor
|
||||
@ -167,18 +167,20 @@ class TimetableWidgetProvider : HiltBroadcastReceiver() {
|
||||
action = appWidgetId.toString()
|
||||
}
|
||||
val accountIntent = PendingIntent.getActivity(
|
||||
context, -Int.MAX_VALUE + appWidgetId,
|
||||
context,
|
||||
-Int.MAX_VALUE + appWidgetId,
|
||||
Intent(context, TimetableWidgetConfigureActivity::class.java).apply {
|
||||
addFlags(FLAG_ACTIVITY_NEW_TASK or FLAG_ACTIVITY_CLEAR_TASK)
|
||||
putExtra(EXTRA_APPWIDGET_ID, appWidgetId)
|
||||
putExtra(EXTRA_FROM_PROVIDER, true)
|
||||
}, FLAG_UPDATE_CURRENT
|
||||
}, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||
|
||||
)
|
||||
val appIntent = PendingIntent.getActivity(
|
||||
context,
|
||||
TIMETABLE_PENDING_INTENT_ID,
|
||||
MainActivity.getStartIntent(context, Destination.Timetable(), true),
|
||||
FLAG_UPDATE_CURRENT
|
||||
SplashActivity.getStartIntent(context, Destination.Timetable(), true),
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
val remoteView = RemoteViews(context.packageName, layoutId).apply {
|
||||
@ -222,16 +224,16 @@ class TimetableWidgetProvider : HiltBroadcastReceiver() {
|
||||
code: Int,
|
||||
appWidgetId: Int,
|
||||
buttonType: String
|
||||
): PendingIntent {
|
||||
return PendingIntent.getBroadcast(
|
||||
context, code,
|
||||
Intent(context, TimetableWidgetProvider::class.java).apply {
|
||||
action = ACTION_APPWIDGET_UPDATE
|
||||
putExtra(EXTRA_BUTTON_TYPE, buttonType)
|
||||
putExtra(EXTRA_TOGGLED_WIDGET_ID, appWidgetId)
|
||||
}, FLAG_UPDATE_CURRENT
|
||||
)
|
||||
}
|
||||
) = PendingIntent.getBroadcast(
|
||||
context,
|
||||
code,
|
||||
Intent(context, TimetableWidgetProvider::class.java).apply {
|
||||
action = ACTION_APPWIDGET_UPDATE
|
||||
putExtra(EXTRA_BUTTON_TYPE, buttonType)
|
||||
putExtra(EXTRA_TOGGLED_WIDGET_ID, appWidgetId)
|
||||
},
|
||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntentCompat.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
private suspend fun getStudent(studentId: Long, appWidgetId: Int) = try {
|
||||
val students = studentRepository.getSavedStudents(false)
|
||||
|
@ -3,17 +3,15 @@ package io.github.wulkanowy.ui.widgets
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.ViewGroup
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
|
||||
/**
|
||||
* @see <a href="https://stackoverflow.com/a/50382854">Tabs don't fit to screen with tabmode=scrollable, Even with a Custom Tab Layout</a>
|
||||
*/
|
||||
class FittedScrollableTabLayout : MaterialTabLayout {
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
||||
class FittedScrollableTabLayout @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null
|
||||
) : TabLayout(context, attrs) {
|
||||
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
setMeasuredDimension(widthMeasureSpec, heightMeasureSpec)
|
||||
|
@ -1,24 +1,19 @@
|
||||
package io.github.wulkanowy.ui.widgets
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.os.Build.VERSION_CODES.LOLLIPOP
|
||||
import android.util.AttributeSet
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.view.ViewCompat
|
||||
import com.google.android.material.elevation.ElevationOverlayProvider
|
||||
import com.google.android.material.shape.MaterialShapeDrawable
|
||||
|
||||
class MaterialLinearLayout : LinearLayout {
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attr: AttributeSet) : super(context, attr)
|
||||
|
||||
constructor(context: Context, attr: AttributeSet, defStyleAttr: Int) : super(context, attr, defStyleAttr)
|
||||
class MaterialLinearLayout @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null
|
||||
) : LinearLayout(context, attrs) {
|
||||
|
||||
init {
|
||||
val drawable = MaterialShapeDrawable.createWithElevationOverlay(context, ViewCompat.getElevation(this))
|
||||
val drawable =
|
||||
MaterialShapeDrawable.createWithElevationOverlay(context, ViewCompat.getElevation(this))
|
||||
ViewCompat.setBackground(this, drawable)
|
||||
}
|
||||
|
||||
@ -28,12 +23,4 @@ class MaterialLinearLayout : LinearLayout {
|
||||
(background as MaterialShapeDrawable).elevation = elevation
|
||||
}
|
||||
}
|
||||
|
||||
fun setElevationCompat(elevation: Float) {
|
||||
if (SDK_INT >= LOLLIPOP) {
|
||||
setElevation(elevation)
|
||||
} else {
|
||||
setBackgroundColor(ElevationOverlayProvider(context).compositeOverlayWithThemeSurfaceColorIfNeeded(elevation))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
package io.github.wulkanowy.ui.widgets
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.os.Build.VERSION_CODES.LOLLIPOP
|
||||
import android.util.AttributeSet
|
||||
import com.google.android.material.elevation.ElevationOverlayProvider
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
|
||||
open class MaterialTabLayout : TabLayout {
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attr: AttributeSet) : super(context, attr)
|
||||
|
||||
constructor(context: Context, attr: AttributeSet, defStyleAttr: Int) : super(context, attr, defStyleAttr)
|
||||
|
||||
fun setElevationCompat(elevation: Float) {
|
||||
if (SDK_INT >= LOLLIPOP) {
|
||||
setElevation(elevation)
|
||||
} else {
|
||||
setBackgroundColor(ElevationOverlayProvider(context).compositeOverlayWithThemeSurfaceColorIfNeeded(elevation))
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package io.github.wulkanowy.utils
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.os.Build
|
||||
|
||||
object PendingIntentCompat {
|
||||
|
||||
val FLAG_IMMUTABLE = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
} else 0
|
||||
}
|
@ -4,6 +4,4 @@ inline fun String?.ifNullOrBlank(defaultValue: () -> String) =
|
||||
if (isNullOrBlank()) defaultValue() else this
|
||||
|
||||
fun String.capitalise() =
|
||||
replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
|
||||
|
||||
fun String.decapitalise() = replaceFirstChar { it.lowercase() }
|
||||
replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
|
@ -2,10 +2,8 @@
|
||||
|
||||
package io.github.wulkanowy.utils.security
|
||||
|
||||
import android.annotation.TargetApi
|
||||
import android.content.Context
|
||||
import android.os.Build.VERSION.SDK_INT
|
||||
import android.os.Build.VERSION_CODES.JELLY_BEAN_MR2
|
||||
import android.os.Build.VERSION_CODES.M
|
||||
import android.security.KeyPairGeneratorSpec
|
||||
import android.security.keystore.KeyGenParameterSpec
|
||||
@ -116,7 +114,6 @@ fun decrypt(cipherText: String): String {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(JELLY_BEAN_MR2)
|
||||
private fun generateKeyPair(context: Context) {
|
||||
(if (SDK_INT >= M) {
|
||||
KeyGenParameterSpec.Builder(KEY_ALIAS, PURPOSE_DECRYPT or PURPOSE_ENCRYPT)
|
||||
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:gravity="fill">
|
||||
<color android:color="?attr/windowSplashScreenBackground" />
|
||||
</item>
|
||||
<item
|
||||
android:width="@dimen/splashscreen_icon_size_no_background"
|
||||
android:height="@dimen/splashscreen_icon_size_no_background"
|
||||
android:drawable="?windowSplashScreenAnimatedIcon"
|
||||
android:gravity="center" />
|
||||
|
||||
<!-- We mask the outer bounds of the icon like we do on Android 12 -->
|
||||
<item
|
||||
android:width="@dimen/splashscreen_icon_mask_size_no_background"
|
||||
android:height="@dimen/splashscreen_icon_mask_size_no_background"
|
||||
android:gravity="center">
|
||||
<shape android:shape="oval">
|
||||
<stroke
|
||||
android:width="@dimen/splashscreen_icon_mask_stroke_no_background"
|
||||
android:color="?windowSplashScreenBackground" />
|
||||
<solid android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
Binary file not shown.
Before Width: | Height: | Size: 19 KiB |
@ -1,12 +0,0 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="@color/colorPrimaryDark" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:drawable="@drawable/img_splash_logo"
|
||||
android:gravity="center" />
|
||||
</layer-list>
|
12
app/src/main/res/drawable/ic_splash_logo.xml
Normal file
12
app/src/main/res/drawable/ic_splash_logo.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="1926"
|
||||
android:viewportHeight="1926">
|
||||
<path
|
||||
android:fillColor="#fff"
|
||||
android:pathData="M1082,1260v4l-6,73c0,5 -5,9 -10,9H879c-4,0 -8,-2 -10,-5l-31,-58 -29,-71v-8l48,-94c2,-3 2,-5 1, -8l-24,-65c-1,-2 0,-5 1,-7l39,-84c4,-8 17,-8 20,1l12,38 38,101c1,2 3,5 6,6l80,27c3,1 6,3 7,6l45,135zM852,717c0,-23 15,-43 35,-52l-2,-8c0,-11 13,-20 29,-20h1a38,38 0,0 1,36 -18l3,-2c11,-16 37,-27 68,-27 12,0 23,2 32,4 3,-3 8,-6 14,-6s12,3 14,8c8,-9 22,-16 38,-16 25,0 45,16 45,36l-1,7 3,4c16,6 27,17 27,30 0,14 -15,27 -34,32 -2,0 -3,1 -3,3 0,11 -11,21 -26,22v1c0,22 -41,40 -92,40 -11,0 -21,-1 -31,-3v1c0,9 -12,16 -26,16h-2l2,7c0,14 -18,25 -40,25h-7l-4, 2c-2,7 -8,12 -15,12 -9,0 -16,-7 -16,-16 0,-5 1,-8 4,-11l1,-4c-2,-3 -2,-5 -2,-8 0,-2 -2,-3 -3,-3 -27,-6 -48,-29 -48,-56z" />
|
||||
<path
|
||||
android:fillColor="#fff"
|
||||
android:pathData="M1336,1346h-125c-3,0 -6,-1 -8,-4l-84,-118 -1,-2 -42,-122 -5,-5 -102,-52 -5,-6 -15,-75 -2,-3 -34,-51c-2,-3 -2,-6 -1,-9l21,-45c2,-4 5,-6 9,-6l39,-2c3,0 5,-1 6,-3l29,-22c5,-4 14,-2 17,4l98,201 1,2 13,81 2,5 197,216c6,6 1,16 -8,16zM801,1302c1,3 1,6 -1,8l-19,31c-2,3 -5,5 -9,5H591c-8,0 -13,-8 -9,-15l116,-171 2,-3 53, -228c1,-3 3,-5 5,-6l72,-40c3,-1 5,-4 5,-7l10,-42c2,-9 15,-11 20,-3l3,6c2,2 2,5 1,8l-66,190v5l16,91v5l-40,88v6l22,72z" />
|
||||
</vector>
|
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
@ -1,12 +0,0 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="@color/colorPrimaryDark" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="left|right|top|bottom"
|
||||
android:src="@drawable/img_splash_logo" />
|
||||
</item>
|
||||
</layer-list>
|
@ -142,8 +142,8 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitStart"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_left" />
|
||||
app:srcCompat="@drawable/ic_chevron_left"
|
||||
app:tint="?colorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/attendanceNavDate"
|
||||
@ -167,7 +167,7 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitEnd"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_right" />
|
||||
app:srcCompat="@drawable/ic_chevron_right"
|
||||
app:tint="?colorPrimary" />
|
||||
</io.github.wulkanowy.ui.widgets.MaterialLinearLayout>
|
||||
</FrameLayout>
|
||||
|
@ -128,8 +128,8 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitStart"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_left" />
|
||||
app:srcCompat="@drawable/ic_chevron_left"
|
||||
app:tint="?colorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/examNavDate"
|
||||
@ -152,7 +152,7 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitEnd"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_right" />
|
||||
app:srcCompat="@drawable/ic_chevron_right"
|
||||
app:tint="?colorPrimary" />
|
||||
</io.github.wulkanowy.ui.widgets.MaterialLinearLayout>
|
||||
</FrameLayout>
|
||||
|
@ -118,8 +118,8 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitStart"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_left" />
|
||||
app:srcCompat="@drawable/ic_chevron_left"
|
||||
app:tint="?colorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/luckyNumberHistoryNavDate"
|
||||
@ -143,7 +143,7 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitEnd"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_right" />
|
||||
app:srcCompat="@drawable/ic_chevron_right"
|
||||
app:tint="?colorPrimary" />
|
||||
</io.github.wulkanowy.ui.widgets.MaterialLinearLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
@ -5,7 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<io.github.wulkanowy.ui.widgets.MaterialTabLayout
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/messageTabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
|
@ -95,12 +95,12 @@
|
||||
app:srcCompat="@drawable/ic_school_directions"
|
||||
android:contentDescription="@string/school_address_button"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:tint="?colorPrimary"
|
||||
android:padding="4dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_gravity="center_vertical" />
|
||||
android:layout_gravity="center_vertical"
|
||||
app:tint="?colorPrimary" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -142,12 +142,12 @@
|
||||
app:srcCompat="@drawable/ic_all_phone"
|
||||
android:contentDescription="@string/school_telephone_button"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:tint="?colorPrimary"
|
||||
android:padding="4dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_gravity="center_vertical" />
|
||||
android:layout_gravity="center_vertical"
|
||||
app:tint="?colorPrimary" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -5,7 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<io.github.wulkanowy.ui.widgets.MaterialTabLayout
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/schoolandteachersTabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
|
@ -142,8 +142,8 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitStart"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_left" />
|
||||
app:srcCompat="@drawable/ic_chevron_left"
|
||||
app:tint="?colorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timetableNavDate"
|
||||
@ -167,7 +167,7 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitEnd"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_right" />
|
||||
app:srcCompat="@drawable/ic_chevron_right"
|
||||
app:tint="?colorPrimary" />
|
||||
</io.github.wulkanowy.ui.widgets.MaterialLinearLayout>
|
||||
</FrameLayout>
|
||||
|
@ -131,8 +131,8 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitStart"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_left" />
|
||||
app:srcCompat="@drawable/ic_chevron_left"
|
||||
app:tint="?colorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/additionalLessonsNavDate"
|
||||
@ -156,7 +156,7 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitEnd"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_right" />
|
||||
app:srcCompat="@drawable/ic_chevron_right"
|
||||
app:tint="?colorPrimary" />
|
||||
</io.github.wulkanowy.ui.widgets.MaterialLinearLayout>
|
||||
</FrameLayout>
|
||||
|
@ -130,8 +130,8 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitStart"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_left" />
|
||||
app:srcCompat="@drawable/ic_chevron_left"
|
||||
app:tint="?colorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/completedLessonsNavDate"
|
||||
@ -155,7 +155,7 @@
|
||||
android:paddingRight="12dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:scaleType="fitEnd"
|
||||
android:tint="?colorPrimary"
|
||||
app:srcCompat="@drawable/ic_chevron_right" />
|
||||
app:srcCompat="@drawable/ic_chevron_right"
|
||||
app:tint="?colorPrimary" />
|
||||
</io.github.wulkanowy.ui.widgets.MaterialLinearLayout>
|
||||
</FrameLayout>
|
||||
|
@ -2,7 +2,8 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashboard_homework_subitem_title"
|
||||
@ -12,7 +13,7 @@
|
||||
android:layout_marginEnd="24dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="Spotaknie z rodzicami/opiekunami"
|
||||
tools:text="Spotaknie z rodzicami/opiekunami"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/dashboard_homework_subitem_time"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@ -24,7 +25,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:text="17:00 02.11.2020"
|
||||
tools:text="17:00 02.11.2020"
|
||||
android:textSize="13sp"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -1,14 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="WulkanowyTheme" parent="BaseWulkanowyTheme">
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:statusBarColor">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="WulkanowyTheme.SplashScreen" parent="WulkanowyTheme.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/layer_splash_background</item>
|
||||
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
</style>
|
||||
</resources>
|
@ -5,11 +5,4 @@
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="android:statusBarColor">@android:color/darker_gray</item>
|
||||
</style>
|
||||
|
||||
<style name="WulkanowyTheme.SplashScreen" parent="WulkanowyTheme.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/layer_splash_background</item>
|
||||
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
@ -6,12 +6,4 @@
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:statusBarColor">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="WulkanowyTheme.SplashScreen" parent="WulkanowyTheme.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/layer_splash_background</item>
|
||||
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:windowLightNavigationBar">false</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
</style>
|
||||
</resources>
|
@ -6,12 +6,4 @@
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:statusBarColor">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="WulkanowyTheme.SplashScreen" parent="WulkanowyTheme.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/layer_splash_background</item>
|
||||
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:windowLightNavigationBar">false</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
</style>
|
||||
</resources>
|
@ -23,10 +23,11 @@
|
||||
<item name="windowActionModeOverlay">true</item>
|
||||
</style>
|
||||
|
||||
<style name="WulkanowyTheme.SplashScreen" parent="WulkanowyTheme.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/layer_splash_background</item>
|
||||
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
|
||||
<item name="android:navigationBarColor">@color/colorPrimaryDark</item>
|
||||
<style name="WulkanowyTheme.SplashScreen" parent="Theme.SplashScreen">
|
||||
<item name="windowSplashScreenBackground">@color/colorPrimaryDark</item>
|
||||
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_splash_logo</item>
|
||||
<item name="postSplashScreenTheme">@style/WulkanowyTheme.NoActionBar</item>
|
||||
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
|
||||
</style>
|
||||
|
||||
<style name="WulkanowyTheme.WidgetAccountSwitcher" parent="Theme.MaterialComponents.Light.Dialog">
|
||||
@ -38,7 +39,6 @@
|
||||
</style>
|
||||
|
||||
<style name="Widget.Wulkanowy.Chip.Choice" parent="Widget.MaterialComponents.Chip.Choice">
|
||||
...
|
||||
<item name="materialThemeOverlay">@style/ThemeOverlay.Wulkanowy.Chip.Choice</item>
|
||||
</style>
|
||||
|
||||
@ -50,8 +50,6 @@
|
||||
<item name="android:textSize">11sp</item>
|
||||
</style>
|
||||
|
||||
<style name="mdtp_ActionButton.Text" parent="Widget.MaterialComponents.Button.TextButton.Dialog" />
|
||||
|
||||
<style name="WulkanowyTheme.Login" parent="WulkanowyTheme.NoActionBar" />
|
||||
|
||||
<style name="WulkanowyTheme.MessageSend" parent="WulkanowyTheme.NoActionBar" />
|
||||
|
@ -4,12 +4,6 @@ import android.util.Log
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import fr.bipi.tressence.base.FormatterPriorityTree
|
||||
import fr.bipi.tressence.common.StackTraceRecorder
|
||||
import fr.bipi.tressence.common.filters.Filter
|
||||
import io.github.wulkanowy.sdk.exception.FeatureNotAvailableException
|
||||
import io.github.wulkanowy.sdk.scrapper.exception.FeatureDisabledException
|
||||
import java.io.InterruptedIOException
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
|
||||
class CrashLogTree : FormatterPriorityTree(Log.VERBOSE) {
|
||||
|
||||
|
@ -37,7 +37,7 @@ class SplashPresenterTest {
|
||||
fun testOpenLoginView() {
|
||||
coEvery { studentRepository.isCurrentStudentSet() } returns false
|
||||
|
||||
presenter.onAttachView(splashView, null)
|
||||
presenter.onAttachView(splashView, null, null)
|
||||
verify { splashView.openLoginView() }
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ class SplashPresenterTest {
|
||||
fun testMainMainView() {
|
||||
coEvery { studentRepository.isCurrentStudentSet() } returns true
|
||||
|
||||
presenter.onAttachView(splashView, null)
|
||||
verify { splashView.openMainView() }
|
||||
presenter.onAttachView(splashView, null, null)
|
||||
verify { splashView.openMainView(null) }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user