Comments (6)
yes, there is TiActivity
and TiFragment
from thirtyinch.
ThirtyInch doesn't define how you structure your UI implementation. ViewPager
works as well but your Activity (the TiView
implementation) is responsible to forward the data to the corresponding pages inside the ViewPager
. The presenter doesn't know about the ViewPager
, it only knowns the TiView
has multiple lists which have to be filled with data.
It's hard to guess how you are using the ViewPager right now. Here some suggestions:
You can use a ViewPager
with fragments inside. Each Fragment
can have it's own presenter. This is useful when one tab is totally independent from the others.
We recently had a UI with two tabs showing different lists. We used a ViewPager
to switch between them. Instead of a ViewPager
with fragments we used plain views (RecyclerView
) and filled the data in those adapters from the presenter.
from thirtyinch.
I'm using the ViewPager with fragments.
I have ViewPagers with fragments inside which have ReceyclerViews. Data is loaded from database. User could interact with RecyclerView-items (mark favorite, open items,...).
The RecyclerView-items (items look nearly same and also the functionality is nearly the same (items have state "running"/"finished", therefore different interactions)).
And I also have ViewPager to create an item. This means every fragment is completely different - but at the sum all data of the fragments is ONE object which will be created. I have to validate the input data (not only for one fragment but for all fragments together).
from thirtyinch.
@passsy Should I provide more information? What do you need? I'm very interested in using this lib.
from thirtyinch.
There is no "right" way to implement MVP with ThirtyInch when your UI has a ViewPager
. It's totally up to you.
You can put presenters in the fragments of the ViewPager, you can put a single presenter in the Activity. I've seen and implemented all of those scenarios. All have pros and cons and you have to decide what fits best into your app architecture and personal preference.
First of all you should ask yourself what kind of problem you are trying to solve with the introduction of MVP. That's why I can't answer your questions. I have no idea what stops you from using Ti
.
If you don't have a problem you should not use Ti
.
from thirtyinch.
One last question in this thread (thanks for your time):
You can put presenters in the fragments of the ViewPager, you can put a single presenter in the Activity. I've seen and implemented all of those scenarios. All have pros and cons and you have to decide what fits best into your app architecture and personal preference.
And all scenarios are working with Ti
?
from thirtyinch.
Related Issues (20)
- Debugging a @CallOnMainThread annotated method crashes the app HOT 2
- Create Kotlin module/extensions HOT 2
- Switch from compileOnly to implementation HOT 1
- [Discussion] Should manageViewDisposable() throw an exception
- Support for AndroidX HOT 4
- BackstackReader doesn't work with AndroidX HOT 3
- "Don't add observers when the presenter reached the DESTROYED state" EXCEPTION HOT 1
- sendToView HOT 4
- Lint warning with sendToView, but not with deliverToView
- Why saving the Presenter on orientation change HOT 1
- Problems with @CallOnMainThread
- Lint does not report by abstract classes without implementation View
- Crash using AndroidX with ProGuard enabled HOT 2
- Lint reports: Obsolete custom lint check
- bundle[buildType] was replaced with AGP 3.2.0
- Package thirtyinch-kotlin-coroutines not published HOT 3
- Plugin module not available with version 0.9.5 HOT 2
- Release for androidx HOT 2
- Restore old BackstackReader.isInBackstack() implementation once AndroidX Fragment 1.2.1 is released HOT 1
- Migrate away from JCenter HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thirtyinch.