diff --git a/.idea/render.experimental.xml b/.idea/render.experimental.xml
deleted file mode 100644
index 8ec256a..0000000
--- a/.idea/render.experimental.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/java/pl/szczodrzynski/navigation/MainActivity.kt b/app/src/main/java/pl/szczodrzynski/navigation/MainActivity.kt
index f69e815..3d63b95 100644
--- a/app/src/main/java/pl/szczodrzynski/navigation/MainActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/navigation/MainActivity.kt
@@ -1,25 +1,62 @@
package pl.szczodrzynski.navigation
+import android.content.Context
+import android.content.SharedPreferences
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.MotionEvent
import android.view.View
+import android.widget.Switch
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.floatingactionbutton.FloatingActionButton
import android.widget.Toast
import androidx.core.widget.NestedScrollView
import com.google.android.material.bottomappbar.BottomAppBar
+import android.view.WindowManager
+import android.os.Build
+import kotlinx.android.synthetic.main.sample_nav_view.*
class MainActivity : AppCompatActivity() {
+ companion object {
+ var darkTheme: Boolean? = null
+ }
var showing = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
+
+ if (darkTheme == null)
+ darkTheme = getSharedPreferences("prefs", Context.MODE_PRIVATE).getBoolean("darkTheme", false)
+
+ Log.d("MainActivity", "Dark theme $darkTheme")
+ setTheme(if (darkTheme == true) R.style.AppTheme else R.style.AppTheme_Light)
+
setContentView(R.layout.sample_nav_view)
+ window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or (when {
+ darkTheme == true -> 0
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
+ else -> 0
+ })
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ val w = window // in Activity's onCreate() for instance
+ w.setFlags(
+ WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
+ WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
+ )
+ }
+
+ button.setOnClickListener {
+ // use commit instead of apply because of recreating the activity
+ darkTheme = (darkTheme == false)
+ getSharedPreferences("prefs", Context.MODE_PRIVATE).edit().putBoolean("darkTheme", darkTheme == true).commit()
+ recreate()
+ }
+
/*val dim = findViewById(R.id.view)
val nestedScrollView = findViewById(R.id.nestedScrollView)
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 50401e0..02092fd 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -6,15 +6,18 @@
- #64b5f6
- #1976d2
- #1976d2
- - #ba68c8
- - #ba68c8
- - #9c27b0
+ - #ff6e40
+ - #ff6e40
+ - #ff3d00
- @color/black
+ - ?android:colorBackground
- #1f1f1f
- - ?android:colorBackground
- - false
- - ?colorPrimaryDark
+ - @android:color/transparent
+ - false
+
+ - @android:color/transparent
+ - false
- #000000
- #000000
@@ -24,6 +27,8 @@
- ?colorSurface
- false
- true
+
+