Compare commits

...

2 Commits

11 changed files with 123 additions and 68 deletions

View File

@ -15,6 +15,7 @@ class ConfigUI(base: Config) {
var appBackground by base.config<String?>("appBg", null) var appBackground by base.config<String?>("appBg", null)
var headerBackground by base.config<String?>("headerBg", null) var headerBackground by base.config<String?>("headerBg", null)
var lockLayout by base.config<Boolean>(false)
var miniMenuVisible by base.config<Boolean>(false) var miniMenuVisible by base.config<Boolean>(false)
var miniMenuButtons by base.config<Set<NavTarget>> { var miniMenuButtons by base.config<Set<NavTarget>> {
setOf( setOf(

View File

@ -136,6 +136,7 @@ class HomeFragment : Fragment(), CoroutineScope {
Toast.makeText(activity, R.string.main_menu_mark_as_read_success, Toast.LENGTH_SHORT).show() Toast.makeText(activity, R.string.main_menu_mark_as_read_success, Toast.LENGTH_SHORT).show()
}) })
) )
b.configureCards.onClick { b.configureCards.onClick {
HomeConfigDialog(activity, reloadOnDismiss = true).show() HomeConfigDialog(activity, reloadOnDismiss = true).show()
} }
@ -168,43 +169,63 @@ class HomeFragment : Fragment(), CoroutineScope {
else -> null else -> null
} as HomeCard? } as HomeCard?
} }
//if (App.devMode) //if (App.devMode)
// items += HomeDebugCard(100, app, activity, this, app.profile) // items += HomeDebugCard(100, app, activity, this, app.profile)
if (app.profile.archived) if (app.profile.archived)
items.add(0, HomeArchiveCard(101, app, activity, this, app.profile)) items.add(0, HomeArchiveCard(101, app, activity, this, app.profile))
val status = app.availabilityManager.check(app.profile, cacheOnly = true)?.status val status = app.availabilityManager.check(app.profile, cacheOnly = true)?.status
val lockLayout = app.config.ui.lockLayout
val update = app.config.update val update = app.config.update
if (update != null && update.versionCode > BuildConfig.VERSION_CODE || status?.userMessage != null) { if (update != null && update.versionCode > BuildConfig.VERSION_CODE || status?.userMessage != null) {
items.add(0, HomeAvailabilityCard(102, app, activity, this, app.profile)) items.add(0, HomeAvailabilityCard(102, app, activity, this, app.profile))
} }
val adapter = HomeCardAdapter(items) val adapter = HomeCardAdapter(items)
val itemTouchHelper = ItemTouchHelper(CardItemTouchHelperCallback(adapter, b.refreshLayout))
adapter.itemTouchHelper = itemTouchHelper
b.list.layoutManager = LinearLayoutManager(activity)
b.list.adapter = adapter b.list.adapter = adapter
b.list.setAccessibilityDelegateCompat(object : RecyclerViewAccessibilityDelegate(b.list) { b.list.layoutManager = LinearLayoutManager(activity)
val itemTouchHelper =
ItemTouchHelper(CardItemTouchHelperCallback(adapter, b.refreshLayout))
adapter.itemTouchHelper = itemTouchHelper
if (!lockLayout) {
b.list.setAccessibilityDelegateCompat(object :
RecyclerViewAccessibilityDelegate(b.list) {
override fun getItemDelegate(): AccessibilityDelegateCompat { override fun getItemDelegate(): AccessibilityDelegateCompat {
return object : ItemDelegate(this) { return object : ItemDelegate(this) {
override fun onInitializeAccessibilityNodeInfo(host: View, info: AccessibilityNodeInfoCompat) { override fun onInitializeAccessibilityNodeInfo(
host: View,
info: AccessibilityNodeInfoCompat
) {
super.onInitializeAccessibilityNodeInfo(host, info) super.onInitializeAccessibilityNodeInfo(host, info)
val position: Int = b.list.getChildLayoutPosition(host) val position: Int = b.list.getChildLayoutPosition(host)
if (position != 0) { if (position != 0) {
info.addAction(AccessibilityActionCompat( info.addAction(
AccessibilityActionCompat(
R.id.move_card_up_action, R.id.move_card_up_action,
host.resources.getString(R.string.card_action_move_up) host.resources.getString(R.string.card_action_move_up)
)) )
)
} }
if (position != adapter.itemCount - 1) { if (position != adapter.itemCount - 1) {
info.addAction(AccessibilityActionCompat( info.addAction(
AccessibilityActionCompat(
R.id.move_card_down_action, R.id.move_card_down_action,
host.resources.getString(R.string.card_action_move_down) host.resources.getString(R.string.card_action_move_down)
)) )
)
} }
} }
override fun performAccessibilityAction(host: View, action: Int, args: Bundle?): Boolean { override fun performAccessibilityAction(
host: View,
action: Int,
args: Bundle?
): Boolean {
val fromPosition: Int = b.list.getChildLayoutPosition(host) val fromPosition: Int = b.list.getChildLayoutPosition(host)
if (action == R.id.move_card_down_action) { if (action == R.id.move_card_down_action) {
swapCards(fromPosition, fromPosition + 1, adapter) swapCards(fromPosition, fromPosition + 1, adapter)
@ -218,6 +239,8 @@ class HomeFragment : Fragment(), CoroutineScope {
} }
} }
}) })
itemTouchHelper.attachToRecyclerView(b.list) itemTouchHelper.attachToRecyclerView(b.list)
} }
} }
}

View File

@ -74,6 +74,16 @@ class SettingsThemeCard(util: SettingsUtil) : SettingsCard(util) {
) { _, it -> ) { _, it ->
configGlobal.ui.miniMenuVisible = it configGlobal.ui.miniMenuVisible = it
activity.navView.drawer.miniDrawerVisiblePortrait = it activity.navView.drawer.miniDrawerVisiblePortrait = it
},
util.createPropertyItem(
text = R.string.settings_ui_lock_layout_text,
subText = R.string.settings_ui_lock_layout_subtext,
icon = CommunityMaterial.Icon.cmd_axis_lock,
value = configGlobal.ui.lockLayout
) { _, it ->
configGlobal.ui.lockLayout = it
activity.recreate()
} }
) )

