diff --git a/.travis.yml b/.travis.yml index 5dbd9e366..c2361d66c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ cache: branches: only: - develop - - 0.20.5 + - 0.21.0 android: licenses: @@ -48,8 +48,8 @@ before_script: script: - ./gradlew dependencies --stacktrace --daemon - fossa --no-ansi || true - - ./gradlew -Pcoverage testPlayDebugUnitTest --stacktrace --daemon - - ./gradlew -Pcoverage createFdroidDebugCoverageReport --stacktrace --daemon + - ./gradlew -Pcoverage testFdroidDebugUnitTest --stacktrace --daemon + - ./gradlew -Pcoverage connectedFdroidDebugAndroidTest --stacktrace --daemon - ./gradlew -Pcoverage jacocoTestReport --stacktrace --daemon - | if [ $TRAVIS_TAG ]; then diff --git a/app/build.gradle b/app/build.gradle index 11a82fbd0..0dd315277 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -18,8 +18,8 @@ android { testApplicationId "io.github.tests.wulkanowy" minSdkVersion 17 targetSdkVersion 29 - versionCode 69 - versionName "0.20.5" + versionCode 70 + versionName "0.21.0" multiDexEnabled true resValue "string", "app_name", "Wulkanowy" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -119,6 +119,7 @@ ext { room = "2.2.5" chucker = "3.2.0" mockk = "1.10.0" + moshi = "1.9.3" } configurations.all { @@ -126,7 +127,7 @@ configurations.all { } dependencies { - implementation "io.github.wulkanowy:sdk:0.20.5" + implementation "io.github.wulkanowy:sdk:0.21.0" coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10' @@ -170,7 +171,9 @@ dependencies { implementation "com.ncapdevi:frag-nav:3.3.0" implementation "com.github.YarikSOffice:lingver:1.2.2" - implementation "com.google.code.gson:gson:2.8.6" + implementation "com.squareup.moshi:moshi:$moshi" + implementation "com.squareup.moshi:moshi-adapters:$moshi" + kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi" implementation "com.jakewharton.timber:timber:4.7.1" implementation "at.favre.lib:slf4j-timber:1.0.1" implementation "fr.bipi.treessence:treessence:0.3.2" diff --git a/app/jacoco.gradle b/app/jacoco.gradle index e9abfb613..a5cf84e63 100644 --- a/app/jacoco.gradle +++ b/app/jacoco.gradle @@ -35,13 +35,13 @@ task jacocoTestReport(type: JacocoReport) { dir: "$buildDir/intermediates/classes/debug", excludes: excludes ) + fileTree( - dir: "$buildDir/tmp/kotlin-classes/playDebug", + dir: "$buildDir/tmp/kotlin-classes/fdroidDebug", excludes: excludes )) sourceDirectories.setFrom(files([ "src/main/java", - "src/play/java" + "src/fdroid/java" ])) executionData.setFrom(fileTree( dir: project.projectDir, diff --git a/app/src/main/java/io/github/wulkanowy/data/db/Converters.kt b/app/src/main/java/io/github/wulkanowy/data/db/Converters.kt index b21c4834f..834a9636a 100644 --- a/app/src/main/java/io/github/wulkanowy/data/db/Converters.kt +++ b/app/src/main/java/io/github/wulkanowy/data/db/Converters.kt @@ -1,8 +1,8 @@ package io.github.wulkanowy.data.db import androidx.room.TypeConverter -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken +import com.squareup.moshi.Moshi +import com.squareup.moshi.Types import java.time.Instant import java.time.LocalDate import java.time.LocalDateTime @@ -12,6 +12,16 @@ import java.util.Date class Converters { + private val moshi by lazy { Moshi.Builder().build() } + + private val integerListAdapter by lazy { + moshi.adapter>(Types.newParameterizedType(List::class.java, Integer::class.java)) + } + + private val stringMapAdapter by lazy { + moshi.adapter>(Types.newParameterizedType(MutableMap::class.java, String::class.java, String::class.java)) + } + @TypeConverter fun timestampToDate(value: Long?): LocalDate? = value?.run { Date(value).toInstant().atZone(ZoneOffset.UTC).toLocalDate() @@ -39,22 +49,22 @@ class Converters { fun intToMonth(value: Int?) = value?.let { Month.of(it) } @TypeConverter - fun intListToGson(list: List): String { - return Gson().toJson(list) + fun intListToJson(list: List): String { + return integerListAdapter.toJson(list) } @TypeConverter - fun gsonToIntList(value: String): List { - return Gson().fromJson(value, object : TypeToken>() {}.type) + fun jsonToIntList(value: String): List { + return integerListAdapter.fromJson(value).orEmpty() } @TypeConverter - fun stringPairListToGson(list: List>): String { - return Gson().toJson(list) + fun stringPairListToJson(list: List>): String { + return stringMapAdapter.toJson(list.toMap()) } @TypeConverter - fun gsonToStringPairList(value: String): List> { - return Gson().fromJson(value, object : TypeToken>>() {}.type) + fun jsonToStringPairList(value: String): List> { + return stringMapAdapter.fromJson(value).orEmpty().toList() } } diff --git a/app/src/main/java/io/github/wulkanowy/data/pojos/Contributor.kt b/app/src/main/java/io/github/wulkanowy/data/pojos/Contributor.kt index e792bde46..d2338c281 100644 --- a/app/src/main/java/io/github/wulkanowy/data/pojos/Contributor.kt +++ b/app/src/main/java/io/github/wulkanowy/data/pojos/Contributor.kt @@ -1,3 +1,9 @@ package io.github.wulkanowy.data.pojos -class Contributor(val displayName: String, val githubUsername: String) +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = true) +class Contributor( + val displayName: String, + val githubUsername: String +) diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/appcreator/AppCreatorRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/appcreator/AppCreatorRepository.kt index d19565579..ff538969b 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/appcreator/AppCreatorRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/appcreator/AppCreatorRepository.kt @@ -1,7 +1,8 @@ package io.github.wulkanowy.data.repositories.appcreator import android.content.res.AssetManager -import com.google.gson.Gson +import com.squareup.moshi.Moshi +import com.squareup.moshi.Types import io.github.wulkanowy.data.pojos.Contributor import io.github.wulkanowy.utils.DispatchersProvider import kotlinx.coroutines.withContext @@ -15,9 +16,9 @@ class AppCreatorRepository @Inject constructor( ) { suspend fun getAppCreators() = withContext(dispatchers.backgroundThread) { - Gson().fromJson( - assets.open("contributors.json").bufferedReader().use { it.readText() }, - Array::class.java - ).toList() + val moshi = Moshi.Builder().build() + val type = Types.newParameterizedType(List::class.java, Contributor::class.java) + val adapter = moshi.adapter>(type) + adapter.fromJson(assets.open("contributors.json").bufferedReader().use { it.readText() }) } } diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt index 1d5e57f8a..da31751a1 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/preferences/PreferencesRepository.kt @@ -5,6 +5,7 @@ import android.content.SharedPreferences import dagger.hilt.android.qualifiers.ApplicationContext import io.github.wulkanowy.R import io.github.wulkanowy.ui.modules.grade.GradeAverageMode +import io.github.wulkanowy.ui.modules.grade.GradeSortingMode import javax.inject.Inject import javax.inject.Singleton @@ -74,12 +75,25 @@ class PreferencesRepository @Inject constructor( val fillMessageContent: Boolean get() = getBoolean(R.string.pref_key_fill_message_content, R.bool.pref_default_fill_message_content) + val showGroupsInPlan: Boolean + get() = getBoolean(R.string.pref_key_timetable_show_groups, R.bool.pref_default_timetable_show_groups) + val showWholeClassPlan: String get() = getString(R.string.pref_key_timetable_show_whole_class, R.string.pref_default_timetable_show_whole_class) + val gradeSortingMode: GradeSortingMode + get() = GradeSortingMode.getByValue(getString(R.string.pref_key_grade_sorting_mode, R.string.pref_default_grade_sorting_mode)) + val showTimetableTimers: Boolean get() = getBoolean(R.string.pref_key_timetable_show_timers, R.bool.pref_default_timetable_show_timers) + var isHomeworkFullscreen: Boolean + get() = getBoolean(R.string.pref_key_homework_fullscreen, R.bool.pref_default_homework_fullscreen) + set(value) = sharedPref.edit().putBoolean("homework_fullscreen", value).apply() + + val showSubjectsWithoutGrades: Boolean + get() = getBoolean(R.string.pref_key_subjects_without_grades, R.bool.pref_default_subjects_without_grades) + private fun getString(id: Int, default: Int) = getString(context.getString(id), default) private fun getString(id: String, default: Int) = sharedPref.getString(id, context.getString(default)) ?: context.getString(default) diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt index 84b806795..b08896966 100644 --- a/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt +++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt @@ -14,6 +14,9 @@ import io.github.wulkanowy.data.db.entities.Semester import io.github.wulkanowy.data.db.entities.Student import io.github.wulkanowy.data.repositories.note.NoteRepository import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository +import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory +import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory.NEUTRAL +import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory.POSITIVE import io.github.wulkanowy.services.sync.channels.NewNotesChannel import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainView @@ -41,8 +44,20 @@ class NoteWork @Inject constructor( private fun notify(notes: List) { notificationManager.notify(Random.nextInt(Int.MAX_VALUE), NotificationCompat.Builder(context, NewNotesChannel.CHANNEL_ID) - .setContentTitle(context.resources.getQuantityString(R.plurals.note_new_items, notes.size, notes.size)) - .setContentText(context.resources.getQuantityString(R.plurals.note_notify_new_items, notes.size, notes.size)) + .setContentTitle( + when (NoteCategory.getByValue(notes.first().categoryType)) { + POSITIVE -> context.resources.getQuantityString(R.plurals.praise_new_items, notes.size, notes.size) + NEUTRAL -> context.resources.getQuantityString(R.plurals.neutral_note_new_items, notes.size, notes.size) + else -> context.resources.getQuantityString(R.plurals.note_new_items, notes.size, notes.size) + } + ) + .setContentText( + when (NoteCategory.getByValue(notes.first().categoryType)) { + POSITIVE -> context.resources.getQuantityString(R.plurals.praise_notify_new_items, notes.size, notes.size) + NEUTRAL -> context.resources.getQuantityString(R.plurals.neutral_note_notify_new_items, notes.size, notes.size) + else -> context.resources.getQuantityString(R.plurals.note_notify_new_items, notes.size, notes.size) + } + ) .setSmallIcon(R.drawable.ic_stat_note) .setAutoCancel(true) .setDefaults(DEFAULT_ALL) @@ -52,7 +67,13 @@ class NoteWork @Inject constructor( PendingIntent.getActivity(context, MainView.Section.NOTE.id, MainActivity.getStartIntent(context, MainView.Section.NOTE, true), FLAG_UPDATE_CURRENT)) .setStyle(NotificationCompat.InboxStyle().run { - setSummaryText(context.resources.getQuantityString(R.plurals.note_number_item, notes.size, notes.size)) + setSummaryText( + when (NoteCategory.getByValue(notes.first().categoryType)) { + POSITIVE -> context.resources.getQuantityString(R.plurals.praise_number_item, notes.size, notes.size) + NEUTRAL -> context.resources.getQuantityString(R.plurals.neutral_note_number_item, notes.size, notes.size) + else -> context.resources.getQuantityString(R.plurals.note_number_item, notes.size, notes.size) + } + ) notes.forEach { addLine("${it.teacher}: ${it.category}") } this }) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeSortingMode.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeSortingMode.kt new file mode 100644 index 000000000..1e6b26e8c --- /dev/null +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeSortingMode.kt @@ -0,0 +1,10 @@ +package io.github.wulkanowy.ui.modules.grade + +enum class GradeSortingMode(val value: String) { + ALPHABETIC("alphabetic"), + DATE("date"); + + companion object { + fun getByValue(value: String) = values().firstOrNull { it.value == value } ?: ALPHABETIC + } +} \ No newline at end of file diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt index a36517938..97b7b71c6 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt @@ -1,5 +1,6 @@ package io.github.wulkanowy.ui.modules.grade.details +import android.annotation.SuppressLint import io.github.wulkanowy.data.Status import io.github.wulkanowy.data.db.entities.Grade import io.github.wulkanowy.data.repositories.grade.GradeRepository @@ -10,6 +11,8 @@ import io.github.wulkanowy.ui.base.BasePresenter import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.ui.modules.grade.GradeAverageProvider import io.github.wulkanowy.ui.modules.grade.GradeDetailsWithAverage +import io.github.wulkanowy.ui.modules.grade.GradeSortingMode.ALPHABETIC +import io.github.wulkanowy.ui.modules.grade.GradeSortingMode.DATE import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.afterLoading import io.github.wulkanowy.utils.flowWithResource @@ -184,10 +187,20 @@ class GradeDetailsPresenter @Inject constructor( } } + @SuppressLint("DefaultLocale") private fun createGradeItems(items: List): List { return items - .filter { it.grades.isNotEmpty() } - .sortedBy { it.subject } + .let { gradesWithAverages -> + if (!preferencesRepository.showSubjectsWithoutGrades) { + gradesWithAverages.filter { it.grades.isNotEmpty() } + } else gradesWithAverages + } + .let { + when (preferencesRepository.gradeSortingMode) { + DATE -> it.sortedByDescending { gradeDetailsWithAverage -> gradeDetailsWithAverage.grades.firstOrNull()?.date } + ALPHABETIC -> it.sortedBy { gradeDetailsWithAverage -> gradeDetailsWithAverage.subject.toLowerCase() } + } + } .map { (subject, average, points, _, grades) -> val subItems = grades .sortedByDescending { it.date } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsAdapter.kt index 5d6ee162a..cd9a7e851 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsAdapter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsAdapter.kt @@ -29,6 +29,8 @@ class HomeworkDetailsAdapter @Inject constructor() : attachments = value?.attachments.orEmpty() } + var isHomeworkFullscreen = false + var onAttachmentClickListener: (url: String) -> Unit = {} var onFullScreenClickListener = {} @@ -67,6 +69,8 @@ class HomeworkDetailsAdapter @Inject constructor() : homeworkDialogSubject.text = homework?.subject homeworkDialogTeacher.text = homework?.teacher homeworkDialogContent.text = homework?.content + homeworkDialogFullScreen.visibility = if (isHomeworkFullscreen) GONE else VISIBLE + homeworkDialogFullScreenExit.visibility = if (isHomeworkFullscreen) VISIBLE else GONE homeworkDialogFullScreen.setOnClickListener { homeworkDialogFullScreen.visibility = GONE homeworkDialogFullScreenExit.visibility = VISIBLE diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsDialog.kt index 78abfffd0..aecaa394d 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsDialog.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsDialog.kt @@ -62,12 +62,25 @@ class HomeworkDetailsDialog : BaseDialogFragment(), Homew homeworkDialogClose.setOnClickListener { dismiss() } } + if (presenter.isHomeworkFullscreen) { + dialog?.window?.setLayout(MATCH_PARENT, MATCH_PARENT) + } else { + dialog?.window?.setLayout(WRAP_CONTENT, WRAP_CONTENT) + } + with(binding.homeworkDialogRecycler) { layoutManager = LinearLayoutManager(context) adapter = detailsAdapter.apply { onAttachmentClickListener = { context.openInternetBrowser(it, ::showMessage) } - onFullScreenClickListener = { dialog?.window?.setLayout(MATCH_PARENT, MATCH_PARENT) } - onFullScreenExitClickListener = { dialog?.window?.setLayout(WRAP_CONTENT, WRAP_CONTENT) } + onFullScreenClickListener = { + dialog?.window?.setLayout(MATCH_PARENT, MATCH_PARENT) + presenter.isHomeworkFullscreen = true + } + onFullScreenExitClickListener = { + dialog?.window?.setLayout(WRAP_CONTENT, WRAP_CONTENT) + presenter.isHomeworkFullscreen = false + } + isHomeworkFullscreen = presenter.isHomeworkFullscreen homework = this@HomeworkDetailsDialog.homework } } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsPresenter.kt index a53d38e86..e485dd748 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/details/HomeworkDetailsPresenter.kt @@ -3,6 +3,7 @@ package io.github.wulkanowy.ui.modules.homework.details import io.github.wulkanowy.data.Status import io.github.wulkanowy.data.db.entities.Homework import io.github.wulkanowy.data.repositories.homework.HomeworkRepository +import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository import io.github.wulkanowy.data.repositories.student.StudentRepository import io.github.wulkanowy.ui.base.BasePresenter import io.github.wulkanowy.ui.base.ErrorHandler @@ -16,9 +17,16 @@ class HomeworkDetailsPresenter @Inject constructor( errorHandler: ErrorHandler, studentRepository: StudentRepository, private val homeworkRepository: HomeworkRepository, - private val analytics: FirebaseAnalyticsHelper + private val analytics: FirebaseAnalyticsHelper, + private val preferencesRepository: PreferencesRepository ) : BasePresenter(errorHandler, studentRepository) { + var isHomeworkFullscreen + get() = preferencesRepository.isHomeworkFullscreen + set(value) { + preferencesRepository.isHomeworkFullscreen = value + } + override fun onAttachView(view: HomeworkDetailsView) { super.onAttachView(view) view.initView() diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt index 035608893..95b4aa77a 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt @@ -1,14 +1,21 @@ 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.content.pm.ShortcutInfo +import android.content.pm.ShortcutManager +import android.graphics.drawable.Icon +import android.os.Build import android.os.Build.VERSION.SDK_INT import android.os.Build.VERSION_CODES.LOLLIPOP import android.os.Bundle import android.view.Menu import android.view.MenuItem +import androidx.annotation.RequiresApi +import androidx.core.content.getSystemService import androidx.core.view.ViewCompat import androidx.fragment.app.DialogFragment import androidx.fragment.app.Fragment @@ -31,6 +38,7 @@ import io.github.wulkanowy.ui.modules.message.MessageFragment import io.github.wulkanowy.ui.modules.more.MoreFragment import io.github.wulkanowy.ui.modules.note.NoteFragment import io.github.wulkanowy.ui.modules.timetable.TimetableFragment +import io.github.wulkanowy.utils.AppInfo import io.github.wulkanowy.utils.FirebaseAnalyticsHelper import io.github.wulkanowy.utils.dpToPx import io.github.wulkanowy.utils.getThemeAttrColor @@ -48,6 +56,9 @@ class MainActivity : BaseActivity(), MainVie @Inject lateinit var analytics: FirebaseAnalyticsHelper + @Inject + lateinit var appInfo: AppInfo + private val overlayProvider by lazy { ElevationOverlayProvider(this) } private val navController = FragNavController(supportFragmentManager, R.id.mainFragmentContainer) @@ -59,7 +70,7 @@ class MainActivity : BaseActivity(), MainVie return Intent(context, MainActivity::class.java) .apply { if (clear) flags = FLAG_ACTIVITY_NEW_TASK or FLAG_ACTIVITY_CLEAR_TASK - startMenu?.let { putExtra(EXTRA_START_MENU, it) } + startMenu?.let { putExtra(EXTRA_START_MENU, it.id) } } } } @@ -83,18 +94,45 @@ class MainActivity : BaseActivity(), MainVie MainView.Section.LUCKY_NUMBER.id to LuckyNumberFragment.newInstance() ) + @SuppressLint("NewApi") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(ActivityMainBinding.inflate(layoutInflater).apply { binding = this }.root) setSupportActionBar(binding.mainToolbar) messageContainer = binding.mainFragmentContainer - presenter.onAttachView(this, intent.getSerializableExtra(EXTRA_START_MENU) as? MainView.Section) + presenter.onAttachView(this, MainView.Section.values().singleOrNull { it.id == intent.getIntExtra(EXTRA_START_MENU, -1) }) with(navController) { initialize(startMenuIndex, savedInstanceState) pushFragment(moreMenuFragments[startMenuMoreIndex]) } + if (appInfo.systemVersion >= Build.VERSION_CODES.N_MR1) initShortcuts() + } + + @RequiresApi(Build.VERSION_CODES.N_MR1) + fun initShortcuts() { + val shortcutsList = mutableListOf() + + listOf( + Triple(getString(R.string.grade_title), R.drawable.ic_shortcut_grade, MainView.Section.GRADE), + Triple(getString(R.string.attendance_title), R.drawable.ic_shortcut_attendance, MainView.Section.ATTENDANCE), + Triple(getString(R.string.exam_title), R.drawable.ic_shortcut_exam, MainView.Section.EXAM), + Triple(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(ShortcutInfo.Builder(applicationContext, title) + .setShortLabel(title) + .setLongLabel(title) + .setIcon(Icon.createWithResource(applicationContext, icon)) + .setIntents(arrayOf( + Intent(applicationContext, MainActivity::class.java).setAction(Intent.ACTION_VIEW), + Intent(applicationContext, MainActivity::class.java).putExtra(EXTRA_START_MENU, enum.id) + .setAction(Intent.ACTION_VIEW).addFlags(FLAG_ACTIVITY_NEW_TASK or FLAG_ACTIVITY_CLEAR_TASK))) + .build()) + } + + getSystemService()?.dynamicShortcuts = shortcutsList } override fun onCreateOptionsMenu(menu: Menu?): Boolean { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt index 58be38cec..f049f828e 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableAdapter.kt @@ -41,6 +41,8 @@ class TimetableAdapter @Inject constructor() : RecyclerView.Adapter() @@ -99,6 +101,7 @@ class TimetableAdapter @Inject constructor() : RecyclerView.Adapter(R.layout.fragme else false } - override fun updateData(data: List, showWholeClassPlanType: String, showTimetableTimers: Boolean) { + override fun updateData(data: List, showWholeClassPlanType: String, showGroupsInPlanType: Boolean, showTimetableTimers: Boolean) { with(timetableAdapter) { items = data.toMutableList() showTimers = showTimetableTimers showWholeClassPlan = showWholeClassPlanType + showGroupsInPlan = showGroupsInPlanType notifyDataSetChanged() } } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt index 8581b73c6..f924650a0 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt @@ -143,6 +143,7 @@ class TimetablePresenter @Inject constructor( view?.apply { updateData( showWholeClassPlanType = prefRepository.showWholeClassPlan, + showGroupsInPlanType = prefRepository.showGroupsInPlan, showTimetableTimers = prefRepository.showTimetableTimers, data = it.data!! .filter { item -> if (prefRepository.showWholeClassPlan == "no") item.isStudentPlan else true } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt index fe34f1ee9..244120176 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableView.kt @@ -12,7 +12,7 @@ interface TimetableView : BaseView { fun initView() - fun updateData(data: List, showWholeClassPlanType: String, showTimetableTimers: Boolean) + fun updateData(data: List, showWholeClassPlanType: String, showGroupsInPlanType: Boolean, showTimetableTimers: Boolean) fun updateNavigationDay(date: String) diff --git a/app/src/main/play/release-notes/pl-PL/default.txt b/app/src/main/play/release-notes/pl-PL/default.txt index 62a71f437..09f44931d 100644 --- a/app/src/main/play/release-notes/pl-PL/default.txt +++ b/app/src/main/play/release-notes/pl-PL/default.txt @@ -1,5 +1,10 @@ -Wersja 0.20.5 -- naprawiliśmy logowanie do koszalińskiego dziennika -- naprawiliśmy resetowanie hasła na gdańskim dzienniku +Wersja 0.21.0 +- naprawiliśmy logowanie do tarnowskiego dziennika +- naprawiliśmy wyświetlanie podsumowania punktów klasy +- dodaliśmy skróty aplikacji +- dodaliśmy opcję pokazywania nazwy grupy w planie lekcji na liście +- dodaliśmy opcję pokazywania w ocenach przedmiotów bez ocen +- dodaliśmy dodatkowe opcje sortowania ocen +- dodaliśmy rozróżnianie powiadomień dla pochwał i uwag Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases diff --git a/app/src/main/res/drawable-hdpi/ic_shortcut_attendance.png b/app/src/main/res/drawable-hdpi/ic_shortcut_attendance.png new file mode 100644 index 000000000..0b5feff2d Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_shortcut_attendance.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_shortcut_exam.png b/app/src/main/res/drawable-hdpi/ic_shortcut_exam.png new file mode 100644 index 000000000..e5af0d086 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_shortcut_exam.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_shortcut_grade.png b/app/src/main/res/drawable-hdpi/ic_shortcut_grade.png new file mode 100644 index 000000000..095a8228c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_shortcut_grade.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_shortcut_message.png b/app/src/main/res/drawable-hdpi/ic_shortcut_message.png new file mode 100644 index 000000000..7bcd79e01 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_shortcut_message.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_shortcut_timetable.png b/app/src/main/res/drawable-hdpi/ic_shortcut_timetable.png new file mode 100644 index 000000000..2808559a5 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_shortcut_timetable.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_shortcut_attendance.png b/app/src/main/res/drawable-mdpi/ic_shortcut_attendance.png new file mode 100644 index 000000000..e81e7ad92 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_shortcut_attendance.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_shortcut_exam.png b/app/src/main/res/drawable-mdpi/ic_shortcut_exam.png new file mode 100644 index 000000000..3bdb5297f Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_shortcut_exam.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_shortcut_grade.png b/app/src/main/res/drawable-mdpi/ic_shortcut_grade.png new file mode 100644 index 000000000..e35135071 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_shortcut_grade.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_shortcut_message.png b/app/src/main/res/drawable-mdpi/ic_shortcut_message.png new file mode 100644 index 000000000..392c45d24 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_shortcut_message.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_shortcut_timetable.png b/app/src/main/res/drawable-mdpi/ic_shortcut_timetable.png new file mode 100644 index 000000000..7d61306a4 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_shortcut_timetable.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_shortcut_attendance.png b/app/src/main/res/drawable-xhdpi/ic_shortcut_attendance.png new file mode 100644 index 000000000..302b9e0ee Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_shortcut_attendance.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_shortcut_exam.png b/app/src/main/res/drawable-xhdpi/ic_shortcut_exam.png new file mode 100644 index 000000000..9f36ca47a Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_shortcut_exam.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_shortcut_grade.png b/app/src/main/res/drawable-xhdpi/ic_shortcut_grade.png new file mode 100644 index 000000000..281bc7a31 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_shortcut_grade.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_shortcut_message.png b/app/src/main/res/drawable-xhdpi/ic_shortcut_message.png new file mode 100644 index 000000000..184929a3c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_shortcut_message.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_shortcut_timetable.png b/app/src/main/res/drawable-xhdpi/ic_shortcut_timetable.png new file mode 100644 index 000000000..9a40fe61c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_shortcut_timetable.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_shortcut_attendance.png b/app/src/main/res/drawable-xxhdpi/ic_shortcut_attendance.png new file mode 100644 index 000000000..9b4ef2daf Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_shortcut_attendance.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_shortcut_exam.png b/app/src/main/res/drawable-xxhdpi/ic_shortcut_exam.png new file mode 100644 index 000000000..c2677a139 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_shortcut_exam.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_shortcut_grade.png b/app/src/main/res/drawable-xxhdpi/ic_shortcut_grade.png new file mode 100644 index 000000000..8b51021cb Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_shortcut_grade.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_shortcut_message.png b/app/src/main/res/drawable-xxhdpi/ic_shortcut_message.png new file mode 100644 index 000000000..250c290aa Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_shortcut_message.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_shortcut_timetable.png b/app/src/main/res/drawable-xxhdpi/ic_shortcut_timetable.png new file mode 100644 index 000000000..c530153a1 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_shortcut_timetable.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_shortcut_attendance.png b/app/src/main/res/drawable-xxxhdpi/ic_shortcut_attendance.png new file mode 100644 index 000000000..7b9a68a70 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_shortcut_attendance.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_shortcut_exam.png b/app/src/main/res/drawable-xxxhdpi/ic_shortcut_exam.png new file mode 100644 index 000000000..519c50abc Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_shortcut_exam.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_shortcut_grade.png b/app/src/main/res/drawable-xxxhdpi/ic_shortcut_grade.png new file mode 100644 index 000000000..13c793d5e Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_shortcut_grade.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_shortcut_message.png b/app/src/main/res/drawable-xxxhdpi/ic_shortcut_message.png new file mode 100644 index 000000000..eaffa2dde Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_shortcut_message.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_shortcut_timetable.png b/app/src/main/res/drawable-xxxhdpi/ic_shortcut_timetable.png new file mode 100644 index 000000000..03522e9a5 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_shortcut_timetable.png differ diff --git a/app/src/main/res/layout/fragment_contributor.xml b/app/src/main/res/layout/fragment_contributor.xml index 399ab5999..d913c5a4d 100644 --- a/app/src/main/res/layout/fragment_contributor.xml +++ b/app/src/main/res/layout/fragment_contributor.xml @@ -1,5 +1,6 @@ @@ -20,17 +21,18 @@ android:id="@+id/creatorRecycler" android:layout_width="match_parent" android:layout_height="0dp" - android:layout_weight="1" /> + android:layout_weight="1" + tools:listitem="@layout/item_contributor" /> diff --git a/app/src/main/res/layout/item_contributor.xml b/app/src/main/res/layout/item_contributor.xml index 36eb64ecc..9b1263438 100644 --- a/app/src/main/res/layout/item_contributor.xml +++ b/app/src/main/res/layout/item_contributor.xml @@ -15,7 +15,8 @@ android:layout_marginStart="16dp" android:layout_marginTop="8dp" android:layout_marginBottom="8dp" - android:contentDescription="@string/contributor_avatar_description" /> + android:contentDescription="@string/contributor_avatar_description" + tools:src="@tools:sample/avatars" /> + tools:visibility="visible" /> + + + tools:visibility="visible" /> diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 42169ca53..7e2877674 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -19,7 +19,7 @@ Hausaufgaben Wählen Sie ein Konto - Semester %d, %d/%d + Semester %1$d, %2$d/%3$d Melden Sie sich mit dem Studenten- oder Elternkonto an Geben Sie das Symbol diff --git a/app/src/main/res/values-pl/preferences_values.xml b/app/src/main/res/values-pl/preferences_values.xml index 1d81fb586..c57d2be54 100644 --- a/app/src/main/res/values-pl/preferences_values.xml +++ b/app/src/main/res/values-pl/preferences_values.xml @@ -29,6 +29,10 @@ 0,5 0,75 + + Alfabetycznie + Według daty + Dzienniczek+ Wulkanowy diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index ebc145423..0923951ad 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -19,7 +19,7 @@ Zadania domowe Wybierz konto - Semestr %d, %d/%d + Semestr %1$d, %2$d/%3$d Zaloguj się za pomocą konta ucznia lub rodzica Podaj symbol @@ -252,6 +252,44 @@ Masz %1$d nowych uwag Masz %1$d nowych uwag + + + %d pochwała + %d pochwały + %d pochwał + %d pochwał + + + Nowa pochwała + Nowe pochwały + Nowe pochwały + Nowe pochwały + + + Masz %1$d nową pochwałę + Masz %1$d nowe pochwały + Masz %1$d nowych pochwał + Masz %1$d nowych pochwał + + + + %d neutralna uwaga + %d neutralne uwagi + %d neutralnych uwag + %d neutralnych uwag + + + Nowa neutralna uwaga + Nowe neutralne uwagi + Nowe neutralne uwagi + Nowe neutralne uwagi + + + Masz %1$d nową neutralną uwagę + Masz %1$d nowe neutralne uwagi + Masz %1$d nowych neutralnych uwag + Masz %1$d nowych neutralnych uwag + Brak zadań domowych Wykonane @@ -357,9 +395,12 @@ Motyw aplikacji Rozwiń oceny Oznaczaj bieżącą lekcję na planie + Pokazuj grupę obok przedmiotu na planie Pokazuj listę wykresów w ocenach klasy Pokazuj lekcje całej klasy + Pokazuj przedmioty bez ocen w Oceny Schemat kolorów ocen + Sortowanie przedmiotów w "Oceny" Język aplikacji Powiadomienia Pokazuj powiadomienia diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 15c583173..7052fbc9c 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -19,7 +19,7 @@ Домашние задания Выберите аккаунт - %d семестр, %d/%d + %1$d семестр, %2$d/%3$d Авторизируйтесь при помощи аккаунта ученика или родителя Впишите \"symbol\" diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 423c4e12f..15fe203d5 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -19,7 +19,7 @@ Домашні завдання Оберіть аккаунт - %d семестр, %d/%d + %1$d семестр, %2$d/%3$d Авторизуйтеся за допомогою аккаунта учня або батька Впишіть \"symbol\" diff --git a/app/src/main/res/values/preferences_defaults.xml b/app/src/main/res/values/preferences_defaults.xml index a82b14eb7..fb82e0ed6 100644 --- a/app/src/main/res/values/preferences_defaults.xml +++ b/app/src/main/res/values/preferences_defaults.xml @@ -18,6 +18,10 @@ 0.33 0.33 true + false no + alphabetic false + false + false diff --git a/app/src/main/res/values/preferences_keys.xml b/app/src/main/res/values/preferences_keys.xml index 6cb877ec2..0cfa485e3 100644 --- a/app/src/main/res/values/preferences_keys.xml +++ b/app/src/main/res/values/preferences_keys.xml @@ -20,6 +20,10 @@ grade_modifier_plus grade_modifier_minus fill_message_content + grade_sorting_mode show_whole_class_plan + show_groups_in_plan timetable_show_timers + homework_fullscreen + subjects_without_grades diff --git a/app/src/main/res/values/preferences_values.xml b/app/src/main/res/values/preferences_values.xml index 5824658c4..06a9d8c4a 100644 --- a/app/src/main/res/values/preferences_values.xml +++ b/app/src/main/res/values/preferences_values.xml @@ -75,6 +75,15 @@ 0.75 + + Alphabetic + By date + + + alphabetic + date + + Dzienniczek+ Wulkanowy diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 963c70478..bf4727be6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -21,7 +21,7 @@ - Semester %d, %d/%d + Semester %1$d, %2$d/%3$d @@ -249,6 +249,34 @@ You received %1$d notes + + + %d praise + %d praises + + + New praise + New praises + + + You received %1$d praise + You received %1$d praises + + + + + %d neutral note + %d neutral notes + + + New neutral note + New neutral notes + + + You received %1$d neutral note + You received %1$d neutral notes + + No info about homework @@ -383,9 +411,12 @@ Application theme Expand grades Mark current lesson in timetable + Show groups next to subjects in timetable Show chart list in class grades Show whole class lessons + Show subjects without grades in Grades Grades color scheme + Subjects sorting in "Grades" App language Notifications diff --git a/app/src/main/res/xml/scheme_preferences.xml b/app/src/main/res/xml/scheme_preferences.xml index 4cdb989c7..3f24c787a 100644 --- a/app/src/main/res/xml/scheme_preferences.xml +++ b/app/src/main/res/xml/scheme_preferences.xml @@ -40,6 +40,18 @@ app:key="@string/pref_key_grade_statistics_list" app:singleLineTitle="false" app:title="@string/pref_view_grade_statistics_list" /> + + + NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell