forked from github/szkolny
[UI] Show class name and school year in subname. Fix setting language.
This commit is contained in:
parent
97e0f36f09
commit
26f8c03570
@ -167,6 +167,10 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
||||
db.profileDao().firstId?.let { profileLoadById(it) }
|
||||
}
|
||||
|
||||
config.ui.language?.let {
|
||||
setLanguage(it)
|
||||
}
|
||||
|
||||
devMode = BuildConfig.DEBUG
|
||||
|
||||
Signing.getCert(this)
|
||||
|
@ -454,7 +454,7 @@ operator fun MatchResult.get(group: Int): String {
|
||||
return groupValues[group]
|
||||
}
|
||||
|
||||
fun Activity.setLanguage(language: String) {
|
||||
fun Context.setLanguage(language: String) {
|
||||
val locale = Locale(language.toLowerCase(Locale.ROOT))
|
||||
val configuration = resources.configuration
|
||||
Locale.setDefault(locale)
|
||||
@ -463,7 +463,6 @@ fun Activity.setLanguage(language: String) {
|
||||
}
|
||||
configuration.locale = locale
|
||||
resources.updateConfiguration(configuration, resources.displayMetrics)
|
||||
baseContext.resources.updateConfiguration(configuration, baseContext.resources.displayMetrics)
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -197,6 +197,13 @@ abstract class Data(val app: App, val profile: Profile?, val loginStore: LoginSt
|
||||
|
||||
profile.userCode = generateUserCode()
|
||||
|
||||
// update profile subname with class name, school year and account type
|
||||
profile.subname = joinNotNullStrings(
|
||||
" - ",
|
||||
profile.studentClassName,
|
||||
"${profile.studentSchoolYearStart}/${profile.studentSchoolYearStart + 1}"
|
||||
) + " " + app.getString(if (profile.isParent) R.string.login_summary_account_parent else R.string.login_summary_account_child)
|
||||
|
||||
db.profileDao().add(profile)
|
||||
db.loginStoreDao().add(loginStore)
|
||||
|
||||
|
@ -55,6 +55,7 @@ import pl.szczodrzynski.edziennik.ui.dialogs.changelog.ChangelogDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.settings.GradesConfigDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.settings.ProfileRemoveDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.dialogs.sync.NotificationFilterDialog;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity;
|
||||
import pl.szczodrzynski.edziennik.utils.Themes;
|
||||
import pl.szczodrzynski.edziennik.utils.Utils;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
@ -161,7 +162,7 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
||||
|
||||
profileCardTitleItem = new MaterialAboutProfileItem(
|
||||
app.getProfile().getName(),
|
||||
getString(R.string.settings_profile_subtitle_format, app.getProfile().getSubname()),
|
||||
app.getProfile().getSubname(),
|
||||
getProfileDrawable()
|
||||
);
|
||||
profileCardTitleItem.setOnClickAction(() -> {
|
||||
@ -218,6 +219,20 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
||||
})
|
||||
);*/
|
||||
|
||||
items.add(
|
||||
new MaterialAboutActionItem(
|
||||
getString(R.string.settings_add_student_text),
|
||||
getString(R.string.settings_add_student_subtext),
|
||||
new IconicsDrawable(activity)
|
||||
.icon(CommunityMaterial.Icon.cmd_account_plus_outline)
|
||||
.size(IconicsSize.dp(iconSizeDp))
|
||||
.color(IconicsColor.colorInt(iconColor))
|
||||
)
|
||||
.setOnClickAction(() -> {
|
||||
startActivity(new Intent(activity, LoginActivity.class));
|
||||
})
|
||||
);
|
||||
|
||||
items.add(
|
||||
new MaterialAboutActionItem(
|
||||
getString(R.string.settings_profile_notifications_text),
|
||||
@ -232,6 +247,20 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
||||
})
|
||||
);
|
||||
|
||||
items.add(
|
||||
new MaterialAboutActionItem(
|
||||
getString(R.string.settings_profile_remove_text),
|
||||
getString(R.string.settings_profile_remove_subtext),
|
||||
new IconicsDrawable(activity)
|
||||
.icon(SzkolnyFont.Icon.szf_delete_empty_outline)
|
||||
.size(IconicsSize.dp(iconSizeDp))
|
||||
.color(IconicsColor.colorInt(iconColor))
|
||||
)
|
||||
.setOnClickAction(() -> {
|
||||
new ProfileRemoveDialog(activity, app.getProfile().getId(), app.getProfile().getName());
|
||||
})
|
||||
);
|
||||
|
||||
items.add(getMoreItem(() -> addCardItems(CARD_PROFILE, getProfileCard(true))));
|
||||
}
|
||||
else {
|
||||
@ -253,20 +282,6 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
||||
}))
|
||||
);
|
||||
|
||||
items.add(
|
||||
new MaterialAboutActionItem(
|
||||
getString(R.string.settings_profile_remove_text),
|
||||
getString(R.string.settings_profile_remove_subtext),
|
||||
new IconicsDrawable(activity)
|
||||
.icon(SzkolnyFont.Icon.szf_delete_empty_outline)
|
||||
.size(IconicsSize.dp(iconSizeDp))
|
||||
.color(IconicsColor.colorInt(iconColor))
|
||||
)
|
||||
.setOnClickAction(() -> {
|
||||
new ProfileRemoveDialog(activity, app.getProfile().getId(), app.getProfile().getName());
|
||||
})
|
||||
);
|
||||
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
@ -1230,4 +1230,7 @@
|
||||
<string name="yesterday">yesterday</string>
|
||||
<string name="you_are_offline_text">You\'re offline. Try enabling Wi-Fi or mobile data.</string>
|
||||
<string name="you_are_offline_title">Internet connection</string>
|
||||
<string name="permissions_attachment">In order to download the file, you have to grant file storage permission for the application.\n\nClick OK to grant the permission.</string>
|
||||
<string name="permissions_denied">You denied the required permissions for the application.\n\nIn order to grant the permission, open the Permissions screen for Szkolny.eu in phone settings.\n\nClick OK to open app settings now.</string>
|
||||
<string name="permissions_required">Required permissions</string>
|
||||
</resources>
|
||||
|
@ -1286,4 +1286,6 @@
|
||||
<string name="yesterday">wczoraj</string>
|
||||
<string name="you_are_offline_text">Jesteś offline. Spróbuj włączyć Wi-Fi lub dane komórkowe.</string>
|
||||
<string name="you_are_offline_title">Połączenie sieciowe</string>
|
||||
<string name="settings_add_student_text">Dodaj nowego ucznia</string>
|
||||
<string name="settings_add_student_subtext">Zaloguj konto ucznia/rodzica w aplikacji</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user