extend activity

This commit is contained in:
Bnyro 2022-08-08 11:43:54 +02:00
parent 57b3053b58
commit 5f498e2e39
7 changed files with 22 additions and 29 deletions

View File

@ -5,7 +5,6 @@ import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.text.Html
import androidx.appcompat.app.AppCompatActivity
import com.github.libretube.DONATE_URL
import com.github.libretube.GITHUB_URL
import com.github.libretube.PIPED_GITHUB_URL
@ -13,10 +12,11 @@ import com.github.libretube.R
import com.github.libretube.WEBLATE_URL
import com.github.libretube.WEBSITE_URL
import com.github.libretube.databinding.ActivityAboutBinding
import com.github.libretube.extensions.BaseActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
class AboutActivity : AppCompatActivity() {
class AboutActivity : BaseActivity() {
private lateinit var binding: ActivityAboutBinding
override fun onCreate(savedInstanceState: Bundle?) {

View File

@ -3,15 +3,15 @@ package com.github.libretube.activities
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.libretube.DISCORD_URL
import com.github.libretube.MATRIX_URL
import com.github.libretube.REDDIT_URL
import com.github.libretube.TELEGRAM_URL
import com.github.libretube.TWITTER_URL
import com.github.libretube.databinding.ActivityCommunityBinding
import com.github.libretube.extensions.BaseActivity
class CommunityActivity : AppCompatActivity() {
class CommunityActivity : BaseActivity() {
private lateinit var binding: ActivityCommunityBinding
override fun onCreate(savedInstanceState: Bundle?) {

View File

@ -16,7 +16,6 @@ import android.view.WindowInsets
import android.view.WindowInsetsController
import android.view.WindowManager
import android.widget.LinearLayout
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SearchView
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.constraintlayout.widget.ConstraintLayout
@ -30,6 +29,7 @@ import com.github.libretube.Globals
import com.github.libretube.R
import com.github.libretube.databinding.ActivityMainBinding
import com.github.libretube.dialogs.ErrorDialog
import com.github.libretube.extensions.BaseActivity
import com.github.libretube.fragments.PlayerFragment
import com.github.libretube.models.SearchViewModel
import com.github.libretube.preferences.PreferenceHelper
@ -42,7 +42,7 @@ import com.github.libretube.util.ThemeHelper
import com.google.android.material.elevation.SurfaceColors
import com.google.android.material.navigation.NavigationBarView
class MainActivity : AppCompatActivity() {
class MainActivity : BaseActivity() {
val TAG = "MainActivity"
lateinit var binding: ActivityMainBinding
@ -54,9 +54,6 @@ class MainActivity : AppCompatActivity() {
lateinit var searchView: SearchView
override fun onCreate(savedInstanceState: Bundle?) {
// set the app theme (e.g. Material You)
ThemeHelper.updateTheme(this)
// set the language
LocaleHelper.updateLanguage(this)

View File

@ -2,18 +2,17 @@ package com.github.libretube.activities
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.libretube.R
import com.github.libretube.databinding.ActivityNointernetBinding
import com.github.libretube.extensions.BaseActivity
import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.ThemeHelper
import com.google.android.material.snackbar.Snackbar
class NoInternetActivity : AppCompatActivity() {
class NoInternetActivity : BaseActivity() {
private lateinit var binding: ActivityNointernetBinding
override fun onCreate(savedInstanceState: Bundle?) {
ThemeHelper.updateTheme(this)
super.onCreate(savedInstanceState)
binding = ActivityNointernetBinding.inflate(layoutInflater)

View File

@ -5,11 +5,11 @@ import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.github.libretube.R
import com.github.libretube.extensions.BaseActivity
import com.github.libretube.util.ThemeHelper
class RouterActivity : AppCompatActivity() {
class RouterActivity : BaseActivity() {
val TAG = "RouterActivity"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

View File

@ -1,31 +1,20 @@
package com.github.libretube.activities
import android.os.Build
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.libretube.R
import com.github.libretube.databinding.ActivitySettingsBinding
import com.github.libretube.extensions.BaseActivity
import com.github.libretube.preferences.MainSettings
import com.github.libretube.util.ThemeHelper
class SettingsActivity : AppCompatActivity() {
class SettingsActivity : BaseActivity() {
val TAG = "SettingsActivity"
lateinit var binding: ActivitySettingsBinding
override fun onCreate(savedInstanceState: Bundle?) {
ThemeHelper.updateTheme(this)
super.onCreate(savedInstanceState)
binding = ActivitySettingsBinding.inflate(layoutInflater)
// animate the layout transition
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
overridePendingTransition(50, 50)
}
binding.root.alpha = 0F
binding.root.animate().alpha(1F).duration = 300
setContentView(binding.root)
binding.backImageButton.setOnClickListener {

View File

@ -1,6 +1,14 @@
package com.github.libretube.extensions
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.github.libretube.util.ThemeHelper
class BaseActivity: AppCompatActivity() {
}
open class BaseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
// set the app theme (e.g. Material You)
ThemeHelper.updateTheme(this)
super.onCreate(savedInstanceState)
}
}