Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert gallery from mvp to mvvm #443

Merged
merged 75 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
8c22a0d
Add inject method
hieuwu Mar 30, 2024
614146a
Create fragment
hieuwu Mar 30, 2024
afbd77b
Add view model
hieuwu Mar 30, 2024
9db1c55
Extract flows
hieuwu Mar 30, 2024
2102572
Move logic down to viewmodel
hieuwu Mar 30, 2024
10bd592
Update proper data structure
hieuwu Mar 31, 2024
dc8cf65
Observe data change
hieuwu Mar 31, 2024
516cd68
Collect state ad update method call
hieuwu Apr 6, 2024
1429420
Create new view adapters version
hieuwu Apr 9, 2024
589b658
Extract states, collect them in view
hieuwu Apr 9, 2024
d1aae0c
Add argument names
hieuwu Apr 10, 2024
58ee959
Provide view models
hieuwu Apr 10, 2024
74363f3
Navigate to new uplift gallery screen
hieuwu Apr 10, 2024
cec293d
Provide layout file
hieuwu Apr 11, 2024
cee81a6
Set value when navigate
hieuwu Apr 13, 2024
2bb2cdf
Handle state change
hieuwu Apr 13, 2024
acbf8d1
Handle state change
hieuwu Apr 13, 2024
0883fd7
Improve coding style
hieuwu Apr 13, 2024
b6d2cd3
Extract classes & refactor code usage
hieuwu Apr 13, 2024
2e456f9
Update method modifiers
hieuwu Apr 13, 2024
325df2c
Update method modifiers
hieuwu Apr 13, 2024
4158e9f
Reorder properties
hieuwu Apr 13, 2024
cf98ddf
Use backing field
hieuwu Apr 13, 2024
d2d222a
Create state and side effect
hieuwu Jun 1, 2024
c816b6f
Extract state to side effect
hieuwu Jun 1, 2024
9b1d665
Remove unused state, update state param
hieuwu Jun 2, 2024
1780a15
Temporarily replace flow by side effect
hieuwu Jun 2, 2024
62dcdb3
Trigger side effect
hieuwu Jun 2, 2024
6d51220
Extract side effect
hieuwu Jun 2, 2024
5981d6c
Extract side effect
hieuwu Jun 2, 2024
16e1a6f
Fix klihnt check
hieuwu Jun 2, 2024
970d0a0
Fix klihnt check
hieuwu Jun 2, 2024
1a0a791
Fix klihnt check
hieuwu Jun 2, 2024
6a5aec3
Fix klihnt check
hieuwu Jun 2, 2024
18fd42c
Fix klihnt check
hieuwu Jun 2, 2024
3848f7e
Improve default value
hieuwu Jun 2, 2024
71532b4
Init state, simplify code flow
hieuwu Jun 14, 2024
52d722d
Rename method
hieuwu Jun 14, 2024
fb0e062
Reformat code
hieuwu Jun 14, 2024
a5482af
Fix wrong order of method call, simplify post effect call by reducing…
hieuwu Jun 16, 2024
ab3b641
Remove space
hieuwu Jun 16, 2024
6966bd5
Fix score widget not shown
hieuwu Jun 19, 2024
f5ad7ac
Remove unused class
hieuwu Jun 23, 2024
84bd6d5
Extract state of progress
hieuwu Jun 23, 2024
9d3576e
Use new progress state
hieuwu Jun 23, 2024
6b5965d
Use new progress state
hieuwu Jun 23, 2024
c542b84
Extract strings
hieuwu Jun 23, 2024
ba5f639
Fix klint code format
hieuwu Jun 23, 2024
d6ae001
Fix klint code format
hieuwu Jun 23, 2024
78495fc
Fix klint code format
hieuwu Jun 23, 2024
64e7e05
Move controlsVisible to state
mdrlzy Sep 3, 2024
bfba730
Move rootAndFav to state
mdrlzy Sep 3, 2024
ed44374
call initStorages from viewmodel init
mdrlzy Sep 3, 2024
439537e
Handle startPos in viewModel
mdrlzy Sep 3, 2024
0b742bc
update pager items in render, move gallery items to state
mdrlzy Sep 3, 2024
811a17d
Add path to GalleryItem, replace GalleryPresenter.GalleryItem
mdrlzy Sep 3, 2024
9322a71
dont bind viewholders in viewmodel
mdrlzy Sep 3, 2024
8789151
disable StrictMode
mdrlzy Sep 3, 2024
d6b4ddc
refactor onRemoveFabClick
mdrlzy Sep 3, 2024
0849571
make GalleryState.currentItem as property
mdrlzy Sep 3, 2024
911382e
Use currentItem from state not from viewmodel property
mdrlzy Sep 3, 2024
03e417d
remove updateAdapter sideEffect and diffResult from viewmodel
mdrlzy Sep 4, 2024
769d0bc
use state gallery items instead of viewmodel property
mdrlzy Sep 4, 2024
c6e87a3
Refactor side effects and domain models
mdrlzy Sep 4, 2024
dc862e5
Refactor selecting and move selectedResources to state
mdrlzy Sep 4, 2024
7f68bf0
Move progress state to screen state
mdrlzy Sep 4, 2024
0bd196e
Move tags to state
mdrlzy Sep 4, 2024
d3fdcbf
Handle setupPreview in render
mdrlzy Sep 4, 2024
d823ab0
Optimize render
mdrlzy Sep 4, 2024
40f0c10
Move rootAndFav to state
mdrlzy Sep 5, 2024
3ff5299
Move resourcesIds to state
mdrlzy Sep 5, 2024
495325b
minor
mdrlzy Sep 5, 2024
2186b2a
Merge remote-tracking branch 'ARK-Builders/main' into feature/convert…
mdrlzy Sep 5, 2024
a928af3
ktlint formatting
mdrlzy Sep 5, 2024
7977711
Remove old gallery screen
mdrlzy Oct 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import dev.arkbuilders.navigator.presentation.screen.settings.SettingsFragment
import dev.arkbuilders.arkfilepicker.folders.FoldersRepo
import dev.arkbuilders.navigator.analytics.AnalyticsModule
import dev.arkbuilders.navigator.di.modules.DispatcherModule
import dev.arkbuilders.navigator.presentation.screen.gallery.galleryuplift.GalleryUpliftFragment
import javax.inject.Singleton

