diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index afbca28b91..f1cd7a7415 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -31,11 +31,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: 'Vanced-Manager' - path: app/build/outputs/apk/debug/app-debug.apk - - - name: Upload to Discord - uses: sinshutu/upload-to-discord@master - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - with: - args: app/build/outputs/apk/debug/app-debug.apk \ No newline at end of file + path: app/build/outputs/apk/debug/app-debug.apk \ No newline at end of file diff --git a/README.md b/README.md index ef1f2b99b2..31780008ae 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Pull requests should be made to the Dev branch as that is the working branch, master is for release code. ====== -For anyone who wants to provide translations please submit them to https://translate.vanced.app as we also use it for YouTube Vanced. Any issues with translations should be posted there too. +For anyone who wants to provide translations please submit them to https://translatemanager.vanced.app as we also use it for YouTube Vanced. Any issues with translations should be posted there too. ====== [![Github All Releases](https://img.shields.io/github/downloads/YTVanced/VancedManager/total.svg)]() [![Github All Releases](https://img.shields.io/github/release/YTVanced/VancedManager.svg)]() # Vanced Manager diff --git a/app/build.gradle b/app/build.gradle index 3fa8800ec8..0e520aa457 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId "com.vanced.manager" minSdkVersion 21 targetSdkVersion 29 - versionCode 10 - versionName "1.0.2" + versionCode 11 + versionName "1.1.0 (Big Sur)" vectorDrawables.useSupportLibrary = true } diff --git a/app/src/main/java/com/vanced/manager/core/App.kt b/app/src/main/java/com/vanced/manager/core/App.kt index 0cf5930682..11a5a88a51 100644 --- a/app/src/main/java/com/vanced/manager/core/App.kt +++ b/app/src/main/java/com/vanced/manager/core/App.kt @@ -1,34 +1,15 @@ package com.vanced.manager.core import android.app.Application -import android.widget.Toast -import androidx.preference.PreferenceManager -import com.dezlum.codelabs.getjson.GetJson import com.downloader.PRDownloader -import com.vanced.manager.R -import com.vanced.manager.utils.InternetTools import com.vanced.manager.utils.NotificationHelper.createNotifChannel class App: Application() { override fun onCreate() { super.onCreate() - //checkUpdates() - PRDownloader.initialize(applicationContext) + PRDownloader.initialize(this) createNotifChannel(this) } - /* - private fun checkUpdates() { - val checkPrefs = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("auto_check_update", true) - if (checkPrefs) { - if (GetJson().isConnected(this) && InternetTools.isUpdateAvailable()) { - Toast.makeText(this, getString(R.string.update_found), Toast.LENGTH_SHORT).show() - } else - Toast.makeText(this, getString(R.string.update_notfound), Toast.LENGTH_SHORT).show() - } - } - - */ - } \ No newline at end of file diff --git a/app/src/main/java/com/vanced/manager/core/Main.kt b/app/src/main/java/com/vanced/manager/core/Main.kt index 52450f21f1..ebb7a73116 100644 --- a/app/src/main/java/com/vanced/manager/core/Main.kt +++ b/app/src/main/java/com/vanced/manager/core/Main.kt @@ -55,8 +55,6 @@ open class Main: AppCompatActivity() { if (GetJson().isConnected(this) && isUpdateAvailable()) { val fm = supportFragmentManager UpdateCheckFragment().show(fm, "UpdateCheck") - } else { - Toast.makeText(this, getString(R.string.update_notfound), Toast.LENGTH_SHORT).show() } } diff --git a/app/src/main/java/com/vanced/manager/ui/MainActivity.kt b/app/src/main/java/com/vanced/manager/ui/MainActivity.kt index cd3c0ec173..4ddf242325 100644 --- a/app/src/main/java/com/vanced/manager/ui/MainActivity.kt +++ b/app/src/main/java/com/vanced/manager/ui/MainActivity.kt @@ -13,7 +13,6 @@ import androidx.navigation.NavDestination import androidx.navigation.findNavController import androidx.navigation.ui.AppBarConfiguration import androidx.navigation.ui.setupWithNavController -import com.google.android.material.appbar.MaterialToolbar import com.vanced.manager.R import com.vanced.manager.core.Main import com.vanced.manager.databinding.ActivityMainBinding @@ -24,36 +23,9 @@ import com.vanced.manager.utils.ThemeHelper.setFinalTheme class MainActivity : Main() { - private var isParent = true private lateinit var binding: ActivityMainBinding - - override fun onCreate(savedInstanceState: Bundle?) { - setFinalTheme(this) - super.onCreate(savedInstanceState) - - binding = DataBindingUtil.setContentView(this, R.layout.activity_main) - binding.lifecycleOwner = this - - val toolbar: MaterialToolbar = findViewById(R.id.home_toolbar) - setSupportActionBar(toolbar) - - val navHost = findNavController(R.id.bottom_nav_host) - val appBarConfiguration = AppBarConfiguration(navHost.graph) - toolbar.setupWithNavController(navHost, appBarConfiguration) - - navHost.addOnDestinationChangedListener{_, currFrag: NavDestination, _ -> - isParent = when (currFrag.id) { - R.id.home_fragment -> true - else -> false - } - - setDisplayHomeAsUpEnabled(!isParent) - - } - - registerReceivers() - - } + private val navHost by lazy { findNavController(R.id.bottom_nav_host) } + private val localBroadcastManager by lazy { LocalBroadcastManager.getInstance(this) } private val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { @@ -74,9 +46,26 @@ class MainActivity : Main() { } } + override fun onCreate(savedInstanceState: Bundle?) { + setFinalTheme(this) + super.onCreate(savedInstanceState) + binding = DataBindingUtil.setContentView(this, R.layout.activity_main) + + with(binding) { + lifecycleOwner = this@MainActivity + setSupportActionBar(homeToolbar) + val appBarConfiguration = AppBarConfiguration(navHost.graph) + homeToolbar.setupWithNavController(navHost, appBarConfiguration) + } + + navHost.addOnDestinationChangedListener { _, currFrag: NavDestination, _ -> + setDisplayHomeAsUpEnabled(currFrag.id != R.id.home_fragment) + } + } + override fun onPause() { super.onPause() - LocalBroadcastManager.getInstance(this).unregisterReceiver(broadcastReceiver) + localBroadcastManager.unregisterReceiver(broadcastReceiver) } override fun onResume() { @@ -100,7 +89,7 @@ class MainActivity : Main() { navHost.navigate(R.id.action_settingsFragment) return true } - R.id.dev_settings -> { + R.id.dev_settings -> { navHost.navigate(R.id.toDevSettingsFragment) return true } @@ -110,11 +99,8 @@ class MainActivity : Main() { } private fun setDisplayHomeAsUpEnabled(isNeeded: Boolean) { - val toolbar: MaterialToolbar = findViewById(R.id.home_toolbar) - when { - isNeeded -> toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp) - else -> toolbar.navigationIcon = null - } + binding.homeToolbar.navigationIcon = if (isNeeded) getDrawable(R.drawable.ic_keyboard_backspace_black_24dp) else null + } private fun registerReceivers() { @@ -123,7 +109,7 @@ class MainActivity : Main() { intentFilter.addAction(INSTALL_FAILED) intentFilter.addAction(APP_UNINSTALLED) intentFilter.addAction(APP_NOT_UNINSTALLED) - LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, intentFilter) + localBroadcastManager.registerReceiver(broadcastReceiver, intentFilter) } @@ -134,9 +120,9 @@ class MainActivity : Main() { } companion object { - const val INSTALL_COMPLETED = "Installation completed" - const val INSTALL_FAILED = "it just failed idk" - const val APP_UNINSTALLED = "App uninstalled" - const val APP_NOT_UNINSTALLED = "App not uninstalled" + const val INSTALL_COMPLETED = "install_completed" + const val INSTALL_FAILED = "install_failed" + const val APP_UNINSTALLED = "app_uninstalled" + const val APP_NOT_UNINSTALLED = "app_not_installed" } } diff --git a/app/src/main/java/com/vanced/manager/ui/fragments/AboutFragment.kt b/app/src/main/java/com/vanced/manager/ui/fragments/AboutFragment.kt index 7e67c2ab4d..f6ad5f3517 100644 --- a/app/src/main/java/com/vanced/manager/ui/fragments/AboutFragment.kt +++ b/app/src/main/java/com/vanced/manager/ui/fragments/AboutFragment.kt @@ -19,7 +19,7 @@ class AboutFragment : About() { inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - activity?.title = getString(R.string.title_about) + requireActivity().title = getString(R.string.title_about) binding = DataBindingUtil.inflate(inflater, R.layout.fragment_about, container, false) return binding.root } diff --git a/app/src/main/java/com/vanced/manager/ui/fragments/ChosenPreferenceDialogFragment.kt b/app/src/main/java/com/vanced/manager/ui/fragments/ChosenPreferenceDialogFragment.kt index 6e4635656e..e105f45ee3 100644 --- a/app/src/main/java/com/vanced/manager/ui/fragments/ChosenPreferenceDialogFragment.kt +++ b/app/src/main/java/com/vanced/manager/ui/fragments/ChosenPreferenceDialogFragment.kt @@ -7,50 +7,41 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.Button -import android.widget.TextView +import androidx.core.content.edit +import androidx.databinding.DataBindingUtil import androidx.fragment.app.DialogFragment - import com.vanced.manager.R +import com.vanced.manager.databinding.FragmentChosenPreferencesBinding class ChosenPreferenceDialogFragment : DialogFragment() { + private lateinit var binding: FragmentChosenPreferencesBinding + override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? ): View? { - if (dialog != null && dialog?.window != null) { - dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) - } - return inflater.inflate(R.layout.fragment_chosen_preferences, container, false) + dialog?.window?.apply { setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) } + binding = DataBindingUtil.inflate(inflater, R.layout.fragment_chosen_preferences, container, false) + return binding.root } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - val closebtn = view.findViewById