View File

@ -1,11 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="64dp"
android:height="24dp" android:height="64dp"
android:viewportWidth="48" android:viewportWidth="48"
android:viewportHeight="48" android:viewportHeight="48">
android:tint="?colorOnBackground"
android:autoMirrored="true">
<path <path
android:fillColor="?colorOnBackground" android:pathData="M8,39.001v-30c0,-2.2 1.8,-4 4,-4h24c2.2,0 4,1.8 4,4v30c0,2.2 -1.8,4 -4,4H12C9.8,43.001 8,41.201 8,39.001z"
android:pathData="M15,34.2Q15.75,34.2 16.3,33.675Q16.85,33.15 16.85,32.4Q16.85,31.65 16.3,31.1Q15.75,30.55 15,30.55Q14.25,30.55 13.725,31.1Q13.2,31.65 13.2,32.4Q13.2,33.15 13.725,33.675Q14.25,34.2 15,34.2ZM15,25.8Q15.75,25.8 16.3,25.275Q16.85,24.75 16.85,24Q16.85,23.25 16.3,22.7Q15.75,22.15 15,22.15Q14.25,22.15 13.725,22.7Q13.2,23.25 13.2,24Q13.2,24.75 13.725,25.275Q14.25,25.8 15,25.8ZM15,17.35Q15.75,17.35 16.3,16.825Q16.85,16.3 16.85,15.55Q16.85,14.8 16.3,14.25Q15.75,13.7 15,13.7Q14.25,13.7 13.725,14.25Q13.2,14.8 13.2,15.55Q13.2,16.3 13.725,16.825Q14.25,17.35 15,17.35ZM21.45,34.25H34.15V30.6H21.45ZM21.45,25.8H34.15V22.15H21.45ZM21.45,17.4H34.15V13.75H21.45ZM9,42.65Q7.55,42.65 6.45,41.55Q5.35,40.45 5.35,39V9Q5.35,7.55 6.45,6.45Q7.55,5.35 9,5.35H39Q40.45,5.35 41.55,6.45Q42.65,7.55 42.65,9V39Q42.65,40.45 41.55,41.55Q40.45,42.65 39,42.65ZM9,39H39Q39,39 39,39Q39,39 39,39V9Q39,9 39,9Q39,9 39,9H9Q9,9 9,9Q9,9 9,9V39Q9,39 9,39Q9,39 9,39ZM9,9Q9,9 9,9Q9,9 9,9V39Q9,39 9,39Q9,39 9,39Q9,39 9,39Q9,39 9,39V9Q9,9 9,9Q9,9 9,9Z"/> android:fillColor="#42a5f5"/>
<path
android:pathData="M14,8.001c0,-1.105 -0.895,-2 -2,-2s-2,0.895 -2,2s0.895,2 2,2S14,9.105 14,8.001zM22,8.001c0,-1.105 -0.895,-2 -2,-2s-2,0.895 -2,2s0.895,2 2,2S22,9.105 22,8.001zM30,8.001c0,-1.105 -0.895,-2 -2,-2s-2,0.895 -2,2s0.895,2 2,2S30,9.105 30,8.001zM38,8.001c0,-1.105 -0.895,-2 -2,-2s-2,0.895 -2,2s0.895,2 2,2S38,9.105 38,8.001z"
android:fillColor="#1e88e5"/>
<path
android:pathData="M11,8.001v-4c0,-0.6 0.4,-1 1,-1l0,0c0.6,0 1,0.4 1,1v4c0,0.6 -0.4,1 -1,1l0,0C11.4,9.001 11,8.601 11,8.001zM19,8.001v-4c0,-0.6 0.4,-1 1,-1l0,0c0.6,0 1,0.4 1,1v4c0,0.6 -0.4,1 -1,1l0,0C19.4,9.001 19,8.601 19,8.001zM27,8.001v-4c0,-0.6 0.4,-1 1,-1l0,0c0.6,0 1,0.4 1,1v4c0,0.6 -0.4,1 -1,1l0,0C27.4,9.001 27,8.601 27,8.001zM35,8.001v-4c0,-0.6 0.4,-1 1,-1l0,0c0.6,0 1,0.4 1,1v4c0,0.6 -0.4,1 -1,1l0,0C35.4,9.001 35,8.601 35,8.001z"
android:fillColor="#cfd8dc"/>
<path
android:pathData="M14,19.001h19.993v2H14V19.001zM14.007,15.001H34v2H14.007V15.001zM14,30.001h17v2H14V30.001zM27,34.001h6.993v2H27V34.001zM14,34.001h11v2H14V34.001zM21,23.001h-7v2h7V23.001z"
android:fillColor="#1565c0"/>
</vector> </vector>

