package com.github.libretube import android.app.Activity import android.content.Context import android.content.Intent import android.content.pm.ActivityInfo import android.content.res.Configuration import android.net.ConnectivityManager import android.net.NetworkCapabilities import android.net.Uri import android.os.Build import android.os.Bundle import android.os.Handler import android.os.Looper import android.util.Log import android.util.TypedValue import android.view.View import android.view.WindowInsets import android.view.WindowInsetsController import android.view.WindowManager import android.view.inputmethod.InputMethodManager import android.widget.Button import android.widget.ImageView import android.widget.LinearLayout import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.Toolbar import androidx.constraintlayout.motion.widget.MotionLayout import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.os.bundleOf import androidx.core.text.HtmlCompat import androidx.fragment.app.Fragment import androidx.navigation.NavController import androidx.navigation.findNavController import androidx.navigation.ui.setupWithNavController import com.github.libretube.databinding.ActivityMainBinding import com.github.libretube.fragments.PlayerFragment import com.github.libretube.fragments.isFullScreen import com.github.libretube.services.ClosingService import com.github.libretube.util.CronetHelper import com.github.libretube.util.LocaleHelper import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.RetrofitInstance import com.github.libretube.util.ThemeHelper import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.color.DynamicColors class MainActivity : AppCompatActivity() { val TAG = "MainActivity" lateinit var binding: ActivityMainBinding private lateinit var bottomNavigationView: BottomNavigationView private lateinit var toolbar: Toolbar lateinit var navController: NavController override fun onCreate(savedInstanceState: Bundle?) { DynamicColors.applyToActivityIfAvailable(this) super.onCreate(savedInstanceState) // start service that gets called on closure startService(Intent(this, ClosingService::class.java)) CronetHelper.initCronet(this.applicationContext) RetrofitInstance.url = PreferenceHelper.getString(this, "selectInstance", "https://pipedapi.kavin.rocks/")!! ThemeHelper.updateTheme(this) LocaleHelper.updateLanguage(this) // show noInternet Activity if no internet available on app startup if (!isNetworkAvailable(this)) { setContentView(R.layout.activity_nointernet) findViewById