)
+ fun isLoading(loading: Boolean)
+ fun resolveEmptyText(isEmpty: Boolean)
+ fun invalidateMenu()
+ fun startDirectLogin()
+
+ fun notifyDataSetChanged()
+ fun notifyItemRemoved(position: Int)
+ fun notifyItemRangeRemoved(positionStart: Int, count: Int)
+ fun notifyItemRangeInserted(positionStart: Int, count: Int)
+ fun showColoredSnack(text: String?, @ColorInt color: Int)
+ fun showColoredSnack(@StringRes resId: Int, @ColorInt color: Int, vararg params: Any?)
+}
\ No newline at end of file
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AbsAttachmentsEditFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AbsAttachmentsEditFragment.kt
index e45e85b08..07fe91ba7 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AbsAttachmentsEditFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AbsAttachmentsEditFragment.kt
@@ -29,7 +29,7 @@ import dev.ragnarok.fenrir.activity.PhotosActivity
import dev.ragnarok.fenrir.db.model.AttachmentsTypes
import dev.ragnarok.fenrir.fragment.base.BaseMvpFragment
import dev.ragnarok.fenrir.fragment.createpoll.CreatePollFragment
-import dev.ragnarok.fenrir.fragment.vkphotos.IVkPhotosView
+import dev.ragnarok.fenrir.fragment.vkphotos.IVKPhotosView
import dev.ragnarok.fenrir.getParcelableArrayListExtraCompat
import dev.ragnarok.fenrir.getParcelableCompat
import dev.ragnarok.fenrir.listener.BackPressCallback
@@ -251,7 +251,7 @@ abstract class AbsAttachmentsEditFragment, V
val intent = Intent(requireActivity(), PhotoAlbumsActivity::class.java)
intent.putExtra(Extra.OWNER_ID, accountId)
intent.putExtra(Extra.ACCOUNT_ID, ownerId)
- intent.putExtra(Extra.ACTION, IVkPhotosView.ACTION_SELECT_PHOTOS)
+ intent.putExtra(Extra.ACTION, IVKPhotosView.ACTION_SELECT_PHOTOS)
openRequestPhotoFromVK.launch(intent)
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AbsAttachmentsEditPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AbsAttachmentsEditPresenter.kt
index 2c3e63d2d..1064247d3 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AbsAttachmentsEditPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AbsAttachmentsEditPresenter.kt
@@ -2,9 +2,17 @@ package dev.ragnarok.fenrir.fragment.attachments.absattachmentsedit
import android.net.Uri
import android.os.Bundle
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Includes
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.base.AccountDependencyPresenter
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.getParcelableArrayListCompat
+import dev.ragnarok.fenrir.getParcelableCompat
+import dev.ragnarok.fenrir.model.AbsModel
+import dev.ragnarok.fenrir.model.AttachmentEntry
+import dev.ragnarok.fenrir.model.LocalPhoto
+import dev.ragnarok.fenrir.model.Photo
+import dev.ragnarok.fenrir.model.Poll
+import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.settings.Settings
import dev.ragnarok.fenrir.upload.IUploadManager
import dev.ragnarok.fenrir.upload.IUploadManager.IProgressUpdate
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 3e53ae8a2..39fde6ce6 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
@@ -10,7 +10,25 @@ import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.base.RecyclerBindableAdapter
import dev.ragnarok.fenrir.fragment.base.holder.IdentificableHolder
import dev.ragnarok.fenrir.fragment.base.holder.SharedHolders
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.AbsModelType
+import dev.ragnarok.fenrir.model.Article
+import dev.ragnarok.fenrir.model.AttachmentEntry
+import dev.ragnarok.fenrir.model.Audio
+import dev.ragnarok.fenrir.model.AudioArtist
+import dev.ragnarok.fenrir.model.AudioPlaylist
+import dev.ragnarok.fenrir.model.Document
+import dev.ragnarok.fenrir.model.Event
+import dev.ragnarok.fenrir.model.Graffiti
+import dev.ragnarok.fenrir.model.Link
+import dev.ragnarok.fenrir.model.Market
+import dev.ragnarok.fenrir.model.MarketAlbum
+import dev.ragnarok.fenrir.model.Photo
+import dev.ragnarok.fenrir.model.PhotoAlbum
+import dev.ragnarok.fenrir.model.PhotoSize
+import dev.ragnarok.fenrir.model.Poll
+import dev.ragnarok.fenrir.model.Post
+import dev.ragnarok.fenrir.model.Story
+import dev.ragnarok.fenrir.model.Video
import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.with
import dev.ragnarok.fenrir.settings.CurrentTheme
@@ -73,14 +91,17 @@ class AttchmentsEditorAdapter(
holder.tvTitle.setText(R.string.error)
holder.tvTitle.setTextColor(ERROR_COLOR)
}
+
Upload.STATUS_QUEUE -> {
holder.tvTitle.setText(R.string.in_order)
holder.tvTitle.setTextColor(nonErrorTextColor)
}
+
Upload.STATUS_CANCELLING -> {
holder.tvTitle.setText(R.string.cancelling)
holder.tvTitle.setTextColor(nonErrorTextColor)
}
+
else -> {
holder.tvTitle.setTextColor(nonErrorTextColor)
val progressLine = upload.progress.toString() + "%"
@@ -346,69 +367,91 @@ class AttchmentsEditorAdapter(
AbsModelType.MODEL_PHOTO -> {
bindPhoto(holder, model as Photo)
}
+
AbsModelType.MODEL_VIDEO -> {
bindVideo(holder, model as Video)
}
+
AbsModelType.MODEL_AUDIO -> {
bindAudio(holder, model as Audio)
}
+
AbsModelType.MODEL_POLL -> {
bindPoll(holder, model as Poll)
}
+
AbsModelType.MODEL_POST -> {
bindPost(holder, model as Post)
}
+
AbsModelType.MODEL_DOCUMENT -> {
bindDoc(holder, model as Document)
}
+
AbsModelType.MODEL_FWDMESSAGES -> {
bindFwdMessages(holder)
}
+
AbsModelType.MODEL_UPLOAD -> {
configUploadObject(model as Upload, holder)
}
+
AbsModelType.MODEL_LINK -> {
bindLink(holder, model as Link)
}
+
AbsModelType.MODEL_ARTICLE -> {
bindArticle(holder, model as Article)
}
+
AbsModelType.MODEL_STORY -> {
bindStory(holder, model as Story)
}
+
AbsModelType.MODEL_CALL -> {
bindCall(holder)
}
+
AbsModelType.MODEL_GEO -> {
bindGeo(holder)
}
+
AbsModelType.MODEL_NOT_SUPPORTED -> {
bindNotSupported(holder)
}
+
AbsModelType.MODEL_EVENT -> {
bindEvent(holder, model as Event)
}
+
AbsModelType.MODEL_MARKET -> {
bindMarket(holder, model as Market)
}
+
AbsModelType.MODEL_MARKET_ALBUM -> {
bindMarketAlbum(holder, model as MarketAlbum)
}
+
AbsModelType.MODEL_AUDIO_ARTIST -> {
bindAudioArtist(holder, model as AudioArtist)
}
+
AbsModelType.MODEL_AUDIO_PLAYLIST -> {
bindAudioPlaylist(holder, model as AudioPlaylist)
}
+
AbsModelType.MODEL_GRAFFITI -> {
bindGraffiti(holder, model as Graffiti)
}
+
AbsModelType.MODEL_PHOTO_ALBUM -> {
bindPhotoAlbum(holder, model as PhotoAlbum)
}
+
AbsModelType.MODEL_WALL_REPLY -> {
bindWallReplies(holder)
}
+
else -> {
throw UnsupportedOperationException("Type " + model.javaClass + " in not supported")
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/commentcreate/CommentCreatePresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/commentcreate/CommentCreatePresenter.kt
index 4826c7e76..552cf217a 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/commentcreate/CommentCreatePresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/commentcreate/CommentCreatePresenter.kt
@@ -5,7 +5,9 @@ import dev.ragnarok.fenrir.Includes
import dev.ragnarok.fenrir.Includes.provideMainThreadScheduler
import dev.ragnarok.fenrir.db.AttachToType
import dev.ragnarok.fenrir.domain.IAttachmentsRepository
-import dev.ragnarok.fenrir.domain.IAttachmentsRepository.*
+import dev.ragnarok.fenrir.domain.IAttachmentsRepository.IAddEvent
+import dev.ragnarok.fenrir.domain.IAttachmentsRepository.IBaseEvent
+import dev.ragnarok.fenrir.domain.IAttachmentsRepository.IRemoveEvent
import dev.ragnarok.fenrir.fragment.attachments.absattachmentsedit.AbsAttachmentsEditPresenter
import dev.ragnarok.fenrir.fromIOToMain
import dev.ragnarok.fenrir.model.AbsModel
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/commentedit/CommentEditPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/commentedit/CommentEditPresenter.kt
index 6d1e067a1..355bb0205 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/commentedit/CommentEditPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/commentedit/CommentEditPresenter.kt
@@ -10,7 +10,11 @@ import dev.ragnarok.fenrir.domain.Repository.owners
import dev.ragnarok.fenrir.domain.impl.CommentsInteractor
import dev.ragnarok.fenrir.fragment.attachments.absattachmentsedit.AbsAttachmentsEditPresenter
import dev.ragnarok.fenrir.fromIOToMain
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.AbsModel
+import dev.ragnarok.fenrir.model.AttachmentEntry
+import dev.ragnarok.fenrir.model.Comment
+import dev.ragnarok.fenrir.model.LocalPhoto
+import dev.ragnarok.fenrir.model.Photo
import dev.ragnarok.fenrir.requireNonNull
import dev.ragnarok.fenrir.upload.Upload
import dev.ragnarok.fenrir.upload.UploadDestination
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/postcreate/PostCreatePresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/postcreate/PostCreatePresenter.kt
index 6585b2173..51e2e95a3 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/postcreate/PostCreatePresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/postcreate/PostCreatePresenter.kt
@@ -17,10 +17,25 @@ import dev.ragnarok.fenrir.domain.IWallsRepository
import dev.ragnarok.fenrir.domain.Repository
import dev.ragnarok.fenrir.fragment.attachments.abspostedit.AbsPostEditPresenter
import dev.ragnarok.fenrir.fromIOToMain
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.AbsModel
+import dev.ragnarok.fenrir.model.AttachmentEntry
+import dev.ragnarok.fenrir.model.Attachments
+import dev.ragnarok.fenrir.model.Community
+import dev.ragnarok.fenrir.model.EditingPostType
+import dev.ragnarok.fenrir.model.LocalPhoto
+import dev.ragnarok.fenrir.model.ModelsBundle
+import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.model.Poll
+import dev.ragnarok.fenrir.model.Post
+import dev.ragnarok.fenrir.model.WallEditorAttrs
import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.settings.Settings
-import dev.ragnarok.fenrir.upload.*
+import dev.ragnarok.fenrir.upload.MessageMethod
+import dev.ragnarok.fenrir.upload.Method
+import dev.ragnarok.fenrir.upload.Upload
+import dev.ragnarok.fenrir.upload.UploadDestination
+import dev.ragnarok.fenrir.upload.UploadIntent
+import dev.ragnarok.fenrir.upload.UploadUtils
import dev.ragnarok.fenrir.util.Optional
import dev.ragnarok.fenrir.util.Optional.Companion.empty
import dev.ragnarok.fenrir.util.Optional.Companion.wrap
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/postedit/PostEditPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/postedit/PostEditPresenter.kt
index 2ecf854eb..6d95031f7 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/postedit/PostEditPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/postedit/PostEditPresenter.kt
@@ -11,7 +11,15 @@ import dev.ragnarok.fenrir.domain.Repository.walls
import dev.ragnarok.fenrir.fragment.attachments.abspostedit.AbsPostEditPresenter
import dev.ragnarok.fenrir.fromIOToMain
import dev.ragnarok.fenrir.getParcelableCompat
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.AbsModel
+import dev.ragnarok.fenrir.model.AttachmentEntry
+import dev.ragnarok.fenrir.model.Community
+import dev.ragnarok.fenrir.model.LocalPhoto
+import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.model.Photo
+import dev.ragnarok.fenrir.model.Poll
+import dev.ragnarok.fenrir.model.Post
+import dev.ragnarok.fenrir.model.WallEditorAttrs
import dev.ragnarok.fenrir.requireNonNull
import dev.ragnarok.fenrir.upload.Upload
import dev.ragnarok.fenrir.upload.UploadDestination
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudioPlayerFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudioPlayerFragment.kt
index b6a7d0291..2698ff65a 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudioPlayerFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudioPlayerFragment.kt
@@ -169,6 +169,7 @@ class AudioPlayerFragment : BottomSheetDialogFragment(), CustomSeekBar.CustomSee
updateNowPlayingInfo()
resolveControlViews()
}
+
PlayerStatus.UPDATE_PLAY_PAUSE -> {
updatePlaybackControls()
resolveTotalTime()
@@ -185,16 +186,20 @@ class AudioPlayerFragment : BottomSheetDialogFragment(), CustomSeekBar.CustomSee
}
}
}
+
PlayerStatus.REPEATMODE_CHANGED -> {
mRepeatButton?.updateRepeatState()
}
+
PlayerStatus.SHUFFLEMODE_CHANGED -> {
mShuffleButton?.updateShuffleState()
updateCovers()
}
+
PlayerStatus.UPDATE_PLAY_LIST -> {
updateCovers()
}
+
PlayerStatus.SERVICE_KILLED -> {
updatePlaybackControls()
updateNowPlayingInfo()
@@ -457,6 +462,7 @@ class AudioPlayerFragment : BottomSheetDialogFragment(), CustomSeekBar.CustomSee
createCustomToast(requireActivity()).showToastBottom(R.string.saved_audio)
ivSave?.setImageResource(R.drawable.succ)
}
+
1 -> {
CustomSnackbars.createCustomSnackbars(v, mPlayPauseButton)
?.setDurationSnack(Snackbar.LENGTH_LONG)
@@ -472,6 +478,7 @@ class AudioPlayerFragment : BottomSheetDialogFragment(), CustomSeekBar.CustomSee
)
}?.show()
}
+
2 -> {
CustomSnackbars.createCustomSnackbars(v, mPlayPauseButton)
?.setDurationSnack(Snackbar.LENGTH_LONG)
@@ -488,6 +495,7 @@ class AudioPlayerFragment : BottomSheetDialogFragment(), CustomSeekBar.CustomSee
}?.show()
ivSave?.setImageResource(R.drawable.succ)
}
+
else -> createCustomToast(requireActivity()).showToastBottom(R.string.error_audio)
}
}
@@ -767,15 +775,19 @@ class AudioPlayerFragment : BottomSheetDialogFragment(), CustomSeekBar.CustomSee
TrackIsDownloaded(current) == 1 -> {
ivSave?.setImageResource(R.drawable.succ)
}
+
TrackIsDownloaded(current) == 2 -> {
ivSave?.setImageResource(R.drawable.remote_cloud)
}
+
current.url.isNullOrEmpty() -> {
ivSave?.setImageResource(R.drawable.audio_died)
}
+
("https://vk.com/mp3/audio_api_unavailable.mp3" == current.url) -> {
ivSave?.setImageResource(R.drawable.report)
}
+
else -> ivSave?.setImageResource(R.drawable.save)
}
} else ivSave?.setImageResource(R.drawable.save)
@@ -982,6 +994,7 @@ class AudioPlayerFragment : BottomSheetDialogFragment(), CustomSeekBar.CustomSee
MusicPlaybackController.isPlaying -> {
mCurrentTime?.visibility = View.VISIBLE
}
+
else -> {
// blink the counter
val vis = mCurrentTime?.visibility
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudioSelectTabsFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudioSelectTabsFragment.kt
index 8f1462588..0ae14564d 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudioSelectTabsFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudioSelectTabsFragment.kt
@@ -1,7 +1,12 @@
package dev.ragnarok.fenrir.fragment.audio
import android.os.Bundle
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
import androidx.fragment.app.Fragment
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudiosTabsFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudiosTabsFragment.kt
index 55e65ab9e..14cec8612 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudiosTabsFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/AudiosTabsFragment.kt
@@ -1,7 +1,12 @@
package dev.ragnarok.fenrir.fragment.audio
import android.os.Bundle
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
import androidx.fragment.app.Fragment
@@ -65,14 +70,19 @@ class AudiosTabsFragment : BaseFragment(), MenuProvider {
when (val fid = adapter.pFragments[position]) {
MY_AUDIO -> tab.text =
getString(R.string.my_saved)
+
PLAYLISTS -> tab.text =
getString(R.string.playlists)
+
MY_RECOMMENDATIONS -> tab.text =
getString(R.string.recommendation)
+
LOCAL -> tab.text =
getString(R.string.local_audios)
+
LOCAL_SERVER -> tab.text =
getString(R.string.on_server)
+
else -> tab.text =
VKApiAudio.Genre.getTitleByGenre(requireActivity(), fid)
}
@@ -86,19 +96,23 @@ class AudiosTabsFragment : BaseFragment(), MenuProvider {
fragment.requireArguments().putBoolean(AudiosFragment.EXTRA_IN_TABS_CONTAINER, true)
fragment
}
+
LOCAL -> {
val fragment = AudiosLocalFragment.newInstance(accountId)
fragment.requireArguments().putBoolean(AudiosFragment.EXTRA_IN_TABS_CONTAINER, true)
fragment
}
+
LOCAL_SERVER -> {
AudiosLocalServerFragment.newInstance(accountId)
}
+
MY_AUDIO -> {
val args = AudiosFragment.buildArgs(accountId, ownerId, null, null)
args.putBoolean(AudiosFragment.EXTRA_IN_TABS_CONTAINER, true)
AudiosFragment.newInstance(args)
}
+
MY_RECOMMENDATIONS -> {
val fragment = AudiosRecommendationFragment.newInstance(
accountId, ownerId, false, 0
@@ -106,6 +120,7 @@ class AudiosTabsFragment : BaseFragment(), MenuProvider {
fragment.requireArguments().putBoolean(AudiosFragment.EXTRA_IN_TABS_CONTAINER, true)
fragment
}
+
else -> {
val fragment = AudiosRecommendationFragment.newInstance(
accountId, ownerId, true, option_menu
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audioplaylists/AudioPlaylistsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audioplaylists/AudioPlaylistsPresenter.kt
index 754bc4dfa..4803a9ff7 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audioplaylists/AudioPlaylistsPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audioplaylists/AudioPlaylistsPresenter.kt
@@ -25,7 +25,7 @@ import dev.ragnarok.fenrir.util.Utils.safeCheck
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.disposables.Disposable
-import java.util.*
+import java.util.Locale
import java.util.concurrent.TimeUnit
class AudioPlaylistsPresenter(accountId: Long, val owner_id: Long, savedInstanceState: Bundle?) :
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 62f33cf2d..f9aa3a086 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
@@ -18,7 +18,9 @@ import com.google.android.material.card.MaterialCardView
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.BaseTransientBottomBar
import com.squareup.picasso3.Transformation
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.AccountType
+import dev.ragnarok.fenrir.Constants
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.SendAttachmentsActivity.Companion.startForSendAttachments
import dev.ragnarok.fenrir.api.model.AccessIdPair
import dev.ragnarok.fenrir.domain.IAudioInteractor
@@ -26,6 +28,7 @@ import dev.ragnarok.fenrir.domain.InteractorFactory
import dev.ragnarok.fenrir.fragment.base.RecyclerBindableAdapter
import dev.ragnarok.fenrir.fragment.search.SearchContentType
import dev.ragnarok.fenrir.fragment.search.criteria.AudioSearchCriteria
+import dev.ragnarok.fenrir.fromIOToMain
import dev.ragnarok.fenrir.media.music.MusicPlaybackController.canPlayAfterCurrent
import dev.ragnarok.fenrir.media.music.MusicPlaybackController.currentAudio
import dev.ragnarok.fenrir.media.music.MusicPlaybackController.isNowPlayingOrPreparingOrPaused
@@ -40,6 +43,8 @@ import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.Option
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.OptionRequest
import dev.ragnarok.fenrir.model.Audio
import dev.ragnarok.fenrir.model.menu.options.AudioOption
+import dev.ragnarok.fenrir.nonNullNoEmpty
+import dev.ragnarok.fenrir.orZero
import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.with
import dev.ragnarok.fenrir.picasso.transforms.PolyTransformation
import dev.ragnarok.fenrir.picasso.transforms.RoundTransformation
@@ -50,6 +55,7 @@ import dev.ragnarok.fenrir.place.PlaceFactory.getPlayerPlace
import dev.ragnarok.fenrir.place.PlaceFactory.getSingleTabSearchPlace
import dev.ragnarok.fenrir.settings.CurrentTheme
import dev.ragnarok.fenrir.settings.Settings
+import dev.ragnarok.fenrir.toMainThread
import dev.ragnarok.fenrir.util.AppPerms.hasReadWriteStoragePermission
import dev.ragnarok.fenrir.util.AppTextUtils
import dev.ragnarok.fenrir.util.DownloadWorkUtils.TrackIsDownloaded
@@ -216,6 +222,7 @@ class AudioRecyclerAdapter(
currAudio = currentAudio
updateAudio(currAudio)
}
+
PlayerStatus.REPEATMODE_CHANGED, PlayerStatus.SHUFFLEMODE_CHANGED, PlayerStatus.UPDATE_PLAY_LIST -> {}
}
}
@@ -275,6 +282,7 @@ class AudioRecyclerAdapter(
Utils.doWavesLottie(holder.visual, true)
holder.play_cover.setColorFilter(Color.parseColor("#44000000"))
}
+
2 -> {
Utils.doWavesLottie(holder.visual, false)
holder.play_cover.setColorFilter(Color.parseColor("#44000000"))
@@ -450,17 +458,21 @@ class AudioRecyclerAdapter(
Settings.get().accounts().current
).tryOpenWith(mContext)
}
+
AudioOption.play_item_after_current_audio -> playAfterCurrent(
audio
)
+
AudioOption.edit_track -> {
mClickListener?.onEdit(position, audio)
}
+
AudioOption.share_button -> startForSendAttachments(
mContext,
Settings.get().accounts().current,
audio
)
+
AudioOption.search_by_artist -> getSingleTabSearchPlace(
Settings.get().accounts().current,
SearchContentType.AUDIOS,
@@ -468,16 +480,19 @@ class AudioRecyclerAdapter(
audio.artist, by_artist = true, in_main_page = false
)
).tryOpenWith(mContext)
+
AudioOption.get_lyrics_menu -> get_lyrics(audio)
AudioOption.get_recommendation_by_audio -> SearchByAudioPlace(
Settings.get().accounts().current, audio.ownerId, audio.id
).tryOpenWith(mContext)
+
AudioOption.open_album -> getAudiosInAlbumPlace(
Settings.get().accounts().current,
audio.album_owner_id,
audio.albumId,
audio.album_access_key
).tryOpenWith(mContext)
+
AudioOption.copy_url -> {
val clipboard =
mContext.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager?
@@ -485,6 +500,7 @@ class AudioRecyclerAdapter(
clipboard?.setPrimaryClip(clip)
createCustomToast(mContext).showToast(R.string.copied)
}
+
AudioOption.add_item_audio -> {
val myAudio = audio.ownerId == Settings.get().accounts().current
if (myAudio) {
@@ -493,6 +509,7 @@ class AudioRecyclerAdapter(
addTrack(Settings.get().accounts().current, audio)
}
}
+
AudioOption.add_and_download_button -> {
if (audio.ownerId != Settings.get().accounts().current) {
addTrack(Settings.get().accounts().current, audio)
@@ -529,6 +546,7 @@ class AudioRecyclerAdapter(
}
?.show()
}
+
else -> {
audio.downloadIndicator = 0
updateDownloadState(holder, audio)
@@ -536,6 +554,7 @@ class AudioRecyclerAdapter(
}
}
}
+
AudioOption.save_item_audio -> {
if (!hasReadWriteStoragePermission(mContext)) {
mClickListener?.onRequestWritePermissions()
@@ -569,6 +588,7 @@ class AudioRecyclerAdapter(
}
?.show()
}
+
else -> {
audio.downloadIndicator = 0
updateDownloadState(holder, audio)
@@ -576,9 +596,11 @@ class AudioRecyclerAdapter(
}
}
}
+
AudioOption.bitrate_item_audio -> getMp3AndBitrate(
Settings.get().accounts().current, audio
)
+
AudioOption.goto_artist -> {
val artists = Utils.getArrayFromHash(
audio.main_artists
@@ -646,9 +668,11 @@ class AudioRecyclerAdapter(
audio.url.isNullOrEmpty() -> {
viewHolder.isSelectedView.setCardBackgroundColor(Color.parseColor("#ff0000"))
}
+
TrackIsDownloaded(audio) != 0 -> {
viewHolder.isSelectedView.setCardBackgroundColor(Color.parseColor("#00aa00"))
}
+
else -> {
viewHolder.isSelectedView.setCardBackgroundColor(
CurrentTheme.getColorPrimary(
@@ -743,6 +767,7 @@ class AudioRecyclerAdapter(
?.show()
}
}
+
else -> {
audio.downloadIndicator = 0
updateDownloadState(viewHolder, audio)
@@ -770,9 +795,11 @@ class AudioRecyclerAdapter(
audio.url.isNullOrEmpty() -> {
viewHolder.isSelectedView.setCardBackgroundColor(Color.parseColor("#ff0000"))
}
+
TrackIsDownloaded(audio) != 0 -> {
viewHolder.isSelectedView.setCardBackgroundColor(Color.parseColor("#00aa00"))
}
+
else -> {
viewHolder.isSelectedView.setCardBackgroundColor(
CurrentTheme.getColorPrimary(
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudiosFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudiosFragment.kt
index a91ce36ed..cba26817a 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudiosFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudiosFragment.kt
@@ -157,6 +157,7 @@ class AudiosFragment : BaseMvpFragment(), IAudiosV
isSelectMode -> View.GONE
Settings.get()
.other().isAudio_save_mode_button -> View.VISIBLE
+
else -> View.GONE
}
save_mode.setOnClickListener {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudiosPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudiosPresenter.kt
index dbe128189..8399f7596 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudiosPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/audios/AudiosPresenter.kt
@@ -30,7 +30,8 @@ import dev.ragnarok.fenrir.util.rxutils.RxUtils.ignore
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.disposables.Disposable
-import java.util.*
+import java.util.Collections
+import java.util.Locale
import java.util.concurrent.TimeUnit
class AudiosPresenter(
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/listedit/CatalogV2ListEditFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/listedit/CatalogV2ListEditFragment.kt
index 88c0e2d35..8c39e3ef5 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/listedit/CatalogV2ListEditFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/listedit/CatalogV2ListEditFragment.kt
@@ -1,7 +1,12 @@
package dev.ragnarok.fenrir.fragment.audio.catalog_v2.listedit
import android.os.Bundle
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
import androidx.recyclerview.widget.ItemTouchHelper
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/listedit/CatalogV2ListEditPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/listedit/CatalogV2ListEditPresenter.kt
index 4f6f26e1e..2e40730b5 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/listedit/CatalogV2ListEditPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/listedit/CatalogV2ListEditPresenter.kt
@@ -3,7 +3,7 @@ package dev.ragnarok.fenrir.fragment.audio.catalog_v2.listedit
import android.os.Bundle
import dev.ragnarok.fenrir.fragment.base.core.AbsPresenter
import dev.ragnarok.fenrir.settings.Settings
-import java.util.*
+import java.util.Collections
class CatalogV2ListEditPresenter(savedInstanceState: Bundle?) :
AbsPresenter(savedInstanceState) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/lists/CatalogV2ListFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/lists/CatalogV2ListFragment.kt
index dd701f698..66f98358c 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/lists/CatalogV2ListFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/lists/CatalogV2ListFragment.kt
@@ -3,7 +3,12 @@ package dev.ragnarok.fenrir.fragment.audio.catalog_v2.lists
import android.animation.Animator
import android.animation.ObjectAnimator
import android.os.Bundle
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
import androidx.fragment.app.Fragment
@@ -11,7 +16,9 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Extra
+import dev.ragnarok.fenrir.R
+import dev.ragnarok.fenrir.StubAnimatorListener
import dev.ragnarok.fenrir.activity.ActivityFeatures
import dev.ragnarok.fenrir.activity.ActivityUtils.supportToolbarFor
import dev.ragnarok.fenrir.fragment.audio.audioplaylists.AudioPlaylistsFragment
@@ -22,6 +29,7 @@ import dev.ragnarok.fenrir.fragment.audio.local.audioslocal.AudiosLocalFragment
import dev.ragnarok.fenrir.fragment.base.BaseMvpFragment
import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory
import dev.ragnarok.fenrir.fragment.localserver.audioslocalserver.AudiosLocalServerFragment
+import dev.ragnarok.fenrir.fromIOToMain
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2List
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory.Companion.TYPE_AUDIO
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory.Companion.TYPE_CATALOG
@@ -29,9 +37,11 @@ import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory.Comp
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory.Companion.TYPE_LOCAL_SERVER_AUDIO
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory.Companion.TYPE_PLAYLIST
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory.Companion.TYPE_RECOMMENDATIONS
+import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.place.PlaceFactory
import dev.ragnarok.fenrir.settings.CurrentTheme
import dev.ragnarok.fenrir.settings.Settings
+import dev.ragnarok.fenrir.trimmedNonNullNoEmpty
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.rxutils.RxUtils
import dev.ragnarok.fenrir.view.MySearchView
@@ -73,6 +83,7 @@ class CatalogV2ListFragment : BaseMvpFragment {
PlaceFactory.getCatalogV2AudioCatalogPlace(
requireArguments().getLong(Extra.ACCOUNT_ID),
@@ -83,6 +94,7 @@ class CatalogV2ListFragment : BaseMvpFragment {
PlaceFactory.getCatalogV2AudioCatalogPlace(
requireArguments().getLong(Extra.ACCOUNT_ID),
@@ -93,6 +105,7 @@ class CatalogV2ListFragment : BaseMvpFragment {
PlaceFactory.getCatalogV2AudioCatalogPlace(
requireArguments().getLong(Extra.ACCOUNT_ID),
@@ -103,6 +116,7 @@ class CatalogV2ListFragment : BaseMvpFragment {
PlaceFactory.getCatalogV2AudioCatalogPlace(
requireArguments().getLong(Extra.ACCOUNT_ID),
@@ -113,6 +127,7 @@ class CatalogV2ListFragment : BaseMvpFragment return false
}
}
@@ -315,9 +330,11 @@ class CatalogV2ListFragment : BaseMvpFragment return AudiosLocalFragment.newInstance(
requireArguments().getLong(Extra.ACCOUNT_ID)
)
+
TYPE_LOCAL_SERVER_AUDIO -> return AudiosLocalServerFragment.newInstance(
requireArguments().getLong(Extra.ACCOUNT_ID)
)
+
TYPE_AUDIO -> {
val args = AudiosFragment.buildArgs(
requireArguments().getLong(Extra.ACCOUNT_ID),
@@ -328,6 +345,7 @@ class CatalogV2ListFragment : BaseMvpFragment {
val fragment = AudioPlaylistsFragment.newInstance(
requireArguments().getLong(Extra.ACCOUNT_ID),
@@ -337,6 +355,7 @@ class CatalogV2ListFragment : BaseMvpFragment {
val fragment = AudiosRecommendationFragment.newInstance(
requireArguments().getLong(Extra.ACCOUNT_ID),
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/lists/CatalogV2ListPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/lists/CatalogV2ListPresenter.kt
index e9e81cb39..9ce6bdffe 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/lists/CatalogV2ListPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/lists/CatalogV2ListPresenter.kt
@@ -2,11 +2,13 @@ package dev.ragnarok.fenrir.fragment.audio.catalog_v2.lists
import android.content.Context
import android.os.Bundle
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.SendAttachmentsActivity.Companion.startForSendAttachments
import dev.ragnarok.fenrir.domain.IAudioInteractor
import dev.ragnarok.fenrir.domain.InteractorFactory
import dev.ragnarok.fenrir.fragment.base.AccountDependencyPresenter
+import dev.ragnarok.fenrir.fromIOToMain
+import dev.ragnarok.fenrir.ifNonNullNoEmpty
import dev.ragnarok.fenrir.model.AudioArtist
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2List
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory
@@ -16,6 +18,8 @@ import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory.Comp
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory.Companion.TYPE_LOCAL_SERVER_AUDIO
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory.Companion.TYPE_PLAYLIST
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2SortListCategory.Companion.TYPE_RECOMMENDATIONS
+import dev.ragnarok.fenrir.nonNullNoEmpty
+import dev.ragnarok.fenrir.orZero
import dev.ragnarok.fenrir.settings.Settings
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.disposables.Disposable
@@ -133,11 +137,13 @@ class CatalogV2ListPresenter(
)
)
}
+
TYPE_CATALOG -> {
if (catalogSections != null) {
mSections.addAll(catalogSections)
}
}
+
TYPE_LOCAL_AUDIO -> {
if (accountId == owner_id) {
mSections.add(
@@ -148,6 +154,7 @@ class CatalogV2ListPresenter(
)
}
}
+
TYPE_LOCAL_SERVER_AUDIO -> {
if (accountId == owner_id && accountId >= 0 && Settings.get()
.other().localServer.enabled
@@ -160,6 +167,7 @@ class CatalogV2ListPresenter(
)
}
}
+
TYPE_PLAYLIST -> {
mSections.add(
CatalogV2List.CatalogV2ListItem(
@@ -168,6 +176,7 @@ class CatalogV2ListPresenter(
)
)
}
+
TYPE_RECOMMENDATIONS -> {
mSections.add(
CatalogV2List.CatalogV2ListItem(
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 586aba22d..5a0892ae1 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
@@ -23,7 +23,9 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.BaseTransientBottomBar
import com.google.android.material.textfield.TextInputEditText
import com.squareup.picasso3.Transformation
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.AccountType
+import dev.ragnarok.fenrir.Constants
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.SendAttachmentsActivity
import dev.ragnarok.fenrir.domain.IAudioInteractor
import dev.ragnarok.fenrir.domain.InteractorFactory
@@ -31,6 +33,7 @@ import dev.ragnarok.fenrir.fragment.audio.catalog_v2.sections.holders.IViewHolde
import dev.ragnarok.fenrir.fragment.base.RecyclerBindableAdapter
import dev.ragnarok.fenrir.fragment.search.SearchContentType
import dev.ragnarok.fenrir.fragment.search.criteria.AudioSearchCriteria
+import dev.ragnarok.fenrir.fromIOToMain
import dev.ragnarok.fenrir.listener.EndlessRecyclerOnScrollListener
import dev.ragnarok.fenrir.listener.PicassoPauseOnScrollListener
import dev.ragnarok.fenrir.media.music.MusicPlaybackController
@@ -52,6 +55,8 @@ import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2Layout.CATALOG_V2_HOL
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2Layout.CATALOG_V2_HOLDER.Companion.TYPE_CATALOG_TRIPLE_STACKED_SLIDER
import dev.ragnarok.fenrir.model.menu.options.AudioOption
import dev.ragnarok.fenrir.module.StringHash
+import dev.ragnarok.fenrir.nonNullNoEmpty
+import dev.ragnarok.fenrir.orZero
import dev.ragnarok.fenrir.picasso.PicassoInstance
import dev.ragnarok.fenrir.picasso.transforms.ImageHelper
import dev.ragnarok.fenrir.picasso.transforms.PolyTransformation
@@ -59,7 +64,13 @@ import dev.ragnarok.fenrir.picasso.transforms.RoundTransformation
import dev.ragnarok.fenrir.place.PlaceFactory
import dev.ragnarok.fenrir.settings.CurrentTheme
import dev.ragnarok.fenrir.settings.Settings
-import dev.ragnarok.fenrir.util.*
+import dev.ragnarok.fenrir.toMainThread
+import dev.ragnarok.fenrir.util.AppPerms
+import dev.ragnarok.fenrir.util.AppTextUtils
+import dev.ragnarok.fenrir.util.DownloadWorkUtils
+import dev.ragnarok.fenrir.util.Mp3InfoHelper
+import dev.ragnarok.fenrir.util.Utils
+import dev.ragnarok.fenrir.util.ViewUtils
import dev.ragnarok.fenrir.util.hls.M3U8
import dev.ragnarok.fenrir.util.toast.CustomSnackbars
import dev.ragnarok.fenrir.util.toast.CustomToast
@@ -100,12 +111,15 @@ class CatalogV2SectionAdapter(
type
)
}
+
AbsModelType.MODEL_AUDIO -> {
AudioHolder(view)
}
+
AbsModelType.MODEL_AUDIO_PLAYLIST -> {
PlaylistHolder(view)
}
+
else -> CatalogV2Layout.createHolder(type).create(view)
}
}
@@ -115,12 +129,15 @@ class CatalogV2SectionAdapter(
TYPE_CATALOG_SLIDER, TYPE_CATALOG_LIST, TYPE_CATALOG_TRIPLE_STACKED_SLIDER -> {
R.layout.item_catalog_v2_content_horizontal
}
+
AbsModelType.MODEL_AUDIO -> {
R.layout.item_audio
}
+
AbsModelType.MODEL_AUDIO_PLAYLIST -> {
R.layout.item_catalog_v2_audio_playlist
}
+
else -> CatalogV2Layout.createHolder(type).getLayout()
}
}
@@ -195,11 +212,13 @@ class CatalogV2SectionAdapter(
3,
StaggeredGridLayoutManager.HORIZONTAL
)
+
TYPE_CATALOG_LIST, TYPE_CATALOG_SLIDER -> LinearLayoutManager(
itemView.context,
LinearLayoutManager.HORIZONTAL,
false
)
+
else -> {
throw UnsupportedOperationException()
}
@@ -488,6 +507,7 @@ class CatalogV2SectionAdapter(
currAudio = currentAudio
updateAudio(currAudio)
}
+
PlayerStatus.REPEATMODE_CHANGED, PlayerStatus.SHUFFLEMODE_CHANGED, PlayerStatus.UPDATE_PLAY_LIST -> {}
}
}
@@ -519,6 +539,7 @@ class CatalogV2SectionAdapter(
Utils.doWavesLottie(holder.visual, true)
holder.play_cover.setColorFilter(Color.parseColor("#44000000"))
}
+
2 -> {
Utils.doWavesLottie(holder.visual, false)
holder.play_cover.setColorFilter(Color.parseColor("#44000000"))
@@ -730,17 +751,21 @@ class CatalogV2SectionAdapter(
AudioOption.play_item_audio -> {
doPlay(position, audio)
}
+
AudioOption.play_item_after_current_audio -> MusicPlaybackController.playAfterCurrent(
audio
)
+
AudioOption.edit_track -> {
fireEditTrackIn(position, audio)
}
+
AudioOption.share_button -> SendAttachmentsActivity.startForSendAttachments(
mContext,
Settings.get().accounts().current,
audio
)
+
AudioOption.search_by_artist -> PlaceFactory.getSingleTabSearchPlace(
Settings.get().accounts().current,
SearchContentType.AUDIOS,
@@ -748,16 +773,19 @@ class CatalogV2SectionAdapter(
audio.artist, by_artist = true, in_main_page = false
)
).tryOpenWith(mContext)
+
AudioOption.get_lyrics_menu -> get_lyrics(audio)
AudioOption.get_recommendation_by_audio -> PlaceFactory.SearchByAudioPlace(
Settings.get().accounts().current, audio.ownerId, audio.id
).tryOpenWith(mContext)
+
AudioOption.open_album -> PlaceFactory.getAudiosInAlbumPlace(
Settings.get().accounts().current,
audio.album_owner_id,
audio.albumId,
audio.album_access_key
).tryOpenWith(mContext)
+
AudioOption.copy_url -> {
val clipboard =
mContext.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager?
@@ -765,6 +793,7 @@ class CatalogV2SectionAdapter(
clipboard?.setPrimaryClip(clip)
CustomToast.createCustomToast(mContext).showToast(R.string.copied)
}
+
AudioOption.add_item_audio -> {
val myAudio = audio.ownerId == Settings.get().accounts().current
if (myAudio) {
@@ -773,6 +802,7 @@ class CatalogV2SectionAdapter(
addTrack(Settings.get().accounts().current, audio)
}
}
+
AudioOption.add_and_download_button -> {
if (audio.ownerId != Settings.get().accounts().current) {
addTrack(Settings.get().accounts().current, audio)
@@ -793,6 +823,7 @@ class CatalogV2SectionAdapter(
when (ret) {
0 -> CustomToast.createCustomToast(mContext)
.showToastBottom(R.string.saved_audio)
+
1, 2 -> {
CustomSnackbars.createCustomSnackbars(view)
?.setDurationSnack(BaseTransientBottomBar.LENGTH_LONG)
@@ -810,6 +841,7 @@ class CatalogV2SectionAdapter(
}
?.show()
}
+
else -> {
audio.downloadIndicator = 0
updateDownloadState(holder, audio)
@@ -818,6 +850,7 @@ class CatalogV2SectionAdapter(
}
}
}
+
AudioOption.save_item_audio -> {
if (!AppPerms.hasReadWriteStoragePermission(mContext)) {
clickListener?.onRequestWritePermissions()
@@ -835,6 +868,7 @@ class CatalogV2SectionAdapter(
when (ret) {
0 -> CustomToast.createCustomToast(mContext)
.showToastBottom(R.string.saved_audio)
+
1, 2 -> {
CustomSnackbars.createCustomSnackbars(view)
?.setDurationSnack(BaseTransientBottomBar.LENGTH_LONG)
@@ -852,6 +886,7 @@ class CatalogV2SectionAdapter(
}
?.show()
}
+
else -> {
audio.downloadIndicator = 0
updateDownloadState(holder, audio)
@@ -860,9 +895,11 @@ class CatalogV2SectionAdapter(
}
}
}
+
AudioOption.bitrate_item_audio -> getMp3AndBitrate(
Settings.get().accounts().current, audio
)
+
AudioOption.goto_artist -> {
val artists = Utils.getArrayFromHash(
audio.main_artists
@@ -984,9 +1021,11 @@ class CatalogV2SectionAdapter(
audio.url.isNullOrEmpty() -> {
isSelectedView.setCardBackgroundColor(Color.parseColor("#ff0000"))
}
+
DownloadWorkUtils.TrackIsDownloaded(audio) != 0 -> {
isSelectedView.setCardBackgroundColor(Color.parseColor("#00aa00"))
}
+
else -> {
isSelectedView.setCardBackgroundColor(
CurrentTheme.getColorPrimary(
@@ -1061,6 +1100,7 @@ class CatalogV2SectionAdapter(
when (ret) {
0 -> CustomToast.createCustomToast(mContext)
.showToastBottom(R.string.saved_audio)
+
1, 2 -> {
v?.let {
CustomSnackbars.createCustomSnackbars(it)
@@ -1080,6 +1120,7 @@ class CatalogV2SectionAdapter(
?.show()
}
}
+
else -> {
audio.downloadIndicator = 0
updateDownloadState(this, audio)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionFragment.kt
index c138a7dd0..0dd1733b8 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionFragment.kt
@@ -136,10 +136,12 @@ class CatalogV2SectionFragment :
val columnCount = resources.getInteger(R.integer.photos_column_count)
GridLayoutManager(requireActivity(), columnCount)
}
+
"videos", "artist_videos" -> {
val columnCount = resources.getInteger(R.integer.videos_column_count)
GridLayoutManager(requireActivity(), columnCount)
}
+
else -> {
LinearLayoutManager(requireActivity())
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionPresenter.kt
index 2582e3645..7665569d0 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/catalog_v2/sections/CatalogV2SectionPresenter.kt
@@ -6,7 +6,11 @@ import dev.ragnarok.fenrir.domain.IAudioInteractor
import dev.ragnarok.fenrir.domain.InteractorFactory
import dev.ragnarok.fenrir.fragment.base.AccountDependencyPresenter
import dev.ragnarok.fenrir.fromIOToMain
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.AbsModel
+import dev.ragnarok.fenrir.model.AbsModelType
+import dev.ragnarok.fenrir.model.Audio
+import dev.ragnarok.fenrir.model.AudioPlaylist
+import dev.ragnarok.fenrir.model.LoadMoreState
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2Block
import dev.ragnarok.fenrir.model.catalog_v2_audio.CatalogV2Section
import dev.ragnarok.fenrir.nonNullNoEmpty
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 3c0c48fe6..3a1a85189 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
@@ -173,6 +173,7 @@ class AudioLocalRecyclerAdapter(private val mContext: Context, private var data:
Utils.doWavesLottie(holder.visual, true)
holder.play_cover.setColorFilter(Color.parseColor("#44000000"))
}
+
2 -> {
Utils.doWavesLottie(holder.visual, false)
holder.play_cover.setColorFilter(Color.parseColor("#44000000"))
@@ -257,18 +258,22 @@ class AudioLocalRecyclerAdapter(private val mContext: Context, private var data:
AudioLocalOption.upload_item_audio -> {
mClickListener?.onUpload(position, audio)
}
+
AudioLocalOption.play_via_local_server -> {
mClickListener?.onRemotePlay(position, audio)
}
+
AudioLocalOption.play_item_audio -> {
mClickListener?.onClick(position, audio)
if (Settings.get().other().isShow_mini_player) getPlayerPlace(
Settings.get().accounts().current
).tryOpenWith(mContext)
}
+
AudioLocalOption.play_item_after_current_audio -> playAfterCurrent(
audio
)
+
AudioLocalOption.bitrate_item_audio -> getLocalBitrate(audio.url)
AudioLocalOption.strip_metadata_item_audio -> {
audio.url?.let { it ->
@@ -286,6 +291,7 @@ class AudioLocalRecyclerAdapter(private val mContext: Context, private var data:
)
}
}
+
AudioLocalOption.delete_item_audio -> try {
if (mContext.getContentResolver()
.delete(Uri.parse(audio.url), null, null) == 1
@@ -299,6 +305,7 @@ class AudioLocalRecyclerAdapter(private val mContext: Context, private var data:
} catch (e: Exception) {
createCustomToast(mContext).showToastError(e.localizedMessage)
}
+
else -> {}
}
}
@@ -400,6 +407,7 @@ class AudioLocalRecyclerAdapter(private val mContext: Context, private var data:
currAudio = currentAudio
updateAudio(currAudio)
}
+
PlayerStatus.REPEATMODE_CHANGED, PlayerStatus.SHUFFLEMODE_CHANGED, PlayerStatus.UPDATE_PLAY_LIST -> {}
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudiosLocalPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudiosLocalPresenter.kt
index 2654c3b81..1360c53f6 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudiosLocalPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudiosLocalPresenter.kt
@@ -13,17 +13,21 @@ import dev.ragnarok.fenrir.media.music.MusicPlaybackService.Companion.startForPl
import dev.ragnarok.fenrir.model.Audio
import dev.ragnarok.fenrir.place.PlaceFactory.getPlayerPlace
import dev.ragnarok.fenrir.settings.Settings
-import dev.ragnarok.fenrir.upload.*
+import dev.ragnarok.fenrir.upload.IUploadManager
import dev.ragnarok.fenrir.upload.IUploadManager.IProgressUpdate
+import dev.ragnarok.fenrir.upload.Upload
+import dev.ragnarok.fenrir.upload.UploadDestination
import dev.ragnarok.fenrir.upload.UploadDestination.Companion.forAudio
import dev.ragnarok.fenrir.upload.UploadDestination.Companion.forRemotePlay
+import dev.ragnarok.fenrir.upload.UploadIntent
+import dev.ragnarok.fenrir.upload.UploadResult
import dev.ragnarok.fenrir.util.Pair
import dev.ragnarok.fenrir.util.Utils.SafeCallCheckInt
import dev.ragnarok.fenrir.util.Utils.findIndexById
import dev.ragnarok.fenrir.util.Utils.getCauseIfRuntime
import dev.ragnarok.fenrir.util.Utils.safeCheck
import io.reactivex.rxjava3.disposables.CompositeDisposable
-import java.util.*
+import java.util.Locale
class AudiosLocalPresenter(accountId: Long, savedInstanceState: Bundle?) :
AccountDependencyPresenter(accountId, savedInstanceState) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsPresenter.kt
index c3e831eb3..83ec1758a 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsPresenter.kt
@@ -8,7 +8,7 @@ import dev.ragnarok.fenrir.model.LocalImageAlbum
import dev.ragnarok.fenrir.util.AppPerms.hasReadStoragePermission
import dev.ragnarok.fenrir.util.Objects.safeEquals
import dev.ragnarok.fenrir.util.PersistentLogger
-import java.util.*
+import java.util.Locale
class LocalAudioAlbumsPresenter(savedInstanceState: Bundle?) :
RxSupportPresenter(savedInstanceState) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/AttachmentsViewBinder.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/AttachmentsViewBinder.kt
index cdb110938..caff10748 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/AttachmentsViewBinder.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/AttachmentsViewBinder.kt
@@ -112,7 +112,7 @@ class AttachmentsViewBinder(
messageId: Int?,
peerId: Long?
) {
- if (voices == null || voices.isEmpty() || container == null) {
+ if (voices.isNullOrEmpty() || container == null) {
container?.visibility = View.GONE
return
}
@@ -295,7 +295,7 @@ class AttachmentsViewBinder(
}
private fun displayStickers(stickers: List?, stickersContainer: ViewGroup?) {
- if (stickers == null || stickers.isEmpty() || stickersContainer == null) {
+ if (stickers.isNullOrEmpty() || stickersContainer == null) {
stickersContainer?.visibility = View.GONE
return
}
@@ -347,7 +347,7 @@ class AttachmentsViewBinder(
reduce: Boolean,
layout: Int
) {
- if (posts == null || posts.isEmpty() || container == null) {
+ if (posts.isNullOrEmpty() || container == null) {
container?.visibility = View.GONE
return
}
@@ -410,7 +410,7 @@ class AttachmentsViewBinder(
@SuppressLint("SetTextI18n")
fun displayFriendsPost(users: List?, container: ViewGroup?, layout: Int) {
- if (users == null || users.isEmpty() || container == null) {
+ if (users.isNullOrEmpty() || container == null) {
container?.visibility = View.GONE
return
}
@@ -466,7 +466,7 @@ class AttachmentsViewBinder(
fwdContainer: ViewGroup?,
postsAsLinks: Boolean
) {
- if (fwds == null || fwds.isEmpty() || fwdContainer == null) {
+ if (fwds.isNullOrEmpty() || fwdContainer == null) {
fwdContainer?.visibility = View.GONE
return
}
@@ -548,7 +548,7 @@ class AttachmentsViewBinder(
}
private fun displayDocs(docs: List?, root: ViewGroup?) {
- if (docs == null || docs.isEmpty() || root == null) {
+ if (docs.isNullOrEmpty() || root == null) {
root?.visibility = View.GONE
return
}
@@ -662,6 +662,7 @@ class AttachmentsViewBinder(
ivPhotoT.visibility = View.GONE
ivType.setImageResource(R.drawable.file)
}
+
AttachmentsTypes.GRAFFITI -> {
ivPhotoT.visibility = View.GONE
if (imageUrl != null) {
@@ -673,6 +674,7 @@ class AttachmentsViewBinder(
ivType.setImageResource(R.drawable.counter)
}
}
+
AttachmentsTypes.AUDIO_PLAYLIST -> if (imageUrl != null) {
ivType.visibility = View.VISIBLE
ivPhotoT.visibility = View.VISIBLE
@@ -681,6 +683,7 @@ class AttachmentsViewBinder(
} else {
ivPhotoT.visibility = View.GONE
}
+
AttachmentsTypes.ALBUM -> if (imageUrl != null) {
ivType.visibility = View.VISIBLE
ivPhotoT.visibility = View.VISIBLE
@@ -689,6 +692,7 @@ class AttachmentsViewBinder(
} else {
ivPhotoT.visibility = View.GONE
}
+
AttachmentsTypes.MARKET_ALBUM -> if (imageUrl != null) {
ivType.visibility = View.VISIBLE
ivPhotoT.visibility = View.VISIBLE
@@ -697,6 +701,7 @@ class AttachmentsViewBinder(
} else {
ivPhotoT.visibility = View.GONE
}
+
AttachmentsTypes.ARTIST -> if (imageUrl != null) {
ivType.visibility = View.VISIBLE
ivPhotoT.visibility = View.VISIBLE
@@ -705,6 +710,7 @@ class AttachmentsViewBinder(
} else {
ivPhotoT.visibility = View.GONE
}
+
AttachmentsTypes.MARKET -> if (imageUrl != null) {
ivType.visibility = View.VISIBLE
ivPhotoT.visibility = View.VISIBLE
@@ -713,6 +719,7 @@ class AttachmentsViewBinder(
} else {
ivPhotoT.visibility = View.GONE
}
+
AttachmentsTypes.STORY -> {
ivPhotoT.visibility = View.GONE
ivType.visibility = View.GONE
@@ -733,6 +740,7 @@ class AttachmentsViewBinder(
PhotoSize.X,
true
)
+
st.video != null -> st.video?.image
else -> null
}
@@ -743,6 +751,7 @@ class AttachmentsViewBinder(
ivPhotoT.visibility = View.GONE
}
}
+
AttachmentsTypes.POST -> {
ivPhotoT.visibility = View.GONE
ivType.visibility = View.GONE
@@ -767,6 +776,7 @@ class AttachmentsViewBinder(
null, null
)
}
+
AttachmentsTypes.WALL_REPLY -> {
ivPhotoT.visibility = View.GONE
ivType.visibility = View.VISIBLE
@@ -793,6 +803,7 @@ class AttachmentsViewBinder(
null, null
)
}
+
AttachmentsTypes.EVENT -> {
ivPhotoT.visibility = View.GONE
ivType.visibility = View.VISIBLE
@@ -809,6 +820,7 @@ class AttachmentsViewBinder(
ivPhoto_Post.visibility = View.GONE
}
}
+
AttachmentsTypes.LINK, AttachmentsTypes.WIKI_PAGE -> {
ivType.visibility = View.VISIBLE
if (imageUrl != null) {
@@ -819,26 +831,31 @@ class AttachmentsViewBinder(
}
ivType.setImageResource(R.drawable.attachment)
}
+
AttachmentsTypes.NOT_SUPPORTED -> {
ivType.visibility = View.GONE
ivPhotoT.visibility = View.VISIBLE
ivPhotoT.setImageResource(R.drawable.not_supported)
}
+
AttachmentsTypes.POLL -> {
ivType.visibility = View.VISIBLE
ivPhotoT.visibility = View.GONE
ivType.setImageResource(R.drawable.chart_bar)
}
+
AttachmentsTypes.CALL -> {
ivType.visibility = View.VISIBLE
ivPhotoT.visibility = View.GONE
ivType.setImageResource(R.drawable.phone_call)
}
+
AttachmentsTypes.GEO -> {
ivType.visibility = View.VISIBLE
ivPhotoT.visibility = View.GONE
ivType.setImageResource(R.drawable.geo)
}
+
else -> {
ivType.visibility = View.GONE
ivPhotoT.visibility = View.GONE
@@ -852,7 +869,7 @@ class AttachmentsViewBinder(
}
private fun displayArticles(articles: List?, root: ViewGroup?) {
- if (articles == null || articles.isEmpty() || root == null) {
+ if (articles.isNullOrEmpty() || root == null) {
root?.visibility = View.GONE
return
}
@@ -939,26 +956,32 @@ class AttachmentsViewBinder(
AttachmentsTypes.DOC -> mAttachmentsActionCallback?.onDocPreviewOpen(
link.attachment as Document
)
+
AttachmentsTypes.POST -> mAttachmentsActionCallback?.onPostOpen(link.attachment as Post)
AttachmentsTypes.LINK -> mAttachmentsActionCallback?.onLinkOpen(link.attachment as Link)
AttachmentsTypes.POLL -> mAttachmentsActionCallback?.onPollOpen(link.attachment as Poll)
AttachmentsTypes.WIKI_PAGE -> mAttachmentsActionCallback?.onWikiPageOpen(
link.attachment as WikiPage
)
+
AttachmentsTypes.STORY -> mAttachmentsActionCallback?.onStoryOpen(link.attachment as Story)
AttachmentsTypes.AUDIO_PLAYLIST -> mAttachmentsActionCallback?.onAudioPlaylistOpen(
link.attachment as AudioPlaylist
)
+
AttachmentsTypes.WALL_REPLY -> mAttachmentsActionCallback?.onWallReplyOpen(
link.attachment as WallReply
)
+
AttachmentsTypes.EVENT -> mAttachmentsActionCallback?.onOpenOwner(-1 * abs((link.attachment as Event).id))
AttachmentsTypes.ALBUM -> mAttachmentsActionCallback?.onPhotoAlbumOpen(
link.attachment as PhotoAlbum
)
+
AttachmentsTypes.MARKET_ALBUM -> mAttachmentsActionCallback?.onMarketAlbumOpen(
link.attachment as MarketAlbum
)
+
AttachmentsTypes.MARKET -> mAttachmentsActionCallback?.onMarketOpen(link.attachment as Market)
AttachmentsTypes.ARTIST -> mAttachmentsActionCallback?.onArtistOpen(link.attachment as AudioArtist)
AttachmentsTypes.NOT_SUPPORTED -> {
@@ -969,6 +992,7 @@ class AttachmentsViewBinder(
clipboard?.setPrimaryClip(clip)
CustomToast.createCustomToast(mContext).showToast(R.string.copied)
}
+
AttachmentsTypes.GEO -> {
val geo = link.attachment as Geo
if (geo.latitude.nonNullNoEmpty() && geo.longitude.nonNullNoEmpty() && mContext is Activity) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/BaseMvpBottomSheetDialogFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/BaseMvpBottomSheetDialogFragment.kt
index aaf0aada7..ee13abc14 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/BaseMvpBottomSheetDialogFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/BaseMvpBottomSheetDialogFragment.kt
@@ -14,7 +14,12 @@ import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.ActivityUtils
import dev.ragnarok.fenrir.api.ApiException
import dev.ragnarok.fenrir.fragment.base.compat.AbsMvpBottomSheetDialogFragment
-import dev.ragnarok.fenrir.fragment.base.core.*
+import dev.ragnarok.fenrir.fragment.base.core.AbsPresenter
+import dev.ragnarok.fenrir.fragment.base.core.IErrorView
+import dev.ragnarok.fenrir.fragment.base.core.IMvpView
+import dev.ragnarok.fenrir.fragment.base.core.IProgressView
+import dev.ragnarok.fenrir.fragment.base.core.IToastView
+import dev.ragnarok.fenrir.fragment.base.core.IToolbarView
import dev.ragnarok.fenrir.service.ErrorLocalizer.localizeThrowable
import dev.ragnarok.fenrir.util.ViewUtils
import dev.ragnarok.fenrir.util.spots.SpotsDialog
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/BaseMvpFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/BaseMvpFragment.kt
index d41a51088..9697952b1 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/BaseMvpFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/BaseMvpFragment.kt
@@ -15,7 +15,12 @@ import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.ActivityUtils
import dev.ragnarok.fenrir.api.ApiException
import dev.ragnarok.fenrir.fragment.base.compat.AbsMvpFragment
-import dev.ragnarok.fenrir.fragment.base.core.*
+import dev.ragnarok.fenrir.fragment.base.core.AbsPresenter
+import dev.ragnarok.fenrir.fragment.base.core.IErrorView
+import dev.ragnarok.fenrir.fragment.base.core.IMvpView
+import dev.ragnarok.fenrir.fragment.base.core.IProgressView
+import dev.ragnarok.fenrir.fragment.base.core.IToastView
+import dev.ragnarok.fenrir.fragment.base.core.IToolbarView
import dev.ragnarok.fenrir.service.ErrorLocalizer.localizeThrowable
import dev.ragnarok.fenrir.util.ViewUtils
import dev.ragnarok.fenrir.util.spots.SpotsDialog
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/DocLink.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/DocLink.kt
index 38cff2b94..0bce9edde 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/DocLink.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/DocLink.kt
@@ -3,11 +3,30 @@ package dev.ragnarok.fenrir.fragment.base
import android.content.Context
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.db.model.AttachmentsTypes
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.AbsModel
+import dev.ragnarok.fenrir.model.AbsModelType
+import dev.ragnarok.fenrir.model.AudioArtist
+import dev.ragnarok.fenrir.model.AudioPlaylist
+import dev.ragnarok.fenrir.model.Call
+import dev.ragnarok.fenrir.model.Document
+import dev.ragnarok.fenrir.model.Event
+import dev.ragnarok.fenrir.model.Geo
+import dev.ragnarok.fenrir.model.Graffiti
+import dev.ragnarok.fenrir.model.Link
+import dev.ragnarok.fenrir.model.Market
+import dev.ragnarok.fenrir.model.MarketAlbum
+import dev.ragnarok.fenrir.model.NotSupported
+import dev.ragnarok.fenrir.model.PhotoAlbum
+import dev.ragnarok.fenrir.model.Poll
+import dev.ragnarok.fenrir.model.Post
+import dev.ragnarok.fenrir.model.Story
+import dev.ragnarok.fenrir.model.WallReply
+import dev.ragnarok.fenrir.model.WikiPage
import dev.ragnarok.fenrir.settings.Settings
import dev.ragnarok.fenrir.util.AppTextUtils
import dev.ragnarok.fenrir.util.Utils
-import java.util.*
+import java.util.Calendar
+import java.util.Locale
class DocLink(val attachment: AbsModel) {
@AttachmentsTypes
@@ -19,6 +38,7 @@ class DocLink(val attachment: AbsModel) {
val doc = attachment as Document
return doc.getPreviewWithSize(Settings.get().main().prefPreviewImageSize, true)
}
+
AttachmentsTypes.POST -> return (attachment as Post).authorPhoto
AttachmentsTypes.EVENT -> return (attachment as Event).subjectPhoto
AttachmentsTypes.WALL_REPLY -> return (attachment as WallReply).authorPhoto
@@ -31,12 +51,14 @@ class DocLink(val attachment: AbsModel) {
true
)
}
+
AttachmentsTypes.MARKET_ALBUM -> {
val market_album = attachment as MarketAlbum
return market_album.getPhoto()?.sizes?.getUrlForSize(
Settings.get().main().prefPreviewImageSize, true
)
}
+
AttachmentsTypes.ARTIST -> return (attachment as AudioArtist).getMaxPhoto()
AttachmentsTypes.MARKET -> return (attachment as Market).thumb_photo
AttachmentsTypes.AUDIO_PLAYLIST -> return (attachment as AudioPlaylist).getThumb_image()
@@ -76,11 +98,13 @@ class DocLink(val attachment: AbsModel) {
}
return title
}
+
AttachmentsTypes.NOT_SUPPORTED -> return context.getString(R.string.not_yet_implemented_message)
AttachmentsTypes.POLL -> {
val poll = attachment as Poll
return context.getString(if (poll.isAnonymous) R.string.anonymous_poll else R.string.open_poll)
}
+
AttachmentsTypes.STORY -> return (attachment as Story).owner?.fullName
AttachmentsTypes.WIKI_PAGE -> return context.getString(R.string.wiki_page)
AttachmentsTypes.CALL -> {
@@ -89,6 +113,7 @@ class DocLink(val attachment: AbsModel) {
.accounts().current
) context.getString(R.string.input_call) else context.getString(R.string.output_call)
}
+
AttachmentsTypes.GEO -> {
return (attachment as Geo).title
}
@@ -113,10 +138,12 @@ class DocLink(val attachment: AbsModel) {
AttachmentsTypes.DOC -> return AppTextUtils.getSizeString(
(attachment as Document).size
)
+
AttachmentsTypes.NOT_SUPPORTED -> {
val ns = attachment as NotSupported
return ns.getType() + ": " + ns.getBody()
}
+
AttachmentsTypes.POST -> {
val post = attachment as Post
return when {
@@ -127,6 +154,7 @@ class DocLink(val attachment: AbsModel) {
)
}
}
+
AttachmentsTypes.EVENT -> {
val event = attachment as Event
return Utils.firstNonEmptyString(
@@ -134,16 +162,19 @@ class DocLink(val attachment: AbsModel) {
" "
) + ", " + Utils.firstNonEmptyString(event.text)
}
+
AttachmentsTypes.WALL_REPLY -> {
val comment = attachment as WallReply
return comment.text
}
+
AttachmentsTypes.LINK -> return (attachment as Link).url
AttachmentsTypes.ALBUM -> return Utils.firstNonEmptyString(
(attachment as PhotoAlbum).getDescription(),
" "
) +
" " + context.getString(R.string.photos_count, attachment.getSize())
+
AttachmentsTypes.POLL -> return (attachment as Poll).question
AttachmentsTypes.WIKI_PAGE -> return (attachment as WikiPage).title
AttachmentsTypes.CALL -> return (attachment as Call).getLocalizedState(context)
@@ -152,15 +183,18 @@ class DocLink(val attachment: AbsModel) {
attachment.description, " "
)
)
+
AttachmentsTypes.MARKET_ALBUM -> return context.getString(
R.string.markets_count,
(attachment as MarketAlbum).getCount()
)
+
AttachmentsTypes.AUDIO_PLAYLIST -> return Utils.firstNonEmptyString(
(attachment as AudioPlaylist).getArtist_name(),
" "
) + " " +
attachment.getCount() + " " + context.getString(R.string.audios_pattern_count)
+
AttachmentsTypes.STORY -> {
val item = attachment as Story
return if (item.expires <= 0) null else {
@@ -181,6 +215,7 @@ class DocLink(val attachment: AbsModel) {
}
}
}
+
AttachmentsTypes.GEO -> {
val geo = attachment as Geo
return geo.latitude.orEmpty() + " " + geo.longitude.orEmpty() + "\r\n" + geo.address.orEmpty()
@@ -199,54 +234,71 @@ class DocLink(val attachment: AbsModel) {
AbsModelType.MODEL_DOCUMENT -> {
return AttachmentsTypes.DOC
}
+
AbsModelType.MODEL_POST -> {
return AttachmentsTypes.POST
}
+
AbsModelType.MODEL_LINK -> {
return AttachmentsTypes.LINK
}
+
AbsModelType.MODEL_POLL -> {
return AttachmentsTypes.POLL
}
+
AbsModelType.MODEL_WIKI_PAGE -> {
return AttachmentsTypes.WIKI_PAGE
}
+
AbsModelType.MODEL_STORY -> {
return AttachmentsTypes.STORY
}
+
AbsModelType.MODEL_CALL -> {
return AttachmentsTypes.CALL
}
+
AbsModelType.MODEL_GEO -> {
return AttachmentsTypes.GEO
}
+
AbsModelType.MODEL_AUDIO_ARTIST -> {
return AttachmentsTypes.ARTIST
}
+
AbsModelType.MODEL_WALL_REPLY -> {
return AttachmentsTypes.WALL_REPLY
}
+
AbsModelType.MODEL_AUDIO_PLAYLIST -> {
return AttachmentsTypes.AUDIO_PLAYLIST
}
+
AbsModelType.MODEL_GRAFFITI -> {
return AttachmentsTypes.GRAFFITI
}
+
AbsModelType.MODEL_PHOTO_ALBUM -> {
return AttachmentsTypes.ALBUM
}
+
AbsModelType.MODEL_NOT_SUPPORTED -> {
return AttachmentsTypes.NOT_SUPPORTED
}
+
AbsModelType.MODEL_EVENT -> {
return AttachmentsTypes.EVENT
}
+
AbsModelType.MODEL_MARKET -> {
return AttachmentsTypes.MARKET
}
+
AbsModelType.MODEL_MARKET_ALBUM -> {
return AttachmentsTypes.MARKET_ALBUM
}
+
else -> throw IllegalArgumentException()
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/IAttachmentsPlacesView.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/IAttachmentsPlacesView.kt
index 5760ab14c..df21a0539 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/IAttachmentsPlacesView.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/IAttachmentsPlacesView.kt
@@ -2,7 +2,24 @@ package dev.ragnarok.fenrir.fragment.base
import dev.ragnarok.fenrir.fragment.search.SearchContentType
import dev.ragnarok.fenrir.fragment.search.criteria.BaseSearchCriteria
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Audio
+import dev.ragnarok.fenrir.model.AudioArtist
+import dev.ragnarok.fenrir.model.AudioPlaylist
+import dev.ragnarok.fenrir.model.Commented
+import dev.ragnarok.fenrir.model.Document
+import dev.ragnarok.fenrir.model.Link
+import dev.ragnarok.fenrir.model.Market
+import dev.ragnarok.fenrir.model.MarketAlbum
+import dev.ragnarok.fenrir.model.Message
+import dev.ragnarok.fenrir.model.Peer
+import dev.ragnarok.fenrir.model.Photo
+import dev.ragnarok.fenrir.model.PhotoAlbum
+import dev.ragnarok.fenrir.model.Poll
+import dev.ragnarok.fenrir.model.Post
+import dev.ragnarok.fenrir.model.Story
+import dev.ragnarok.fenrir.model.Video
+import dev.ragnarok.fenrir.model.WallReply
+import dev.ragnarok.fenrir.model.WikiPage
interface IAttachmentsPlacesView {
fun openChatWith(accountId: Long, messagesOwnerId: Long, peer: Peer)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PlaceSupportMvpFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PlaceSupportMvpFragment.kt
index 32f31c5d6..11c885e27 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PlaceSupportMvpFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PlaceSupportMvpFragment.kt
@@ -14,7 +14,26 @@ import dev.ragnarok.fenrir.fragment.search.SearchContentType
import dev.ragnarok.fenrir.fragment.search.criteria.BaseSearchCriteria
import dev.ragnarok.fenrir.link.LinkHelper
import dev.ragnarok.fenrir.media.music.MusicPlaybackService.Companion.startForPlayList
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Article
+import dev.ragnarok.fenrir.model.Audio
+import dev.ragnarok.fenrir.model.AudioArtist
+import dev.ragnarok.fenrir.model.AudioPlaylist
+import dev.ragnarok.fenrir.model.Commented
+import dev.ragnarok.fenrir.model.CommentedType
+import dev.ragnarok.fenrir.model.Document
+import dev.ragnarok.fenrir.model.Link
+import dev.ragnarok.fenrir.model.Market
+import dev.ragnarok.fenrir.model.MarketAlbum
+import dev.ragnarok.fenrir.model.Message
+import dev.ragnarok.fenrir.model.Peer
+import dev.ragnarok.fenrir.model.Photo
+import dev.ragnarok.fenrir.model.PhotoAlbum
+import dev.ragnarok.fenrir.model.Poll
+import dev.ragnarok.fenrir.model.Post
+import dev.ragnarok.fenrir.model.Story
+import dev.ragnarok.fenrir.model.Video
+import dev.ragnarok.fenrir.model.WallReply
+import dev.ragnarok.fenrir.model.WikiPage
import dev.ragnarok.fenrir.place.PlaceFactory
import dev.ragnarok.fenrir.settings.Settings
import dev.ragnarok.fenrir.util.AppPerms.requestPermissionsAbs
@@ -51,11 +70,13 @@ abstract class PlaceSupportMvpFragment, V> : BaseMv
post1?.generateVkPostLink(),
post1?.text
)
+
PostShareDialog.Methods.REPOST_YOURSELF -> PlaceFactory.getRepostPlace(
accountId1,
null,
post1
).tryOpenWith(requireActivity())
+
PostShareDialog.Methods.SEND_MESSAGE -> post1?.let {
SendAttachmentsActivity.startForSendAttachments(
requireActivity(),
@@ -63,6 +84,7 @@ abstract class PlaceSupportMvpFragment
, V> : BaseMv
it
)
}
+
PostShareDialog.Methods.REPOST_GROUP -> {
val ownerId = PostShareDialog.extractOwnerId(result)
PlaceFactory.getRepostPlace(accountId1, abs(ownerId), post1)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PlaceSupportPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PlaceSupportPresenter.kt
index 355163aec..bc16d233b 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PlaceSupportPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PlaceSupportPresenter.kt
@@ -7,7 +7,24 @@ import dev.ragnarok.fenrir.fragment.base.core.IMvpView
import dev.ragnarok.fenrir.fragment.search.SearchContentType
import dev.ragnarok.fenrir.fragment.search.criteria.NewsFeedCriteria
import dev.ragnarok.fenrir.fromIOToMain
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Article
+import dev.ragnarok.fenrir.model.Audio
+import dev.ragnarok.fenrir.model.AudioArtist
+import dev.ragnarok.fenrir.model.AudioPlaylist
+import dev.ragnarok.fenrir.model.Commented
+import dev.ragnarok.fenrir.model.Document
+import dev.ragnarok.fenrir.model.Link
+import dev.ragnarok.fenrir.model.Market
+import dev.ragnarok.fenrir.model.MarketAlbum
+import dev.ragnarok.fenrir.model.Message
+import dev.ragnarok.fenrir.model.Photo
+import dev.ragnarok.fenrir.model.PhotoAlbum
+import dev.ragnarok.fenrir.model.Poll
+import dev.ragnarok.fenrir.model.Post
+import dev.ragnarok.fenrir.model.Story
+import dev.ragnarok.fenrir.model.Video
+import dev.ragnarok.fenrir.model.WallReply
+import dev.ragnarok.fenrir.model.WikiPage
import dev.ragnarok.fenrir.util.rxutils.RxUtils
abstract class PlaceSupportPresenter(accountId: Long, savedInstanceState: Bundle?) :
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PostImage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PostImage.kt
index 460cbbfc1..4e89a03ad 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PostImage.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/PostImage.kt
@@ -1,6 +1,10 @@
package dev.ragnarok.fenrir.fragment.base
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.AbsModel
+import dev.ragnarok.fenrir.model.Document
+import dev.ragnarok.fenrir.model.Photo
+import dev.ragnarok.fenrir.model.PhotoSize
+import dev.ragnarok.fenrir.model.Video
import dev.ragnarok.fenrir.view.mozaik.PostImagePosition
class PostImage(val attachment: AbsModel, val type: Int) {
@@ -17,12 +21,14 @@ class PostImage(val attachment: AbsModel, val type: Int) {
val photo = attachment as Photo
if (photo.width == 0) 100 else photo.width
}
+
TYPE_VIDEO -> 640
TYPE_GIF -> {
val document = attachment as Document
val max = document.getMaxPreviewSize(false)
max?.getW() ?: 640
}
+
else -> throw UnsupportedOperationException()
}
@@ -33,10 +39,12 @@ class PostImage(val attachment: AbsModel, val type: Int) {
val size = photo.sizes?.getSize(photoPreviewSize, true)
return size?.url
}
+
TYPE_VIDEO -> {
val video = attachment as Video
return video.image
}
+
TYPE_GIF -> {
val document = attachment as Document
return document.getPreviewWithSize(PhotoSize.Q, false)
@@ -51,12 +59,14 @@ class PostImage(val attachment: AbsModel, val type: Int) {
val photo = attachment as Photo
if (photo.height == 0) 100 else photo.height
}
+
TYPE_VIDEO -> 360
TYPE_GIF -> {
val document = attachment as Document
val max = document.getMaxPreviewSize(false)
max?.getH() ?: 480
}
+
else -> throw UnsupportedOperationException()
}
val aspectRatio: Float
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/RecyclerBindableAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/RecyclerBindableAdapter.kt
index 14817506b..f3ac3a794 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/RecyclerBindableAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/RecyclerBindableAdapter.kt
@@ -169,11 +169,13 @@ abstract class RecyclerBindableAdapter(private
//add our view to a header view and display it
prepareHeaderFooter(vh as HeaderFooterViewHolder, v)
}
+
isFooter(position) -> {
val v = footers[position - realItemCount - headersCount]
//add our view to a footer view and display it
prepareHeaderFooter(vh as HeaderFooterViewHolder, v)
}
+
else -> {
//it's one of our items, display as required
onBindItemViewHolder(vh, position - headers.size, getItemType(position))
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/RecyclerMenuAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/RecyclerMenuAdapter.kt
index 13e7ac7a1..6cf2e27d0 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/RecyclerMenuAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/RecyclerMenuAdapter.kt
@@ -65,9 +65,11 @@ class RecyclerMenuAdapter : RecyclerView.Adapter {
section == null -> {
false
}
+
position == 0 -> {
true
}
+
else -> {
val previous = getItem(position - 1)
section != previous.section
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 fe0188359..dd95b7053 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
@@ -21,6 +21,7 @@ class HorizontalOptionsAdapter(data: MutableList) :
when {
(title
?: return).startsWith("#") -> title
+
item.isCustom -> title
else -> "#$title"
}
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 fe2b5e91c..d1e28d918 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
@@ -11,7 +11,7 @@ import dev.ragnarok.fenrir.model.Story
import dev.ragnarok.fenrir.picasso.transforms.RoundTransformation
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.ViewUtils.displayAvatar
-import java.util.*
+import java.util.Calendar
class HorizontalStoryAdapter(data: MutableList) :
RecyclerBindableAdapter(data) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsAdapter.kt
index 3f0dac9a7..6117b082f 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsAdapter.kt
@@ -35,7 +35,7 @@ import dev.ragnarok.fenrir.util.ViewUtils.displayAvatar
import dev.ragnarok.fenrir.view.CommentContainer
import dev.ragnarok.fenrir.view.WeakViewAnimatorAdapter
import dev.ragnarok.fenrir.view.emoji.EmojiconTextView
-import java.util.*
+import java.util.Locale
class CommentsAdapter(
private val context: Context,
@@ -213,6 +213,7 @@ class CommentsAdapter(
TYPE_DELETED -> DeletedHolder(
view
)
+
else -> throw IllegalArgumentException()
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsFragment.kt
index 1fe1b05df..786472b5f 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsFragment.kt
@@ -5,7 +5,12 @@ import android.content.ClipboardManager
import android.content.Context
import android.content.DialogInterface
import android.os.Bundle
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
@@ -35,7 +40,11 @@ import dev.ragnarok.fenrir.listener.OnSectionResumeCallback
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.ModalBottomSheetDialogFragment
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.Option
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.OptionRequest
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Comment
+import dev.ragnarok.fenrir.model.Commented
+import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.model.Sticker
+import dev.ragnarok.fenrir.model.User
import dev.ragnarok.fenrir.model.menu.options.CommentsOption
import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.with
@@ -567,32 +576,41 @@ class CommentsFragment : PlaceSupportMvpFragment presenter?.fireReplyToCommentClick(
comment
)
+
CommentsOption.report_item_comment -> presenter?.fireReport(
comment
)
+
CommentsOption.delete_item_comment -> presenter?.fireCommentDeleteClick(
comment
)
+
CommentsOption.edit_item_comment -> presenter?.fireCommentEditClick(
comment
)
+
CommentsOption.block_author_item_comment -> presenter?.fireBanClick(
comment
)
+
CommentsOption.like_item_comment -> presenter?.fireCommentLikeClick(
comment,
true
)
+
CommentsOption.dislike_item_comment -> presenter?.fireCommentLikeClick(
comment,
false
)
+
CommentsOption.who_like_item_comment -> presenter?.fireWhoLikesClick(
comment
)
+
CommentsOption.send_to_friend_item_comment -> presenter?.fireReplyToChat(
comment
)
@@ -647,20 +665,24 @@ class CommentsFragment : PlaceSupportMvpFragment {
presenter?.fireTopicPollClick()
return true
}
+
R.id.to_commented -> {
presenter?.fireGotoSourceClick()
return true
}
+
R.id.direction -> {
val decs = Settings.get().other().toggleCommentsDirection()
menuItem.setIcon(getDirectionIcon(decs))
presenter?.fireDirectionChanged()
return true
}
+
else -> return false
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsPresenter.kt
index 2043dd241..779edb234 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/CommentsPresenter.kt
@@ -215,6 +215,7 @@ class CommentsPresenter(
"asc"
)
}
+
directionDesc -> {
interactor.getCommentsPortion(
accountId,
@@ -227,6 +228,7 @@ class CommentsPresenter(
"desc"
)
}
+
else -> {
interactor.getCommentsPortion(
accountId,
@@ -312,6 +314,7 @@ class CommentsPresenter(
comments.size
)
}
+
LoadingState.DOWN -> {
if (comments.nonNullNoEmpty()) {
comments.removeAt(comments.size - 1) // последним комментарием приходит комментарий к кодом, который был передан в startCommentId
@@ -404,6 +407,7 @@ class CommentsPresenter(
view?.setupLoadUpHeader(if (isCommentsAvailableUp) LoadMoreState.CAN_LOAD_MORE else LoadMoreState.END_OF_LIST)
view?.setupLoadDownFooter(if (isCommentsAvailableDown) LoadMoreState.CAN_LOAD_MORE else LoadMoreState.END_OF_LIST)
}
+
LoadingState.DOWN -> {
view?.setupLoadDownFooter(
LoadMoreState.LOADING
@@ -412,6 +416,7 @@ class CommentsPresenter(
LoadMoreState.END_OF_LIST
)
}
+
LoadingState.UP -> {
view?.setupLoadDownFooter(
LoadMoreState.END_OF_LIST
@@ -420,6 +425,7 @@ class CommentsPresenter(
LoadMoreState.LOADING
)
}
+
LoadingState.INITIAL -> {
view?.setupLoadDownFooter(
LoadMoreState.END_OF_LIST
@@ -802,6 +808,7 @@ class CommentsPresenter(
false
)
}
+
loadingAvailableAuthorsNow -> {
view?.displayProgressDialog(
R.string.please_wait,
@@ -809,6 +816,7 @@ class CommentsPresenter(
false
)
}
+
else -> {
view?.dismissProgressDialog()
}
@@ -888,12 +896,15 @@ class CommentsPresenter(
.setAccessKey(commented.accessKey)
firePhotoClick(singletonArrayList(photo), 0, true)
}
+
CommentedType.POST -> view?.goToWallPost(
authorId, commented.sourceId, commented.sourceOwnerId
)
+
CommentedType.VIDEO -> view?.goToVideoPreview(
authorId, commented.sourceId, commented.sourceOwnerId
)
+
CommentedType.TOPIC -> {}
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/ICommentsView.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/ICommentsView.kt
index 0e8390845..ec12438a1 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/ICommentsView.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/comments/ICommentsView.kt
@@ -2,8 +2,16 @@ package dev.ragnarok.fenrir.fragment.comments
import androidx.annotation.StringRes
import dev.ragnarok.fenrir.fragment.base.IAttachmentsPlacesView
-import dev.ragnarok.fenrir.fragment.base.core.*
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.fragment.base.core.IErrorView
+import dev.ragnarok.fenrir.fragment.base.core.IMvpView
+import dev.ragnarok.fenrir.fragment.base.core.IProgressView
+import dev.ragnarok.fenrir.fragment.base.core.IToastView
+import dev.ragnarok.fenrir.fragment.base.core.IToolbarView
+import dev.ragnarok.fenrir.model.Comment
+import dev.ragnarok.fenrir.model.LoadMoreState
+import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.model.Sticker
+import dev.ragnarok.fenrir.model.User
interface ICommentsView : IAttachmentsPlacesView, IMvpView, IErrorView,
IToolbarView, IProgressView, IToastView {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesAdapter.kt
index 395fc22c7..e4f5ed856 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesAdapter.kt
@@ -93,6 +93,7 @@ class CommunitiesAdapter(
if (community.closed == VKApiCommunity.Status.OPEN) R.string.type_opened else R.string.type_closed,
context.getString(R.string.type_event)
)
+
VKApiCommunity.Type.PAGE -> return context.getString(R.string.type_page)
}
return context.getString(
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesPresenter.kt
index 0e2546726..e853f5e13 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesPresenter.kt
@@ -1,14 +1,18 @@
package dev.ragnarok.fenrir.fragment.communities
import android.os.Bundle
-import dev.ragnarok.fenrir.*
import dev.ragnarok.fenrir.domain.ICommunitiesInteractor
import dev.ragnarok.fenrir.domain.InteractorFactory
import dev.ragnarok.fenrir.fragment.base.AccountDependencyPresenter
+import dev.ragnarok.fenrir.fromIOToMain
+import dev.ragnarok.fenrir.fromIOToMainComputation
import dev.ragnarok.fenrir.model.Community
import dev.ragnarok.fenrir.model.DataWrapper
import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.settings.Settings
+import dev.ragnarok.fenrir.trimmedIsNullOrEmpty
+import dev.ragnarok.fenrir.trimmedNonNullNoEmpty
import dev.ragnarok.fenrir.util.Objects.safeEquals
import dev.ragnarok.fenrir.util.Translit.cyr2lat
import dev.ragnarok.fenrir.util.Translit.lat2cyr
@@ -19,7 +23,7 @@ import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.core.SingleEmitter
import io.reactivex.rxjava3.disposables.CompositeDisposable
-import java.util.*
+import java.util.Locale
import java.util.concurrent.TimeUnit
class CommunitiesPresenter(accountId: Long, private val userId: Long, savedInstanceState: Bundle?) :
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityban/CommunityBanEditFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityban/CommunityBanEditFragment.kt
index 5fa626e5b..7ca133011 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityban/CommunityBanEditFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityban/CommunityBanEditFragment.kt
@@ -3,7 +3,12 @@ package dev.ragnarok.fenrir.fragment.communitycontrol.communityban
import android.content.DialogInterface
import android.os.Bundle
import android.text.method.LinkMovementMethod
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import android.widget.CompoundButton
import android.widget.ImageView
import android.widget.TextView
@@ -12,14 +17,22 @@ import androidx.core.view.MenuProvider
import com.google.android.material.checkbox.MaterialCheckBox
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.textfield.TextInputEditText
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Extra
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.ActivityFeatures
import dev.ragnarok.fenrir.activity.ActivityUtils.setToolbarSubtitle
import dev.ragnarok.fenrir.activity.ActivityUtils.setToolbarTitle
import dev.ragnarok.fenrir.fragment.base.BaseMvpFragment
import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory
+import dev.ragnarok.fenrir.getParcelableArrayListCompat
+import dev.ragnarok.fenrir.getParcelableCompat
import dev.ragnarok.fenrir.listener.TextWatcherAdapter
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Banned
+import dev.ragnarok.fenrir.model.Community
+import dev.ragnarok.fenrir.model.IdOption
+import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.model.User
+import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.picasso.transforms.RoundTransformation
import dev.ragnarok.fenrir.place.PlaceFactory.getOwnerWallPlace
import dev.ragnarok.fenrir.settings.AvatarStyle
@@ -162,9 +175,11 @@ class CommunityBanEditFragment :
user.domain.nonNullNoEmpty() -> {
safelySetText(mDomain, "@" + user.domain)
}
+
user is User -> {
safelySetText(mDomain, "@id" + user.getOwnerObjectId())
}
+
user is Community -> {
safelySetText(mDomain, "@club" + user.id)
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityban/CommunityBanEditPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityban/CommunityBanEditPresenter.kt
index cb3507017..e54364bf8 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityban/CommunityBanEditPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityban/CommunityBanEditPresenter.kt
@@ -14,7 +14,8 @@ import dev.ragnarok.fenrir.util.Logger.wtf
import dev.ragnarok.fenrir.util.Utils.getCauseIfRuntime
import dev.ragnarok.fenrir.util.Utils.singletonArrayList
import java.text.DateFormat
-import java.util.*
+import java.util.Calendar
+import java.util.Date
class CommunityBanEditPresenter : AccountDependencyPresenter {
private val groupId: Long
@@ -114,15 +115,19 @@ class CommunityBanEditPresenter : AccountDependencyPresenter view?.displayReason(
getString(R.string.reason_spam)
)
+
BlockReason.IRRELEVANT_MESSAGES -> view?.displayReason(
getString(R.string.reason_irrelevant_messages)
)
+
BlockReason.STRONG_LANGUAGE -> view?.displayReason(
getString(R.string.reason_strong_language)
)
+
BlockReason.VERBAL_ABUSE -> view?.displayReason(
getString(R.string.reason_verbal_abuse)
)
+
else -> view?.displayReason(
getString(R.string.reason_other)
)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanageredit/CommunityManagerEditFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanageredit/CommunityManagerEditFragment.kt
index d4a2b6f64..0d802d281 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanageredit/CommunityManagerEditFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanageredit/CommunityManagerEditFragment.kt
@@ -1,21 +1,34 @@
package dev.ragnarok.fenrir.fragment.communitycontrol.communitymanageredit
import android.os.Bundle
-import android.view.*
-import android.widget.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
+import android.widget.CompoundButton
+import android.widget.ImageView
+import android.widget.RadioButton
+import android.widget.RadioGroup
+import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
import com.google.android.material.checkbox.MaterialCheckBox
import com.google.android.material.textfield.TextInputEditText
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Extra
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.ActivityFeatures
import dev.ragnarok.fenrir.activity.ActivityUtils.setToolbarSubtitle
import dev.ragnarok.fenrir.activity.ActivityUtils.setToolbarTitle
import dev.ragnarok.fenrir.fragment.base.BaseMvpFragment
import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory
+import dev.ragnarok.fenrir.getParcelableArrayListCompat
+import dev.ragnarok.fenrir.getParcelableCompat
import dev.ragnarok.fenrir.listener.TextWatcherAdapter
import dev.ragnarok.fenrir.model.Manager
import dev.ragnarok.fenrir.model.User
+import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.picasso.transforms.RoundTransformation
import dev.ragnarok.fenrir.place.PlaceFactory.getOwnerWallPlace
import dev.ragnarok.fenrir.settings.AvatarStyle
@@ -71,9 +84,11 @@ class CommunityManagerEditFragment :
R.id.button_moderator -> {
presenter?.fireModeratorChecked()
}
+
R.id.button_editor -> {
presenter?.fireEditorChecked()
}
+
R.id.button_admin -> {
presenter?.fireAdminChecked()
}
@@ -124,10 +139,12 @@ class CommunityManagerEditFragment :
presenter?.fireButtonSaveClick()
true
}
+
R.id.action_delete -> {
presenter?.fireDeleteClick()
true
}
+
else -> false
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanageredit/CommunityManagerEditPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanageredit/CommunityManagerEditPresenter.kt
index 6ef1cf5f8..3409c7078 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanageredit/CommunityManagerEditPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanageredit/CommunityManagerEditPresenter.kt
@@ -282,12 +282,15 @@ class CommunityManagerEditPresenter : AccountDependencyPresenter {
VKApiCommunity.AdminLevel.MODERATOR
}
+
"editor".equals(role, ignoreCase = true) -> {
VKApiCommunity.AdminLevel.EDITOR
}
+
"administrator".equals(role, ignoreCase = true) -> {
VKApiCommunity.AdminLevel.ADMIN
}
+
else -> 0
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanagers/CommunityManagersFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanagers/CommunityManagersFragment.kt
index 641c4ec4a..8ca15dc3e 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanagers/CommunityManagersFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanagers/CommunityManagersFragment.kt
@@ -21,7 +21,11 @@ import dev.ragnarok.fenrir.fragment.search.SearchContentType
import dev.ragnarok.fenrir.fragment.search.criteria.PeopleSearchCriteria
import dev.ragnarok.fenrir.getParcelableArrayListExtraCompat
import dev.ragnarok.fenrir.getParcelableCompat
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Community
+import dev.ragnarok.fenrir.model.Manager
+import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.model.SelectProfileCriteria
+import dev.ragnarok.fenrir.model.User
import dev.ragnarok.fenrir.place.PlaceFactory.getCommunityManagerAddPlace
import dev.ragnarok.fenrir.place.PlaceFactory.getCommunityManagerEditPlace
import dev.ragnarok.fenrir.place.PlaceFactory.getOwnerWallPlace
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanagers/CommunityManagersPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanagers/CommunityManagersPresenter.kt
index 9aeabe866..81535b621 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanagers/CommunityManagersPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymanagers/CommunityManagersPresenter.kt
@@ -14,7 +14,11 @@ import dev.ragnarok.fenrir.domain.impl.GroupSettingsInteractor
import dev.ragnarok.fenrir.domain.mappers.Dto2Model.transformUser
import dev.ragnarok.fenrir.fragment.base.AccountDependencyPresenter
import dev.ragnarok.fenrir.fromIOToMain
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Community
+import dev.ragnarok.fenrir.model.ContactInfo
+import dev.ragnarok.fenrir.model.Manager
+import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.model.User
import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.Utils.getCauseIfRuntime
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymembers/CommunityMembersFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymembers/CommunityMembersFragment.kt
index 97239de62..52e7f8cbe 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymembers/CommunityMembersFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymembers/CommunityMembersFragment.kt
@@ -1,7 +1,12 @@
package dev.ragnarok.fenrir.fragment.communitycontrol.communitymembers
import android.os.Bundle
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
@@ -75,6 +80,7 @@ class CommunityMembersFragment :
presenter?.fireSearch()
return true
}
+
R.id.action_options -> {
presenter?.fireFilter()
return true
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityoptions/CommunityOptionsFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityoptions/CommunityOptionsFragment.kt
index 1813368c8..0bb3ad8cb 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityoptions/CommunityOptionsFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityoptions/CommunityOptionsFragment.kt
@@ -2,7 +2,12 @@ package dev.ragnarok.fenrir.fragment.communitycontrol.communityoptions
import android.content.DialogInterface
import android.os.Bundle
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import android.widget.RadioGroup
import android.widget.TextView
import androidx.core.view.MenuProvider
@@ -126,11 +131,13 @@ class CommunityOptionsFragment :
view?.findViewById(R.id.age_16_to_18)?.isChecked = false
view?.findViewById(R.id.age_under16)?.isChecked = true
}
+
2 -> {
view?.findViewById(R.id.age_after_18)?.isChecked = false
view?.findViewById(R.id.age_16_to_18)?.isChecked = true
view?.findViewById(R.id.age_under16)?.isChecked = false
}
+
3 -> {
view?.findViewById(R.id.age_after_18)?.isChecked = true
view?.findViewById(R.id.age_16_to_18)?.isChecked = false
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityoptions/CommunityOptionsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityoptions/CommunityOptionsPresenter.kt
index 24e1f21fb..a4a7cc9f8 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityoptions/CommunityOptionsPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communityoptions/CommunityOptionsPresenter.kt
@@ -11,7 +11,7 @@ import dev.ragnarok.fenrir.model.GroupSettings
import dev.ragnarok.fenrir.model.IdOption
import dev.ragnarok.fenrir.util.Utils
import java.text.SimpleDateFormat
-import java.util.*
+import java.util.Calendar
class CommunityOptionsPresenter(
accountId: Long,
@@ -127,14 +127,17 @@ class CommunityOptionsPresenter(
settings.setCategory(option)
resolveCategoryView()
}
+
REQUEST_DAY -> {
settings.getDateCreated()?.day = option.getObjectId()
resolvePublicDateView()
}
+
REQUEST_MONTH -> {
settings.getDateCreated()?.month = option.getObjectId()
resolvePublicDateView()
}
+
REQUEST_YEAR -> {
settings.getDateCreated()?.year = option.getObjectId()
resolvePublicDateView()
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createphotoalbum/CreatePhotoAlbumFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createphotoalbum/CreatePhotoAlbumFragment.kt
index fd8a29b71..0dba5af51 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createphotoalbum/CreatePhotoAlbumFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createphotoalbum/CreatePhotoAlbumFragment.kt
@@ -20,7 +20,11 @@ import dev.ragnarok.fenrir.model.PhotoAlbum
import dev.ragnarok.fenrir.model.PhotoAlbumEditor
import dev.ragnarok.fenrir.view.steppers.base.AbsStepHolder
import dev.ragnarok.fenrir.view.steppers.base.AbsSteppersVerticalAdapter
-import dev.ragnarok.fenrir.view.steppers.impl.*
+import dev.ragnarok.fenrir.view.steppers.impl.CreatePhotoAlbumStep1Holder
+import dev.ragnarok.fenrir.view.steppers.impl.CreatePhotoAlbumStep2Holder
+import dev.ragnarok.fenrir.view.steppers.impl.CreatePhotoAlbumStep3Holder
+import dev.ragnarok.fenrir.view.steppers.impl.CreatePhotoAlbumStep4Holder
+import dev.ragnarok.fenrir.view.steppers.impl.CreatePhotoAlbumStepsHost
class CreatePhotoAlbumFragment : BaseMvpFragment(),
BackPressCallback, IEditPhotoAlbumView, CreatePhotoAlbumStep4Holder.ActionListener,
@@ -83,17 +87,21 @@ class CreatePhotoAlbumFragment : BaseMvpFragment CreatePhotoAlbumStep1Holder(
parent, this
)
+
CreatePhotoAlbumStepsHost.STEP_UPLOAD_AND_COMMENTS -> CreatePhotoAlbumStep2Holder(
parent, this
)
+
CreatePhotoAlbumStepsHost.STEP_PRIVACY_VIEW -> CreatePhotoAlbumStep3Holder(
parent,
this
)
+
CreatePhotoAlbumStepsHost.STEP_PRIVACY_COMMENT -> CreatePhotoAlbumStep4Holder(
parent,
this
)
+
else -> throw IllegalArgumentException("Inavalid step index: $step")
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createphotoalbum/EditPhotoAlbumPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createphotoalbum/EditPhotoAlbumPresenter.kt
index cfaed8373..ab7bde737 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createphotoalbum/EditPhotoAlbumPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createphotoalbum/EditPhotoAlbumPresenter.kt
@@ -7,7 +7,7 @@ import dev.ragnarok.fenrir.Includes.networkInterfaces
import dev.ragnarok.fenrir.api.interfaces.INetworker
import dev.ragnarok.fenrir.api.model.VKApiPhotoAlbum
import dev.ragnarok.fenrir.fragment.base.AccountDependencyPresenter
-import dev.ragnarok.fenrir.fragment.vkphotos.IVkPhotosView
+import dev.ragnarok.fenrir.fragment.vkphotos.IVKPhotosView
import dev.ragnarok.fenrir.fromIOToMain
import dev.ragnarok.fenrir.model.PhotoAlbum
import dev.ragnarok.fenrir.model.PhotoAlbumEditor
@@ -154,7 +154,7 @@ class EditPhotoAlbumPresenter : AccountDependencyPresenter
private fun goToAlbum(album: VKApiPhotoAlbum) {
getVKPhotosAlbumPlace(
accountId, album.owner_id, album.id,
- IVkPhotosView.ACTION_SHOW_PHOTOS
+ IVKPhotosView.ACTION_SHOW_PHOTOS
)
.withParcelableExtra(Extra.ALBUM, PhotoAlbum(album.id, album.owner_id))
.tryOpenWith(context)
@@ -164,7 +164,7 @@ class EditPhotoAlbumPresenter : AccountDependencyPresenter
if (ret == null || !ret) return
getVKPhotosAlbumPlace(
accountId, (album ?: return).ownerId, album.getObjectId(),
- IVkPhotosView.ACTION_SHOW_PHOTOS
+ IVKPhotosView.ACTION_SHOW_PHOTOS
)
.withParcelableExtra(Extra.ALBUM, album)
.tryOpenWith(context)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpin/CreatePinFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpin/CreatePinFragment.kt
index 250121b36..b173dccd9 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpin/CreatePinFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpin/CreatePinFragment.kt
@@ -9,11 +9,13 @@ import android.view.ViewGroup
import android.view.animation.AnimationUtils
import android.widget.TextView
import androidx.annotation.StringRes
+import com.google.android.material.materialswitch.MaterialSwitch
import dev.ragnarok.fenrir.Constants
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.base.BaseMvpFragment
import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory
import dev.ragnarok.fenrir.listener.BackPressCallback
+import dev.ragnarok.fenrir.settings.Settings
import dev.ragnarok.fenrir.view.KeyboardView
import dev.ragnarok.fenrir.view.KeyboardView.OnKeyboardClickListener
@@ -21,6 +23,9 @@ class CreatePinFragment : BaseMvpFragment(),
OnKeyboardClickListener, BackPressCallback {
private var mTitle: TextView? = null
private var mValuesRoot: View? = null
+ private var mAllowFingerprint: MaterialSwitch? = null
+ private var mPinCodeOnStart: MaterialSwitch? = null
+ private var mDontAskEveryTime: MaterialSwitch? = null
private var mValuesCircles: Array = arrayOfNulls(Constants.PIN_DIGITS_COUNT)
override fun onCreateView(
inflater: LayoutInflater,
@@ -37,6 +42,38 @@ class CreatePinFragment : BaseMvpFragment(),
mValuesCircles[1] = root.findViewById(R.id.pincode_digit_1)
mValuesCircles[2] = root.findViewById(R.id.pincode_digit_2)
mValuesCircles[3] = root.findViewById(R.id.pincode_digit_3)
+
+ mAllowFingerprint = root.findViewById(R.id.fingerprint_sw)
+ mPinCodeOnStart = root.findViewById(R.id.pin_entrance_sw)
+ mDontAskEveryTime = root.findViewById(R.id.pin_delayed_pin_for_entrance_sw)
+
+ mAllowFingerprint?.setOnCheckedChangeListener { _, isChecked ->
+ Settings.get().security().isEntranceByFingerprintAllowed = isChecked
+ }
+
+ mPinCodeOnStart?.setOnCheckedChangeListener { _, isChecked ->
+ Settings.get().security().isUsePinForEntrance = isChecked
+ }
+
+ mDontAskEveryTime?.setOnCheckedChangeListener { _, isChecked ->
+ Settings.get().security().isDelayedAllow = isChecked
+ }
+
+ if (requireActivity().intent?.extras?.containsKey(
+ EXTRA_PREF_KEY
+ ) != true
+ ) {
+ mAllowFingerprint?.visibility = View.VISIBLE
+ mPinCodeOnStart?.visibility = View.VISIBLE
+ mDontAskEveryTime?.visibility = View.VISIBLE
+ Settings.get().security().isUsePinForEntrance = false
+ Settings.get().security().isEntranceByFingerprintAllowed = false
+ Settings.get().security().isDelayedAllow = false
+ } else {
+ mAllowFingerprint?.visibility = View.GONE
+ mPinCodeOnStart?.visibility = View.GONE
+ mDontAskEveryTime?.visibility = View.GONE
+ }
return root
}
@@ -62,7 +99,7 @@ class CreatePinFragment : BaseMvpFragment(),
override fun sendSuccessAndClose(values: IntArray) {
val data = Intent()
data.putExtra(EXTRA_PIN_VALUE, values)
- if (requireActivity().intent != null && requireActivity().intent.extras != null && requireActivity().intent.extras?.containsKey(
+ if (requireActivity().intent?.extras?.containsKey(
EXTRA_PREF_KEY
) == true
) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpin/CreatePinPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpin/CreatePinPresenter.kt
index 74bd9f28a..fb21d31ca 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpin/CreatePinPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpin/CreatePinPresenter.kt
@@ -6,7 +6,7 @@ import android.os.Looper
import dev.ragnarok.fenrir.Constants
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.base.RxSupportPresenter
-import java.util.*
+import java.util.Arrays
class CreatePinPresenter(savedInstanceState: Bundle?) :
RxSupportPresenter(savedInstanceState) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpoll/CreatePollFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpoll/CreatePollFragment.kt
index 5b8b31404..37a3839a3 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpoll/CreatePollFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/createpoll/CreatePollFragment.kt
@@ -2,7 +2,12 @@ package dev.ragnarok.fenrir.fragment.createpoll
import android.os.Bundle
import android.text.Editable
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import android.widget.CompoundButton
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsAdapter.kt
index b46d5969a..54feb7f9e 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsAdapter.kt
@@ -13,7 +13,8 @@ import dev.ragnarok.fenrir.model.PhotoSize
import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.with
import dev.ragnarok.fenrir.util.AppTextUtils
-import java.util.*
+import java.util.EventListener
+import java.util.Locale
class DocsAdapter(data: MutableList) :
RecyclerBindableAdapter(data) {
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 103533163..a05903f11 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
@@ -11,7 +11,7 @@ import dev.ragnarok.fenrir.model.Document
import dev.ragnarok.fenrir.model.PhotoSize
import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.with
-import java.util.*
+import java.util.EventListener
class DocsAsImagesAdapter(data: MutableList) :
RecyclerBindableAdapter(data) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsFragment.kt
index a178bcdbb..58c8c0c24 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsFragment.kt
@@ -15,7 +15,9 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.google.android.material.floatingactionbutton.FloatingActionButton
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Constants
+import dev.ragnarok.fenrir.Extra
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.ActivityFeatures
import dev.ragnarok.fenrir.activity.ActivityUtils.supportToolbarFor
import dev.ragnarok.fenrir.activity.DualTabPhotoActivity.Companion.createIntent
@@ -23,6 +25,7 @@ import dev.ragnarok.fenrir.fragment.base.BaseMvpFragment
import dev.ragnarok.fenrir.fragment.base.RecyclerBindableAdapter
import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory
import dev.ragnarok.fenrir.fragment.base.horizontal.HorizontalOptionsAdapter
+import dev.ragnarok.fenrir.getParcelableArrayListExtraCompat
import dev.ragnarok.fenrir.listener.OnSectionResumeCallback
import dev.ragnarok.fenrir.listener.PicassoPauseOnScrollListener
import dev.ragnarok.fenrir.model.DocFilter
@@ -31,6 +34,7 @@ import dev.ragnarok.fenrir.model.LocalPhoto
import dev.ragnarok.fenrir.model.selection.FileManagerSelectableSource
import dev.ragnarok.fenrir.model.selection.LocalPhotosSelectableSource
import dev.ragnarok.fenrir.model.selection.Sources
+import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.place.Place
import dev.ragnarok.fenrir.place.PlaceFactory.getDocPreviewPlace
import dev.ragnarok.fenrir.place.PlaceFactory.getGifPagerPlace
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsListPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsListPresenter.kt
index d610e0bee..de661e650 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsListPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsListPresenter.kt
@@ -19,13 +19,22 @@ import dev.ragnarok.fenrir.fromIOToMain
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.ModalBottomSheetDialogFragment
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.Option
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.OptionRequest
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.AbsModel
+import dev.ragnarok.fenrir.model.DocFilter
+import dev.ragnarok.fenrir.model.Document
+import dev.ragnarok.fenrir.model.EditingPostType
+import dev.ragnarok.fenrir.model.LocalPhoto
+import dev.ragnarok.fenrir.model.PhotoSize
import dev.ragnarok.fenrir.model.menu.options.DocsOption
import dev.ragnarok.fenrir.place.PlaceFactory.getOwnerWallPlace
import dev.ragnarok.fenrir.place.PlaceUtil.goToPostCreation
-import dev.ragnarok.fenrir.upload.*
+import dev.ragnarok.fenrir.upload.IUploadManager
import dev.ragnarok.fenrir.upload.IUploadManager.IProgressUpdate
+import dev.ragnarok.fenrir.upload.Upload
+import dev.ragnarok.fenrir.upload.UploadDestination
import dev.ragnarok.fenrir.upload.UploadDestination.Companion.forDocuments
+import dev.ragnarok.fenrir.upload.UploadIntent
+import dev.ragnarok.fenrir.upload.UploadResult
import dev.ragnarok.fenrir.upload.UploadUtils.createIntents
import dev.ragnarok.fenrir.util.AppPerms.hasReadStoragePermission
import dev.ragnarok.fenrir.util.DisposableHolder
@@ -174,6 +183,7 @@ class DocsListPresenter(
showError(getCauseIfRuntime(t))
})
}
+
DocsOption.delete_item_doc -> MaterialAlertDialogBuilder(context)
.setTitle(R.string.remove_confirm)
.setMessage(R.string.doc_remove_confirm_message)
@@ -185,6 +195,7 @@ class DocsListPresenter(
}
.setNegativeButton(R.string.cancel, null)
.show()
+
DocsOption.go_to_owner_doc -> getOwnerWallPlace(
accountId,
doc.ownerId,
@@ -218,6 +229,7 @@ class DocsListPresenter(
String.format("vk.com/doc%s_%s", document.ownerId, document.id),
document.title
)
+
1 -> startForSendAttachments(context, accountId, document)
2 -> postToMyWall(context, document)
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsUploadAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsUploadAdapter.kt
index 953240c81..b7ba6d417 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsUploadAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/docs/DocsUploadAdapter.kt
@@ -41,6 +41,7 @@ class DocsUploadAdapter(
val precentText = upload.progress.toString() + "%"
holder.status.text = precentText
}
+
Upload.STATUS_CANCELLING -> holder.status.setText(R.string.cancelling)
Upload.STATUS_QUEUE -> holder.status.setText(R.string.in_order)
Upload.STATUS_ERROR -> {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/enterpin/EnterPinPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/enterpin/EnterPinPresenter.kt
index d9f97ae7e..74efc0dae 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/enterpin/EnterPinPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/enterpin/EnterPinPresenter.kt
@@ -13,7 +13,7 @@ import dev.ragnarok.fenrir.model.Owner
import dev.ragnarok.fenrir.settings.ISettings
import dev.ragnarok.fenrir.settings.ISettings.ISecuritySettings
import dev.ragnarok.fenrir.settings.Settings
-import java.util.*
+import java.util.Arrays
class EnterPinPresenter(savedState: Bundle?) : RxSupportPresenter(savedState) {
private val ownersRepository: IOwnersRepository = owners
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesPresenter.kt
index 43cd586ca..60c4174ea 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesPresenter.kt
@@ -17,7 +17,7 @@ import dev.ragnarok.fenrir.util.Utils.safeCountOf
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.disposables.Disposable
-import java.util.*
+import java.util.Locale
import java.util.concurrent.TimeUnit
import kotlin.math.abs
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/faveposts/FavePostAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/faveposts/FavePostAdapter.kt
index 3c8392d74..69d3bf521 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/faveposts/FavePostAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/faveposts/FavePostAdapter.kt
@@ -138,6 +138,7 @@ class FavePostAdapter(
when (it.getData()) {
VKApiPostSource.Data.PROFILE_ACTIVITY -> postSubtitle =
mContext.getString(R.string.updated_status_at, formattedDate)
+
VKApiPostSource.Data.PROFILE_PHOTO -> postSubtitle =
mContext.getString(R.string.updated_profile_photo_at, formattedDate)
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feed/FeedAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feed/FeedAdapter.kt
index 7e7c61ada..f581a080f 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feed/FeedAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feed/FeedAdapter.kt
@@ -84,22 +84,27 @@ class FeedAdapter(
force = true
viewHolder.tvText.setText(R.string.public_photo)
}
+
"wall_photo" -> {
force = true
viewHolder.tvText.setText(R.string.public_photo_wall)
}
+
"photo_tag" -> {
force = true
viewHolder.tvText.setText(R.string.public_photo_tag)
}
+
"friend" -> {
force = true
viewHolder.tvText.setText(R.string.public_friends)
}
+
"audio" -> {
force = true
viewHolder.tvText.setText(R.string.public_audio)
}
+
"video" -> {
force = true
viewHolder.tvText.setText(R.string.public_video)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feed/FeedFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feed/FeedFragment.kt
index ca43fbc1a..49c99f7fb 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feed/FeedFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feed/FeedFragment.kt
@@ -100,15 +100,18 @@ class FeedFragment : PlaceSupportMvpFragment(), IFeedV
presenter?.fireRefresh()
true
}
+
R.id.action_create_list -> {
requestProfileSelect.launch(startFaveSelection(requireActivity()))
true
}
+
R.id.action_feed_ban -> {
PlaceFactory.getFeedBanPlace(Settings.get().accounts().current)
.tryOpenWith(requireActivity())
true
}
+
else -> false
}
}
@@ -353,6 +356,7 @@ class FeedFragment : PlaceSupportMvpFragment(), IFeedV
kJson.decodeFromString(LinearLayoutManager_SavedState.serializer(), state)
mFeedLayoutManager?.onRestoreInstanceState(savedState)
}
+
is StaggeredGridLayoutManager -> {
val savedState = kJson.decodeFromString(
StaggeredGridLayoutManager_SavedState.serializer(),
@@ -373,12 +377,14 @@ class FeedFragment : PlaceSupportMvpFragment(), IFeedV
parcelable as LinearLayoutManager_SavedState
)
}
+
is StaggeredGridLayoutManager -> {
kJson.encodeToString(
StaggeredGridLayoutManager_SavedState.serializer(),
parcelable as StaggeredGridLayoutManager_SavedState
)
}
+
else -> {
super.onPause()
return
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedback/FeedbackAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedback/FeedbackAdapter.kt
index f71ba3aed..726560a61 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedback/FeedbackAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedback/FeedbackAdapter.kt
@@ -11,9 +11,20 @@ import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.base.AttachmentsViewBinder.OnAttachmentsActionCallback
import dev.ragnarok.fenrir.fragment.base.RecyclerBindableAdapter
import dev.ragnarok.fenrir.fragment.feedback.FeedbackAdapter.FeedbackHolder
-import dev.ragnarok.fenrir.model.feedback.*
+import dev.ragnarok.fenrir.model.feedback.CommentFeedback
+import dev.ragnarok.fenrir.model.feedback.CopyFeedback
+import dev.ragnarok.fenrir.model.feedback.Feedback
+import dev.ragnarok.fenrir.model.feedback.FeedbackType
+import dev.ragnarok.fenrir.model.feedback.LikeCommentFeedback
+import dev.ragnarok.fenrir.model.feedback.LikeFeedback
+import dev.ragnarok.fenrir.model.feedback.MentionCommentFeedback
+import dev.ragnarok.fenrir.model.feedback.MentionFeedback
+import dev.ragnarok.fenrir.model.feedback.PostPublishFeedback
+import dev.ragnarok.fenrir.model.feedback.ReplyCommentFeedback
+import dev.ragnarok.fenrir.model.feedback.UsersFeedback
import dev.ragnarok.fenrir.view.OnlineView
-import java.util.*
+import java.util.Calendar
+import java.util.EventListener
class FeedbackAdapter(
context: Activity,
@@ -36,14 +47,17 @@ class FeedbackAdapter(
viewHolder.headerRoot.visibility = View.VISIBLE
viewHolder.headerText.text = mContext.getString(R.string.dialog_day_older)
}
+
HEADER_TODAY -> {
viewHolder.headerRoot.visibility = View.VISIBLE
viewHolder.headerText.text = mContext.getString(R.string.dialog_day_today)
}
+
HEADER_YESTERDAY -> {
viewHolder.headerRoot.visibility = View.VISIBLE
viewHolder.headerText.text = mContext.getString(R.string.dialog_day_yesterday)
}
+
HEADER_THIS_WEEK -> {
viewHolder.headerRoot.visibility = View.VISIBLE
viewHolder.headerText.text = mContext.getString(R.string.dialog_day_ten_days)
@@ -70,50 +84,62 @@ class FeedbackAdapter(
notification as PostPublishFeedback,
holder
)
+
FeedbackType.WALL -> mFeedbackViewBinder.configWallFeedback(
notification as PostPublishFeedback,
holder
)
+
FeedbackType.MENTION -> mFeedbackViewBinder.configMentionFeedback(
notification as MentionFeedback,
holder
)
+
FeedbackType.REPLY_COMMENT -> mFeedbackViewBinder.configReplyCommentFeedback(
notification as ReplyCommentFeedback,
holder
)
+
FeedbackType.REPLY_TOPIC -> mFeedbackViewBinder.configReplyTopicFeedback(
notification as ReplyCommentFeedback,
holder
)
+
FeedbackType.REPLY_COMMENT_PHOTO -> mFeedbackViewBinder.configReplyCommentPhotoFeedback(
notification as ReplyCommentFeedback,
holder
)
+
FeedbackType.REPLY_COMMENT_VIDEO -> mFeedbackViewBinder.configReplyCommentVideoFeedback(
notification as ReplyCommentFeedback,
holder
)
+
FeedbackType.MENTION_COMMENT_POST -> mFeedbackViewBinder.configMentionCommentsFeedback(
notification as MentionCommentFeedback,
holder
)
+
FeedbackType.MENTION_COMMENT_PHOTO -> mFeedbackViewBinder.configMentionCommentsPhotoFeedback(
notification as MentionCommentFeedback,
holder
)
+
FeedbackType.MENTION_COMMENT_VIDEO -> mFeedbackViewBinder.configMentionCommentsVideoFeedback(
notification as MentionCommentFeedback,
holder
)
+
FeedbackType.COMMENT_POST -> mFeedbackViewBinder.configCommentPostFeedback(
notification as CommentFeedback,
holder
)
+
FeedbackType.COMMENT_PHOTO -> mFeedbackViewBinder.configCommentPhotoFeedback(
notification as CommentFeedback,
holder
)
+
FeedbackType.COMMENT_VIDEO -> mFeedbackViewBinder.configCommentVideoFeedback(
notification as CommentFeedback,
holder
@@ -127,46 +153,57 @@ class FeedbackAdapter(
notification as LikeFeedback,
holder
)
+
FeedbackType.LIKE_PHOTO -> mFeedbackViewBinder.configLikePhotoFeedback(
notification as LikeFeedback,
holder
)
+
FeedbackType.LIKE_VIDEO -> mFeedbackViewBinder.configLikeVideoFeedback(
notification as LikeFeedback,
holder
)
+
FeedbackType.LIKE_COMMENT_POST -> mFeedbackViewBinder.configLikeCommentFeedback(
notification as LikeCommentFeedback,
holder
)
+
FeedbackType.LIKE_COMMENT_TOPIC -> mFeedbackViewBinder.configLikeCommentTopicFeedback(
notification as LikeCommentFeedback,
holder
)
+
FeedbackType.FOLLOW -> mFeedbackViewBinder.configFollowFeedback(
notification as UsersFeedback,
holder
)
+
FeedbackType.FRIEND_ACCEPTED -> mFeedbackViewBinder.configFriendAcceptedFeedback(
notification as UsersFeedback,
holder
)
+
FeedbackType.LIKE_COMMENT_PHOTO -> mFeedbackViewBinder.configLikeCommentForPhotoFeedback(
notification as LikeCommentFeedback,
holder
)
+
FeedbackType.LIKE_COMMENT_VIDEO -> mFeedbackViewBinder.configLikeCommentVideoFeedback(
notification as LikeCommentFeedback,
holder
)
+
FeedbackType.COPY_POST -> mFeedbackViewBinder.configCopyPostFeedback(
notification as CopyFeedback,
holder
)
+
FeedbackType.COPY_PHOTO -> mFeedbackViewBinder.configCopyPhotoFeedback(
notification as CopyFeedback,
holder
)
+
FeedbackType.COPY_VIDEO -> mFeedbackViewBinder.configCopyVideoFeedback(
notification as CopyFeedback,
holder
@@ -231,12 +268,15 @@ class FeedbackAdapter(
time >= today -> {
HEADER_TODAY
}
+
time >= yesterday -> {
HEADER_YESTERDAY
}
+
time >= week -> {
HEADER_THIS_WEEK
}
+
else -> HEADER_OLD
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedback/FeedbackViewBinder.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedback/FeedbackViewBinder.kt
index 0a0df7815..6c4daf25a 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedback/FeedbackViewBinder.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedback/FeedbackViewBinder.kt
@@ -19,7 +19,15 @@ import dev.ragnarok.fenrir.fragment.feedback.FeedbackAdapter.UsersHolder
import dev.ragnarok.fenrir.link.internal.LinkActionAdapter
import dev.ragnarok.fenrir.link.internal.OwnerLinkSpanFactory
import dev.ragnarok.fenrir.model.*
-import dev.ragnarok.fenrir.model.feedback.*
+import dev.ragnarok.fenrir.model.feedback.CommentFeedback
+import dev.ragnarok.fenrir.model.feedback.CopyFeedback
+import dev.ragnarok.fenrir.model.feedback.LikeCommentFeedback
+import dev.ragnarok.fenrir.model.feedback.LikeFeedback
+import dev.ragnarok.fenrir.model.feedback.MentionCommentFeedback
+import dev.ragnarok.fenrir.model.feedback.MentionFeedback
+import dev.ragnarok.fenrir.model.feedback.PostPublishFeedback
+import dev.ragnarok.fenrir.model.feedback.ReplyCommentFeedback
+import dev.ragnarok.fenrir.model.feedback.UsersFeedback
import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.orZero
import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.with
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedbackvkofficial/FeedbackVKOfficialAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedbackvkofficial/FeedbackVKOfficialAdapter.kt
index 42b15eaff..0611c7fb7 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedbackvkofficial/FeedbackVKOfficialAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/feedbackvkofficial/FeedbackVKOfficialAdapter.kt
@@ -154,14 +154,17 @@ class FeedbackVKOfficialAdapter(
holder.mHeaderTitle.visibility = View.VISIBLE
holder.mHeaderTitle.setText(R.string.dialog_day_older)
}
+
DIV_TODAY -> {
holder.mHeaderTitle.visibility = View.VISIBLE
holder.mHeaderTitle.setText(R.string.dialog_day_today)
}
+
DIV_YESTERDAY -> {
holder.mHeaderTitle.visibility = View.VISIBLE
holder.mHeaderTitle.setText(R.string.dialog_day_yesterday)
}
+
DIV_THIS_WEEK -> {
holder.mHeaderTitle.visibility = View.VISIBLE
holder.mHeaderTitle.setText(R.string.dialog_day_ten_days)
@@ -237,6 +240,7 @@ class FeedbackVKOfficialAdapter(
holder.attachments.visibility = View.GONE
holder.attachments.adapter = null
}
+
Page.attachments?.size == 1 -> {
holder.photo_image.visibility = View.VISIBLE
holder.attachments.visibility = View.GONE
@@ -258,6 +262,7 @@ class FeedbackVKOfficialAdapter(
}
}
}
+
else -> {
with().cancelRequest(holder.photo_image)
holder.photo_image.visibility = View.GONE
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectAdapter.kt
index cda6fc0d5..7d260accd 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectAdapter.kt
@@ -37,6 +37,7 @@ class FileManagerSelectAdapter(private var data: List) :
LayoutInflater.from(parent.context)
.inflate(R.layout.item_manager_folder, parent, false)
)
+
else -> {
LayoutInflater.from(parent.context)
.inflate(R.layout.item_manager_file, parent, false)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectFragment.kt
index 51e704cbb..11f46141c 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectFragment.kt
@@ -17,9 +17,13 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.snackbar.BaseTransientBottomBar
import com.google.android.material.textview.MaterialTextView
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Constants
+import dev.ragnarok.fenrir.Extra
+import dev.ragnarok.fenrir.R
+import dev.ragnarok.fenrir.StubAnimatorListener
import dev.ragnarok.fenrir.fragment.base.BaseMvpFragment
import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory
+import dev.ragnarok.fenrir.fromIOToMain
import dev.ragnarok.fenrir.listener.BackPressCallback
import dev.ragnarok.fenrir.listener.PicassoPauseOnScrollListener
import dev.ragnarok.fenrir.listener.UpdatableNavigation
@@ -33,7 +37,7 @@ import dev.ragnarok.fenrir.view.natives.rlottie.RLottieImageView
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.disposables.Disposable
import java.io.File
-import java.util.*
+import java.util.Collections
import java.util.concurrent.TimeUnit
class FileManagerSelectFragment :
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectPresenter.kt
index ce6d22934..2270cd726 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/filemanagerselect/FileManagerSelectPresenter.kt
@@ -156,9 +156,8 @@ class FileManagerSelectPresenter(
view?.resolveEmptyText(fileList.isEmpty())
view?.resolveLoading(isLoading)
view?.notifyAllChanged()
- val k = directoryScrollPositions.remove(path.absolutePath)
- if (k != null) {
- view?.restoreScroll(k)
+ directoryScrollPositions.remove(path.absolutePath)?.let { scroll ->
+ view?.restoreScroll(scroll)
}
}, {
view?.onError(it)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/allfriends/AllFriendsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/allfriends/AllFriendsPresenter.kt
index ddd154c3c..9dc4755dd 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/allfriends/AllFriendsPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/allfriends/AllFriendsPresenter.kt
@@ -18,7 +18,7 @@ import dev.ragnarok.fenrir.util.Utils.getCauseIfRuntime
import dev.ragnarok.fenrir.util.Utils.indexOf
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.disposables.CompositeDisposable
-import java.util.*
+import java.util.Locale
import java.util.concurrent.TimeUnit
class AllFriendsPresenter(accountId: Long, private val userId: Long, savedInstanceState: Bundle?) :
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/birthday/BirthDayPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/birthday/BirthDayPresenter.kt
index 0f0917462..44c2186d1 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/birthday/BirthDayPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/birthday/BirthDayPresenter.kt
@@ -8,7 +8,7 @@ import dev.ragnarok.fenrir.fromIOToMain
import dev.ragnarok.fenrir.model.BirthDay
import dev.ragnarok.fenrir.model.User
import io.reactivex.rxjava3.disposables.CompositeDisposable
-import java.util.*
+import java.util.Calendar
class BirthDayPresenter(accountId: Long, private val ownerId: Long, savedInstanceState: Bundle?) :
AccountDependencyPresenter(accountId, savedInstanceState) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendsbyphones/FriendsByPhonesFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendsbyphones/FriendsByPhonesFragment.kt
index 412b0726f..a335304ed 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendsbyphones/FriendsByPhonesFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendsbyphones/FriendsByPhonesFragment.kt
@@ -25,7 +25,6 @@ import dev.ragnarok.fenrir.activity.ActivityUtils.supportToolbarFor
import dev.ragnarok.fenrir.activity.FileManagerSelectActivity
import dev.ragnarok.fenrir.fragment.base.BaseMvpFragment
import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory
-import dev.ragnarok.fenrir.kJson
import dev.ragnarok.fenrir.listener.PicassoPauseOnScrollListener
import dev.ragnarok.fenrir.model.ContactConversation
import dev.ragnarok.fenrir.model.Peer
@@ -35,12 +34,9 @@ import dev.ragnarok.fenrir.util.AppPerms
import dev.ragnarok.fenrir.util.AppPerms.requestPermissionsAbs
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.ViewUtils.setupSwipeRefreshLayoutWithCurrentTheme
-import dev.ragnarok.fenrir.util.serializeble.json.decodeFromStream
import dev.ragnarok.fenrir.util.toast.CustomToast
import dev.ragnarok.fenrir.view.MySearchView
-import kotlinx.serialization.builtins.ListSerializer
import java.io.File
-import java.io.FileInputStream
class FriendsByPhonesFragment : BaseMvpFragment(),
ContactsAdapter.ClickListener, IFriendsByPhonesView, MenuProvider {
@@ -89,20 +85,7 @@ class FriendsByPhonesFragment : BaseMvpFragment
if (result.resultCode == Activity.RESULT_OK && result.data != null) {
- try {
- val file = File(
- result.data?.getStringExtra(Extra.PATH) ?: return@registerForActivityResult
- )
- if (file.exists()) {
- val contacts: List = kJson.decodeFromStream(
- ListSerializer(ContactConversation.serializer()),
- FileInputStream(file)
- )
- presenter?.fireImport(contacts)
- }
- } catch (e: Exception) {
- CustomToast.createCustomToast(requireActivity()).showToastError(e.localizedMessage)
- }
+ result.data?.getStringExtra(Extra.PATH)?.let { presenter?.fireImportContacts(it) }
}
}
@@ -186,6 +169,7 @@ class FriendsByPhonesFragment : BaseMvpFragment {
presenter?.fireReset()
}
+
R.id.action_read -> {
if (!AppPerms.hasReadStoragePermission(requireActivity())) {
requestReadPermission.launch()
@@ -194,6 +178,7 @@ class FriendsByPhonesFragment : BaseMvpFragment {
if (!AppPerms.hasReadWriteStoragePermission(requireActivity())) {
requestWritePermission.launch()
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendsbyphones/FriendsByPhonesPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendsbyphones/FriendsByPhonesPresenter.kt
index 4065db6e7..e0c177176 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendsbyphones/FriendsByPhonesPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendsbyphones/FriendsByPhonesPresenter.kt
@@ -10,12 +10,15 @@ import dev.ragnarok.fenrir.domain.IAccountsInteractor
import dev.ragnarok.fenrir.domain.InteractorFactory
import dev.ragnarok.fenrir.fragment.base.AccountDependencyPresenter
import dev.ragnarok.fenrir.fromIOToMain
+import dev.ragnarok.fenrir.kJson
import dev.ragnarok.fenrir.model.ContactConversation
import dev.ragnarok.fenrir.trimmedNonNullNoEmpty
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.serializeble.json.Json
+import dev.ragnarok.fenrir.util.serializeble.json.decodeFromStream
import kotlinx.serialization.builtins.ListSerializer
import java.io.File
+import java.io.FileInputStream
import java.io.FileOutputStream
import java.util.*
@@ -34,12 +37,6 @@ class FriendsByPhonesPresenter(accountId: Long, context: Context, savedInstanceS
)
}
- fun fireImport(reader: List) {
- data.clear()
- data.addAll(reader)
- view?.notifyDataSetChanged()
- }
-
private fun requestActualData() {
netLoadingNow = true
resolveRefreshingView()
@@ -52,6 +49,23 @@ class FriendsByPhonesPresenter(accountId: Long, context: Context, savedInstanceS
})
}
+ fun fireImportContacts(path: String) {
+ try {
+ val file = File(path)
+ if (file.exists()) {
+ val contacts: List = kJson.decodeFromStream(
+ ListSerializer(ContactConversation.serializer()),
+ FileInputStream(file)
+ )
+ data.clear()
+ data.addAll(contacts)
+ view?.notifyDataSetChanged()
+ }
+ } catch (e: Exception) {
+ view?.customToast?.showToastError(e.localizedMessage)
+ }
+ }
+
@Suppress("DEPRECATION")
fun fireExport(file: File) {
var out: FileOutputStream? = null
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendstabs/FriendsTabsFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendstabs/FriendsTabsFragment.kt
index 142c1a26e..d02552d66 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendstabs/FriendsTabsFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/friendstabs/FriendsTabsFragment.kt
@@ -2,7 +2,13 @@ package dev.ragnarok.fenrir.fragment.friends.friendstabs
import android.content.Context
import android.os.Bundle
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
+import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
import androidx.fragment.app.Fragment
@@ -10,7 +16,8 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Extra
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.ActivityFeatures
import dev.ragnarok.fenrir.activity.ActivityUtils.setToolbarSubtitle
import dev.ragnarok.fenrir.activity.ActivityUtils.setToolbarTitle
@@ -22,8 +29,11 @@ import dev.ragnarok.fenrir.fragment.friends.mutualfriends.MutualFriendsFragment
import dev.ragnarok.fenrir.fragment.friends.onlinefriends.OnlineFriendsFragment
import dev.ragnarok.fenrir.fragment.friends.recommendationsfriends.RecommendationsFriendsFragment
import dev.ragnarok.fenrir.fragment.friends.requests.RequestsFragment
+import dev.ragnarok.fenrir.getParcelableCompat
import dev.ragnarok.fenrir.listener.OnSectionResumeCallback
import dev.ragnarok.fenrir.model.FriendsCounters
+import dev.ragnarok.fenrir.nonNullNoEmpty
+import dev.ragnarok.fenrir.orZero
import dev.ragnarok.fenrir.place.Place
import dev.ragnarok.fenrir.place.PlaceFactory
import dev.ragnarok.fenrir.settings.Settings
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/requests/RequestsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/requests/RequestsPresenter.kt
index b33d7a6cd..07daac2c9 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/requests/RequestsPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/requests/RequestsPresenter.kt
@@ -17,7 +17,7 @@ import dev.ragnarok.fenrir.util.Utils.getCauseIfRuntime
import dev.ragnarok.fenrir.util.Utils.indexOf
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.disposables.CompositeDisposable
-import java.util.*
+import java.util.Locale
import java.util.concurrent.TimeUnit
class RequestsPresenter(accountId: Long, private val userId: Long, savedInstanceState: Bundle?) :
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupchats/GroupChatsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupchats/GroupChatsAdapter.kt
index 54dc92d9c..9acaf444f 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupchats/GroupChatsAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupchats/GroupChatsAdapter.kt
@@ -18,7 +18,7 @@ import dev.ragnarok.fenrir.settings.CurrentTheme
import dev.ragnarok.fenrir.util.AppTextUtils
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.toast.CustomToast.Companion.createCustomToast
-import java.util.*
+import java.util.EventListener
class GroupChatsAdapter(
context: Context,
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallFragment.kt
index fff59f1cd..b1e91e728 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallFragment.kt
@@ -7,7 +7,11 @@ import android.graphics.Color
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.text.method.LinkMovementMethod
-import android.view.*
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.activity.result.ActivityResult
@@ -21,7 +25,8 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.textview.MaterialTextView
import com.squareup.picasso3.BitmapTarget
import com.squareup.picasso3.Picasso
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Extra
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.ActivityUtils.setToolbarSubtitle
import dev.ragnarok.fenrir.activity.ActivityUtils.setToolbarTitle
import dev.ragnarok.fenrir.activity.LoginActivity.Companion.createIntent
@@ -32,11 +37,19 @@ import dev.ragnarok.fenrir.fragment.base.horizontal.HorizontalMenuAdapter
import dev.ragnarok.fenrir.fragment.base.horizontal.HorizontalOptionsAdapter
import dev.ragnarok.fenrir.fragment.docs.DocsListPresenter
import dev.ragnarok.fenrir.fragment.groupwall.IGroupWallView.IOptionMenuView
+import dev.ragnarok.fenrir.getParcelableCompat
+import dev.ragnarok.fenrir.ifNonNullNoEmpty
import dev.ragnarok.fenrir.link.LinkHelper
import dev.ragnarok.fenrir.link.internal.LinkActionAdapter
import dev.ragnarok.fenrir.link.internal.OwnerLinkSpanFactory
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Community
+import dev.ragnarok.fenrir.model.CommunityDetails
+import dev.ragnarok.fenrir.model.GroupSettings
+import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.model.ParcelableOwnerWrapper
+import dev.ragnarok.fenrir.model.PostFilter
import dev.ragnarok.fenrir.module.FenrirNative
+import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.with
import dev.ragnarok.fenrir.picasso.transforms.BlurTransformation
import dev.ragnarok.fenrir.picasso.transforms.MonochromeTransformation
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallPresenter.kt
index c84c1c96e..e49bb33ef 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallPresenter.kt
@@ -3,17 +3,30 @@ package dev.ragnarok.fenrir.fragment.groupwall
import android.content.Context
import android.os.Bundle
import androidx.annotation.StringRes
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Includes
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.api.model.VKApiCommunity
-import dev.ragnarok.fenrir.domain.*
+import dev.ragnarok.fenrir.domain.ICommunitiesInteractor
+import dev.ragnarok.fenrir.domain.IFaveInteractor
+import dev.ragnarok.fenrir.domain.IOwnersRepository
+import dev.ragnarok.fenrir.domain.IWallsRepository
+import dev.ragnarok.fenrir.domain.InteractorFactory
import dev.ragnarok.fenrir.domain.Repository.owners
import dev.ragnarok.fenrir.domain.Repository.walls
import dev.ragnarok.fenrir.domain.impl.GroupSettingsInteractor
import dev.ragnarok.fenrir.fragment.abswall.AbsWallPresenter
import dev.ragnarok.fenrir.fragment.groupwall.IGroupWallView.IOptionMenuView
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.fromIOToMain
+import dev.ragnarok.fenrir.model.Community
+import dev.ragnarok.fenrir.model.CommunityDetails
+import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.model.Peer
+import dev.ragnarok.fenrir.model.PostFilter
+import dev.ragnarok.fenrir.model.Token
import dev.ragnarok.fenrir.model.criteria.WallCriteria
+import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.place.PlaceFactory.getMentionsPlace
+import dev.ragnarok.fenrir.requireNonNull
import dev.ragnarok.fenrir.settings.ISettings.IAccountsSettings
import dev.ragnarok.fenrir.util.ShortcutUtils.createWallShortcutRx
import dev.ragnarok.fenrir.util.Utils.getCauseIfRuntime
@@ -318,17 +331,21 @@ class GroupWallPresenter(
VKApiCommunity.Status.CLOSED -> primaryText = R.string.community_send_request
VKApiCommunity.Status.OPEN -> primaryText = R.string.community_join
}
+
VKApiCommunity.Type.PAGE -> primaryText = R.string.community_follow
VKApiCommunity.Type.EVENT -> primaryText = R.string.community_to_go
}
+
VKApiCommunity.MemberStatus.IS_MEMBER -> when (community.communityType) {
VKApiCommunity.Type.GROUP -> primaryText = R.string.community_leave
VKApiCommunity.Type.PAGE -> primaryText = R.string.community_unsubscribe_from_news
VKApiCommunity.Type.EVENT -> primaryText = R.string.community_not_to_go
}
+
VKApiCommunity.MemberStatus.NOT_SURE -> primaryText = R.string.community_leave
VKApiCommunity.MemberStatus.DECLINED_INVITATION -> primaryText =
R.string.community_send_request
+
VKApiCommunity.MemberStatus.SENT_REQUEST -> primaryText = R.string.cancel_request
VKApiCommunity.MemberStatus.INVITED -> {
primaryText = R.string.community_join
@@ -352,15 +369,18 @@ class GroupWallPresenter(
when (community.communityType) {
VKApiCommunity.Type.GROUP, VKApiCommunity.Type.EVENT -> resultMessage =
R.string.community_leave_success
+
VKApiCommunity.Type.PAGE -> resultMessage =
R.string.community_unsubscribe_from_news_success
}
}
+
VKApiCommunity.MemberStatus.SENT_REQUEST -> if (community.communityType == VKApiCommunity.Type.GROUP) {
community.setMemberStatus(VKApiCommunity.MemberStatus.IS_NOT_MEMBER)
community.setMember(false)
resultMessage = R.string.request_canceled
}
+
VKApiCommunity.MemberStatus.INVITED -> if (community.communityType == VKApiCommunity.Type.GROUP) {
community.setMember(false)
community.setMemberStatus(VKApiCommunity.MemberStatus.IS_NOT_MEMBER)
@@ -387,23 +407,27 @@ class GroupWallPresenter(
community.setMemberStatus(VKApiCommunity.MemberStatus.SENT_REQUEST)
resultMessage = R.string.community_send_request_success
}
+
VKApiCommunity.Status.OPEN -> {
community.setMember(true)
community.setMemberStatus(VKApiCommunity.MemberStatus.IS_MEMBER)
resultMessage = R.string.community_join_success
}
}
+
VKApiCommunity.Type.PAGE, VKApiCommunity.Type.EVENT -> {
community.setMember(true)
community.setMemberStatus(VKApiCommunity.MemberStatus.IS_MEMBER)
resultMessage = R.string.community_follow_success
}
}
+
VKApiCommunity.MemberStatus.DECLINED_INVITATION -> if (community.communityType == VKApiCommunity.Type.GROUP) {
community.setMember(false)
community.setMemberStatus(VKApiCommunity.MemberStatus.SENT_REQUEST)
resultMessage = R.string.community_send_request_success
}
+
VKApiCommunity.MemberStatus.INVITED -> if (community.communityType == VKApiCommunity.Type.GROUP) {
community.setMember(true)
community.setMemberStatus(VKApiCommunity.MemberStatus.IS_MEMBER)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/IGroupWallView.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/IGroupWallView.kt
index 3e70e80b4..a19a988cf 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/IGroupWallView.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/IGroupWallView.kt
@@ -2,7 +2,11 @@ package dev.ragnarok.fenrir.fragment.groupwall
import androidx.annotation.StringRes
import dev.ragnarok.fenrir.fragment.abswall.IWallView
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Community
+import dev.ragnarok.fenrir.model.CommunityDetails
+import dev.ragnarok.fenrir.model.GroupSettings
+import dev.ragnarok.fenrir.model.Owner
+import dev.ragnarok.fenrir.model.PostFilter
interface IGroupWallView : IWallView {
fun displayBaseCommunityData(community: Community, details: CommunityDetails)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localimagealbums/LocalPhotoAlbumsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localimagealbums/LocalPhotoAlbumsPresenter.kt
index ea7924d54..ca0b96b04 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localimagealbums/LocalPhotoAlbumsPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localimagealbums/LocalPhotoAlbumsPresenter.kt
@@ -8,7 +8,7 @@ import dev.ragnarok.fenrir.model.LocalImageAlbum
import dev.ragnarok.fenrir.util.AppPerms.hasReadStoragePermission
import dev.ragnarok.fenrir.util.Objects.safeEquals
import dev.ragnarok.fenrir.util.PersistentLogger
-import java.util.*
+import java.util.Locale
class LocalPhotoAlbumsPresenter(savedInstanceState: Bundle?) :
RxSupportPresenter(savedInstanceState) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/audioslocalserver/AudioLocalServerRecyclerAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/audioslocalserver/AudioLocalServerRecyclerAdapter.kt
index 1ae93cbb4..aab6ad622 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/audioslocalserver/AudioLocalServerRecyclerAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/audioslocalserver/AudioLocalServerRecyclerAdapter.kt
@@ -20,10 +20,12 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.BaseTransientBottomBar
import com.google.android.material.textfield.TextInputEditText
import com.squareup.picasso3.Transformation
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Constants
+import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.domain.ILocalServerInteractor
import dev.ragnarok.fenrir.domain.InteractorFactory
-import dev.ragnarok.fenrir.link.VkLinkParser
+import dev.ragnarok.fenrir.fromIOToMain
+import dev.ragnarok.fenrir.link.VKLinkParser
import dev.ragnarok.fenrir.media.music.MusicPlaybackController.canPlayAfterCurrent
import dev.ragnarok.fenrir.media.music.MusicPlaybackController.currentAudio
import dev.ragnarok.fenrir.media.music.MusicPlaybackController.isNowPlayingOrPreparingOrPaused
@@ -38,12 +40,14 @@ import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.Option
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.OptionRequest
import dev.ragnarok.fenrir.model.Audio
import dev.ragnarok.fenrir.model.menu.options.AudioLocalServerOption
+import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.with
import dev.ragnarok.fenrir.picasso.transforms.PolyTransformation
import dev.ragnarok.fenrir.picasso.transforms.RoundTransformation
import dev.ragnarok.fenrir.place.PlaceFactory.getPlayerPlace
import dev.ragnarok.fenrir.settings.CurrentTheme
import dev.ragnarok.fenrir.settings.Settings
+import dev.ragnarok.fenrir.toMainThread
import dev.ragnarok.fenrir.util.AppPerms.hasReadWriteStoragePermission
import dev.ragnarok.fenrir.util.DownloadWorkUtils.doDownloadAudio
import dev.ragnarok.fenrir.util.Utils
@@ -126,6 +130,7 @@ class AudioLocalServerRecyclerAdapter(
Utils.doWavesLottie(holder.visual, true)
holder.play_cover.setColorFilter(Color.parseColor("#44000000"))
}
+
2 -> {
Utils.doWavesLottie(holder.visual, false)
holder.play_cover.setColorFilter(Color.parseColor("#44000000"))
@@ -258,6 +263,7 @@ class AudioLocalServerRecyclerAdapter(
}
?.show()
}
+
else -> {
audio.downloadIndicator = 0
updateDownloadState(holder, audio)
@@ -265,21 +271,25 @@ class AudioLocalServerRecyclerAdapter(
}
}
}
+
AudioLocalServerOption.play_item_audio -> {
mClickListener?.onClick(position, audio)
if (Settings.get().other().isShow_mini_player) getPlayerPlace(
Settings.get().accounts().current
).tryOpenWith(mContext)
}
+
AudioLocalServerOption.play_item_after_current_audio -> playAfterCurrent(
audio
)
+
AudioLocalServerOption.bitrate_item_audio -> getBitrate(
audio.url,
audio.duration
)
+
AudioLocalServerOption.update_time_item_audio -> {
- val hash = VkLinkParser.parseLocalServerURL(audio.url)
+ val hash = VKLinkParser.parseLocalServerURL(audio.url)
if (hash.isNullOrEmpty()) {
return
}
@@ -289,8 +299,9 @@ class AudioLocalServerRecyclerAdapter(
createCustomToast(mContext).showToastThrowable(t)
}
}
+
AudioLocalServerOption.edit_item_audio -> {
- val hash2 = VkLinkParser.parseLocalServerURL(audio.url)
+ val hash2 = VKLinkParser.parseLocalServerURL(audio.url)
if (hash2.isNullOrEmpty()) {
return
}
@@ -329,6 +340,7 @@ class AudioLocalServerRecyclerAdapter(
createCustomToast(mContext).showToastThrowable(t)
}
}
+
AudioLocalServerOption.delete_item_audio -> MaterialAlertDialogBuilder(
mContext
)
@@ -336,7 +348,7 @@ class AudioLocalServerRecyclerAdapter(
.setTitle(R.string.confirmation)
.setCancelable(true)
.setPositiveButton(R.string.button_yes) { _: DialogInterface?, _: Int ->
- val hash1 = VkLinkParser.parseLocalServerURL(audio.url)
+ val hash1 = VKLinkParser.parseLocalServerURL(audio.url)
if (hash1.isNullOrEmpty()) {
return@setPositiveButton
}
@@ -348,8 +360,9 @@ class AudioLocalServerRecyclerAdapter(
}
.setNegativeButton(R.string.button_cancel, null)
.show()
+
AudioLocalServerOption.upload_item_audio -> {
- val hash1 = VkLinkParser.parseLocalServerURL(audio.url)
+ val hash1 = VKLinkParser.parseLocalServerURL(audio.url)
if (hash1.isNullOrEmpty()) {
return
}
@@ -359,6 +372,7 @@ class AudioLocalServerRecyclerAdapter(
createCustomToast(mContext).showToastThrowable(o)
}
}
+
else -> {}
}
}
@@ -473,6 +487,7 @@ class AudioLocalServerRecyclerAdapter(
}?.show()
}
}
+
else -> {
audio.downloadIndicator = 0
updateDownloadState(holder, audio)
@@ -516,6 +531,7 @@ class AudioLocalServerRecyclerAdapter(
currAudio = currentAudio
updateAudio(currAudio)
}
+
PlayerStatus.REPEATMODE_CHANGED, PlayerStatus.SHUFFLEMODE_CHANGED, PlayerStatus.UPDATE_PLAY_LIST -> {}
}
}
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 e532a90a3..cfaf73475 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
@@ -21,7 +21,7 @@ import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.domain.ILocalServerInteractor
import dev.ragnarok.fenrir.domain.InteractorFactory
import dev.ragnarok.fenrir.fromIOToMain
-import dev.ragnarok.fenrir.link.VkLinkParser
+import dev.ragnarok.fenrir.link.VKLinkParser
import dev.ragnarok.fenrir.media.music.MusicPlaybackController
import dev.ragnarok.fenrir.media.music.PlayerStatus
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.ModalBottomSheetDialogFragment
@@ -77,6 +77,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
currAudio = MusicPlaybackController.currentAudio
updateAudio(currAudio)
}
+
PlayerStatus.REPEATMODE_CHANGED, PlayerStatus.SHUFFLEMODE_CHANGED, PlayerStatus.UPDATE_PLAY_LIST -> {}
}
}
@@ -110,10 +111,12 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
LayoutInflater.from(parent.context)
.inflate(R.layout.item_manager_file, parent, false)
)
+
FileType.folder -> return FileHolder(
LayoutInflater.from(parent.context)
.inflate(R.layout.item_manager_folder, parent, false)
)
+
FileType.audio -> return AudioHolder(
LayoutInflater.from(parent.context)
.inflate(R.layout.item_manager_audio, parent, false)
@@ -164,6 +167,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
Utils.doWavesLottieBig(holder.visual, true)
holder.icon.setColorFilter(Color.parseColor("#44000000"))
}
+
2 -> {
Utils.doWavesLottieBig(holder.visual, false)
holder.icon.setColorFilter(Color.parseColor("#44000000"))
@@ -265,6 +269,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
FileLocalServerOption.play_item_after_current_audio -> MusicPlaybackController.playAfterCurrent(
t
)
+
FileLocalServerOption.save_item -> {
when (DownloadWorkUtils.doDownloadAudio(
context, t, Settings.get().accounts().current,
@@ -274,6 +279,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
0 -> {
createCustomToast(context).showToastBottom(R.string.saved_audio)
}
+
1 -> {
CustomSnackbars.createCustomSnackbars(view)
?.setDurationSnack(BaseTransientBottomBar.LENGTH_LONG)
@@ -288,6 +294,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
}
?.show()
}
+
2 -> {
CustomSnackbars.createCustomSnackbars(view)
?.setDurationSnack(Snackbar.LENGTH_LONG)
@@ -303,6 +310,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
)
}?.show()
}
+
else -> {
createCustomToast(context).showToastBottom(R.string.error_audio)
}
@@ -310,7 +318,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
}
FileLocalServerOption.upload_item_audio -> {
- val hash1 = VkLinkParser.parseLocalServerURL(audio.url)
+ val hash1 = VKLinkParser.parseLocalServerURL(audio.url)
if (hash1.isNullOrEmpty()) {
return
}
@@ -320,6 +328,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
createCustomToast(context).showToastThrowable(o)
}
}
+
FileLocalServerOption.delete_item -> {
MaterialAlertDialogBuilder(
context
@@ -329,7 +338,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
.setCancelable(true)
.setPositiveButton(R.string.button_yes) { _: DialogInterface?, _: Int ->
val hash1 =
- VkLinkParser.parseLocalServerURL(audio.url)
+ VKLinkParser.parseLocalServerURL(audio.url)
if (hash1.isNullOrEmpty()) {
return@setPositiveButton
}
@@ -344,9 +353,10 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
.setNegativeButton(R.string.button_cancel, null)
.show()
}
+
FileLocalServerOption.update_time_item -> {
val hash =
- VkLinkParser.parseLocalServerURL(audio.url)
+ VKLinkParser.parseLocalServerURL(audio.url)
if (hash.isNullOrEmpty()) {
return
}
@@ -360,7 +370,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
FileLocalServerOption.edit_item -> {
val hash2 =
- VkLinkParser.parseLocalServerURL(audio.url)
+ VKLinkParser.parseLocalServerURL(audio.url)
if (hash2.isNullOrEmpty()) {
return
}
@@ -405,12 +415,14 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
createCustomToast(context).showToastThrowable(t)
}
}
+
FileLocalServerOption.play_item_audio -> {
clickListener?.onClick(position, audio)
if (Settings.get().other().isShow_mini_player) getPlayerPlace(
Settings.get().accounts().current
).tryOpenWith(context)
}
+
else -> {}
}
}
@@ -521,7 +533,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
.setCancelable(true)
.setPositiveButton(R.string.button_yes) { _: DialogInterface?, _: Int ->
val hash1 =
- VkLinkParser.parseLocalServerURL(file.url)
+ VKLinkParser.parseLocalServerURL(file.url)
if (hash1.isNullOrEmpty()) {
return@setPositiveButton
}
@@ -536,9 +548,10 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
.setNegativeButton(R.string.button_cancel, null)
.show()
}
+
FileLocalServerOption.update_time_item -> {
val hash =
- VkLinkParser.parseLocalServerURL(file.url)
+ VKLinkParser.parseLocalServerURL(file.url)
if (hash.isNullOrEmpty()) {
return
}
@@ -549,9 +562,10 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
createCustomToast(context).showToastThrowable(t)
}
}
+
FileLocalServerOption.edit_item -> {
val hash2 =
- VkLinkParser.parseLocalServerURL(file.url)
+ VKLinkParser.parseLocalServerURL(file.url)
if (hash2.isNullOrEmpty()) {
return
}
@@ -596,6 +610,7 @@ class FileManagerRemoteAdapter(private var context: Context, private var data: L
createCustomToast(context).showToastThrowable(t)
}
}
+
else -> {}
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemoteFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemoteFragment.kt
index 5f90b69a0..27b1f0dd5 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemoteFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemoteFragment.kt
@@ -18,15 +18,24 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.snackbar.Snackbar
-import dev.ragnarok.fenrir.*
+import dev.ragnarok.fenrir.Constants
+import dev.ragnarok.fenrir.Extra
+import dev.ragnarok.fenrir.R
+import dev.ragnarok.fenrir.StubAnimatorListener
import dev.ragnarok.fenrir.fragment.base.BaseMvpFragment
import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory
+import dev.ragnarok.fenrir.fromIOToMain
import dev.ragnarok.fenrir.listener.BackPressCallback
import dev.ragnarok.fenrir.listener.PicassoPauseOnScrollListener
import dev.ragnarok.fenrir.listener.UpdatableNavigation
import dev.ragnarok.fenrir.media.music.MusicPlaybackController
import dev.ragnarok.fenrir.media.music.MusicPlaybackService
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Audio
+import dev.ragnarok.fenrir.model.FileRemote
+import dev.ragnarok.fenrir.model.FileType
+import dev.ragnarok.fenrir.model.InternalVideoSize
+import dev.ragnarok.fenrir.model.Photo
+import dev.ragnarok.fenrir.model.Video
import dev.ragnarok.fenrir.module.parcel.ParcelNative
import dev.ragnarok.fenrir.place.PlaceFactory
import dev.ragnarok.fenrir.service.ErrorLocalizer
@@ -41,7 +50,7 @@ import dev.ragnarok.fenrir.view.MySearchView
import dev.ragnarok.fenrir.view.natives.rlottie.RLottieImageView
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.disposables.Disposable
-import java.util.*
+import java.util.Collections
import java.util.concurrent.TimeUnit
class FileManagerRemoteFragment :
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemotePresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemotePresenter.kt
index cba43d152..70ebfcc2f 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemotePresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/filemanagerremote/FileManagerRemotePresenter.kt
@@ -5,12 +5,17 @@ import android.os.Parcelable
import dev.ragnarok.fenrir.domain.InteractorFactory
import dev.ragnarok.fenrir.fragment.base.RxSupportPresenter
import dev.ragnarok.fenrir.fromIOToMain
-import dev.ragnarok.fenrir.model.*
+import dev.ragnarok.fenrir.model.Audio
+import dev.ragnarok.fenrir.model.FileRemote
+import dev.ragnarok.fenrir.model.FileType
+import dev.ragnarok.fenrir.model.Photo
+import dev.ragnarok.fenrir.model.PhotoSizes
+import dev.ragnarok.fenrir.model.Video
import dev.ragnarok.fenrir.module.parcel.ParcelFlags
import dev.ragnarok.fenrir.module.parcel.ParcelNative
import dev.ragnarok.fenrir.nonNullNoEmpty
import dev.ragnarok.fenrir.util.Objects.safeEquals
-import java.util.*
+import java.util.Locale
class FileManagerRemotePresenter(
savedInstanceState: Bundle?
@@ -248,9 +253,8 @@ class FileManagerRemotePresenter(
view?.resolveEmptyText(fileList.isEmpty())
view?.resolveLoading(isLoading)
view?.notifyAllChanged()
- val k = directoryScrollPositions.remove(buildPath())
- if (k != null) {
- view?.restoreScroll(k)
+ directoryScrollPositions.remove(buildPath())?.let { scroll ->
+ view?.restoreScroll(scroll)
}
}, {
view?.onError(it)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/videoslocalserver/LocalServerVideosAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/videoslocalserver/LocalServerVideosAdapter.kt
index 1030d39a6..74ad1215e 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/videoslocalserver/LocalServerVideosAdapter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localserver/videoslocalserver/LocalServerVideosAdapter.kt
@@ -16,7 +16,7 @@ import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.domain.ILocalServerInteractor
import dev.ragnarok.fenrir.domain.InteractorFactory
import dev.ragnarok.fenrir.fromIOToMain
-import dev.ragnarok.fenrir.link.VkLinkParser
+import dev.ragnarok.fenrir.link.VKLinkParser
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.ModalBottomSheetDialogFragment
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.Option
import dev.ragnarok.fenrir.modalbottomsheetdialogfragment.OptionRequest
@@ -127,14 +127,16 @@ class LocalServerVideosAdapter(private val context: Context, private var data: L
)
}
}
+
VideoLocalServerOption.play_item_video -> {
videoOnClickListener?.onVideoClick(
holder.bindingAdapterPosition,
video
)
}
+
VideoLocalServerOption.update_time_item_video -> {
- val hash = VkLinkParser.parseLocalServerURL(video.mp4link720)
+ val hash = VKLinkParser.parseLocalServerURL(video.mp4link720)
if (hash.isNullOrEmpty()) {
return
}
@@ -148,8 +150,9 @@ class LocalServerVideosAdapter(private val context: Context, private var data: L
createCustomToast(context).showToastThrowable(t)
}
}
+
VideoLocalServerOption.edit_item_video -> {
- val hash2 = VkLinkParser.parseLocalServerURL(video.mp4link720)
+ val hash2 = VKLinkParser.parseLocalServerURL(video.mp4link720)
if (hash2.isNullOrEmpty()) {
return
}
@@ -189,6 +192,7 @@ class LocalServerVideosAdapter(private val context: Context, private var data: L
createCustomToast(context).showToastThrowable(t)
}
}
+
VideoLocalServerOption.delete_item_video -> MaterialAlertDialogBuilder(
context
)
@@ -196,7 +200,7 @@ class LocalServerVideosAdapter(private val context: Context, private var data: L
.setTitle(R.string.confirmation)
.setCancelable(true)
.setPositiveButton(R.string.button_yes) { _: DialogInterface?, _: Int ->
- val hash1 = VkLinkParser.parseLocalServerURL(video.mp4link720)
+ val hash1 = VKLinkParser.parseLocalServerURL(video.mp4link720)
if (hash1.isNullOrEmpty()) {
return@setPositiveButton
}
@@ -213,6 +217,7 @@ class LocalServerVideosAdapter(private val context: Context, private var data: L
}
.setNegativeButton(R.string.button_cancel, null)
.show()
+
else -> {}
}
}
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localvideos/LocalVideosPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localvideos/LocalVideosPresenter.kt
index 35bb4b89b..a48965ed3 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localvideos/LocalVideosPresenter.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/localvideos/LocalVideosPresenter.kt
@@ -9,7 +9,7 @@ import dev.ragnarok.fenrir.model.LocalVideo
import dev.ragnarok.fenrir.util.Objects.safeEquals
import dev.ragnarok.fenrir.util.Utils.countOfSelection
import dev.ragnarok.fenrir.util.Utils.getSelected
-import java.util.*
+import java.util.Locale
class LocalVideosPresenter(savedInstanceState: Bundle?) :
RxSupportPresenter(savedInstanceState) {
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 263f408e0..ffc48e9cc 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
@@ -9,7 +9,7 @@ import dev.ragnarok.fenrir.model.LogEventWrapper
import dev.ragnarok.fenrir.orZero
import dev.ragnarok.fenrir.util.AppTextUtils
import dev.ragnarok.fenrir.util.Utils
-import java.util.*
+import java.util.EventListener
class LogsAdapter(data: MutableList, private val actionListener: ActionListener) :
RecyclerBindableAdapter(data) {
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/logs/LogsFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/logs/LogsFragment.kt
index c1aefeb60..1695e5e03 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/logs/LogsFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/logs/LogsFragment.kt
@@ -4,7 +4,12 @@ import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.os.Bundle
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuProvider
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/marketview/MarketViewFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/marketview/MarketViewFragment.kt
index 26a845448..7eb061eee 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/marketview/MarketViewFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/marketview/MarketViewFragment.kt
@@ -111,10 +111,12 @@ class MarketViewFragment : BaseMvpFragment
available?.setTextColor(CurrentTheme.getColorOnSurface(requireActivity()))
available?.setText(R.string.markets_available)
}
+
2 -> {
available?.setTextColor(Color.parseColor("#ffaa00"))
available?.setText(R.string.markets_not_available)
}
+
else -> {
available?.setTextColor(Color.parseColor("#ff0000"))
available?.setText(R.string.markets_deleted)
diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatFragment.kt
index 4be4dcce1..b17c1a663 100644
--- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatFragment.kt
+++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatFragment.kt
@@ -173,6 +173,7 @@ class ChatFragment : PlaceSupportMvpFragment(), IChatV
})
.show()
}
+
else -> presenter?.fireEditPhotoMaked(defaultSize)
}
}
@@ -432,18 +433,22 @@ class ChatFragment : PlaceSupportMvpFragment(), IChatV
reference.get()?.presenter?.fireActionModeEditClick()
hide()
}
+
R.id.buttonForward -> {
reference.get()?.presenter?.onActionModeForwardClick()
hide()
}
+
R.id.buttonCopy -> {
reference.get()?.presenter?.fireActionModeCopyClick()
hide()
}
+
R.id.buttonDelete -> {
reference.get()?.presenter?.fireActionModeDeleteClick()
hide()
}
+
R.id.buttonSpam -> {
val dlgAlert =
reference.get()?.let { MaterialAlertDialogBuilder(it.requireActivity()) }
@@ -459,10 +464,12 @@ class ChatFragment : PlaceSupportMvpFragment(), IChatV
dlgAlert?.setCancelable(true)
dlgAlert?.create()?.show()
}
+
R.id.buttonPin -> {
reference.get()?.presenter?.fireActionModePinClick()
hide()
}
+
R.id.buttonStar -> {
reference.get()?.presenter?.fireActionModeStarClick()
hide()
@@ -939,6 +946,7 @@ class ChatFragment : PlaceSupportMvpFragment(), IChatV
})
.show()
}
+
Upload.IMAGE_SIZE_CROPPING -> {
if (photos.size == 1) {
var to_up = photos[0].getFullImageUri() ?: return
@@ -958,6 +966,7 @@ class ChatFragment : PlaceSupportMvpFragment(), IChatV
presenter?.fireEditLocalPhotosSelected(photos, Upload.IMAGE_SIZE_FULL)
}
}
+
else -> presenter?.fireEditLocalPhotosSelected(photos, defaultSize)
}
}
@@ -983,6 +992,7 @@ class ChatFragment : PlaceSupportMvpFragment(), IChatV
})
.show()
}
+
Upload.IMAGE_SIZE_CROPPING -> {
openRequestPhotoResize.launch(
Intent(requireContext(), IMGEditActivity::class.java)
@@ -996,6 +1006,7 @@ class ChatFragment : PlaceSupportMvpFragment(), IChatV
)
)
}
+
else -> presenter?.fireFilePhotoForUploadSelected(file, defaultSize)
}
return
@@ -1041,6 +1052,7 @@ class ChatFragment : PlaceSupportMvpFragment