mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-25 12:45:12 +00:00
sorted out core functions and placed them in core folder, fixed toolbar
This commit is contained in:
parent
f1f25fde03
commit
42d267018b
17 changed files with 273 additions and 263 deletions
|
@ -72,15 +72,15 @@
|
|||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/out" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/kaptKotlin/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/out" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/kapt/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/out" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/kapt/debugAndroidTest" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/kapt/debugAndroidTest" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/kapt/debugUnitTest" isTestSource="true" generated="true" />
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.vanced.manager.ui.core
|
||||
package com.vanced.manager.core.base
|
||||
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -14,4 +15,13 @@ open class BaseFragment : Fragment() {
|
|||
customTabsIntent.launchUrl(requireContext(), Uri.parse(Url))
|
||||
}
|
||||
|
||||
fun isPackageInstalled(packageName: String, packageManager: PackageManager): Boolean {
|
||||
return try {
|
||||
packageManager.getPackageInfo(packageName, 0)
|
||||
true
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
30
app/src/main/java/com/vanced/manager/core/fragments/About.kt
Normal file
30
app/src/main/java/com/vanced/manager/core/fragments/About.kt
Normal file
|
@ -0,0 +1,30 @@
|
|||
package com.vanced.manager.core.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.base.BaseFragment
|
||||
|
||||
open class About : BaseFragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val githubSource = getView()?.findViewById(R.id.about_github_button) as Button
|
||||
val license = getView()?.findViewById(R.id.about_license_button) as Button
|
||||
|
||||
githubSource.setOnClickListener {
|
||||
openUrl("https://github.com/YTvanced/VancedInstaller", R.color.GitHub)
|
||||
}
|
||||
|
||||
license.setOnClickListener {
|
||||
openUrl(
|
||||
"https://raw.githubusercontent.com/YTVanced/VancedInstaller/dev/LICENSE",
|
||||
R.color.GitHub
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
88
app/src/main/java/com/vanced/manager/core/fragments/Home.kt
Normal file
88
app/src/main/java/com/vanced/manager/core/fragments/Home.kt
Normal file
|
@ -0,0 +1,88 @@
|
|||
package com.vanced.manager.core.fragments
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import androidx.navigation.findNavController
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.base.BaseFragment
|
||||
|
||||
open class Home : BaseFragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val pm = activity?.packageManager
|
||||
|
||||
val microginstallbtn = getView()?.findViewById(R.id.microg_installbtn) as Button
|
||||
val microguninstallbtn = getView()?.findViewById(R.id.microg_uninstallbtn) as Button
|
||||
val microgsettingsbtn = getView()?.findViewById(R.id.microg_settingsbtn) as Button
|
||||
val vancedinstallbtn = getView()?.findViewById(R.id.vanced_installbtn) as Button
|
||||
|
||||
val bravebtn = getView()?.findViewById(R.id.brave_button) as Button
|
||||
val websitebtn = getView()?.findViewById(R.id.website_button) as Button
|
||||
val discordbtn = getView()?.findViewById(R.id.discordbtn) as Button
|
||||
val telegrambtn = getView()?.findViewById(R.id.tgbtn) as Button
|
||||
val twitterbtn = getView()?.findViewById(R.id.twitterbtn) as Button
|
||||
val redditbtn = getView()?.findViewById(R.id.redditbtn) as Button
|
||||
|
||||
val microgStatus = pm?.let { isPackageInstalled("com.mgoogle.android.gms", it) }
|
||||
val vancedStatus = pm?.let { isPackageInstalled("com.vanced.android.youtube", it) }
|
||||
|
||||
vancedinstallbtn.setOnClickListener {
|
||||
view.findNavController().navigate(R.id.toInstallThemeFragment)
|
||||
}
|
||||
|
||||
microginstallbtn.setOnClickListener {
|
||||
openUrl("https://youtu.be/dQw4w9WgXcQ", R.color.YT)
|
||||
}
|
||||
|
||||
if (microgStatus!!) {
|
||||
microguninstallbtn.setOnClickListener {
|
||||
val uri = Uri.parse("package:com.mgoogle.android.gms")
|
||||
val mgUninstall = Intent(Intent.ACTION_DELETE, uri)
|
||||
startActivity(mgUninstall)
|
||||
}
|
||||
|
||||
microgsettingsbtn.setOnClickListener {
|
||||
val intent = Intent()
|
||||
intent.component = ComponentName(
|
||||
"com.mgoogle.android.gms",
|
||||
"org.microg.gms.ui.SettingsActivity"
|
||||
)
|
||||
startActivity(intent)
|
||||
}
|
||||
} else {
|
||||
microgsettingsbtn.visibility = View.INVISIBLE
|
||||
microguninstallbtn.visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
bravebtn.setOnClickListener {
|
||||
openUrl("https://brave.com/van874", R.color.Brave)
|
||||
|
||||
}
|
||||
websitebtn.setOnClickListener {
|
||||
openUrl("https://vanced.app", R.color.Vanced)
|
||||
}
|
||||
discordbtn.setOnClickListener {
|
||||
openUrl("https://discord.gg/TUVd7rd", R.color.Discord)
|
||||
|
||||
}
|
||||
telegrambtn.setOnClickListener {
|
||||
openUrl("https://t.me/joinchat/AAAAAEHf-pi4jH1SDlAL4w", R.color.Telegram)
|
||||
|
||||
}
|
||||
twitterbtn.setOnClickListener {
|
||||
openUrl("https://twitter.com/YTVanced", R.color.Twitter)
|
||||
|
||||
}
|
||||
redditbtn.setOnClickListener {
|
||||
openUrl("https://reddit.com/r/vanced", R.color.Reddit)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.vanced.manager.core.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.findNavController
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.ui.fragments.LanguageScrollviewFragment
|
||||
|
||||
open class LanguageInstall : Fragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val fragmentManager = childFragmentManager
|
||||
|
||||
val finishButton = getView()?.findViewById(R.id.vanced_install_finish) as Button
|
||||
|
||||
finishButton.setOnClickListener {
|
||||
view.findNavController().navigate(R.id.action_installTo_homeFragment)
|
||||
}
|
||||
|
||||
fragmentManager
|
||||
.beginTransaction()
|
||||
.replace(R.id.language_choose_frame, LanguageScrollviewFragment())
|
||||
.commit()
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.vanced.manager.core.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.findNavController
|
||||
import com.vanced.manager.R
|
||||
|
||||
open class ThemeInstall : Fragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val nextButton = getView()?.findViewById(R.id.vanced_next_to_variant) as Button
|
||||
|
||||
nextButton.setOnClickListener {
|
||||
view.findNavController().navigate(R.id.toInstallVariantFragment)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.vanced.manager.core.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.findNavController
|
||||
import com.vanced.manager.R
|
||||
|
||||
open class VariantInstall : Fragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val nextButton = getView()?.findViewById(R.id.vanced_next_to_language) as Button
|
||||
|
||||
nextButton.setOnClickListener {
|
||||
view.findNavController().navigate(R.id.toInstallLanguageFragment)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ import android.view.View
|
|||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.view.forEach
|
||||
import androidx.navigation.NavDestination
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.ui.AppBarConfiguration
|
||||
|
@ -84,24 +83,28 @@ class MainActivity : ThemeActivity() {
|
|||
|
||||
setDisplayHomeAsUpEnabled(!isParent)
|
||||
|
||||
navBar.menu.forEach {
|
||||
if (it.itemId == currfrag.id) {
|
||||
it.isChecked = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
val navHost = findNavController(R.id.bottom_nav_host)
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
findNavController(R.id.bottom_nav_host).navigate(R.id.action_homeFragment)
|
||||
onBackPressed()
|
||||
return true
|
||||
}
|
||||
R.id.toolbar_about -> {
|
||||
navHost.navigate(R.id.toAboutFragment)
|
||||
return true
|
||||
}
|
||||
R.id.secret_settings -> {
|
||||
navHost.navigate(R.id.toSecretSettingsFragment)
|
||||
return true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
private fun setDisplayHomeAsUpEnabled(isNeeded: Boolean) {
|
||||
|
@ -115,8 +118,12 @@ class MainActivity : ThemeActivity() {
|
|||
private fun showSecurityDialog() {
|
||||
AlertDialog.Builder(this)
|
||||
.setTitle("Welcome!")
|
||||
.setMessage("Before we implement a proper security system to check whether app was modified or not, please be sure that you downloaded manager from vanced.app/github")
|
||||
.setPositiveButton("close"
|
||||
.setMessage(
|
||||
"Before we implement a proper security system to check whether the app was modified or not," +
|
||||
" please make sure that you downloaded it from vanced.app/github"
|
||||
)
|
||||
.setPositiveButton(
|
||||
"Close"
|
||||
) { dialog, _ -> dialog.dismiss() }
|
||||
.create().show()
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ open class ThemeActivity : AppCompatActivity() {
|
|||
setFinalTheme(currentTheme)
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
||||
setTaskBG(currentTheme)
|
||||
setTaskBG()
|
||||
}
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ open class ThemeActivity : AppCompatActivity() {
|
|||
if (currentTheme != theme)
|
||||
recreate()
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
||||
setTaskBG(currentTheme)
|
||||
setTaskBG()
|
||||
}
|
||||
}
|
||||
private fun setFinalTheme(currentTheme: String) {
|
||||
|
@ -50,35 +50,14 @@ open class ThemeActivity : AppCompatActivity() {
|
|||
else -> setTheme(R.style.LightTheme_Blue)
|
||||
}
|
||||
}
|
||||
private fun setTaskBG(currentTheme: String) {
|
||||
|
||||
private fun setTaskBG() {
|
||||
val label = getString(R.string.app_name)
|
||||
when (currentTheme) {
|
||||
"LIGHT" -> {
|
||||
val color = ResourcesCompat.getColor(resources, R.color.Black, null)
|
||||
val taskDec: ActivityManager.TaskDescription = ActivityManager.TaskDescription(label, null, color)
|
||||
val taskDec: ActivityManager.TaskDescription =
|
||||
ActivityManager.TaskDescription(label, null, color)
|
||||
setTaskDescription(taskDec)
|
||||
}
|
||||
"DARK" -> {
|
||||
val color = ResourcesCompat.getColor(resources, R.color.Black, null)
|
||||
val taskDec: ActivityManager.TaskDescription = ActivityManager.TaskDescription(label, null, color)
|
||||
setTaskDescription(taskDec)
|
||||
}
|
||||
"FOLLOW" -> {
|
||||
when (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
|
||||
Configuration.UI_MODE_NIGHT_YES -> {
|
||||
val color = ResourcesCompat.getColor(resources, R.color.Black, null)
|
||||
val taskDec: ActivityManager.TaskDescription = ActivityManager.TaskDescription(label, null, color)
|
||||
setTaskDescription(taskDec)
|
||||
}
|
||||
Configuration.UI_MODE_NIGHT_NO -> {
|
||||
val color = ResourcesCompat.getColor(resources, R.color.White, null)
|
||||
val taskDec: ActivityManager.TaskDescription = ActivityManager.TaskDescription(label, null, color)
|
||||
setTaskDescription(taskDec)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +1,24 @@
|
|||
package com.vanced.manager.ui.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.*
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.widget.TextView
|
||||
import androidx.navigation.fragment.findNavController
|
||||
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.ui.core.BaseFragment
|
||||
import com.vanced.manager.core.fragments.About
|
||||
|
||||
/**
|
||||
* A simple [Fragment] subclass.
|
||||
*/
|
||||
class AboutFragment : BaseFragment() {
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
activity?.title = getString(R.string.title_about)
|
||||
}
|
||||
class AboutFragment : About() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
activity?.title = getString(R.string.title_about)
|
||||
return inflater.inflate(R.layout.fragment_about, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val githubSource = getView()?.findViewById(R.id.about_github_button) as TextView
|
||||
val license = getView()?.findViewById(R.id.about_license_button) as TextView
|
||||
|
||||
githubSource.setOnClickListener{
|
||||
openUrl("https://github.com/YTvanced/VancedInstaller", R.color.GitHub)
|
||||
}
|
||||
|
||||
license.setOnClickListener{
|
||||
openUrl("https://raw.githubusercontent.com/YTVanced/VancedInstaller/dev/LICENSE", R.color.GitHub)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +1,23 @@
|
|||
package com.vanced.manager.ui.fragments
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.Network
|
||||
import android.net.NetworkCapabilities
|
||||
import android.net.NetworkRequest
|
||||
import android.os.Bundle
|
||||
import android.widget.Button
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.Intent
|
||||
import android.net.*
|
||||
import android.os.Build
|
||||
import android.view.*
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.google.android.material.card.MaterialCardView
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.vanced.manager.adapter.SectionPageAdapter
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.ui.core.BaseFragment
|
||||
import kotlinx.android.synthetic.main.fragment_home.*
|
||||
import kotlin.time.Duration
|
||||
import com.vanced.manager.adapter.SectionPageAdapter
|
||||
import com.vanced.manager.core.fragments.Home
|
||||
|
||||
class HomeFragment : BaseFragment() {
|
||||
class HomeFragment : Home() {
|
||||
|
||||
private lateinit var sectionPageAdapter: SectionPageAdapter
|
||||
private lateinit var viewPager: ViewPager2
|
||||
|
@ -56,75 +50,6 @@ class HomeFragment : BaseFragment() {
|
|||
}
|
||||
}.attach()
|
||||
|
||||
val pm = activity?.packageManager
|
||||
|
||||
val microginstallbtn = getView()?.findViewById(R.id.microg_installbtn) as Button
|
||||
val microguninstallbtn = getView()?.findViewById(R.id.microg_uninstallbtn) as Button
|
||||
val microgsettingsbtn = getView()?.findViewById(R.id.microg_settingsbtn) as Button
|
||||
val vancedinstallbtn = getView()?.findViewById(R.id.vanced_installbtn) as Button
|
||||
|
||||
val bravebtn = getView()?.findViewById(R.id.brave_button) as Button
|
||||
val websitebtn = getView()?.findViewById(R.id.website_button) as Button
|
||||
val discordbtn = getView()?.findViewById(R.id.discordbtn) as Button
|
||||
val telegrambtn = getView()?.findViewById(R.id.tgbtn) as Button
|
||||
val twitterbtn = getView()?.findViewById(R.id.twitterbtn) as Button
|
||||
val redditbtn = getView()?.findViewById(R.id.redditbtn) as Button
|
||||
|
||||
val microgStatus = pm?.let { isPackageInstalled("com.mgoogle.android.gms", it) }
|
||||
val vancedStatus = pm?.let { isPackageInstalled("com.vanced.android.youtube", it)}
|
||||
|
||||
vancedinstallbtn.setOnClickListener{
|
||||
view.findNavController().navigate(R.id.toInstallThemeFragment)
|
||||
}
|
||||
|
||||
microginstallbtn.setOnClickListener {
|
||||
openUrl("https://youtu.be/dQw4w9WgXcQ", R.color.YT)
|
||||
}
|
||||
|
||||
if (microgStatus!!) {
|
||||
microguninstallbtn.setOnClickListener {
|
||||
val uri = Uri.parse("package:com.mgoogle.android.gms")
|
||||
val mgUninstall = Intent(Intent.ACTION_DELETE, uri)
|
||||
startActivity(mgUninstall)
|
||||
}
|
||||
|
||||
microgsettingsbtn.setOnClickListener {
|
||||
val intent = Intent()
|
||||
intent.component = ComponentName(
|
||||
"com.mgoogle.android.gms",
|
||||
"org.microg.gms.ui.SettingsActivity"
|
||||
)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
else {
|
||||
microgsettingsbtn.visibility = View.INVISIBLE
|
||||
microguninstallbtn.visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
bravebtn.setOnClickListener {
|
||||
openUrl("https://brave.com/van874", R.color.Brave)
|
||||
|
||||
}
|
||||
websitebtn.setOnClickListener {
|
||||
openUrl("https://vanced.app", R.color.Vanced)
|
||||
}
|
||||
discordbtn.setOnClickListener {
|
||||
openUrl("https://discord.gg/TUVd7rd", R.color.Discord)
|
||||
|
||||
}
|
||||
telegrambtn.setOnClickListener {
|
||||
openUrl("https://t.me/joinchat/AAAAAEHf-pi4jH1SDIAL4w", R.color.Telegram)
|
||||
|
||||
}
|
||||
twitterbtn.setOnClickListener {
|
||||
openUrl("https://twitter.com/YTVanced", R.color.Twitter)
|
||||
|
||||
}
|
||||
redditbtn.setOnClickListener {
|
||||
openUrl("https://reddit.com/r/vanced", R.color.Reddit)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
|
@ -132,25 +57,7 @@ class HomeFragment : BaseFragment() {
|
|||
super .onCreateOptionsMenu(menu, inflater)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.toolbar_about -> {
|
||||
activity?.findNavController(R.id.bottom_nav_host)?.navigate(R.id.toAboutFragment)
|
||||
Toast.makeText(context, "You clicked on About menu", Toast.LENGTH_SHORT)
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private fun isPackageInstalled(packageName: String, packageManager: PackageManager): Boolean {
|
||||
return try {
|
||||
packageManager.getPackageInfo(packageName, 0)
|
||||
true
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private var networkCallback = object: ConnectivityManager.NetworkCallback() {
|
||||
|
||||
|
|
|
@ -6,14 +6,9 @@ import com.vanced.manager.R
|
|||
|
||||
class SecretSettingsFragment : PreferenceFragmentCompat() {
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
activity?.title = "Secret Settings"
|
||||
setHasOptionsMenu(true)
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.preferences, rootKey)
|
||||
setPreferencesFromResource(R.xml.secret_settings, rootKey)
|
||||
activity?.title = "Secret Settings"
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,6 @@ import android.content.res.Configuration
|
|||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
|
@ -63,16 +60,17 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
super .onCreateOptionsMenu(menu, inflater)
|
||||
}
|
||||
|
||||
/*
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.secret_settings -> {
|
||||
activity?.findNavController(R.id.bottom_nav_host)?.navigate(R.id.toSecretSettingsFragment)
|
||||
Toast.makeText(context, "You clicked on SS menu", Toast.LENGTH_SHORT)
|
||||
Toast.makeText(context, "You clicked on SS menu", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}
|
|
@ -1,45 +1,20 @@
|
|||
package com.vanced.manager.ui.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import androidx.navigation.findNavController
|
||||
|
||||
import com.vanced.manager.R
|
||||
import kotlinx.android.synthetic.main.fragment_vanced_language_selection.view.*
|
||||
import com.vanced.manager.core.fragments.LanguageInstall
|
||||
|
||||
class VancedLanguageSelectionFragment : Fragment() {
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
activity?.title = getString(R.string.title_install)
|
||||
}
|
||||
class VancedLanguageSelectionFragment : LanguageInstall() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
activity?.title = getString(R.string.title_install)
|
||||
return inflater.inflate(R.layout.fragment_vanced_language_selection, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val fragmentManager = childFragmentManager
|
||||
|
||||
val finishButton = getView()?.findViewById(R.id.vanced_install_finish) as Button
|
||||
|
||||
finishButton.setOnClickListener {
|
||||
view.findNavController().navigate(R.id.action_installTo_homeFragment)
|
||||
}
|
||||
|
||||
fragmentManager
|
||||
.beginTransaction()
|
||||
.replace(R.id.language_choose_frame, LanguageScrollviewFragment())
|
||||
.commit()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,39 +1,20 @@
|
|||
package com.vanced.manager.ui.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.navigation.findNavController
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.fragments.ThemeInstall
|
||||
|
||||
class VancedThemeSelectionFragment : Fragment() {
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
activity?.title = getString(R.string.title_install)
|
||||
}
|
||||
class VancedThemeSelectionFragment : ThemeInstall() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
activity?.title = getString(R.string.title_install)
|
||||
return inflater.inflate(R.layout.fragment_vanced_theme_selection, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val fragmentManager = activity?.supportFragmentManager
|
||||
|
||||
val nextButton = getView()?.findViewById(R.id.vanced_next_to_variant) as Button
|
||||
|
||||
nextButton.setOnClickListener{
|
||||
view.findNavController().navigate(R.id.toInstallVariantFragment)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,39 +1,23 @@
|
|||
package com.vanced.manager.ui.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.core.fragments.VariantInstall
|
||||
|
||||
class VancedVariantSelectionFragment : Fragment() {
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
activity?.title = getString(R.string.title_install)
|
||||
}
|
||||
class VancedVariantSelectionFragment : VariantInstall() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
activity?.title = getString(R.string.title_install)
|
||||
return inflater.inflate(R.layout.fragment_vanced_variant_selection, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val fragmentManager = activity?.supportFragmentManager
|
||||
|
||||
val nextButton = getView()?.findViewById(R.id.vanced_next_to_language) as Button
|
||||
|
||||
nextButton.setOnClickListener{
|
||||
view.findNavController().navigate(R.id.toInstallLanguageFragment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,10 +15,12 @@
|
|||
<action
|
||||
android:id="@+id/toAboutFragment"
|
||||
app:destination="@id/about_fragment"
|
||||
app:enterAnim="@anim/nav_default_enter_anim"
|
||||
app:exitAnim="@anim/nav_default_exit_anim"
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||
app:enterAnim="@anim/fragment_enter_left"
|
||||
app:exitAnim="@anim/fragment_exit_right"
|
||||
app:popEnterAnim="@anim/fragment_enter_right"
|
||||
app:popExitAnim="@anim/fragment_exit_left"
|
||||
app:popUpTo="@id/home_fragment"
|
||||
app:popUpToInclusive="true" />
|
||||
|
||||
<action
|
||||
android:id="@+id/toInstallThemeFragment"
|
||||
|
@ -38,10 +40,12 @@
|
|||
<action
|
||||
android:id="@+id/toSecretSettingsFragment"
|
||||
app:destination="@id/secret_settings_fragment"
|
||||
app:enterAnim="@anim/nav_default_enter_anim"
|
||||
app:exitAnim="@anim/nav_default_exit_anim"
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||
app:enterAnim="@anim/fragment_enter_left"
|
||||
app:exitAnim="@anim/fragment_exit_right"
|
||||
app:popEnterAnim="@anim/fragment_enter_right"
|
||||
app:popExitAnim="@anim/fragment_exit_left"
|
||||
app:popUpTo="@id/settings_fragment"
|
||||
app:popUpToInclusive="true" />
|
||||
|
||||
</fragment>
|
||||
|
||||
|
|
Loading…
Reference in a new issue