fixed navController and android manifest

This commit is contained in:
LagradOst 2021-09-30 14:16:23 +02:00
parent 3a78f41aad
commit 42f76c1c5c
2 changed files with 44 additions and 47 deletions

View file

@ -38,14 +38,20 @@
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="https" android:host="bestdubbedanime.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="gogoanime.vc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="animeflick.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="kawaiifu.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="tenshi.moe" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.wcostream.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="wcostream.cc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="bestdubbedanime.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="hdm.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="lookmovie.io" android:pathPrefix="/"/>
<data android:scheme="https" android:host="trailers.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.vmovee.watch" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.wcostream.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="allmoviesforyou.co" android:pathPrefix="/"/>
<data android:scheme="https" android:host="asiaflix.app" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.thenos.org" android:pathPrefix="/"/>
<data android:scheme="https" android:host="vidembed.cc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="trailers.to" android:pathPrefix="/"/>
</intent-filter>
</activity>

View file

@ -12,20 +12,14 @@ import android.content.res.Resources
import android.os.Build
import android.os.Bundle
import android.view.*
import android.view.View.GONE
import android.view.View.VISIBLE
import android.widget.TextView
import android.widget.Toast
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isVisible
import androidx.core.view.marginBottom
import androidx.navigation.findNavController
import androidx.navigation.ui.setupWithNavController
import androidx.preference.PreferenceManager
import androidx.transition.ChangeBounds
import androidx.transition.TransitionManager
import com.google.android.gms.cast.framework.*
import com.jaredrummler.android.colorpicker.ColorPickerDialogListener
import com.lagradost.cloudstream3.APIHolder.apis
@ -83,7 +77,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
var mCastSession: CastSession? = null
lateinit var mSessionManager: SessionManager
val mSessionManagerListener: SessionManagerListener<Session> by lazy { SessionManagerListenerImpl() }
private val mSessionManagerListener: SessionManagerListener<Session> by lazy { SessionManagerListenerImpl() }
private inner class SessionManagerListenerImpl : SessionManagerListener<Session> {
override fun onSessionStarting(session: Session) {
@ -325,7 +319,6 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
.build()*/
nav_view.setupWithNavController(navController)
var startUp = true
navController.addOnDestinationChangedListener { _, destination, _ ->
// nav_view.hideKeyboard()
/*if (destination.id != R.id.navigation_player) {
@ -339,33 +332,13 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
// Fucks up anime info layout since that has its own layout
cast_mini_controller_holder?.isVisible = destination.id != R.id.navigation_results
if (listOf(
nav_view.isVisible = listOf(
R.id.navigation_home,
R.id.navigation_search,
R.id.navigation_downloads,
R.id.navigation_settings,
R.id.navigation_download_child
).contains(destination.id)
) {
nav_view.visibility = VISIBLE
if (nav_view.marginBottom < 0) {
nav_view.layoutParams = nav_view.layoutParams.apply {
val transition = ChangeBounds()
transition.duration = 100 // DURATION OF ANIMATION IN MS
TransitionManager.beginDelayedTransition(homeRoot, transition)
(this as ConstraintLayout.LayoutParams).setMargins(0, 0, 0, 0)
}
}
} else {
if (startUp) nav_view.visibility = GONE
nav_view.layoutParams = nav_view.layoutParams.apply {
val transition = ChangeBounds()
transition.duration = 100 // DURATION OF ANIMATION IN MS
TransitionManager.beginDelayedTransition(homeRoot, transition)
(this as ConstraintLayout.LayoutParams).setMargins(0, 0, 0, -nav_view.height)
}
}
startUp = false
}
/*nav_view.setOnNavigationItemSelectedListener { item ->
@ -458,11 +431,29 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
}*/
var providersString = "Current providers are:\n"
var providersAndroidManifestString = "Current androidmanifest should be:\n"
for (api in apis) {
providersString += "+ ${api.mainUrl}\n"
providersAndroidManifestString += "<data android:scheme=\"https\" android:host=\"${
api.mainUrl.removePrefix(
"https://"
)
}\" android:pathPrefix=\"/\"/>\n"
}
for (api in restrictedApis) {
providersString += "+ ${api.mainUrl}\n"
providersAndroidManifestString += "<data android:scheme=\"https\" android:host=\"${
api.mainUrl.removePrefix(
"https://"
)
}\" android:pathPrefix=\"/\"/>\n"
}
println(providersString)
println(providersAndroidManifestString)
handleAppIntent(intent)
thread {