View File

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="48"
android:viewportHeight="48"
android:tint="?colorOnBackground"
android:autoMirrored="true">
<path
android:fillColor="?colorOnBackground"
android:pathData="M15,34.2Q15.75,34.2 16.3,33.675Q16.85,33.15 16.85,32.4Q16.85,31.65 16.3,31.1Q15.75,30.55 15,30.55Q14.25,30.55 13.725,31.1Q13.2,31.65 13.2,32.4Q13.2,33.15 13.725,33.675Q14.25,34.2 15,34.2ZM15,25.8Q15.75,25.8 16.3,25.275Q16.85,24.75 16.85,24Q16.85,23.25 16.3,22.7Q15.75,22.15 15,22.15Q14.25,22.15 13.725,22.7Q13.2,23.25 13.2,24Q13.2,24.75 13.725,25.275Q14.25,25.8 15,25.8ZM15,17.35Q15.75,17.35 16.3,16.825Q16.85,16.3 16.85,15.55Q16.85,14.8 16.3,14.25Q15.75,13.7 15,13.7Q14.25,13.7 13.725,14.25Q13.2,14.8 13.2,15.55Q13.2,16.3 13.725,16.825Q14.25,17.35 15,17.35ZM21.45,34.25H34.15V30.6H21.45ZM21.45,25.8H34.15V22.15H21.45ZM21.45,17.4H34.15V13.75H21.45ZM9,42.65Q7.55,42.65 6.45,41.55Q5.35,40.45 5.35,39V9Q5.35,7.55 6.45,6.45Q7.55,5.35 9,5.35H39Q40.45,5.35 41.55,6.45Q42.65,7.55 42.65,9V39Q42.65,40.45 41.55,41.55Q40.45,42.65 39,42.65ZM9,39H39Q39,39 39,39Q39,39 39,39V9Q39,9 39,9Q39,9 39,9H9Q9,9 9,9Q9,9 9,9V39Q9,39 9,39Q9,39 9,39ZM9,9Q9,9 9,9Q9,9 9,9V39Q9,39 9,39Q9,39 9,39Q9,39 9,39Q9,39 9,39V9Q9,9 9,9Q9,9 9,9Z"/>
</vector>

