mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
optimize
This commit is contained in:
parent
7f541a89aa
commit
0826fc8181
4 changed files with 39 additions and 40 deletions
|
@ -186,7 +186,7 @@ import kotlin.system.exitProcess
|
|||
|
||||
//https://github.com/jellyfin/jellyfin-android/blob/6cbf0edf84a3da82347c8d59b5d5590749da81a9/app/src/main/java/org/jellyfin/mobile/bridge/ExternalPlayer.kt#L225
|
||||
|
||||
class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricAuthCallback {
|
||||
class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCallback {
|
||||
companion object {
|
||||
const val VLC_PACKAGE = "org.videolan.vlc"
|
||||
const val MPV_PACKAGE = "is.xyz.mpv"
|
||||
|
|
|
@ -274,7 +274,9 @@ class ExtensionsFragment : Fragment() {
|
|||
showToast(R.string.no_plugins_found_error, Toast.LENGTH_LONG)
|
||||
} else {
|
||||
this@ExtensionsFragment.activity?.addRepositoryDialog(
|
||||
fixedName, true)
|
||||
fixedName,
|
||||
url,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ import com.lagradost.cloudstream3.syncproviders.providers.Kitsu
|
|||
import com.lagradost.cloudstream3.ui.WebviewFragment
|
||||
import com.lagradost.cloudstream3.ui.result.ResultFragment
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals
|
||||
import com.lagradost.cloudstream3.ui.settings.extensions.ExtensionsFragment
|
||||
import com.lagradost.cloudstream3.ui.settings.extensions.PluginsFragment
|
||||
import com.lagradost.cloudstream3.ui.settings.extensions.PluginsViewModel.Companion.downloadAll
|
||||
import com.lagradost.cloudstream3.ui.settings.extensions.RepositoryData
|
||||
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
||||
import com.lagradost.cloudstream3.utils.Coroutines.main
|
||||
|
@ -387,7 +387,7 @@ object AppUtils {
|
|||
)
|
||||
}
|
||||
afterRepositoryLoadedEvent.invoke(true)
|
||||
addRepositoryDialog(repo.name, false)
|
||||
addRepositoryDialog(repo.name, url)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -430,23 +430,23 @@ object AppUtils {
|
|||
}
|
||||
}
|
||||
|
||||
fun Activity.addRepositoryDialog(repositoryName: String, isExtensionsFragment: Boolean) {
|
||||
fun Activity.addRepositoryDialog(
|
||||
repositoryName: String,
|
||||
repositoryURL: String,
|
||||
) {
|
||||
val repos = RepositoryManager.getRepositories()
|
||||
|
||||
// navigate to newly added repository on pressing Open Repository
|
||||
fun openAddedRepo() {
|
||||
|
||||
// don't redirect if user is adding manually from add repository fab button
|
||||
if (!isExtensionsFragment && repos.isNotEmpty()) {
|
||||
normalSafeApiCall {
|
||||
navigate(
|
||||
R.id.navigation_home_to_navigation_settings_plugins,
|
||||
if (repos.isNotEmpty()) {
|
||||
navigate(
|
||||
R.id.global_to_navigation_settings_plugins,
|
||||
PluginsFragment.newInstance(
|
||||
repositoryName,
|
||||
repos.last().url,
|
||||
false)
|
||||
repositoryURL,
|
||||
false,
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -454,11 +454,8 @@ object AppUtils {
|
|||
AlertDialog.Builder(this).apply {
|
||||
setTitle(repositoryName)
|
||||
setMessage(R.string.download_all_plugins_from_repo)
|
||||
// won't show "open button" when adding from settings
|
||||
if (!isExtensionsFragment) {
|
||||
setPositiveButton(R.string.open_downloaded_repo) { _, _ ->
|
||||
openAddedRepo()
|
||||
}
|
||||
setPositiveButton(R.string.open_downloaded_repo) { _, _ ->
|
||||
openAddedRepo()
|
||||
}
|
||||
setNegativeButton(R.string.dismiss, null)
|
||||
show().setDefaultFocus()
|
||||
|
|
|
@ -111,6 +111,27 @@
|
|||
app:argType="boolean" />
|
||||
</action>
|
||||
|
||||
<action
|
||||
android:id="@+id/global_to_navigation_settings_plugins"
|
||||
app:destination="@id/navigation_settings_plugins"
|
||||
app:enterAnim="@anim/enter_anim"
|
||||
app:exitAnim="@anim/exit_anim"
|
||||
app:popEnterAnim="@anim/enter_anim"
|
||||
app:popExitAnim="@anim/exit_anim">
|
||||
<argument
|
||||
android:name="name"
|
||||
android:defaultValue="@null"
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="url"
|
||||
android:defaultValue="@null"
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="isLocal"
|
||||
android:defaultValue="false"
|
||||
app:argType="boolean" />
|
||||
</action>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_settings_player"
|
||||
android:name="com.lagradost.cloudstream3.ui.settings.SettingsPlayer"
|
||||
|
@ -273,27 +294,6 @@
|
|||
app:exitAnim="@anim/exit_anim"
|
||||
app:popEnterAnim="@anim/enter_anim"
|
||||
app:popExitAnim="@anim/exit_anim" />
|
||||
|
||||
<action
|
||||
android:id="@+id/navigation_home_to_navigation_settings_plugins"
|
||||
app:destination="@id/navigation_settings_plugins"
|
||||
app:enterAnim="@anim/enter_anim"
|
||||
app:exitAnim="@anim/exit_anim"
|
||||
app:popEnterAnim="@anim/enter_anim"
|
||||
app:popExitAnim="@anim/exit_anim">
|
||||
<argument
|
||||
android:name="name"
|
||||
android:defaultValue="@null"
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="url"
|
||||
android:defaultValue="@null"
|
||||
app:argType="string" />
|
||||
<argument
|
||||
android:name="isLocal"
|
||||
android:defaultValue="false"
|
||||
app:argType="boolean" />
|
||||
</action>
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue