forked from recloudstream/cloudstream
		
	update UI
This commit is contained in:
		
							parent
							
								
									64cf7ddb1d
								
							
						
					
					
						commit
						bb2ecce6bc
					
				
					 3 changed files with 21 additions and 1 deletions
				
			
		|  | @ -33,6 +33,7 @@ import com.lagradost.cloudstream3.syncproviders.OAuth2API.Companion.OAuth2accoun | |||
| import com.lagradost.cloudstream3.syncproviders.OAuth2API.Companion.appString | ||||
| import com.lagradost.cloudstream3.ui.APIRepository | ||||
| import com.lagradost.cloudstream3.ui.download.DOWNLOAD_NAVIGATE_TO | ||||
| import com.lagradost.cloudstream3.ui.result.ResultFragment | ||||
| import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings | ||||
| import com.lagradost.cloudstream3.utils.AppUtils.isCastApiAvailable | ||||
| import com.lagradost.cloudstream3.utils.AppUtils.loadCache | ||||
|  | @ -219,6 +220,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener { | |||
|                     setViewPos(id, pos, dur) | ||||
|                 } | ||||
|                 removeKey(VLC_LAST_ID_KEY) | ||||
|                 ResultFragment.updateUI() | ||||
|             } | ||||
|         } | ||||
|         super.onActivityResult(requestCode, resultCode, data) | ||||
|  |  | |||
|  | @ -22,6 +22,7 @@ import com.lagradost.cloudstream3.mvvm.normalSafeApiCall | |||
| import com.lagradost.cloudstream3.mvvm.observe | ||||
| import com.lagradost.cloudstream3.ui.player.PlayerSubtitleHelper.Companion.toSubtitleMimeType | ||||
| import com.lagradost.cloudstream3.ui.result.ResultEpisode | ||||
| import com.lagradost.cloudstream3.ui.result.ResultFragment | ||||
| import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings | ||||
| import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment | ||||
| import com.lagradost.cloudstream3.utils.* | ||||
|  | @ -327,6 +328,11 @@ class GeneratorPlayer : FullScreenPlayer() { | |||
|         loadLink(links[newIndex], true) | ||||
|     } | ||||
| 
 | ||||
|     override fun onDestroy() { | ||||
|         ResultFragment.updateUI() | ||||
|         super.onDestroy() | ||||
|     } | ||||
| 
 | ||||
|     override fun playerPositionChanged(posDur: Pair<Long, Long>) { | ||||
|         val (position, duration) = posDur | ||||
|         viewModel.getId()?.let { | ||||
|  |  | |||
|  | @ -187,6 +187,12 @@ class ResultFragment : Fragment() { | |||
|                 putBoolean("restart", true) | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         fun updateUI() { | ||||
|             updateUIListener?.invoke() | ||||
|         } | ||||
| 
 | ||||
|         private var updateUIListener : (() -> Unit)? = null | ||||
|     } | ||||
| 
 | ||||
|     private var currentLoadingCount = | ||||
|  | @ -215,7 +221,7 @@ class ResultFragment : Fragment() { | |||
|     override fun onDestroy() { | ||||
|         //requireActivity().viewModelStore.clear() // REMEMBER THE CLEAR | ||||
|         downloadButton?.dispose() | ||||
| 
 | ||||
|         updateUIListener = null | ||||
|         super.onDestroy() | ||||
|         activity?.let { | ||||
|             it.window?.navigationBarColor = | ||||
|  | @ -353,11 +359,17 @@ class ResultFragment : Fragment() { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private fun updateUI() { | ||||
|         viewModel.reloadEpisodes() | ||||
|     } | ||||
| 
 | ||||
|     @SuppressLint("SetTextI18n") | ||||
|     override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||||
|         super.onViewCreated(view, savedInstanceState) | ||||
|         fixGrid() | ||||
| 
 | ||||
|         updateUIListener = ::updateUI | ||||
| 
 | ||||
|         val restart = arguments?.getBoolean("restart") ?: false | ||||
|         if (restart) { | ||||
|             arguments?.putBoolean("restart", false) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue