mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-18 21:06:44 -06:00
[UI/Settings] Add setting for showing drawer on back pressed.
This commit is contained in:
parent
50ada5f95b
commit
ddb1ecaa99
@ -1063,30 +1063,11 @@ class MainActivity : AppCompatActivity() {
|
||||
private var targetHomeId: Int = -1
|
||||
override fun onBackPressed() {
|
||||
if (!b.navView.onBackPressed()) {
|
||||
|
||||
navigateUp()
|
||||
|
||||
/*val currentDestinationId = navController.currentDestination?.id
|
||||
|
||||
if (if (targetHomeId != -1 && targetPopToHomeList.contains(navController.currentDestination?.id)) {
|
||||
if (!navController.popBackStack(targetHomeId, false)) {
|
||||
navController.navigateUp()
|
||||
}
|
||||
true
|
||||
} else {
|
||||
navController.navigateUp()
|
||||
}) {
|
||||
val currentId = navController.currentDestination?.id ?: -1
|
||||
val drawerSelection = navTargetList
|
||||
.singleOrNull {
|
||||
it.navGraphId == currentId
|
||||
}?.also {
|
||||
navView.toolbar.setTitle(it.title ?: it.name)
|
||||
}?.id ?: -1
|
||||
drawer.setSelection(drawerSelection, false)
|
||||
if (App.getConfig().ui.openDrawerOnBackPressed) {
|
||||
b.navView.drawer.toggle()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
}*/
|
||||
navigateUp()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull
|
||||
|
||||
class ServerSyncTask : IApiTask(-1) {
|
||||
override fun prepare(app: App) {
|
||||
taskName = app.getString(R.string.edziennik_notification_api_notify_title) // TODO text
|
||||
taskName = app.getString(R.string.edziennik_szkolny_api_sync_title) // TODO text
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
|
@ -40,6 +40,11 @@ class ConfigUI(private val config: Config) {
|
||||
get() { mMiniMenuButtons = mMiniMenuButtons ?: config.values.getIntList("miniMenuButtons", listOf()); return mMiniMenuButtons ?: listOf() }
|
||||
set(value) { config.set("miniMenuButtons", value); mMiniMenuButtons = value }
|
||||
|
||||
private var mOpenDrawerOnBackPressed: Boolean? = null
|
||||
var openDrawerOnBackPressed: Boolean
|
||||
get() { mOpenDrawerOnBackPressed = mOpenDrawerOnBackPressed ?: config.values.get("openDrawerOnBackPressed", false); return mOpenDrawerOnBackPressed ?: false }
|
||||
set(value) { config.set("openDrawerOnBackPressed", value); mOpenDrawerOnBackPressed = value }
|
||||
|
||||
private var mAgendaViewType: Int? = null
|
||||
var agendaViewType: Int
|
||||
get() { mAgendaViewType = mAgendaViewType ?: config.values.get("agendaViewType", 0); return mAgendaViewType ?: 0 }
|
||||
@ -49,4 +54,4 @@ class ConfigUI(private val config: Config) {
|
||||
var homeCards: List<HomeCardModel>
|
||||
get() { mHomeCards = mHomeCards ?: config.values.get("homeCards", listOf(), HomeCardModel::class.java); return mHomeCards ?: listOf() }
|
||||
set(value) { config.set("homeCards", value); mHomeCards = value }
|
||||
}
|
||||
}
|
||||
|
@ -461,6 +461,21 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
||||
})
|
||||
);
|
||||
|
||||
items.add(
|
||||
new MaterialAboutSwitchItem(
|
||||
getString(R.string.settings_theme_open_drawer_on_back_pressed_text),
|
||||
null,
|
||||
new IconicsDrawable(activity)
|
||||
.icon(CommunityMaterial.Icon2.cmd_menu_open)
|
||||
.size(IconicsSize.dp(iconSizeDp))
|
||||
.color(IconicsColor.colorInt(iconColor))
|
||||
)
|
||||
.setChecked(app.config.getUi().getOpenDrawerOnBackPressed())
|
||||
.setOnChangeAction((isChecked, tag) -> {
|
||||
app.config.getUi().setOpenDrawerOnBackPressed(isChecked);
|
||||
return true;
|
||||
})
|
||||
);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
@ -1019,9 +1034,9 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
||||
.size(IconicsSize.dp(iconSizeDp))
|
||||
.color(IconicsColor.colorInt(iconColor))
|
||||
)
|
||||
.setChecked(!app.config.getFor(app.profileId).getGrades().getCountZeroToAvg())
|
||||
.setChecked(!app.config.getFor(App.profileId).getGrades().getCountZeroToAvg())
|
||||
.setOnChangeAction((isChecked, tag) -> {
|
||||
app.config.getFor(app.profileId).getGrades().setCountZeroToAvg(!isChecked);
|
||||
app.config.getFor(App.profileId).getGrades().setCountZeroToAvg(!isChecked);
|
||||
app.saveConfig("dontCountZeroToAverage");
|
||||
return true;
|
||||
})
|
||||
|
@ -1059,4 +1059,6 @@
|
||||
<string name="grade_subject_format">z %s</string>
|
||||
<string name="concat_2_strings" translatable="false">%s%s</string>
|
||||
<string name="edziennik_progress_endpoint_behaviour_grades">Pobieranie ocen z zachowania...</string>
|
||||
<string name="edziennik_szkolny_api_sync_title">Synchronizowanie udostępnionych wydarzeń...</string>
|
||||
<string name="settings_theme_open_drawer_on_back_pressed_text">Otwieraj menu przyciskiem wstecz</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user