mortar

How to handle onActivityResult() with Mortar

风流意气都作罢 提交于 2020-01-13 03:54:50
问题 I am looking to integrate an application with Google Play Services and Mortar to retrieve the user's current location. https://developer.android.com/training/location/retrieve-current.html#CheckServices This requires handling onActivityResult() in the case that Google Play Services is not available. My first instinct on how to do this is to make getFirstScreen() in Main.java return a blank loading screen. https://github.com/square/mortar/blob/master/mortar-sample/src/main/java/com/example

Mortar / Flow save view and presenter in backstack

纵饮孤独 提交于 2019-12-12 16:18:36
问题 I'm playing with Mortar / Flow / Dagger2. My app has 2 screens : Screen 1 shows a Google map. I'm using directly the MapView object rather than the MapFragment, and I hooked it properly to the root activity lifecycle events. Screen 2 shows some info from a map marker. We go from screen 1 to screen 2 through Flow.get(context).goTo(new Screen2()); The problem is that when I come back from screen 2 to screen 1, using Flow.get(context).goBack(); , the screen 1 and its MapView are recreated from

What is the prefered way to save/restore screen state with Flow + Mortar + Dagger2?

爱⌒轻易说出口 提交于 2019-12-07 14:26:32
问题 I'm trying to convert an Acticity + Fragments app to Flow + Mortar + Dagger2 I would like to save & restore screen state when jumping from screen to screen (at least backwards). What is the prefered/recommanded way to do that ? I have spent quite a lot of time looking at flow and mortar readmes and samples but couldn't figure it out (the documentation and samples are minimal and only deal with simple/static/unique data). Say, for example, you have a browser-like app that moves from Page to

Using Flow & Mortar with ViewPager

北慕城南 提交于 2019-12-07 04:48:16
问题 I'm in the process of writing an app using Flow and Mortar. I'm having trouble figuring out how to use this when it comes to a view pager with tabs. Only way I can think of is to treat the ViewPager screen as a single screen, and end up using Fragments to build it. But the whole point of using Flow & Mortar is to get rid of Fragments and simplify the lifecycle. Any help is appreciated. Thanks. 回答1: I made a view pager example, up to date with Mortar and Flow versions (based on adapter from

What is the prefered way to save/restore screen state with Flow + Mortar + Dagger2?

情到浓时终转凉″ 提交于 2019-12-05 18:30:25
I'm trying to convert an Acticity + Fragments app to Flow + Mortar + Dagger2 I would like to save & restore screen state when jumping from screen to screen (at least backwards). What is the prefered/recommanded way to do that ? I have spent quite a lot of time looking at flow and mortar readmes and samples but couldn't figure it out (the documentation and samples are minimal and only deal with simple/static/unique data). Say, for example, you have a browser-like app that moves from Page to Page Where each Page use the same same PageView class, the same PagePresenter Class but have different

How to handle onActivityResult() with Mortar

南楼画角 提交于 2019-12-04 09:24:30
I am looking to integrate an application with Google Play Services and Mortar to retrieve the user's current location. https://developer.android.com/training/location/retrieve-current.html#CheckServices This requires handling onActivityResult() in the case that Google Play Services is not available. My first instinct on how to do this is to make getFirstScreen() in Main.java return a blank loading screen. https://github.com/square/mortar/blob/master/mortar-sample/src/main/java/com/example/mortar/core/Main.java After injection, during onCreate() perform the check to see if Google Play Services

Mortar + Flow with third party libraries hooked to activity lifecycle

与世无争的帅哥 提交于 2019-12-04 07:44:08
问题 Some third party libraries use hooks into the activity lifecycle to work correctly - for instance, the Facebook SDK (https://developers.facebook.com/docs/android/login-with-facebook/). I'm having some trouble figuring out how to reconcile this model cleanly with a single-activity flow+mortar setup. For instance, if I want to use Facebook login as part of a login Flow (w/ FlowView/FlowOwner), but not otherwise in the activity, what's the smartest way to pull this off if you need hooks for that

Mortar + Flow with third party libraries hooked to activity lifecycle

て烟熏妆下的殇ゞ 提交于 2019-12-02 17:11:50
Some third party libraries use hooks into the activity lifecycle to work correctly - for instance, the Facebook SDK ( https://developers.facebook.com/docs/android/login-with-facebook/ ). I'm having some trouble figuring out how to reconcile this model cleanly with a single-activity flow+mortar setup. For instance, if I want to use Facebook login as part of a login Flow (w/ FlowView/FlowOwner), but not otherwise in the activity, what's the smartest way to pull this off if you need hooks for that particular flow in onCreate, onResume, onPause, onDestroy, onSaveInstanceState, onActivityResult,