forked from github/szkolny
[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
|
private var targetHomeId: Int = -1
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
if (!b.navView.onBackPressed()) {
|
if (!b.navView.onBackPressed()) {
|
||||||
|
if (App.getConfig().ui.openDrawerOnBackPressed) {
|
||||||
|
b.navView.drawer.toggle()
|
||||||
|
} else {
|
||||||
navigateUp()
|
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)
|
|
||||||
} else {
|
|
||||||
super.onBackPressed()
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import pl.szczodrzynski.edziennik.data.db.modules.profiles.ProfileFull
|
|||||||
|
|
||||||
class ServerSyncTask : IApiTask(-1) {
|
class ServerSyncTask : IApiTask(-1) {
|
||||||
override fun prepare(app: App) {
|
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() {
|
override fun cancel() {
|
||||||
|
@ -40,6 +40,11 @@ class ConfigUI(private val config: Config) {
|
|||||||
get() { mMiniMenuButtons = mMiniMenuButtons ?: config.values.getIntList("miniMenuButtons", listOf()); return mMiniMenuButtons ?: listOf() }
|
get() { mMiniMenuButtons = mMiniMenuButtons ?: config.values.getIntList("miniMenuButtons", listOf()); return mMiniMenuButtons ?: listOf() }
|
||||||
set(value) { config.set("miniMenuButtons", value); mMiniMenuButtons = value }
|
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
|
private var mAgendaViewType: Int? = null
|
||||||
var agendaViewType: Int
|
var agendaViewType: Int
|
||||||
get() { mAgendaViewType = mAgendaViewType ?: config.values.get("agendaViewType", 0); return mAgendaViewType ?: 0 }
|
get() { mAgendaViewType = mAgendaViewType ?: config.values.get("agendaViewType", 0); return mAgendaViewType ?: 0 }
|
||||||
|
@ -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;
|
return items;
|
||||||
}
|
}
|
||||||
@ -1019,9 +1034,9 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
|||||||
.size(IconicsSize.dp(iconSizeDp))
|
.size(IconicsSize.dp(iconSizeDp))
|
||||||
.color(IconicsColor.colorInt(iconColor))
|
.color(IconicsColor.colorInt(iconColor))
|
||||||
)
|
)
|
||||||
.setChecked(!app.config.getFor(app.profileId).getGrades().getCountZeroToAvg())
|
.setChecked(!app.config.getFor(App.profileId).getGrades().getCountZeroToAvg())
|
||||||
.setOnChangeAction((isChecked, tag) -> {
|
.setOnChangeAction((isChecked, tag) -> {
|
||||||
app.config.getFor(app.profileId).getGrades().setCountZeroToAvg(!isChecked);
|
app.config.getFor(App.profileId).getGrades().setCountZeroToAvg(!isChecked);
|
||||||
app.saveConfig("dontCountZeroToAverage");
|
app.saveConfig("dontCountZeroToAverage");
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
|
@ -1059,4 +1059,6 @@
|
|||||||
<string name="grade_subject_format">z %s</string>
|
<string name="grade_subject_format">z %s</string>
|
||||||
<string name="concat_2_strings" translatable="false">%s%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_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>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user