forked from recloudstream/cloudstream
		
	monke update (NOT TESTED)
This commit is contained in:
		
							parent
							
								
									1f57af9362
								
							
						
					
					
						commit
						d57d1dc435
					
				
					 9 changed files with 75 additions and 28 deletions
				
			
		|  | @ -89,7 +89,7 @@ dependencies { | ||||||
|     implementation 'androidx.core:core-ktx:1.7.0' |     implementation 'androidx.core:core-ktx:1.7.0' | ||||||
|     implementation 'androidx.appcompat:appcompat:1.3.1' |     implementation 'androidx.appcompat:appcompat:1.3.1' | ||||||
|     implementation 'com.google.android.material:material:1.4.0' |     implementation 'com.google.android.material:material:1.4.0' | ||||||
|     implementation 'androidx.constraintlayout:constraintlayout:2.1.1' |     implementation 'androidx.constraintlayout:constraintlayout:2.1.2' | ||||||
|     implementation 'androidx.navigation:navigation-fragment-ktx:2.4.0-beta02' |     implementation 'androidx.navigation:navigation-fragment-ktx:2.4.0-beta02' | ||||||
|     implementation 'androidx.navigation:navigation-ui-ktx:2.4.0-beta02' |     implementation 'androidx.navigation:navigation-ui-ktx:2.4.0-beta02' | ||||||
|     implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0' |     implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0' | ||||||
|  | @ -114,6 +114,8 @@ dependencies { | ||||||
| 
 | 
 | ||||||
|     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' |     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' | ||||||
| 
 | 
 | ||||||
|  |     implementation "androidx.leanback:leanback-paging:1.1.0-alpha09" | ||||||
|  | 
 | ||||||
|     // Exoplayer |     // Exoplayer | ||||||
|     implementation 'com.google.android.exoplayer:exoplayer:2.15.1' |     implementation 'com.google.android.exoplayer:exoplayer:2.15.1' | ||||||
|     implementation 'com.google.android.exoplayer:extension-cast:2.15.1' |     implementation 'com.google.android.exoplayer:extension-cast:2.15.1' | ||||||
|  |  | ||||||
|  | @ -51,6 +51,8 @@ import com.lagradost.cloudstream3.utils.UIHelper.requestRW | ||||||
| import com.lagradost.cloudstream3.utils.UIHelper.shouldShowPIPMode | import com.lagradost.cloudstream3.utils.UIHelper.shouldShowPIPMode | ||||||
| import com.lagradost.cloudstream3.utils.UIHelper.toPx | import com.lagradost.cloudstream3.utils.UIHelper.toPx | ||||||
| import kotlinx.android.synthetic.main.activity_main.* | import kotlinx.android.synthetic.main.activity_main.* | ||||||
|  | import kotlinx.android.synthetic.main.activity_main.cast_mini_controller_holder | ||||||
|  | import kotlinx.android.synthetic.main.activity_main_tv.* | ||||||
| import kotlinx.android.synthetic.main.fragment_result.* | import kotlinx.android.synthetic.main.fragment_result.* | ||||||
| import java.util.* | import java.util.* | ||||||
| import kotlin.concurrent.thread | import kotlin.concurrent.thread | ||||||
|  | @ -445,8 +447,8 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener { | ||||||
|             .setPopExitAnim(R.anim.nav_pop_exit) |             .setPopExitAnim(R.anim.nav_pop_exit) | ||||||
|             .setPopUpTo(navController.graph.startDestination, false) |             .setPopUpTo(navController.graph.startDestination, false) | ||||||
|             .build()*/ |             .build()*/ | ||||||
|         nav_view.setupWithNavController(navController) |         nav_view?.setupWithNavController(navController) | ||||||
| 
 |         nav_rail_view?.setupWithNavController(navController) | ||||||
|         navController.addOnDestinationChangedListener { _, destination, _ -> |         navController.addOnDestinationChangedListener { _, destination, _ -> | ||||||
|             this.hideKeyboard() |             this.hideKeyboard() | ||||||
|             // nav_view.hideKeyboard() |             // nav_view.hideKeyboard() | ||||||
|  | @ -462,13 +464,16 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener { | ||||||
|             cast_mini_controller_holder?.isVisible = |             cast_mini_controller_holder?.isVisible = | ||||||
|                 !listOf(R.id.navigation_results, R.id.navigation_player).contains(destination.id) |                 !listOf(R.id.navigation_results, R.id.navigation_player).contains(destination.id) | ||||||
| 
 | 
 | ||||||
|             nav_view.isVisible = listOf( |             val isNavVisible = listOf( | ||||||
|                 R.id.navigation_home, |                 R.id.navigation_home, | ||||||
|                 R.id.navigation_search, |                 R.id.navigation_search, | ||||||
|                 R.id.navigation_downloads, |                 R.id.navigation_downloads, | ||||||
|                 R.id.navigation_settings, |                 R.id.navigation_settings, | ||||||
|                 R.id.navigation_download_child |                 R.id.navigation_download_child | ||||||
|             ).contains(destination.id) |             ).contains(destination.id) | ||||||
|  | 
 | ||||||
|  |             nav_view?.isVisible = isNavVisible | ||||||
|  |             nav_rail_view?.isVisible = isNavVisible | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /*nav_view.setOnNavigationItemSelectedListener { item -> |         /*nav_view.setOnNavigationItemSelectedListener { item -> | ||||||
|  | @ -489,7 +494,9 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener { | ||||||
|             true |             true | ||||||
|         }*/ |         }*/ | ||||||
| 
 | 
 | ||||||
|         nav_view.itemRippleColor = ColorStateList.valueOf(getResourceColor(R.attr.colorPrimary, 0.1f)) |         val rippleColor =  ColorStateList.valueOf(getResourceColor(R.attr.colorPrimary, 0.1f)) | ||||||
|  |         nav_view?.itemRippleColor = rippleColor | ||||||
|  |         nav_rail_view?.itemRippleColor = rippleColor | ||||||
| 
 | 
 | ||||||
|         if (!checkWrite()) { |         if (!checkWrite()) { | ||||||
|             requestRW() |             requestRW() | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ class HomeChildItemAdapter( | ||||||
| 
 | 
 | ||||||
|     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { |     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { | ||||||
|         return CardViewHolder( |         return CardViewHolder( | ||||||
|             LayoutInflater.from(parent.context).inflate(layout, parent, false), clickCallback |             LayoutInflater.from(parent.context).inflate(layout, parent, false), clickCallback, itemCount | ||||||
|         ) |         ) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -39,11 +39,19 @@ class HomeChildItemAdapter( | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     class CardViewHolder |     class CardViewHolder | ||||||
|     constructor(itemView: View, private val clickCallback: (SearchClickCallback) -> Unit) : |     constructor(itemView: View, private val clickCallback: (SearchClickCallback) -> Unit, val itemCount: Int) : | ||||||
|         RecyclerView.ViewHolder(itemView) { |         RecyclerView.ViewHolder(itemView) { | ||||||
| 
 | 
 | ||||||
|         fun bind(card: SearchResponse, index: Int) { |         fun bind(card: SearchResponse, index: Int) { | ||||||
|             SearchResultBuilder.bind(clickCallback, card, itemView) | 
 | ||||||
|  |             // TV focus fixing | ||||||
|  |             val nextFocusBehavior = when(index){ | ||||||
|  |                 0 -> true | ||||||
|  |                 itemCount - 1 -> false | ||||||
|  |                 else -> null | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             SearchResultBuilder.bind(clickCallback, card, itemView, nextFocusBehavior) | ||||||
|             itemView.tag = index |             itemView.tag = index | ||||||
|             //val ani = ScaleAnimation(0.9f, 1.0f, 0.9f, 1f) |             //val ani = ScaleAnimation(0.9f, 1.0f, 0.9f, 1f) | ||||||
|             //ani.fillAfter = true |             //ani.fillAfter = true | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ import com.lagradost.cloudstream3.ui.download.DOWNLOAD_ACTION_DOWNLOAD | ||||||
| import com.lagradost.cloudstream3.ui.download.DownloadButtonViewHolder | import com.lagradost.cloudstream3.ui.download.DownloadButtonViewHolder | ||||||
| import com.lagradost.cloudstream3.ui.download.DownloadClickEvent | import com.lagradost.cloudstream3.ui.download.DownloadClickEvent | ||||||
| import com.lagradost.cloudstream3.ui.download.EasyDownloadButton | import com.lagradost.cloudstream3.ui.download.EasyDownloadButton | ||||||
|  | import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings | ||||||
| import com.lagradost.cloudstream3.utils.UIHelper.setImage | import com.lagradost.cloudstream3.utils.UIHelper.setImage | ||||||
| import com.lagradost.cloudstream3.utils.VideoDownloadHelper | import com.lagradost.cloudstream3.utils.VideoDownloadHelper | ||||||
| import com.lagradost.cloudstream3.utils.VideoDownloadManager | import com.lagradost.cloudstream3.utils.VideoDownloadManager | ||||||
|  | @ -183,6 +184,12 @@ class EpisodeAdapter( | ||||||
|                 clickCallback.invoke(EpisodeClickEvent(ACTION_CLICK_DEFAULT, card)) |                 clickCallback.invoke(EpisodeClickEvent(ACTION_CLICK_DEFAULT, card)) | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  |             if (episodeHolder.context.isTvSettings()) { | ||||||
|  |                 episodeHolder.isFocusable = true | ||||||
|  |                 episodeHolder.isFocusableInTouchMode = true | ||||||
|  |                 episodeHolder.touchscreenBlocksFocus = false | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             episodeHolder.setOnLongClickListener { |             episodeHolder.setOnLongClickListener { | ||||||
|                 clickCallback.invoke(EpisodeClickEvent(ACTION_SHOW_OPTIONS, card)) |                 clickCallback.invoke(EpisodeClickEvent(ACTION_SHOW_OPTIONS, card)) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -69,7 +69,7 @@ class SearchAdapter( | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             SearchResultBuilder.bind(clickCallback, card,  itemView) |             SearchResultBuilder.bind(clickCallback, card,  itemView,) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,7 @@ import com.lagradost.cloudstream3.ui.APIRepository.Companion.typesActive | ||||||
| import com.lagradost.cloudstream3.ui.home.HomeFragment | import com.lagradost.cloudstream3.ui.home.HomeFragment | ||||||
| import com.lagradost.cloudstream3.ui.home.HomeFragment.Companion.loadHomepageList | import com.lagradost.cloudstream3.ui.home.HomeFragment.Companion.loadHomepageList | ||||||
| import com.lagradost.cloudstream3.ui.home.ParentItemAdapter | import com.lagradost.cloudstream3.ui.home.ParentItemAdapter | ||||||
|  | import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings | ||||||
| import com.lagradost.cloudstream3.utils.DataStore.getKey | import com.lagradost.cloudstream3.utils.DataStore.getKey | ||||||
| import com.lagradost.cloudstream3.utils.DataStore.setKey | import com.lagradost.cloudstream3.utils.DataStore.setKey | ||||||
| import com.lagradost.cloudstream3.utils.SEARCH_PROVIDER_TOGGLE | import com.lagradost.cloudstream3.utils.SEARCH_PROVIDER_TOGGLE | ||||||
|  | @ -295,6 +296,11 @@ class SearchFragment : Fragment() { | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         if(context?.isTvSettings() == true) { | ||||||
|  |             search_filter.isFocusable = true | ||||||
|  |             search_filter.isFocusableInTouchMode = true | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         main_search.setOnQueryTextListener(object : SearchView.OnQueryTextListener { |         main_search.setOnQueryTextListener(object : SearchView.OnQueryTextListener { | ||||||
|             override fun onQueryTextSubmit(query: String): Boolean { |             override fun onQueryTextSubmit(query: String): Boolean { | ||||||
|                 context?.let { ctx -> |                 context?.let { ctx -> | ||||||
|  |  | ||||||
|  | @ -6,6 +6,7 @@ import android.widget.ProgressBar | ||||||
| import android.widget.TextView | import android.widget.TextView | ||||||
| import androidx.cardview.widget.CardView | import androidx.cardview.widget.CardView | ||||||
| import com.lagradost.cloudstream3.* | import com.lagradost.cloudstream3.* | ||||||
|  | import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings | ||||||
| import com.lagradost.cloudstream3.utils.AppUtils.getNameFull | import com.lagradost.cloudstream3.utils.AppUtils.getNameFull | ||||||
| import com.lagradost.cloudstream3.utils.DataStoreHelper | import com.lagradost.cloudstream3.utils.DataStoreHelper | ||||||
| import com.lagradost.cloudstream3.utils.DataStoreHelper.fixVisual | import com.lagradost.cloudstream3.utils.DataStoreHelper.fixVisual | ||||||
|  | @ -13,10 +14,15 @@ import com.lagradost.cloudstream3.utils.UIHelper.setImage | ||||||
| import kotlinx.android.synthetic.main.home_result_grid.view.* | import kotlinx.android.synthetic.main.home_result_grid.view.* | ||||||
| 
 | 
 | ||||||
| object SearchResultBuilder { | object SearchResultBuilder { | ||||||
|  |     /** | ||||||
|  |      * @param nextFocusBehavior True if first, False if last, Null if between. | ||||||
|  |      * Used to prevent escaping the adapter horizontally (focus wise). | ||||||
|  |      */ | ||||||
|     fun bind( |     fun bind( | ||||||
|         clickCallback: (SearchClickCallback) -> Unit, |         clickCallback: (SearchClickCallback) -> Unit, | ||||||
|         card: SearchResponse, |         card: SearchResponse, | ||||||
|         itemView: View |         itemView: View, | ||||||
|  |         nextFocusBehavior: Boolean? = null | ||||||
|     ) { |     ) { | ||||||
|         val cardView: ImageView = itemView.imageView |         val cardView: ImageView = itemView.imageView | ||||||
|         val cardText: TextView? = itemView.imageText |         val cardText: TextView? = itemView.imageText | ||||||
|  | @ -51,6 +57,21 @@ object SearchResultBuilder { | ||||||
|             ) |             ) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         when (nextFocusBehavior) { | ||||||
|  |             true -> bg.nextFocusLeftId = bg.id | ||||||
|  |             false -> bg.nextFocusRightId = bg.id | ||||||
|  |             null -> { | ||||||
|  |                 bg.nextFocusRightId = -1 | ||||||
|  |                 bg.nextFocusLeftId = -1 | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (bg.context.isTvSettings()) { | ||||||
|  |             bg.isFocusable = true | ||||||
|  |             bg.isFocusableInTouchMode = true | ||||||
|  |             bg.touchscreenBlocksFocus = false | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         bg.setOnLongClickListener { |         bg.setOnLongClickListener { | ||||||
|             clickCallback.invoke(SearchClickCallback(SEARCH_ACTION_SHOW_METADATA, it, card)) |             clickCallback.invoke(SearchClickCallback(SEARCH_ACTION_SHOW_METADATA, it, card)) | ||||||
|             return@setOnLongClickListener true |             return@setOnLongClickListener true | ||||||
|  |  | ||||||
|  | @ -11,34 +11,31 @@ | ||||||
|     <androidx.constraintlayout.widget.ConstraintLayout |     <androidx.constraintlayout.widget.ConstraintLayout | ||||||
|             android:layout_height="match_parent" |             android:layout_height="match_parent" | ||||||
|             android:layout_width="match_parent"> |             android:layout_width="match_parent"> | ||||||
|         <com.google.android.material.bottomnavigation.BottomNavigationView |         <com.google.android.material.navigationrail.NavigationRailView | ||||||
|                 android:id="@+id/nav_view" |                 android:layout_width="wrap_content" | ||||||
|                 android:layout_width="0dp" |                 android:layout_height="match_parent" | ||||||
|                 android:layout_height="wrap_content" |                 android:id="@+id/nav_rail_view" | ||||||
|                 android:background="?attr/primaryGrayBackground" |                 android:background="?attr/primaryGrayBackground" | ||||||
| 
 |  | ||||||
|                 app:itemTextColor="@color/item_select_color" |                 app:itemTextColor="@color/item_select_color" | ||||||
|                 app:itemIconTint="@color/item_select_color" |                 app:itemIconTint="@color/item_select_color" | ||||||
| 
 |                 app:menuGravity="center" | ||||||
|                 android:outlineSpotShadowColor="@color/transparent" |                 app:layout_constraintStart_toStartOf="parent" | ||||||
|                 android:outlineAmbientShadowColor="@color/transparent" |  | ||||||
| 
 |  | ||||||
|                 app:layout_constraintTop_toTopOf="parent" |                 app:layout_constraintTop_toTopOf="parent" | ||||||
|                 app:labelVisibilityMode="labeled" |                 app:labelVisibilityMode="labeled" | ||||||
|                 app:layout_constraintBottom_toTopOf="@+id/nav_host_fragment" |                 app:menu="@menu/bottom_nav_menu"> | ||||||
|                 app:layout_constraintLeft_toLeftOf="parent" | 
 | ||||||
|                 app:layout_constraintRight_toRightOf="parent" |         </com.google.android.material.navigationrail.NavigationRailView> | ||||||
|                 app:menu="@menu/bottom_nav_menu" | 
 | ||||||
|                 /> |  | ||||||
|         <fragment |         <fragment | ||||||
|                 android:id="@+id/nav_host_fragment" |                 android:id="@+id/nav_host_fragment" | ||||||
|                 android:name="androidx.navigation.fragment.NavHostFragment" |                 android:name="androidx.navigation.fragment.NavHostFragment" | ||||||
|                 android:layout_width="match_parent" |                 android:layout_width="0dp" | ||||||
|                 android:layout_height="0dp" |                 android:layout_height="match_parent" | ||||||
|                 app:defaultNavHost="true" |                 app:defaultNavHost="true" | ||||||
|                 app:layout_constraintTop_toBottomOf="@+id/nav_view" |                 app:layout_constraintLeft_toRightOf="@+id/nav_view" | ||||||
|                 app:layout_constraintBottom_toBottomOf="parent" |                 app:layout_constraintBottom_toBottomOf="parent" | ||||||
|                 app:navGraph="@navigation/mobile_navigation" |                 app:navGraph="@navigation/mobile_navigation" | ||||||
|  |                 app:layout_constraintStart_toEndOf="@id/nav_rail_view" | ||||||
|                 app:layout_constraintEnd_toEndOf="parent"/> |                 app:layout_constraintEnd_toEndOf="parent"/> | ||||||
|         <LinearLayout |         <LinearLayout | ||||||
|                 android:layout_width="match_parent" |                 android:layout_width="match_parent" | ||||||
|  |  | ||||||
|  | @ -302,7 +302,6 @@ | ||||||
| 
 | 
 | ||||||
|                 <androidx.recyclerview.widget.RecyclerView |                 <androidx.recyclerview.widget.RecyclerView | ||||||
|                         android:descendantFocusability="afterDescendants" |                         android:descendantFocusability="afterDescendants" | ||||||
| 
 |  | ||||||
|                         app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" |                         app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | ||||||
|                         android:id="@+id/home_watch_child_recyclerview" |                         android:id="@+id/home_watch_child_recyclerview" | ||||||
|                         android:orientation="horizontal" |                         android:orientation="horizontal" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue