diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Constants.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Constants.kt index 751a99243..60dd20956 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Constants.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Constants.kt @@ -17,8 +17,8 @@ object Constants { const val FILE_PROVIDER_AUTHORITY: String = BuildConfig.APPLICATION_ID + ".file_provider" const val VK_ANDROID_APP_VERSION_NAME = "8.15" const val VK_ANDROID_APP_VERSION_CODE = "15271" - const val KATE_APP_VERSION_NAME = "97.1 lite" - const val KATE_APP_VERSION_CODE = "532" + const val KATE_APP_VERSION_NAME = "99 lite" + const val KATE_APP_VERSION_CODE = "535" const val API_ID: Int = BuildConfig.VK_API_APP_ID const val SECRET: String = BuildConfig.VK_CLIENT_SECRET const val PHOTOS_PATH = "DCIM/Fenrir" diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/photopager/PhotoPagerPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/photopager/PhotoPagerPresenter.kt index 7e0004a44..df39393df 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/photopager/PhotoPagerPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/photopager/PhotoPagerPresenter.kt @@ -86,11 +86,11 @@ open class PhotoPagerPresenter internal constructor( override fun onViewHostAttached(view: IPhotoPagerView) { super.onViewHostAttached(view) - resolveOptionMenu() + resolveOptionMenu(view) } - private fun resolveOptionMenu() { - view?.setupOptionMenu( + private fun resolveOptionMenu(view: IPhotoPagerView) { + view.setupOptionMenu( canSaveYourself(), canDelete() ) @@ -198,7 +198,7 @@ open class PhotoPagerPresenter internal constructor( private fun onPositionChanged() { refreshInfoViews(true) resolveRestoreButtonVisibility() - resolveOptionMenu() + view?.let { resolveOptionMenu(it) } } private fun showPhotoInfo(photo: Photo, album: PhotoAlbum?, bundle: IOwnersBundle?) { @@ -301,7 +301,7 @@ open class PhotoPagerPresenter internal constructor( resolveWithUserView() resolveShareView() resolveCommentsView() - resolveOptionMenu() + view?.let { resolveOptionMenu(it) } if (need_update && need_update_info() && hasPhotos()) { val photo = current if (photo.albumId != -311) { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/HttpLoggerAndParser.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/HttpLoggerAndParser.kt index 8bf90a82f..68cf72f18 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/HttpLoggerAndParser.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/HttpLoggerAndParser.kt @@ -100,11 +100,11 @@ object HttpLoggerAndParser { return this } - val DEFAULT_LOGGING_INTERCEPTOR: OkHttp3LoggingInterceptor by lazy { + private val DEFAULT_LOGGING_INTERCEPTOR: OkHttp3LoggingInterceptor by lazy { OkHttp3LoggingInterceptor().setLevel(OkHttp3LoggingInterceptor.Level.BODY) } - val UPLOAD_LOGGING_INTERCEPTOR: OkHttp3LoggingInterceptor by lazy { + private val UPLOAD_LOGGING_INTERCEPTOR: OkHttp3LoggingInterceptor by lazy { //OkHttp3LoggingInterceptor().setLevel(OkHttp3LoggingInterceptor.Level.HEADERS) OkHttp3LoggingInterceptor().setLevel(OkHttp3LoggingInterceptor.Level.BODY) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/DocsApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/DocsApi.kt index 84b0adaee..05fb243e7 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/DocsApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/DocsApi.kt @@ -7,7 +7,6 @@ import dev.ragnarok.fenrir.api.model.AccessIdPair import dev.ragnarok.fenrir.api.model.Items import dev.ragnarok.fenrir.api.model.VKApiDoc import dev.ragnarok.fenrir.api.model.server.VKApiDocsUploadServer -import dev.ragnarok.fenrir.api.model.server.VKApiVideosUploadServer import dev.ragnarok.fenrir.api.services.IDocsService import io.reactivex.rxjava3.core.Single @@ -75,18 +74,6 @@ internal class DocsApi(accountId: Long, provider: IServiceProvider) : AbsApi(acc } } - override fun getVideoServer( - isPrivate: Int?, - group_id: Long?, - name: String? - ): Single { - return provideService(IDocsService(), TokenType.USER) - .flatMap { service -> - service.getVideoServer(isPrivate, group_id, name) - .map(extractResponseWithErrorHandling()) - } - } - override fun get( ownerId: Long?, count: Int?, diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/VideoApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/VideoApi.kt index 483a3e205..e03416adb 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/VideoApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/VideoApi.kt @@ -10,6 +10,7 @@ import dev.ragnarok.fenrir.api.model.VKApiVideoAlbum import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.DefaultCommentsResponse import dev.ragnarok.fenrir.api.model.response.SearchVideoResponse +import dev.ragnarok.fenrir.api.model.server.VKApiVideosUploadServer import dev.ragnarok.fenrir.api.services.IVideoService import io.reactivex.rxjava3.core.Single @@ -183,4 +184,20 @@ internal class VideoApi(accountId: Long, provider: IServiceProvider) : .map { it == 1 } } } + + override fun getVideoServer( + isPrivate: Int?, + group_id: Long?, + name: String? + ): Single { + return provideService(IVideoService(), TokenType.USER) + .flatMap { service -> + var finalName = name + if (finalName?.startsWith("VID_", false) == true) { + finalName = "Telegram $finalName" + } + service.getVideoServer(isPrivate, group_id, finalName) + .map(extractResponseWithErrorHandling()) + } + } } \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IDocsApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IDocsApi.kt index 5d7b9523c..508fefd52 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IDocsApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IDocsApi.kt @@ -5,7 +5,6 @@ import dev.ragnarok.fenrir.api.model.AccessIdPair import dev.ragnarok.fenrir.api.model.Items import dev.ragnarok.fenrir.api.model.VKApiDoc import dev.ragnarok.fenrir.api.model.server.VKApiDocsUploadServer -import dev.ragnarok.fenrir.api.model.server.VKApiVideosUploadServer import io.reactivex.rxjava3.core.Single interface IDocsApi { @@ -30,13 +29,6 @@ interface IDocsApi { @CheckResult fun getMessagesUploadServer(peerId: Long?, type: String?): Single - @CheckResult - fun getVideoServer( - isPrivate: Int?, - group_id: Long?, - name: String? - ): Single - @CheckResult operator fun get( ownerId: Long?, diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IVideoApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IVideoApi.kt index 079b1df0a..9ba201b16 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IVideoApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IVideoApi.kt @@ -8,6 +8,7 @@ import dev.ragnarok.fenrir.api.model.VKApiVideoAlbum import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.DefaultCommentsResponse import dev.ragnarok.fenrir.api.model.response.SearchVideoResponse +import dev.ragnarok.fenrir.api.model.server.VKApiVideosUploadServer import io.reactivex.rxjava3.core.Single interface IVideoApi { @@ -75,4 +76,11 @@ interface IVideoApi { @CheckResult fun edit(ownerId: Long, video_id: Int, name: String?, desc: String?): Single + + @CheckResult + fun getVideoServer( + isPrivate: Int?, + group_id: Long?, + name: String? + ): Single } \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IDocsService.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IDocsService.kt index b2727f958..eeb22b4e3 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IDocsService.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IDocsService.kt @@ -4,7 +4,6 @@ import dev.ragnarok.fenrir.api.model.Items import dev.ragnarok.fenrir.api.model.VKApiDoc import dev.ragnarok.fenrir.api.model.response.BaseResponse import dev.ragnarok.fenrir.api.model.server.VKApiDocsUploadServer -import dev.ragnarok.fenrir.api.model.server.VKApiVideosUploadServer import dev.ragnarok.fenrir.api.rest.IServiceRest import io.reactivex.rxjava3.core.Single @@ -126,20 +125,6 @@ class IDocsService : IServiceRest() { ) } - fun getVideoServer( - is_private: Int?, - group_id: Long?, - name: String? - ): Single> { - return rest.request( - "video.save", form( - "is_private" to is_private, - "group_id" to group_id, - "name" to name - ), base(VKApiVideosUploadServer.serializer()) - ) - } - /** * Returns detailed information about user or community documents. * diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IVideoService.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IVideoService.kt index 8758bddf7..67164aa1e 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IVideoService.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IVideoService.kt @@ -6,6 +6,7 @@ import dev.ragnarok.fenrir.api.model.VKApiVideoAlbum import dev.ragnarok.fenrir.api.model.response.BaseResponse import dev.ragnarok.fenrir.api.model.response.DefaultCommentsResponse import dev.ragnarok.fenrir.api.model.response.SearchVideoResponse +import dev.ragnarok.fenrir.api.model.server.VKApiVideosUploadServer import dev.ragnarok.fenrir.api.rest.IServiceRest import io.reactivex.rxjava3.core.Single @@ -227,4 +228,18 @@ class IVideoService : IServiceRest() { ), baseInt ) } + + fun getVideoServer( + is_private: Int?, + group_id: Long?, + name: String? + ): Single> { + return rest.request( + "video.save", form( + "is_private" to is_private, + "group_id" to group_id, + "name" to name + ), base(VKApiVideosUploadServer.serializer()) + ) + } } \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/abswall/WallAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/abswall/WallAdapter.kt index 63d66be34..a3af97484 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/abswall/WallAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/abswall/WallAdapter.kt @@ -60,9 +60,9 @@ class WallAdapter( } TYPE_SCHEDULED -> { - val scheludedHolder = viewHolder as ScheludedHolder - configNormalPost(scheludedHolder, item) - bindScheludedButtonsBlock(scheludedHolder, item) + val scheduledHolder = viewHolder as ScheduledHolder + configNormalPost(scheduledHolder, item) + bindScheludedButtonsBlock(scheduledHolder, item) } TYPE_DELETED -> bindDeleted(viewHolder as DeletedHolder, item) @@ -73,7 +73,7 @@ class WallAdapter( nonPublishedPostActionListener = listener } - private fun bindScheludedButtonsBlock(holder: ScheludedHolder, post: Post) { + private fun bindScheludedButtonsBlock(holder: ScheduledHolder, post: Post) { holder.deleteButton.setOnClickListener { nonPublishedPostActionListener?.onButtonRemoveClick(post) } @@ -194,7 +194,7 @@ class WallAdapter( when (type) { TYPE_NORMAL -> return NormalHolder(view) TYPE_DELETED -> return DeletedHolder(view) - TYPE_SCHEDULED -> return ScheludedHolder(view) + TYPE_SCHEDULED -> return ScheduledHolder(view) } throw IllegalArgumentException() } @@ -287,7 +287,7 @@ class WallAdapter( } - private inner class ScheludedHolder(view: View) : AbsPostHolder(view) { + private inner class ScheduledHolder(view: View) : AbsPostHolder(view) { val deleteButton: CircleCounterButton = root.findViewById(R.id.button_delete) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AttchmentsEditorAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AttchmentsEditorAdapter.kt index 39fde6ce6..85d6c808f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AttchmentsEditorAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AttchmentsEditorAdapter.kt @@ -47,7 +47,7 @@ class AttchmentsEditorAdapter( sharedHolders.put(attachment.id, viewHolder) configView(attachment, viewHolder) viewHolder.vRemove.setOnClickListener { - val dataposition = viewHolder.bindingAdapterPosition - headersCount + val dataposition = getItemRawPosition(viewHolder.bindingAdapterPosition) callback.onRemoveClick(dataposition, attachment) } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudioRecyclerAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudioRecyclerAdapter.kt index 656a70d98..40df8b0a4 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudioRecyclerAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudioRecyclerAdapter.kt @@ -729,9 +729,9 @@ class AudioRecyclerAdapter( } viewHolder.play.setOnClickListener { v: View -> if (Settings.get().main().isRevert_play_audio) { - doMenu(viewHolder, position, v, audio) + doMenu(viewHolder, getItemRawPosition(viewHolder.bindingAdapterPosition), v, audio) } else { - doPlay(position, audio) + doPlay(getItemRawPosition(viewHolder.bindingAdapterPosition), audio) } } if (!iSSelectMode) { @@ -785,9 +785,14 @@ class AudioRecyclerAdapter( viewHolder.cancelSelectionAnimation() viewHolder.startSomeAnimation() if (Settings.get().main().isRevert_play_audio) { - doPlay(position, audio) + doPlay(getItemRawPosition(viewHolder.bindingAdapterPosition), audio) } else { - doMenu(viewHolder, position, view, audio) + doMenu( + viewHolder, + getItemRawPosition(viewHolder.bindingAdapterPosition), + view, + audio + ) } } } else { @@ -854,7 +859,7 @@ class AudioRecyclerAdapter( val Track: View = itemView.findViewById(R.id.track_option) val selectionView: MaterialCardView = itemView.findViewById(R.id.item_audio_selection) val isSelectedView: MaterialCardView = itemView.findViewById(R.id.item_audio_select_add) - val animationAdapter: Animator.AnimatorListener + private val animationAdapter: Animator.AnimatorListener var animator: ObjectAnimator? = null fun startSelectionAnimation() { selectionView.setCardBackgroundColor(CurrentTheme.getColorPrimary(mContext)) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionAdapter.kt index 6cd9caff6..d6566aeb2 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionAdapter.kt @@ -1063,9 +1063,9 @@ class CatalogV2SectionAdapter( } play.setOnClickListener { v: View -> if (Settings.get().main().isRevert_play_audio) { - doMenu(this, position, v, audio) + doMenu(this, getItemRawPosition(bindingAdapterPosition), v, audio) } else { - doPlay(position, audio) + doPlay(getItemRawPosition(bindingAdapterPosition), audio) } } if (isLongPressDownload) { @@ -1121,9 +1121,9 @@ class CatalogV2SectionAdapter( cancelSelectionAnimation() startSomeAnimation() if (Settings.get().main().isRevert_play_audio) { - doPlay(position, audio) + doPlay(getItemRawPosition(bindingAdapterPosition), audio) } else { - doMenu(this, position, view, audio) + doMenu(this, getItemRawPosition(bindingAdapterPosition), view, audio) } } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudioLocalRecyclerAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudioLocalRecyclerAdapter.kt index 3a1a85189..8bed5cedc 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudioLocalRecyclerAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudioLocalRecyclerAdapter.kt @@ -367,18 +367,18 @@ class AudioLocalRecyclerAdapter(private val mContext: Context, private var data: } holder.play.setOnClickListener { v: View -> if (Settings.get().main().isRevert_play_audio) { - doMenu(position, v, audio) + doMenu(holder.bindingAdapterPosition, v, audio) } else { - doPlay(position, audio) + doPlay(holder.bindingAdapterPosition, audio) } } holder.Track.setOnClickListener { view: View -> holder.cancelSelectionAnimation() holder.startSomeAnimation() if (Settings.get().main().isRevert_play_audio) { - doPlay(position, audio) + doPlay(holder.bindingAdapterPosition, audio) } else { - doMenu(position, view, audio) + doMenu(holder.bindingAdapterPosition, view, audio) } } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalMenuAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalMenuAdapter.kt index 4b9c6380f..cc50750b8 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalMenuAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalMenuAdapter.kt @@ -20,9 +20,17 @@ class HorizontalMenuAdapter(data: MutableList) : viewHolder.menu_image.visibility = View.VISIBLE displayAvatar(viewHolder.menu_image, null, item.cover, Constants.PICASSO_TAG) } else viewHolder.menu_image.visibility = View.INVISIBLE - viewHolder.itemView.setOnClickListener { listener?.onWallMenuClick(item, position) } + viewHolder.itemView.setOnClickListener { + listener?.onWallMenuClick( + item, + getItemRawPosition(viewHolder.bindingAdapterPosition) + ) + } viewHolder.itemView.setOnLongClickListener { - listener?.onWallMenuLongClick(item, position) + listener?.onWallMenuLongClick( + item, + getItemRawPosition(viewHolder.bindingAdapterPosition) + ) true } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalOptionsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalOptionsAdapter.kt index dd95b7053..8a679cfd1 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalOptionsAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalOptionsAdapter.kt @@ -48,7 +48,10 @@ class HorizontalOptionsAdapter(data: MutableList) : viewHolder.delete.visibility = if (item.isCustom) View.VISIBLE else View.GONE viewHolder.delete.setOnClickListener { if (item.isCustom) { - delete_listener?.onDeleteOptionClick(item, position) + delete_listener?.onDeleteOptionClick( + item, + getItemRawPosition(viewHolder.bindingAdapterPosition) + ) } } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalPlaylistAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalPlaylistAdapter.kt index 17f390454..580f4c012 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalPlaylistAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalPlaylistAdapter.kt @@ -68,8 +68,18 @@ class HorizontalPlaylistAdapter(data: MutableList) : } viewHolder.update.text = AppTextUtils.getDateFromUnixTime(context, playlist.getUpdate_time()) - viewHolder.add.setOnClickListener { listener?.onPlayListClick(playlist, position) } - viewHolder.share.setOnClickListener { listener?.onShareClick(playlist, position) } + viewHolder.add.setOnClickListener { + listener?.onPlayListClick( + playlist, + getItemRawPosition(viewHolder.bindingAdapterPosition) + ) + } + viewHolder.share.setOnClickListener { + listener?.onShareClick( + playlist, + getItemRawPosition(viewHolder.bindingAdapterPosition) + ) + } if (playlist.getId() >= 0) { viewHolder.add.visibility = View.VISIBLE viewHolder.share.visibility = View.VISIBLE diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalStoryAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalStoryAdapter.kt index 57732b383..8d395db35 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalStoryAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/HorizontalStoryAdapter.kt @@ -61,11 +61,16 @@ class HorizontalStoryAdapter(data: MutableList) : Constants.PICASSO_TAG ) } - viewHolder.itemView.setOnClickListener { listener?.onStoryClick(item, position) } + viewHolder.itemView.setOnClickListener { + listener?.onStoryClick( + item, + getItemRawPosition(viewHolder.bindingAdapterPosition) + ) + } viewHolder.itemView.setOnLongClickListener { listener?.onStoryLongClick( item, - position + getItemRawPosition(viewHolder.bindingAdapterPosition) ) == true } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/ImageListAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/ImageListAdapter.kt index 222ac7808..33a59e18c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/ImageListAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/horizontal/ImageListAdapter.kt @@ -84,8 +84,8 @@ class ImageListAdapter : RecyclerView.Adapter() } itemView.setOnClickListener { - mOnRecyclerImageClickListener?.onRecyclerImageClick(position) - selectPosition(position) + mOnRecyclerImageClickListener?.onRecyclerImageClick(bindingAdapterPosition) + selectPosition(bindingAdapterPosition) } if (mCurrentSelectedIndex == position) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsAsImagesAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsAsImagesAdapter.kt index 4c69a3efd..b7b05bdcb 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsAsImagesAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsAsImagesAdapter.kt @@ -38,10 +38,13 @@ class DocsAsImagesAdapter(data: MutableList) : .cancelRequest(viewHolder.image) } viewHolder.itemView.setOnClickListener { - mActionListener?.onDocClick(viewHolder.bindingAdapterPosition, item) + mActionListener?.onDocClick(getItemRawPosition(viewHolder.bindingAdapterPosition), item) } viewHolder.itemView.setOnLongClickListener { - mActionListener?.onDocLongClick(viewHolder.bindingAdapterPosition, item) == true + mActionListener?.onDocLongClick( + getItemRawPosition(viewHolder.bindingAdapterPosition), + item + ) == true } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favearticles/FaveArticlesAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favearticles/FaveArticlesAdapter.kt index b89d50eee..9dbbbcda8 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favearticles/FaveArticlesAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favearticles/FaveArticlesAdapter.kt @@ -30,7 +30,12 @@ class FaveArticlesAdapter(private var data: List
, private val context: override fun onBindViewHolder(holder: Holder, position: Int) { val article = data[position] holder.btFave.setImageResource(R.drawable.favorite) - holder.btFave.setOnClickListener { clickListener?.onDelete(position, article) } + holder.btFave.setOnClickListener { + clickListener?.onDelete( + holder.bindingAdapterPosition, + article + ) + } if (article.uRL != null) { holder.ivButton.visibility = View.VISIBLE holder.ivButton.setOnClickListener { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favevideos/FaveVideosAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favevideos/FaveVideosAdapter.kt index eab5cbcb1..b1d258d30 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favevideos/FaveVideosAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favevideos/FaveVideosAdapter.kt @@ -48,7 +48,7 @@ class FaveVideosAdapter(private val context: Context, private var data: List if (Settings.get().main().isRevert_play_audio) { - doMenu(holder, position, v, audio) + doMenu(holder, holder.bindingAdapterPosition, v, audio) } else { - doPlay(position, audio) + doPlay(holder.bindingAdapterPosition, audio) } } holder.Track.setOnLongClickListener { v: View? -> @@ -500,9 +500,9 @@ class AudioLocalServerRecyclerAdapter( holder.cancelSelectionAnimation() holder.startSomeAnimation() if (Settings.get().main().isRevert_play_audio) { - doPlay(position, audio) + doPlay(holder.bindingAdapterPosition, audio) } else { - doMenu(holder, position, view, audio) + doMenu(holder, holder.bindingAdapterPosition, view, audio) } } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemoteAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemoteAdapter.kt index cfaf73475..c30f4524e 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemoteAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemoteAdapter.kt @@ -482,7 +482,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L } } holder.itemView.setOnLongClickListener { - doAudioMenu(position, item, it) + doAudioMenu(holder.bindingAdapterPosition, item, it) true } updateAudioStatus(holder, item) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/logs/LogsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/logs/LogsAdapter.kt index 6867e787c..930079d48 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/logs/LogsAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/logs/LogsAdapter.kt @@ -32,7 +32,7 @@ class LogsAdapter(data: MutableList, private val actionListener } private fun canReduce(body: String?): Boolean { - return Utils.safeLenghtOf(body) > MAX_BODY_LENGHT + return Utils.safeLenghtOf(body) > MAX_BODY_LENGTH } private fun setupBodyRoot(holder: Holder, wrapper: LogEventWrapper) { @@ -43,7 +43,7 @@ class LogsAdapter(data: MutableList, private val actionListener holder.body.text = body } else { holder.buttonExpand.visibility = View.VISIBLE - holder.body.text = AppTextUtils.reduceText(body, MAX_BODY_LENGHT) + holder.body.text = AppTextUtils.reduceText(body, MAX_BODY_LENGTH) } } @@ -71,6 +71,6 @@ class LogsAdapter(data: MutableList, private val actionListener } companion object { - private const val MAX_BODY_LENGHT = 400 + private const val MAX_BODY_LENGTH = 400 } } \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/MessagesAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/MessagesAdapter.kt index 39b54a18d..7eff03ae0 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/MessagesAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/MessagesAdapter.kt @@ -85,34 +85,34 @@ class MessagesAdapter( ) { val message = getItem(position) when (type) { - TYPE_SERVICE -> bindServiceHolder(viewHolder as ServiceMessageHolder, message, position) + TYPE_SERVICE -> bindServiceHolder(viewHolder as ServiceMessageHolder, message) TYPE_GRAFFITI_FRIEND, TYPE_GRAFFITI_MY, TYPE_MY_MESSAGE, TYPE_FRIEND_MESSAGE -> bindNormalMessage( viewHolder as MessageHolder, - message, - position + message ) TYPE_STICKER_FRIEND, TYPE_STICKER_MY -> bindStickerHolder( viewHolder as StickerMessageHolder, - message, - position + message ) TYPE_GIFT_FRIEND, TYPE_GIFT_MY -> bindGiftHolder( viewHolder as GiftMessageHolder, - message, - position + message ) } } - private fun bindStickerHolder(holder: StickerMessageHolder, message: Message, position: Int) { - bindBaseMessageHolder(holder, message, position) + private fun bindStickerHolder(holder: StickerMessageHolder, message: Message) { + bindBaseMessageHolder(holder, message) if (message.isDeleted) { holder.root.alpha = 0.6f holder.Restore.visibility = View.VISIBLE holder.Restore.setOnClickListener { - onMessageActionListener?.onRestoreClick(message, holder.bindingAdapterPosition) + onMessageActionListener?.onRestoreClick( + message, + getItemRawPosition(holder.bindingAdapterPosition) + ) } } else { holder.root.alpha = 1f @@ -166,13 +166,16 @@ class MessagesAdapter( setItems(messages) } - private fun bindGiftHolder(holder: GiftMessageHolder, message: Message, position: Int) { - bindBaseMessageHolder(holder, message, position) + private fun bindGiftHolder(holder: GiftMessageHolder, message: Message) { + bindBaseMessageHolder(holder, message) if (message.isDeleted) { holder.root.alpha = 0.6f holder.Restore.visibility = View.VISIBLE holder.Restore.setOnClickListener { - onMessageActionListener?.onRestoreClick(message, holder.bindingAdapterPosition) + onMessageActionListener?.onRestoreClick( + message, + getItemRawPosition(holder.bindingAdapterPosition) + ) } } else { holder.root.alpha = 1f @@ -251,7 +254,7 @@ class MessagesAdapter( root.background.alpha = 60 } - private fun bindBaseMessageHolder(holder: BaseMessageHolder, message: Message, position: Int) { + private fun bindBaseMessageHolder(holder: BaseMessageHolder, message: Message) { holder.important.visibility = if (message.isImportant) View.VISIBLE else View.GONE bindStatusText(holder.status, message.status, message.date, message.updateTime) var read = @@ -270,22 +273,36 @@ class MessagesAdapter( } if (holder.user != null) holder.user.text = message.sender?.fullName holder.avatar.setOnClickListener { - onMessageActionListener?.onAvatarClick(message, message.senderId, position) + onMessageActionListener?.onAvatarClick( + message, + message.senderId, + getItemRawPosition(holder.bindingAdapterPosition) + ) } holder.avatar.setOnLongClickListener { - onMessageActionListener?.onLongAvatarClick(message, message.senderId, position) + onMessageActionListener?.onLongAvatarClick( + message, + message.senderId, + getItemRawPosition(holder.bindingAdapterPosition) + ) true } holder.itemView.setOnClickListener { - onMessageActionListener?.onMessageClicked(message, position) + onMessageActionListener?.onMessageClicked( + message, + getItemRawPosition(holder.bindingAdapterPosition) + ) } holder.itemView.setOnLongClickListener { - onMessageActionListener?.onMessageLongClick(message, position) == true + onMessageActionListener?.onMessageLongClick( + message, + getItemRawPosition(holder.bindingAdapterPosition) + ) == true } } - private fun bindNormalMessage(holder: MessageHolder, message: Message, position: Int) { - bindBaseMessageHolder(holder, message, position) + private fun bindNormalMessage(holder: MessageHolder, message: Message) { + bindBaseMessageHolder(holder, message) if (holder.botKeyboardView != null && message.keyboard?.inline == true && message.keyboard?.buttons?.size.orZero() > 0) { holder.botKeyboardView.visibility = View.VISIBLE holder.botKeyboardView.setButtons(message.keyboard?.buttons, false) @@ -301,7 +318,10 @@ class MessagesAdapter( holder.root.alpha = 0.6f holder.Restore.visibility = View.VISIBLE holder.Restore.setOnClickListener { - onMessageActionListener?.onRestoreClick(message, holder.bindingAdapterPosition) + onMessageActionListener?.onRestoreClick( + message, + getItemRawPosition(holder.bindingAdapterPosition) + ) } } else { holder.root.alpha = 1f @@ -382,16 +402,19 @@ class MessagesAdapter( } } - private fun bindServiceHolder(holder: ServiceMessageHolder, message: Message, position: Int) { + private fun bindServiceHolder(holder: ServiceMessageHolder, message: Message) { if (message.isDeleted) { holder.root.alpha = 0.6f - holder.Restore.visibility = View.VISIBLE - holder.Restore.setOnClickListener { - onMessageActionListener?.onRestoreClick(message, holder.bindingAdapterPosition) + holder.bRestore.visibility = View.VISIBLE + holder.bRestore.setOnClickListener { + onMessageActionListener?.onRestoreClick( + message, + getItemRawPosition(holder.bindingAdapterPosition) + ) } } else { holder.root.alpha = 1f - holder.Restore.visibility = View.GONE + holder.bRestore.visibility = View.GONE } if (message.keyboard?.inline == true && message.keyboard?.buttons?.size.orZero() > 0) { holder.botKeyboardView.visibility = View.VISIBLE @@ -410,7 +433,10 @@ class MessagesAdapter( bindReadState(holder.itemView, message.status == MessageStatus.SENT && read) holder.tvAction.text = message.getServiceText(context) holder.itemView.setOnClickListener { - onMessageActionListener?.onMessageClicked(message, position) + onMessageActionListener?.onMessageClicked( + message, + getItemRawPosition(holder.bindingAdapterPosition) + ) } holder.itemView.setOnLongClickListener { onMessageActionListener?.onMessageDelete(message) @@ -527,7 +553,7 @@ class MessagesAdapter( val attachmentsRoot: View = itemView.findViewById(R.id.item_message_attachment_container) val mAttachmentsHolder: AttachmentsHolder = AttachmentsHolder() val botKeyboardView: BotKeyboardView = itemView.findViewById(R.id.input_keyboard_container) - val Restore: Button = itemView.findViewById(R.id.item_message_restore) + val bRestore: Button = itemView.findViewById(R.id.item_message_restore) init { mAttachmentsHolder.setVgAudios(itemView.findViewById(R.id.audio_attachments)) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/ownerarticles/OwnerArticlesAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/ownerarticles/OwnerArticlesAdapter.kt index 1ec5385fc..1841d11e4 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/ownerarticles/OwnerArticlesAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/ownerarticles/OwnerArticlesAdapter.kt @@ -28,9 +28,9 @@ class OwnerArticlesAdapter(private var data: List
, private val context: holder.btFave.setImageResource(if (article.isFavorite) R.drawable.favorite else R.drawable.star_add) holder.btFave.setOnClickListener { if (article.isFavorite) { - clickListener?.onDelete(position, article) + clickListener?.onDelete(holder.bindingAdapterPosition, article) } else { - clickListener?.onAdd(position, article) + clickListener?.onAdd(holder.bindingAdapterPosition, article) } } holder.btShare.setOnClickListener { clickListener?.onShare(article) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/theme/ThemeAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/theme/ThemeAdapter.kt index 506231ed5..4850e3365 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/theme/ThemeAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/theme/ThemeAdapter.kt @@ -95,7 +95,7 @@ class ThemeAdapter(private var data: List, context: Context) : } } holder.clicked.setOnClickListener { - clickListener?.onClick(position, category) + clickListener?.onClick(holder.bindingAdapterPosition, category) } } @@ -133,7 +133,7 @@ class ThemeAdapter(private var data: List, context: Context) : } } holder.clicked.setOnClickListener { - clickListener?.onClick(position, category) + clickListener?.onClick(holder.bindingAdapterPosition, category) } holder.gradient.background = GradientDrawable( GradientDrawable.Orientation.TL_BR, diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/topics/TopicsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/topics/TopicsAdapter.kt index 23223eac5..52ee6782d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/topics/TopicsAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/topics/TopicsAdapter.kt @@ -27,7 +27,7 @@ class TopicsAdapter( private val transformation: Transformation = CurrentTheme.createTransformationForAvatar() private var firstLastPadding = 0 override fun onBindItemViewHolder(viewHolder: ViewHolder, position: Int, type: Int) { - val item = getItem(position - headersCount) + val item = getItem(position) val context = viewHolder.itemView.context viewHolder.title.text = item.title viewHolder.subtitle.text = context.getString( diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/videos/VideosAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/videos/VideosAdapter.kt index daa522147..9cf13fb1e 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/videos/VideosAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/videos/VideosAdapter.kt @@ -44,11 +44,11 @@ class VideosAdapter(private val context: Context, private var data: List