mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01:00 
			
		
		
		
	Update to SDK 28 (#2394)
This commit is contained in:
		| @@ -201,7 +201,7 @@ open class BrowseCatalogueController(bundle: Bundle) : | ||||
|         catalogue_view.addView(recycler, 1) | ||||
|  | ||||
|         if (oldPosition != RecyclerView.NO_POSITION) { | ||||
|             recycler.layoutManager.scrollToPosition(oldPosition) | ||||
|             recycler.layoutManager?.scrollToPosition(oldPosition) | ||||
|         } | ||||
|         this.recycler = recycler | ||||
|     } | ||||
|   | ||||
| @@ -179,7 +179,6 @@ class MangaController : RxController, TabbedController { | ||||
|     } | ||||
|  | ||||
|     companion object { | ||||
|  | ||||
|         const val FROM_CATALOGUE_EXTRA = "from_catalogue" | ||||
|         const val MANGA_EXTRA = "manga" | ||||
|  | ||||
| @@ -187,9 +186,8 @@ class MangaController : RxController, TabbedController { | ||||
|         const val CHAPTERS_CONTROLLER = 1 | ||||
|         const val TRACK_CONTROLLER = 2 | ||||
|  | ||||
|         private val tabField = TabLayout.Tab::class.java.getDeclaredField("mView") | ||||
|         private val tabField = TabLayout.Tab::class.java.getDeclaredField("view") | ||||
|                 .apply { isAccessible = true } | ||||
|     } | ||||
|  | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -62,8 +62,8 @@ open class WebtoonRecyclerView @JvmOverloads constructor( | ||||
|     override fun onScrollStateChanged(state: Int) { | ||||
|         super.onScrollStateChanged(state) | ||||
|         val layoutManager = layoutManager | ||||
|         val visibleItemCount = layoutManager.childCount | ||||
|         val totalItemCount = layoutManager.itemCount | ||||
|         val visibleItemCount = layoutManager?.childCount ?: 0 | ||||
|         val totalItemCount = layoutManager?.itemCount ?: 0 | ||||
|         atLastPosition = visibleItemCount > 0 && lastVisibleItemPosition == totalItemCount - 1 | ||||
|         atFirstPosition = firstVisibleItemPosition == 0 | ||||
|     } | ||||
|   | ||||
| @@ -67,7 +67,7 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer { | ||||
|         recycler.layoutManager = layoutManager | ||||
|         recycler.adapter = adapter | ||||
|         recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() { | ||||
|             override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { | ||||
|             override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { | ||||
|                 val position = layoutManager.findLastEndVisibleItemPosition() | ||||
|                 val item = adapter.items.getOrNull(position) | ||||
|                 if (item != null && currentPage != item) { | ||||
| @@ -98,11 +98,13 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer { | ||||
|         recycler.longTapListener = f@ { event -> | ||||
|             if (activity.menuVisible || config.longTapEnabled) { | ||||
|                 val child = recycler.findChildViewUnder(event.x, event.y) | ||||
|                 val position = recycler.getChildAdapterPosition(child) | ||||
|                 val item = adapter.items.getOrNull(position) | ||||
|                 if (item is ReaderPage) { | ||||
|                     activity.onPageLongTap(item) | ||||
|                     return@f true | ||||
|                 if (child != null) { | ||||
|                     val position = recycler.getChildAdapterPosition(child) | ||||
|                     val item = adapter.items.getOrNull(position) | ||||
|                     if (item is ReaderPage) { | ||||
|                         activity.onPageLongTap(item) | ||||
|                         return@f true | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             false | ||||
|   | ||||
| @@ -150,14 +150,14 @@ class SettingsAboutController : SettingsController() { | ||||
|         override fun onCreateDialog(savedViewState: Bundle?): Dialog { | ||||
|             return MaterialDialog.Builder(activity!!) | ||||
|                     .title(R.string.update_check_title) | ||||
|                     .content(args.getString(BODY_KEY)) | ||||
|                     .content(args.getString(BODY_KEY) ?: "") | ||||
|                     .positiveText(R.string.update_check_confirm) | ||||
|                     .negativeText(R.string.update_check_ignore) | ||||
|                     .onPositive { _, _ -> | ||||
|                         val appContext = applicationContext | ||||
|                         if (appContext != null) { | ||||
|                             // Start download | ||||
|                             val url = args.getString(URL_KEY) | ||||
|                             val url = args.getString(URL_KEY) ?: "" | ||||
|                             UpdaterService.downloadUpdate(appContext, url) | ||||
|                         } | ||||
|                     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user