forked from github/wulkanowy-mirror
Revert "Add "System theme" option to widgets" (#753)
This commit is contained in:
parent
c9b35bed7e
commit
bb30cf2ce3
@ -4,9 +4,6 @@ import android.appwidget.AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
|||||||
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID
|
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID
|
||||||
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_IDS
|
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_IDS
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.Configuration
|
|
||||||
import android.content.res.Configuration.UI_MODE_NIGHT_YES
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
@ -16,7 +13,6 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
|
|||||||
import io.github.wulkanowy.R
|
import io.github.wulkanowy.R
|
||||||
import io.github.wulkanowy.ui.base.BaseActivity
|
import io.github.wulkanowy.ui.base.BaseActivity
|
||||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||||
import io.github.wulkanowy.utils.AppInfo
|
|
||||||
import io.github.wulkanowy.utils.setOnItemClickListener
|
import io.github.wulkanowy.utils.setOnItemClickListener
|
||||||
import kotlinx.android.synthetic.main.activity_widget_configure.*
|
import kotlinx.android.synthetic.main.activity_widget_configure.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -30,9 +26,6 @@ class LuckyNumberWidgetConfigureActivity : BaseActivity<LuckyNumberWidgetConfigu
|
|||||||
@Inject
|
@Inject
|
||||||
override lateinit var presenter: LuckyNumberWidgetConfigurePresenter
|
override lateinit var presenter: LuckyNumberWidgetConfigurePresenter
|
||||||
|
|
||||||
@Inject
|
|
||||||
lateinit var appInfo: AppInfo
|
|
||||||
|
|
||||||
private var dialog: AlertDialog? = null
|
private var dialog: AlertDialog? = null
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@ -55,18 +48,16 @@ class LuckyNumberWidgetConfigureActivity : BaseActivity<LuckyNumberWidgetConfigu
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun showThemeDialog() {
|
override fun showThemeDialog() {
|
||||||
var items = arrayOf(
|
val items = arrayOf(
|
||||||
getString(R.string.widget_timetable_theme_light),
|
getString(R.string.widget_timetable_theme_light),
|
||||||
getString(R.string.widget_timetable_theme_dark)
|
getString(R.string.widget_timetable_theme_dark)
|
||||||
)
|
)
|
||||||
if (appInfo.versionCode >= Build.VERSION_CODES.Q) items+=(getString(R.string.widget_timetable_theme_system))
|
|
||||||
|
|
||||||
dialog = AlertDialog.Builder(this, R.style.WulkanowyTheme_WidgetAccountSwitcher)
|
dialog = AlertDialog.Builder(this, R.style.WulkanowyTheme_WidgetAccountSwitcher)
|
||||||
.setTitle(R.string.widget_timetable_theme_title)
|
.setTitle(R.string.widget_timetable_theme_title)
|
||||||
.setOnDismissListener { presenter.onDismissThemeView() }
|
.setOnDismissListener { presenter.onDismissThemeView() }
|
||||||
.setSingleChoiceItems(items, -1) { _, which ->
|
.setSingleChoiceItems(items, -1) { _, which ->
|
||||||
val isDarkMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == UI_MODE_NIGHT_YES
|
presenter.onThemeSelect(which)
|
||||||
presenter.onThemeSelect(if (isDarkMode && which == 2 || which == 1) 1 else 0)
|
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,6 @@ import android.appwidget.AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
|||||||
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID
|
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID
|
||||||
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_IDS
|
import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_IDS
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.Configuration
|
|
||||||
import android.content.res.Configuration.UI_MODE_NIGHT_YES
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import android.widget.Toast.LENGTH_LONG
|
import android.widget.Toast.LENGTH_LONG
|
||||||
@ -18,7 +15,6 @@ import io.github.wulkanowy.R
|
|||||||
import io.github.wulkanowy.ui.base.BaseActivity
|
import io.github.wulkanowy.ui.base.BaseActivity
|
||||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||||
import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetProvider.Companion.EXTRA_FROM_PROVIDER
|
import io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetProvider.Companion.EXTRA_FROM_PROVIDER
|
||||||
import io.github.wulkanowy.utils.AppInfo
|
|
||||||
import io.github.wulkanowy.utils.setOnItemClickListener
|
import io.github.wulkanowy.utils.setOnItemClickListener
|
||||||
import kotlinx.android.synthetic.main.activity_widget_configure.*
|
import kotlinx.android.synthetic.main.activity_widget_configure.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -32,9 +28,6 @@ class TimetableWidgetConfigureActivity : BaseActivity<TimetableWidgetConfigurePr
|
|||||||
@Inject
|
@Inject
|
||||||
override lateinit var presenter: TimetableWidgetConfigurePresenter
|
override lateinit var presenter: TimetableWidgetConfigurePresenter
|
||||||
|
|
||||||
@Inject
|
|
||||||
lateinit var appInfo: AppInfo
|
|
||||||
|
|
||||||
private var dialog: AlertDialog? = null
|
private var dialog: AlertDialog? = null
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@ -57,18 +50,16 @@ class TimetableWidgetConfigureActivity : BaseActivity<TimetableWidgetConfigurePr
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun showThemeDialog() {
|
override fun showThemeDialog() {
|
||||||
var items = arrayOf(
|
val items = arrayOf(
|
||||||
getString(R.string.widget_timetable_theme_light),
|
getString(R.string.widget_timetable_theme_light),
|
||||||
getString(R.string.widget_timetable_theme_dark)
|
getString(R.string.widget_timetable_theme_dark)
|
||||||
)
|
)
|
||||||
if (appInfo.versionCode >= Build.VERSION_CODES.Q) items += getString(R.string.widget_timetable_theme_system)
|
|
||||||
|
|
||||||
dialog = AlertDialog.Builder(this, R.style.WulkanowyTheme_WidgetAccountSwitcher)
|
dialog = AlertDialog.Builder(this, R.style.WulkanowyTheme_WidgetAccountSwitcher)
|
||||||
.setTitle(R.string.widget_timetable_theme_title)
|
.setTitle(R.string.widget_timetable_theme_title)
|
||||||
.setOnDismissListener { presenter.onDismissThemeView() }
|
.setOnDismissListener { presenter.onDismissThemeView() }
|
||||||
.setSingleChoiceItems(items, -1) { _, which ->
|
.setSingleChoiceItems(items, -1) { _, which ->
|
||||||
val isDarkMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == UI_MODE_NIGHT_YES
|
presenter.onThemeSelect(which)
|
||||||
presenter.onThemeSelect(if (isDarkMode && which == 2 || which == 1) 1 else 0)
|
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,6 @@
|
|||||||
<string name="widget_timetable_theme_title">Thema wählen</string>
|
<string name="widget_timetable_theme_title">Thema wählen</string>
|
||||||
<string name="widget_timetable_theme_light">Licht</string>
|
<string name="widget_timetable_theme_light">Licht</string>
|
||||||
<string name="widget_timetable_theme_dark">Dunkel</string>
|
<string name="widget_timetable_theme_dark">Dunkel</string>
|
||||||
<string name="widget_timetable_theme_system">Systemthema</string>
|
|
||||||
|
|
||||||
|
|
||||||
<!--Preferences-->
|
<!--Preferences-->
|
||||||
|
@ -351,7 +351,6 @@
|
|||||||
<string name="widget_timetable_theme_title">Wybierz motyw</string>
|
<string name="widget_timetable_theme_title">Wybierz motyw</string>
|
||||||
<string name="widget_timetable_theme_light">Jasny</string>
|
<string name="widget_timetable_theme_light">Jasny</string>
|
||||||
<string name="widget_timetable_theme_dark">Ciemny</string>
|
<string name="widget_timetable_theme_dark">Ciemny</string>
|
||||||
<string name="widget_timetable_theme_system">Motyw systemu</string>
|
|
||||||
|
|
||||||
|
|
||||||
<!--Preferences-->
|
<!--Preferences-->
|
||||||
|
@ -348,7 +348,6 @@
|
|||||||
<string name="widget_timetable_theme_title">Выбрать тему</string>
|
<string name="widget_timetable_theme_title">Выбрать тему</string>
|
||||||
<string name="widget_timetable_theme_light">Светлая</string>
|
<string name="widget_timetable_theme_light">Светлая</string>
|
||||||
<string name="widget_timetable_theme_dark">Тёмная</string>
|
<string name="widget_timetable_theme_dark">Тёмная</string>
|
||||||
<string name="widget_timetable_theme_system">Системная тема</string>
|
|
||||||
|
|
||||||
|
|
||||||
<!--Preferences-->
|
<!--Preferences-->
|
||||||
|
@ -349,7 +349,6 @@
|
|||||||
<string name="widget_timetable_theme_title">Вибрати тему</string>
|
<string name="widget_timetable_theme_title">Вибрати тему</string>
|
||||||
<string name="widget_timetable_theme_light">Світла</string>
|
<string name="widget_timetable_theme_light">Світла</string>
|
||||||
<string name="widget_timetable_theme_dark">Темна</string>
|
<string name="widget_timetable_theme_dark">Темна</string>
|
||||||
<string name="widget_timetable_theme_system">Тема системи</string>
|
|
||||||
|
|
||||||
|
|
||||||
<!--Preferences-->
|
<!--Preferences-->
|
||||||
|
@ -336,7 +336,6 @@
|
|||||||
<string name="widget_timetable_theme_title">Choose theme</string>
|
<string name="widget_timetable_theme_title">Choose theme</string>
|
||||||
<string name="widget_timetable_theme_light">Light</string>
|
<string name="widget_timetable_theme_light">Light</string>
|
||||||
<string name="widget_timetable_theme_dark">Dark</string>
|
<string name="widget_timetable_theme_dark">Dark</string>
|
||||||
<string name="widget_timetable_theme_system">System Theme</string>
|
|
||||||
|
|
||||||
|
|
||||||
<!--Preferences-->
|
<!--Preferences-->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user