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.Uri import android.os.Build import android.os.Bundle import android.os.Handler import android.util.Log import android.util.TypedValue import android.view.* import android.view.inputmethod.InputMethodManager import android.widget.Button 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 androidx.preference.PreferenceManager import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.color.DynamicColors class MainActivity : AppCompatActivity() { val TAG = "MainActivity" lateinit var bottomNavigationView: BottomNavigationView lateinit var toolbar: Toolbar lateinit var navController: NavController override fun onCreate(savedInstanceState: Bundle?) { DynamicColors.applyToActivityIfAvailable(this) super.onCreate(savedInstanceState) val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this) RetrofitInstance.url = sharedPreferences.getString("instance", "https://pipedapi.kavin.rocks/")!! SponsorBlockSettings.sponsorBlockEnabled = sharedPreferences.getBoolean("sponsorblock_enabled_key", false) SponsorBlockSettings.introEnabled = sharedPreferences.getBoolean("intro_category_key", false) SponsorBlockSettings.selfPromoEnabled = sharedPreferences.getBoolean("selfpromo_category_key", false) SponsorBlockSettings.interactionEnabled = sharedPreferences.getBoolean("interaction_category_key", false) SponsorBlockSettings.sponsorsEnabled = sharedPreferences.getBoolean("sponsors_category_key", false) SponsorBlockSettings.outroEnabled = sharedPreferences.getBoolean("outro_category_key", false) updateAccentColor(this) updateThemeMode(this) updateLanguage(this) val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val networkInfo = connectivityManager.activeNetworkInfo val isConnected = networkInfo != null && networkInfo.isConnected if (!isConnected) { setContentView(R.layout.activity_nointernet) findViewById