forked from github/szkolny
[UI] 'Cause it's winter.
This commit is contained in:
parent
92e0fc2847
commit
41cebc554f
@ -185,6 +185,8 @@ dependencies {
|
||||
|
||||
implementation "com.squareup.retrofit2:retrofit:${versions.retrofit}"
|
||||
implementation "com.squareup.retrofit2:converter-gson:${versions.retrofit}"
|
||||
|
||||
implementation 'com.github.jetradarmobile:android-snowfall:1.2.0'
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -73,6 +73,7 @@ import pl.szczodrzynski.edziennik.utils.Utils
|
||||
import pl.szczodrzynski.edziennik.utils.Utils.d
|
||||
import pl.szczodrzynski.edziennik.utils.Utils.dpToPx
|
||||
import pl.szczodrzynski.edziennik.utils.appManagerIntentList
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||
import pl.szczodrzynski.edziennik.utils.models.NavTarget
|
||||
import pl.szczodrzynski.navlib.*
|
||||
import pl.szczodrzynski.navlib.SystemBarsUtil.Companion.COLOR_HALF_TRANSPARENT
|
||||
@ -414,6 +415,12 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
// IT'S WINTER MY DUDES
|
||||
val today = Date.getToday()
|
||||
if ((today.month == 12 || today.month == 1) && app.config.ui.snowfall) {
|
||||
b.rootFrame.addView(layoutInflater.inflate(R.layout.snowfall, b.rootFrame, false))
|
||||
}
|
||||
|
||||
// WHAT'S NEW DIALOG
|
||||
if (app.config.appVersion < BuildConfig.VERSION_CODE) {
|
||||
ServerRequest(app, app.requestScheme + APP_URL + "main.php?just_updated", "MainActivity/JU")
|
||||
|
@ -54,4 +54,9 @@ 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 }
|
||||
|
||||
private var mSnowfall: Boolean? = null
|
||||
var snowfall: Boolean
|
||||
get() { mSnowfall = mSnowfall ?: config.values.get("snowfall", false); return mSnowfall ?: false }
|
||||
set(value) { config.set("snowfall", value); mSnowfall = value }
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment;
|
||||
import pl.szczodrzynski.edziennik.ui.modules.webpush.WebPushConfigActivity;
|
||||
import pl.szczodrzynski.edziennik.utils.Themes;
|
||||
import pl.szczodrzynski.edziennik.utils.Utils;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
@ -283,6 +284,26 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
||||
ArrayList<MaterialAboutItem> items = new ArrayList<>();
|
||||
if (!expandedOnly) {
|
||||
|
||||
Date today = Date.getToday();
|
||||
if (today.month == 12 || today.month == 1) {
|
||||
items.add(
|
||||
new MaterialAboutSwitchItem(
|
||||
getString(R.string.settings_theme_snowfall_text),
|
||||
getString(R.string.settings_theme_snowfall_subtext),
|
||||
new IconicsDrawable(activity)
|
||||
.icon(CommunityMaterial.Icon2.cmd_snowflake)
|
||||
.size(IconicsSize.dp(iconSizeDp))
|
||||
.color(IconicsColor.colorInt(iconColor))
|
||||
)
|
||||
.setChecked(app.config.getUi().getSnowfall())
|
||||
.setOnChangeAction((isChecked, tag) -> {
|
||||
app.config.getUi().setSnowfall(isChecked);
|
||||
activity.recreate();
|
||||
return true;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
items.add(
|
||||
new MaterialAboutActionItem(
|
||||
getString(R.string.settings_theme_theme_text),
|
||||
|
@ -1,31 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".MainActivity"
|
||||
tools:theme="@style/AppTheme.Black">
|
||||
|
||||
<pl.szczodrzynski.navlib.NavView
|
||||
android:id="@+id/navView"
|
||||
<FrameLayout
|
||||
android:id="@+id/rootFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoTouch
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
<pl.szczodrzynski.navlib.NavView
|
||||
android:id="@+id/navView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment"
|
||||
<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoTouch
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include layout="@layout/fragment_loading" />
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoTouch>
|
||||
<include layout="@layout/fragment_loading" />
|
||||
</FrameLayout>
|
||||
|
||||
</pl.szczodrzynski.navlib.NavView>
|
||||
</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoTouch>
|
||||
|
||||
</pl.szczodrzynski.navlib.NavView>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</layout>
|
8
app/src/main/res/layout/snowfall.xml
Normal file
8
app/src/main/res/layout/snowfall.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) Kuba Szczodrzyński 2019-12-15.
|
||||
-->
|
||||
|
||||
<com.jetradarmobile.snowfall.SnowfallView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
@ -1067,4 +1067,10 @@
|
||||
<string name="login_error_incorrect_code_or_pin">Nieprawidłowy kod lub PIN</string>
|
||||
<string name="login_error_incorrect_code">Nieprawidłowy kod</string>
|
||||
<string name="login_error_no_code">Podaj kod</string>
|
||||
<string name="event_list_added_by_format">Dodano %1$s przez %2$s%3$s</string>
|
||||
<string name="event_list_added_by_unknown_format">Dodano %1$s%3$s</string>
|
||||
<string name="event_list_shared_by_format">Udostępniono %1$s przez %2$s%3$s</string>
|
||||
<string name="event_list_shared_by_self_format">Udostępniono %1$s przez Ciebie%3$s</string>
|
||||
<string name="settings_theme_snowfall_text">Pada śnieg, pada śnieg</string>
|
||||
<string name="settings_theme_snowfall_subtext">Dzwonią dzwonki sań</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user