Code Monkey home page Code Monkey logo

Comments (6)

passsy avatar passsy commented on May 24, 2024 1

yes, there is TiActivity and TiFragment

from thirtyinch.

passsy avatar passsy commented on May 24, 2024

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.

Rainer-Lang avatar Rainer-Lang commented on May 24, 2024

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.

Rainer-Lang avatar Rainer-Lang commented on May 24, 2024

@passsy Should I provide more information? What do you need? I'm very interested in using this lib.

from thirtyinch.

passsy avatar passsy commented on May 24, 2024

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.

Rainer-Lang avatar Rainer-Lang commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.