View File

@ -18,7 +18,7 @@
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.IconButton.Filled" style="@style/Widget.Material3.Button.IconButton.Filled"
app:icon="@drawable/ic_note" app:icon="@drawable/ic_note_legacy"
app:iconTint="?colorOnPrimaryContainer" app:iconTint="?colorOnPrimaryContainer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -29,7 +29,7 @@
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:text="@{text}" android:text="@{text}"
android:textAppearance="@style/AppTheme.MaterialAlertDialog.TitleText" android:textAppearance="@style/AppTheme.MaterialAlertDialog.TitleText"
app:drawableStartCompat="@drawable/ic_note" app:drawableStartCompat="@drawable/ic_note_legacy"
tools:layout_height="28sp" tools:layout_height="28sp"
tools:text="@string/notes_list_dialog_title" /> tools:text="@string/notes_list_dialog_title" />

View File

@ -23,13 +23,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:drawablePadding="16dp" android:drawablePadding="16dp"
android:drawableTopSize="@{128}"
android:fontFamily="sans-serif-light"
android:gravity="center" android:gravity="center"
android:padding="16dp" android:padding="16dp"
android:text="@string/notes_no_data" android:text="@string/notes_no_data"
android:textSize="24sp"
android:visibility="gone" android:visibility="gone"
android:textAppearance="@style/NavView.TextView.BodyMedium"
app:drawableTopCompat="@drawable/ic_note" app:drawableTopCompat="@drawable/ic_note"
tools:visibility="visible" /> tools:visibility="visible" />
@ -38,7 +36,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="gone" android:visibility="gone"
tools:itemCount="3"
tools:listitem="@layout/note_list_item" tools:listitem="@layout/note_list_item"
tools:visibility="visible" /> tools:visibility="visible" />
</FrameLayout> </FrameLayout>

View File

@ -1227,4 +1227,6 @@
<string name="settings_about_contributors_subtext">Liste der Szkolny-Entwickler</string> <string name="settings_about_contributors_subtext">Liste der Szkolny-Entwickler</string>
<string name="menu_teachers">Lehrer</string> <string name="menu_teachers">Lehrer</string>
<string name="edziennik_progress_endpoint_addressbook">Addressbuch herunterladen…</string> <string name="edziennik_progress_endpoint_addressbook">Addressbuch herunterladen…</string>
<string name="settings_ui_lock_layout_text">Sperren des Startbildschirm-Layouts</string>
<string name="settings_ui_lock_layout_subtext">Sie können keine Elemente auf dem Startbildschirm bearbeiten</string>
</resources> </resources>

View File

@ -1434,4 +1434,6 @@
<string name="menu_agenda_config">Agenda settings</string> <string name="menu_agenda_config">Agenda settings</string>
<string name="registration_config_note_sharing_title">Share notes</string> <string name="registration_config_note_sharing_title">Share notes</string>
<string name="home_timetable_all_lessons">All lessons:</string> <string name="home_timetable_all_lessons">All lessons:</string>
<string name="settings_ui_lock_layout_text">Lock home screen layout</string>
<string name="settings_ui_lock_layout_subtext">You will not be able to edit items on the home screen</string>
</resources> </resources>

View File

@ -1554,4 +1554,6 @@
<string name="home_timetable_all_lessons">Wszystkie lekcje:</string> <string name="home_timetable_all_lessons">Wszystkie lekcje:</string>
<string name="agenda_config_subject_important">Wyświetl nazwę przedmiotu zamiast rodzaju</string> <string name="agenda_config_subject_important">Wyświetl nazwę przedmiotu zamiast rodzaju</string>
<string name="menu_timetable_sync">Odśwież wybrany tydzień</string> <string name="menu_timetable_sync">Odśwież wybrany tydzień</string>
<string name="settings_ui_lock_layout_text">Zablokuj układ ekranu głównego</string>
<string name="settings_ui_lock_layout_subtext">Nie będzie można edytować przedmiotów na ekranie głównym</string>
</resources> </resources>