mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 13:50:30 +05:30
use objects instead of class
This commit is contained in:
parent
ecacd13ceb
commit
b477e1a202
@ -57,8 +57,8 @@ class MainActivity : AppCompatActivity() {
|
||||
RetrofitInstance.url =
|
||||
PreferenceHelper.getString(this, "selectInstance", "https://pipedapi.kavin.rocks/")!!
|
||||
|
||||
ThemeHelper().updateTheme(this)
|
||||
LocaleHelper().updateLanguage(this)
|
||||
ThemeHelper.updateTheme(this)
|
||||
LocaleHelper.updateLanguage(this)
|
||||
|
||||
// show noInternet Activity if no internet available on app startup
|
||||
if (!isNetworkAvailable(this)) {
|
||||
|
@ -21,7 +21,7 @@ class RouterActivity : AppCompatActivity() {
|
||||
handleSendText(uri!!)
|
||||
} else {
|
||||
// start app as normal if URI not in host list
|
||||
ThemeHelper().restartMainActivity(this)
|
||||
ThemeHelper.restartMainActivity(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ class SettingsActivity : AppCompatActivity() {
|
||||
val TAG = "SettingsActivity"
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
DynamicColors.applyToActivityIfAvailable(this)
|
||||
ThemeHelper().updateTheme(this)
|
||||
ThemeHelper.updateTheme(this)
|
||||
// makes the preference dialogs use material dialogs
|
||||
setTheme(R.style.MaterialAlertDialog)
|
||||
|
||||
@ -54,7 +54,7 @@ class SettingsActivity : AppCompatActivity() {
|
||||
val nManager =
|
||||
this.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
nManager.cancelAll()
|
||||
ThemeHelper().restartMainActivity(this)
|
||||
ThemeHelper.restartMainActivity(this)
|
||||
ActivityCompat.finishAffinity(this)
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
|
@ -21,7 +21,7 @@ class AppearanceSettings : PreferenceFragmentCompat() {
|
||||
val themeToggle = findPreference<ListPreference>("theme_togglee")
|
||||
themeToggle?.setOnPreferenceChangeListener { _, _ ->
|
||||
requireMainActivityRestart = true
|
||||
ThemeHelper().restartMainActivity(requireContext())
|
||||
ThemeHelper.restartMainActivity(requireContext())
|
||||
true
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ class AppearanceSettings : PreferenceFragmentCompat() {
|
||||
|
||||
val iconChange = findPreference<ListPreference>("icon_change")
|
||||
iconChange?.setOnPreferenceChangeListener { _, newValue ->
|
||||
ThemeHelper().changeIcon(requireContext(), newValue.toString())
|
||||
ThemeHelper.changeIcon(requireContext(), newValue.toString())
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class MainSettings : PreferenceFragmentCompat() {
|
||||
|
||||
val language = findPreference<ListPreference>("language")
|
||||
language?.setOnPreferenceChangeListener { _, _ ->
|
||||
ThemeHelper().restartMainActivity(requireContext())
|
||||
ThemeHelper.restartMainActivity(requireContext())
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import android.content.Context
|
||||
import android.os.Build
|
||||
import java.util.*
|
||||
|
||||
class LocaleHelper {
|
||||
object LocaleHelper {
|
||||
|
||||
fun updateLanguage(context: Context) {
|
||||
val languageName = PreferenceHelper.getString(context, "language", "en")
|
||||
|
@ -9,7 +9,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import com.github.libretube.R
|
||||
|
||||
class ThemeHelper {
|
||||
object ThemeHelper {
|
||||
|
||||
fun updateTheme(context: Context) {
|
||||
updateAccentColor(context)
|
||||
|
Loading…
Reference in New Issue
Block a user