diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsActivity.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsActivity.kt
index 676a5d58..cc498495 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsActivity.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/settings/contributors/ContributorsActivity.kt
@@ -1,23 +1,24 @@
package pl.szczodrzynski.edziennik.ui.modules.settings.contributors
import android.os.Bundle
+import android.os.Process
+import android.view.KeyEvent
import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.isInvisible
import androidx.core.view.isVisible
-import androidx.viewpager.widget.ViewPager
-import com.google.android.material.tabs.TabLayout
+import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
-import pl.szczodrzynski.edziennik.App
-import pl.szczodrzynski.edziennik.Bundle
-import pl.szczodrzynski.edziennik.R
+import pl.szczodrzynski.edziennik.*
import pl.szczodrzynski.edziennik.data.api.szkolny.SzkolnyApi
import pl.szczodrzynski.edziennik.data.api.szkolny.response.ContributorsResponse
import pl.szczodrzynski.edziennik.databinding.ContributorsActivityBinding
import pl.szczodrzynski.edziennik.ui.modules.base.lazypager.FragmentLazyPagerAdapter
import pl.szczodrzynski.edziennik.ui.modules.error.ErrorSnackbar
import kotlin.coroutines.CoroutineContext
+import kotlin.system.exitProcess
class ContributorsActivity : AppCompatActivity(), CoroutineScope {
companion object {
@@ -35,6 +36,28 @@ class ContributorsActivity : AppCompatActivity(), CoroutineScope {
// local/private variables go here
private val errorSnackbar: ErrorSnackbar by lazy { ErrorSnackbar(this) }
+ private var konami = 0
+
+ override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean {
+ when (keyCode) {
+ KeyEvent.KEYCODE_DPAD_UP -> konami in 0..1
+ KeyEvent.KEYCODE_DPAD_DOWN -> konami in 2..3
+ KeyEvent.KEYCODE_DPAD_LEFT -> konami in 4..6 step 2
+ KeyEvent.KEYCODE_DPAD_RIGHT -> konami in 5..7 step 2
+ KeyEvent.KEYCODE_B -> konami == 8
+ KeyEvent.KEYCODE_A -> konami == 9
+ else -> false
+ }.let {
+ if (!it) {
+ konami = 0
+ return super.onKeyUp(keyCode, event)
+ }
+ konami++
+ b.konami.isVisible = konami == 10
+ return true
+ }
+ }
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
app = application as App
@@ -45,6 +68,40 @@ class ContributorsActivity : AppCompatActivity(), CoroutineScope {
b.tabLayout.isVisible = false
b.viewPager.isVisible = false
+ b.szkolny.onLongClick {
+ if (b.konami.isVisible) {
+ b.glove.isVisible = true
+ b.szkolny.isInvisible = true
+ }
+ true
+ }
+
+ b.glove.onClick {
+ MaterialAlertDialogBuilder(this)
+ .setTitle(R.string.are_you_sure)
+ .setMessage(R.string.dev_mode_enable_warning)
+ .setPositiveButton(R.string.yes) { _, _ ->
+ app.config.devMode = true
+ App.devMode = true
+ MaterialAlertDialogBuilder(this)
+ .setTitle("Restart")
+ .setMessage("Wymagany restart aplikacji")
+ .setPositiveButton(R.string.ok) { _, _ ->
+ Process.killProcess(Process.myPid())
+ Runtime.getRuntime().exit(0)
+ exitProcess(0)
+ }
+ .setCancelable(false)
+ .show()
+ }
+ .setNegativeButton(R.string.no) { _, _ ->
+ app.config.devMode = false
+ App.devMode = false
+ this.finish()
+ }
+ .show()
+ }
+
launch {
contributors = contributors ?: SzkolnyApi(app).runCatching(errorSnackbar) {
getContributors()
diff --git a/app/src/main/res/drawable/thanos_idle.png b/app/src/main/res/drawable/thanos_idle.png
new file mode 100644
index 00000000..b94feb35
Binary files /dev/null and b/app/src/main/res/drawable/thanos_idle.png differ
diff --git a/app/src/main/res/layout/contributors_activity.xml b/app/src/main/res/layout/contributors_activity.xml
index b05e9c37..a9d8a452 100644
--- a/app/src/main/res/layout/contributors_activity.xml
+++ b/app/src/main/res/layout/contributors_activity.xml
@@ -20,6 +20,14 @@
android:layout_height="match_parent"
android:fitsSystemWindows="true">
+
+
-
+ android:layout_gravity="center"
+ android:layout_marginTop="16dp">
+
+
+
+
+