From 17054fbc703c415b24c136b76a73932ebcfbc405 Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Thu, 21 Jul 2022 03:43:23 +0200 Subject: [PATCH] Maybe fixed EgyBest and sorta fixed FireTV crashing on weird navigation with keyboard. --- .../movieproviders/EgyBestProvider.kt | 3 +- .../ui/settings/SettingsAccount.kt | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/EgyBestProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/EgyBestProvider.kt index 16c91ab4..d2e3462c 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/EgyBestProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/EgyBestProvider.kt @@ -222,7 +222,8 @@ class EgyBestProvider : MainAPI() { link, this.mainUrl, quality!!, - true + true, + headers = mapOf("range" to "bytes=0-"), ) ) } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsAccount.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsAccount.kt index b0319b26..2be8c8b4 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsAccount.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsAccount.kt @@ -5,6 +5,8 @@ import android.content.Intent import android.net.Uri import android.os.Bundle import android.view.View +import android.view.View.* +import android.view.inputmethod.EditorInfo import android.widget.TextView import androidx.annotation.UiThread import androidx.appcompat.app.AlertDialog @@ -24,6 +26,7 @@ import com.lagradost.cloudstream3.syncproviders.AuthAPI import com.lagradost.cloudstream3.syncproviders.InAppAuthAPI import com.lagradost.cloudstream3.syncproviders.OAuth2API import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref +import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar import com.lagradost.cloudstream3.utils.Coroutines.ioSafe import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe @@ -76,6 +79,33 @@ class SettingsAccount : PreferenceFragmentCompat() { AlertDialog.Builder(context ?: return, R.style.AlertDialogCustom) .setView(R.layout.add_account_input) val dialog = builder.show() + + val visibilityMap = mapOf( + dialog.login_email_input to api.requiresEmail, + dialog.login_password_input to api.requiresPassword, + dialog.login_server_input to api.requiresServer, + dialog.login_username_input to api.requiresUsername + ) + + if (context?.isTvSettings() == true) { + visibilityMap.forEach { (input, isVisible) -> + input.isVisible = isVisible + + // Band-aid for weird FireTV behavior causing crashes because keyboard covers the screen + input.setOnEditorActionListener { textView, actionId, _ -> + if (actionId == EditorInfo.IME_ACTION_NEXT) { + val view = textView.focusSearch(FOCUS_DOWN) + return@setOnEditorActionListener view?.requestFocus(FOCUS_DOWN) == true + } + return@setOnEditorActionListener true + } + } + } else { + visibilityMap.forEach { (input, isVisible) -> + input.isVisible = isVisible + } + } + dialog.login_email_input?.isVisible = api.requiresEmail dialog.login_password_input?.isVisible = api.requiresPassword dialog.login_server_input?.isVisible = api.requiresServer