@Singleton
Expand All @@ -51,6 +52,8 @@ interface AppComponent {
fun inject(resourcesFragment: ResourcesFragment)
fun inject(galleryPresenter: GalleryPresenter)
fun inject(galleryFragment: GalleryFragment)
fun inject(galleryFragment: GalleryUpliftFragment)

fun inject(settingsFragment: SettingsFragment)
fun inject(resourcesGridPresenter: ResourcesGridPresenter)
fun inject(editTagsDialogPresenter: EditTagsDialogPresenter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import dev.arkbuilders.navigator.presentation.screen.gallery.GalleryFragment
import dev.arkbuilders.navigator.presentation.screen.resources.ResourcesFragment
import dev.arkbuilders.navigator.presentation.screen.settings.SettingsFragment
import dev.arkbuilders.arklib.user.tags.Tag
import dev.arkbuilders.navigator.presentation.screen.gallery.galleryuplift.GalleryUpliftFragment

class Screens {
class FoldersScreen : SupportAppScreen() {
Expand Down Expand Up @@ -40,6 +41,15 @@ class Screens {
GalleryFragment.newInstance(rootAndFav, resources, startAt)
}

class GalleryUpliftScreen(
private val rootAndFav: RootAndFav,
val resources: List<ResourceId>,
private val startAt: Int
) : SupportAppScreen() {
override fun getFragment() =
GalleryUpliftFragment.newInstance(rootAndFav, resources, startAt)
}

class GalleryScreenWithSelected(
private val rootAndFav: RootAndFav,
val resources: List<ResourceId>,
Expand All @@ -56,6 +66,22 @@ class Screens {
)
}

class GalleryScreenWithSelectedUplift(
private val rootAndFav: RootAndFav,
val resources: List<ResourceId>,
private val startAt: Int,
private val selectedResources: List<ResourceId>
) : SupportAppScreen() {
override fun getFragment() =
GalleryUpliftFragment.newInstance(
rootAndFav,
resources,
startAt,
true,
selectedResources
)
}

class SettingsScreen : SupportAppScreen() {
override fun getFragment() = SettingsFragment.newInstance()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ class GalleryFragment :

private val presenter by moxyPresenter {
GalleryPresenter(
requireArguments()[ROOT_AND_FAV_KEY] as RootAndFav,
requireArguments().getParcelableArray(RESOURCES_KEY)!!.toList()
as List<ResourceId>,
requireArguments().getInt(START_AT_KEY),
requireArguments().getBoolean(SELECTING_ENABLED_KEY),
(
rootAndFav = requireArguments()[ROOT_AND_FAV_KEY] as RootAndFav,
resourcesIds = requireArguments().getParcelableArray(RESOURCES_KEY)!!
.toList() as List<ResourceId>,
startAt = requireArguments().getInt(START_AT_KEY),
selectingEnabled = requireArguments().getBoolean(SELECTING_ENABLED_KEY),
selectedResources = (
requireArguments().getParcelableArray(SELECTED_RESOURCES_KEY)!!
.toList() as List<ResourceId>
)
Expand Down
Loading
Loading