From 0f1f73de749d65d37eba0711832cbd31db556409 Mon Sep 17 00:00:00 2001 From: Artem Umerov Date: Thu, 8 Jun 2023 22:15:19 +0300 Subject: [PATCH] 31 31 --- .../kotlin/dev/ragnarok/fenrir/Constants.kt | 3 +- .../fenrir/domain/impl/StickersInteractor.kt | 9 + .../local/audioslocal/AudiosLocalFragment.kt | 29 +- .../local/audioslocal/AudiosLocalPresenter.kt | 12 +- .../local/audioslocal/IAudiosLocalView.kt | 2 + .../localaudioalbums/ILocalAudioAlbumsView.kt | 2 + .../LocalAudioAlbumsAdapter.kt | 122 ++++ .../LocalAudioAlbumsFragment.kt | 29 +- .../LocalAudioAlbumsPresenter.kt | 5 +- .../messages/dialogs/DialogsFragment.kt | 7 +- .../messages/dialogs/DialogsPresenter.kt | 24 +- .../fragment/messages/dialogs/IDialogsView.kt | 1 + .../photos/localphotos/LocalPhotosFragment.kt | 4 +- .../ragnarok/fenrir/longpoll/GroupLongpoll.kt | 2 +- .../ragnarok/fenrir/longpoll/UserLongpoll.kt | 2 +- .../dev/ragnarok/fenrir/settings/ISettings.kt | 2 + .../ragnarok/fenrir/settings/OtherSettings.kt | 13 + .../fenrir/settings/backup/SettingsBackup.kt | 1 + .../fenrir/settings/theme/ThemesController.kt | 13 +- .../layout/fragment_local_albums_audio.xml | 10 + .../res/layout/local_audio_album_item.xml | 75 +++ app_fenrir/src/main/res/values-be/strings.xml | 3 +- .../src/main/res/values-night/styles.xml | 31 + app_fenrir/src/main/res/values-ru/strings.xml | 3 +- app_fenrir/src/main/res/values/strings.xml | 5 +- app_fenrir/src/main/res/values/styles.xml | 22 + .../fragment/PreferencesFragment.kt | 3 + .../settings/theme/ThemesController.kt | 11 + .../src/main/res/values-night/styles.xml | 27 + .../src/main/res/values/styles.xml | 20 + build.gradle | 10 +- .../jni/animation/libyuv/include/libyuv/row.h | 9 +- .../jni/animation/libyuv/source/row_neon64.cc | 40 ++ libfenrir/src/main/jni/compress/lz4/lz4.c | 4 +- libfenrir/src/main/jni/crc.hpp | 105 ---- libfenrir/src/main/jni/crc32.hpp | 109 ++++ libfenrir/src/main/jni/sha1.hpp | 527 ++++++++-------- libfenrir/src/main/jni/string_exist_jni.cpp | 4 +- libfenrir/src/main/jni/thorvg/inc/thorvg.h | 42 +- .../thorvg/src/lib/sw_engine/tvgSwCommon.h | 6 + .../thorvg/src/lib/sw_engine/tvgSwFill.cpp | 62 +- .../thorvg/src/lib/sw_engine/tvgSwRaster.cpp | 179 +++--- .../tvgSwRasterMaskedTexmapInternal.h | 380 ------------ .../src/lib/sw_engine/tvgSwRasterTexmap.h | 585 +++++++++++++++++- .../lib/sw_engine/tvgSwRasterTexmapInternal.h | 214 ------- .../src/main/jni/thorvg/src/lib/tvgPaint.cpp | 6 + .../main/jni/thorvg/src/lib/tvgPicture.cpp | 6 + .../src/main/jni/thorvg/src/lib/tvgShape.cpp | 1 - .../src/loaders/svg/tvgSvgSceneBuilder.cpp | 6 +- other_tool/compress_lz4/lz4.c | 4 +- 50 files changed, 1615 insertions(+), 1176 deletions(-) create mode 100644 app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsAdapter.kt create mode 100644 app_fenrir/src/main/res/layout/local_audio_album_item.xml delete mode 100644 libfenrir/src/main/jni/crc.hpp create mode 100644 libfenrir/src/main/jni/crc32.hpp delete mode 100644 libfenrir/src/main/jni/thorvg/src/lib/sw_engine/tvgSwRasterMaskedTexmapInternal.h delete mode 100644 libfenrir/src/main/jni/thorvg/src/lib/sw_engine/tvgSwRasterTexmapInternal.h diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Constants.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Constants.kt index 32d5b6b69..aa896af8c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Constants.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Constants.kt @@ -44,6 +44,7 @@ object Constants { const val UPLOAD_TIMEOUT = 3600L const val DOWNLOAD_TIMEOUT = 3600L const val GIF_TIMEOUT = 5L - const val LONGPOLL_TIMEOUT = 25L + const val LONGPOLL_TIMEOUT = 45L + const val LONGPOLL_WAIT = 25L const val PICASSO_TIMEOUT = 15L } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/StickersInteractor.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/StickersInteractor.kt index 31e1d3a9b..ed688e12b 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/StickersInteractor.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/StickersInteractor.kt @@ -42,6 +42,9 @@ class StickersInteractor(private val networker: INetworker, private val storage: it ) }).setActive(true).setPurchased(true) + if (items.items.isNullOrEmpty()) { + Settings.get().other().del_last_sticker_sets_custom_sync(accountId) + } storage.storeStickerSetsCustom(accountId, listOf(temp)) } } @@ -56,6 +59,9 @@ class StickersInteractor(private val networker: INetworker, private val storage: list.reverse() } val ret = mapAllMutable(list) { mapStickerSet(it) } + if (list.isEmpty()) { + Settings.get().other().del_last_sticker_sets_sync(accountId) + } storage.storeStickerSets(accountId, ret) } } @@ -81,6 +87,9 @@ class StickersInteractor(private val networker: INetworker, private val storage: } temp.add(StickersKeywordsEntity(stickersKeywords, userStickers)) } + if (list.isEmpty()) { + Settings.get().other().del_last_sticker_keywords_sync(accountId) + } storage.storeKeyWords(accountId, temp) } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudiosLocalFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudiosLocalFragment.kt index 2ad6ce701..4c384409d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudiosLocalFragment.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/audioslocal/AudiosLocalFragment.kt @@ -66,17 +66,7 @@ class AudiosLocalFragment : BaseMvpFragment) fun displayRefreshing(refreshing: Boolean) fun checkPermission() + + fun goToLocalAudioAlbums(selectedId: Int) } \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/ILocalAudioAlbumsView.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/ILocalAudioAlbumsView.kt index a7e8c7513..8b885cbb4 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/ILocalAudioAlbumsView.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/ILocalAudioAlbumsView.kt @@ -10,4 +10,6 @@ interface ILocalAudioAlbumsView : IMvpView { fun openAlbum(album: LocalImageAlbum) fun notifyDataChanged() fun requestReadExternalStoragePermission() + + fun updateCurrentId(currentId: Int) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsAdapter.kt new file mode 100644 index 000000000..c7dfbcbc8 --- /dev/null +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsAdapter.kt @@ -0,0 +1,122 @@ +package dev.ragnarok.fenrir.fragment.audio.local.localaudioalbums + +import android.content.Context +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import dev.ragnarok.fenrir.R +import dev.ragnarok.fenrir.model.LocalImageAlbum +import dev.ragnarok.fenrir.module.FenrirNative +import dev.ragnarok.fenrir.picasso.Content_Local +import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.buildUriForPicasso +import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.with +import dev.ragnarok.fenrir.settings.CurrentTheme +import dev.ragnarok.fenrir.settings.Settings +import dev.ragnarok.fenrir.util.Utils +import dev.ragnarok.fenrir.view.natives.rlottie.RLottieImageView + +class LocalAudioAlbumsAdapter( + context: Context, + private var data: List +) : RecyclerView.Adapter() { + private val isDark: Boolean = Settings.get().ui().isDarkModeEnabled(context) + private var clickListener: ClickListener? = null + private var currentId: Int = -1 + fun setData(data: List) { + this.data = data + notifyDataSetChanged() + } + + fun updateCurrentId(currentId: Int) { + this.currentId = currentId + notifyDataSetChanged() + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder { + return Holder( + LayoutInflater.from(parent.context) + .inflate(R.layout.local_audio_album_item, parent, false) + ) + } + + override fun onBindViewHolder(holder: Holder, position: Int) { + val album = data[position] + val uri = buildUriForPicasso(Content_Local.AUDIO, album.getCoverImageId()) + if (album.getId() != 0) { + holder.title.text = album.getName() + holder.subtitle.text = + holder.itemView.context.getString( + R.string.local_audios_count, + album.getPhotoCount() + ) + with() + .load(uri) + .tag(PICASSO_TAG) + .placeholder(if (isDark) R.drawable.generic_audio_nowplaying_dark else R.drawable.generic_audio_nowplaying_light) + .error(if (isDark) R.drawable.generic_audio_nowplaying_dark else R.drawable.generic_audio_nowplaying_light) + .into(holder.image) + } else { + with().cancelRequest(holder.image) + holder.image.setImageResource(if (isDark) R.drawable.generic_audio_nowplaying_dark else R.drawable.generic_audio_nowplaying_light) + holder.title.setText(R.string.all_audios) + holder.subtitle.text = "" + } + holder.itemView.setOnClickListener { + clickListener?.onClick(album) + } + + val isSelected = currentId == album.getId() + holder.selected.visibility = if (isSelected) View.VISIBLE else View.GONE + if (Utils.hasMarshmallow() && FenrirNative.isNativeLoaded) { + if (isSelected) { + holder.selected.fromRes( + dev.ragnarok.fenrir_common.R.raw.theme_selected, + Utils.dp(120f), + Utils.dp(120f), + intArrayOf( + 0x333333, + CurrentTheme.getColorWhiteContrastFix(holder.selected.context), + 0x777777, + CurrentTheme.getColorPrimary(holder.selected.context), + 0x999999, + CurrentTheme.getColorSecondary(holder.selected.context) + ) + ) + holder.selected.playAnimation() + } else { + holder.selected.clearAnimationDrawable() + } + } else { + if (isSelected) { + holder.selected.setImageResource(R.drawable.theme_select) + } + } + } + + override fun getItemCount(): Int { + return data.size + } + + fun setClickListener(clickListener: ClickListener?) { + this.clickListener = clickListener + } + + interface ClickListener { + fun onClick(album: LocalImageAlbum) + } + + class Holder(itemView: View) : RecyclerView.ViewHolder(itemView) { + val image: ImageView = itemView.findViewById(R.id.item_local_album_cover) + val title: TextView = itemView.findViewById(R.id.item_local_album_name) + val subtitle: TextView = itemView.findViewById(R.id.counter) + val selected: RLottieImageView = itemView.findViewById(R.id.selected) + } + + companion object { + const val PICASSO_TAG = "LocalAudioAlbumsAdapter.TAG" + } + +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsFragment.kt index a9f37b3b2..74fa3d6e6 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsFragment.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/audio/local/localaudioalbums/LocalAudioAlbumsFragment.kt @@ -9,28 +9,30 @@ import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.StaggeredGridLayoutManager import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.google.android.material.bottomsheet.BottomSheetDialog +import com.google.android.material.materialswitch.MaterialSwitch +import dev.ragnarok.fenrir.Extra import dev.ragnarok.fenrir.R import dev.ragnarok.fenrir.fragment.base.BaseMvpBottomSheetDialogFragment import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory import dev.ragnarok.fenrir.fragment.photos.localimagealbums.LocalPhotoAlbumsAdapter import dev.ragnarok.fenrir.listener.PicassoPauseOnScrollListener import dev.ragnarok.fenrir.model.LocalImageAlbum -import dev.ragnarok.fenrir.picasso.Content_Local +import dev.ragnarok.fenrir.settings.Settings import dev.ragnarok.fenrir.util.AppPerms.requestPermissionsAbs import dev.ragnarok.fenrir.view.MySearchView class LocalAudioAlbumsFragment : BaseMvpBottomSheetDialogFragment(), - LocalPhotoAlbumsAdapter.ClickListener, SwipeRefreshLayout.OnRefreshListener, + LocalAudioAlbumsAdapter.ClickListener, SwipeRefreshLayout.OnRefreshListener, ILocalAudioAlbumsView { private val requestReadPermission = requestPermissionsAbs(arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE)) { lazyPresenter { - fireReadExternalStoregePermissionResolved() + fireReadExternalStoragePermissionResolved() } } private var mRecyclerView: RecyclerView? = null - private var mAlbumsAdapter: LocalPhotoAlbumsAdapter? = null + private var mAlbumsAdapter: LocalAudioAlbumsAdapter? = null private var listener: Listener? = null override fun onCreateDialog(savedInstanceState: Bundle?): BottomSheetDialog { val dialog = BottomSheetDialog(requireActivity(), theme) @@ -47,6 +49,11 @@ class LocalAudioAlbumsFragment : ): View? { val view = inflater.inflate(R.layout.fragment_local_albums_audio, container, false) val mySearchView: MySearchView = view.findViewById(R.id.searchview) + val mRememberAudioAlbum: MaterialSwitch = view.findViewById(R.id.remember_audio_album) + mRememberAudioAlbum.isChecked = Settings.get().other().isRememberLocalAudioAlbum + mRememberAudioAlbum.setOnClickListener { + Settings.get().other().isRememberLocalAudioAlbum = mRememberAudioAlbum.isChecked + } mySearchView.setRightButtonVisibility(false) mySearchView.setLeftIcon(R.drawable.magnify) mySearchView.setOnQueryTextListener(object : MySearchView.OnQueryTextListener { @@ -73,7 +80,7 @@ class LocalAudioAlbumsFragment : mRecyclerView?.layoutManager = manager mRecyclerView?.addOnScrollListener(PicassoPauseOnScrollListener(LocalPhotoAlbumsAdapter.PICASSO_TAG)) mAlbumsAdapter = - LocalPhotoAlbumsAdapter(requireActivity(), emptyList(), Content_Local.AUDIO) + LocalAudioAlbumsAdapter(requireActivity(), emptyList()) mAlbumsAdapter?.setClickListener(this) mRecyclerView?.adapter = mAlbumsAdapter return view @@ -108,10 +115,17 @@ class LocalAudioAlbumsFragment : requestReadPermission.launch() } + override fun updateCurrentId(currentId: Int) { + mAlbumsAdapter?.updateCurrentId(currentId) + } + override fun getPresenterFactory(saveInstanceState: Bundle?): IPresenterFactory { return object : IPresenterFactory { override fun create(): LocalAudioAlbumsPresenter { + val selectedId = + requireArguments().getInt(Extra.ALBUM_ID, 0) return LocalAudioAlbumsPresenter( + selectedId, saveInstanceState ) } @@ -123,9 +137,12 @@ class LocalAudioAlbumsFragment : } companion object { + fun newInstance(selectedId: Int, listener: Listener?): LocalAudioAlbumsFragment { + val args = Bundle() + args.putInt(Extra.ALBUM_ID, selectedId) - fun newInstance(listener: Listener?): LocalAudioAlbumsFragment { val fragment = LocalAudioAlbumsFragment() + fragment.arguments = args fragment.listener = listener return fragment } 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 83ec1758a..fd626227e 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 @@ -10,7 +10,7 @@ import dev.ragnarok.fenrir.util.Objects.safeEquals import dev.ragnarok.fenrir.util.PersistentLogger import java.util.Locale -class LocalAudioAlbumsPresenter(savedInstanceState: Bundle?) : +class LocalAudioAlbumsPresenter(private val currentId: Int, savedInstanceState: Bundle?) : RxSupportPresenter(savedInstanceState) { private val mLocalImageAlbums: MutableList private val mLocalImageAlbums_Search: MutableList @@ -46,6 +46,7 @@ class LocalAudioAlbumsPresenter(savedInstanceState: Bundle?) : override fun onGuiCreated(viewHost: ILocalAudioAlbumsView) { super.onGuiCreated(viewHost) + viewHost.updateCurrentId(currentId) if (!hasReadStoragePermission(applicationContext)) { if (!permissionRequestedOnce) { permissionRequestedOnce = true @@ -129,7 +130,7 @@ class LocalAudioAlbumsPresenter(savedInstanceState: Bundle?) : view?.openAlbum(album) } - fun fireReadExternalStoregePermissionResolved() { + fun fireReadExternalStoragePermissionResolved() { if (hasReadStoragePermission(applicationContext)) { loadData() } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsFragment.kt index 42f84f0f3..cd3addb59 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsFragment.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsFragment.kt @@ -234,9 +234,6 @@ class DialogsFragment : BaseMvpFragment(), IDial ) } }).attachToRecyclerView(mRecyclerView) - if (needHelp(HelperSimple.DIALOG_SEND_HELPER, 3)) { - showSnackbar(R.string.dialog_send_helper, true) - } } } @@ -414,6 +411,10 @@ class DialogsFragment : BaseMvpFragment(), IDial }?.show() } + override fun showDialogSendHelper() { + showSnackbar(R.string.dialog_send_helper, true) + } + override fun onAvatarClick(dialog: Dialog) { presenter?.fireDialogAvatarClick( dialog diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsPresenter.kt index eea103536..a26ed4396 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsPresenter.kt @@ -23,6 +23,7 @@ import dev.ragnarok.fenrir.nonNullNoEmpty import dev.ragnarok.fenrir.settings.ISettings import dev.ragnarok.fenrir.settings.Settings import dev.ragnarok.fenrir.util.AssertUtils.assertPositive +import dev.ragnarok.fenrir.util.HelperSimple import dev.ragnarok.fenrir.util.Optional import dev.ragnarok.fenrir.util.Optional.Companion.empty import dev.ragnarok.fenrir.util.Optional.Companion.wrap @@ -58,7 +59,8 @@ class DialogsPresenter( private var endOfContent = false private var netLoadingNow = false private var cacheNowLoading = false - private var needAskWhenGuiReady = false + private var needAskReloadDialogsWhenGuiReady = false + private var needShowDialogSendHelperWhenGuiReady = false override fun saveState(outState: Bundle) { super.saveState(outState) outState.putLong(SAVE_DIALOGS_OWNER_ID, dialogsOwnerId) @@ -70,9 +72,14 @@ class DialogsPresenter( // only for user dialogs viewHost.setCreateGroupChatButtonVisible(dialogsOwnerId > 0) - if (needAskWhenGuiReady) { + if (needAskReloadDialogsWhenGuiReady) { viewHost.askToReload() - needAskWhenGuiReady = false + needAskReloadDialogsWhenGuiReady = false + } + + if (needShowDialogSendHelperWhenGuiReady) { + viewHost.showDialogSendHelper() + needShowDialogSendHelperWhenGuiReady = false } } @@ -279,13 +286,22 @@ class DialogsPresenter( safeNotifyDataSetChanged() resolveRefreshingView() view?.notifyHasAttachments(models != null) + + if (models != null && HelperSimple.needHelp(HelperSimple.DIALOG_SEND_HELPER, 3)) { + if (view == null) { + needShowDialogSendHelperWhenGuiReady = true + } else { + view?.showDialogSendHelper() + } + } + if (Settings.get().other().isNot_update_dialogs || isHiddenCurrent) { if (!isHiddenCurrent) { receiveStickers() } if (needReloadDialogs(accountId)) { if (view == null) { - needAskWhenGuiReady = true + needAskReloadDialogsWhenGuiReady = true } else { view?.askToReload() } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/IDialogsView.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/IDialogsView.kt index af0e7d2bb..e45c219fb 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/IDialogsView.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/IDialogsView.kt @@ -31,6 +31,7 @@ interface IDialogsView : IMvpView, IErrorView, IToastView { fun setCreateGroupChatButtonVisible(visible: Boolean) fun notifyHasAttachments(has: Boolean) fun updateAccountIdNoRefresh(accountId: Long) + fun showDialogSendHelper() interface IContextView { fun setCanDelete(can: Boolean) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/photos/localphotos/LocalPhotosFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/photos/localphotos/LocalPhotosFragment.kt index b162eff1c..0e80ba80c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/photos/localphotos/LocalPhotosFragment.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/photos/localphotos/LocalPhotosFragment.kt @@ -143,10 +143,10 @@ class LocalPhotosFragment : BaseMvpFragment { return object : IPresenterFactory { override fun create(): LocalPhotosPresenter { - val maxSelectionItemCount1 = + val maxSelectionItemCount = requireArguments().getInt(EXTRA_MAX_SELECTION_COUNT, 10) val album: LocalImageAlbum? = requireArguments().getParcelableCompat(Extra.ALBUM) - return LocalPhotosPresenter(album, maxSelectionItemCount1, saveInstanceState) + return LocalPhotosPresenter(album, maxSelectionItemCount, saveInstanceState) } } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/GroupLongpoll.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/GroupLongpoll.kt index 7ff343206..c7edac59e 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/GroupLongpoll.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/GroupLongpoll.kt @@ -65,7 +65,7 @@ internal class GroupLongpoll( if (validServer) { compositeDisposable.add( networker.longpoll() - .getGroupUpdates(server ?: return, key, ts, Constants.LONGPOLL_TIMEOUT) + .getGroupUpdates(server ?: return, key, ts, Constants.LONGPOLL_WAIT) .fromIOToMain() .subscribe({ updates -> onUpdates(updates) }) { throwable -> onUpdatesGetError( diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/UserLongpoll.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/UserLongpoll.kt index 18dd8e9dd..a7052896c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/UserLongpoll.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/UserLongpoll.kt @@ -93,7 +93,7 @@ internal class UserLongpoll( "https://$server", key, ts ?: return, - Constants.LONGPOLL_TIMEOUT, + Constants.LONGPOLL_WAIT, MODE, V ) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/ISettings.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/ISettings.kt index 3065c4b0f..c2c68a951 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/ISettings.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/ISettings.kt @@ -123,6 +123,8 @@ interface ISettings { val isRunes_show: Boolean val musicLifecycle: Int val fFmpegPlugin: Int + var isRememberLocalAudioAlbum: Boolean + var currentLocalAudioAlbum: Int fun videoExt(): Set fun photoExt(): Set fun audioExt(): Set diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/OtherSettings.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/OtherSettings.kt index 84023e6c2..a2a70bb4a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/OtherSettings.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/OtherSettings.kt @@ -507,6 +507,19 @@ internal class OtherSettings(context: Context) : IOtherSettings { set(disabled) { getPreferences(app).edit().putBoolean("disable_likes", disabled).apply() } + override var isRememberLocalAudioAlbum: Boolean + get() = getPreferences(app).getBoolean("remember_local_audio_album", false) + set(remember) { + if (!remember) { + getPreferences(app).edit().remove("current_local_audio_album").apply() + } + getPreferences(app).edit().putBoolean("remember_local_audio_album", remember).apply() + } + override var currentLocalAudioAlbum: Int + get() = getPreferences(app).getInt("current_local_audio_album", 0) + set(current) { + getPreferences(app).edit().putInt("current_local_audio_album", current).apply() + } override var isDisable_notifications: Boolean get() = getPreferences(app).getBoolean("disable_notifications", false) set(disabled) { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/backup/SettingsBackup.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/backup/SettingsBackup.kt index c894a6cbe..b73620ac1 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/backup/SettingsBackup.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/backup/SettingsBackup.kt @@ -166,6 +166,7 @@ class SettingsBackup { var owner_changes_monitor_uids: Set? = null var current_parser: String? = null var audio_catalog_v2_enable: Boolean? = null + var remember_local_audio_album: Boolean? = null var navigation_menu_order: String? = null var side_navigation_menu_order: String? = null } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/theme/ThemesController.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/theme/ThemesController.kt index 7e30281c2..5ae729d2b 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/theme/ThemesController.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/theme/ThemesController.kt @@ -38,7 +38,18 @@ object ThemesController { R.style.App_DayNight_ColdGreen, R.style.App_DayNight_ColdGreen_Amoled, R.style.App_DayNight_ColdGreen_MD1 - ).toast("#4D7198", "#448AFF"), + ).toast("#556518", "#448AFF"), + ThemeValue( + "coffee_pistachio", + "#9B5D56", + "#8EBD9D", + "#E0BCA0", + "#BEDAC3", + "Coffee Pistachio", + R.style.App_DayNight_CoffeePistachio, + R.style.App_DayNight_CoffeePistachio_Amoled, + R.style.App_DayNight_CoffeePistachio_MD1 + ).toast("#9B5D56", "#448AFF"), ThemeValue( "ice", "#448AFF", diff --git a/app_fenrir/src/main/res/layout/fragment_local_albums_audio.xml b/app_fenrir/src/main/res/layout/fragment_local_albums_audio.xml index 1201b2e61..a5e8fe772 100644 --- a/app_fenrir/src/main/res/layout/fragment_local_albums_audio.xml +++ b/app_fenrir/src/main/res/layout/fragment_local_albums_audio.xml @@ -45,6 +45,16 @@ app:layout_scrollFlags="scroll|enterAlways|snap" app:search_source_id="11" /> + + diff --git a/app_fenrir/src/main/res/layout/local_audio_album_item.xml b/app_fenrir/src/main/res/layout/local_audio_album_item.xml new file mode 100644 index 000000000..eefab187c --- /dev/null +++ b/app_fenrir/src/main/res/layout/local_audio_album_item.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app_fenrir/src/main/res/values-be/strings.xml b/app_fenrir/src/main/res/values-be/strings.xml index 91eedc0b3..0564b83e5 100644 --- a/app_fenrir/src/main/res/values-be/strings.xml +++ b/app_fenrir/src/main/res/values-be/strings.xml @@ -1505,7 +1505,7 @@ Аўтавыбар якасці відэа У відэа няма спасылкі Налады якасці адпраўкі фота - Афармленне сцяны для язычнікаў + Паганскае афармленне Паказваць руны Сімвал Прагляд фота @@ -1720,4 +1720,5 @@ Акаўнт не зарэгістраваны! Забараніць адмену голасу Пусты фон + Запомніць \ No newline at end of file diff --git a/app_fenrir/src/main/res/values-night/styles.xml b/app_fenrir/src/main/res/values-night/styles.xml index 0efeaa03a..91a0ee283 100644 --- a/app_fenrir/src/main/res/values-night/styles.xml +++ b/app_fenrir/src/main/res/values-night/styles.xml @@ -226,6 +226,21 @@ #444930 + + + + + + + + + + + + + + + +