|
5 | 5 |
|
6 | 6 | Android-Retainable-Tasks is an easy to use mini-library for easy asynchronous background tasking with callback support to the UI. This library is based on the Android `AsyncTask` implementation but with support for retaining tasks and therefore surviving configuration changes (orientation).
|
7 | 7 |
|
| 8 | +*Key features:* |
| 9 | + |
| 10 | + - Light weight |
| 11 | + - Same Task API on all Android versions, based on the Marshmallow AsyncTask implementation. |
| 12 | + - Simple API |
| 13 | + - Supports API 9+ <sub>(or 11+ if you not use the support library based classes)</sub> |
| 14 | + |
8 | 15 | **Add it to your project**
|
9 | 16 |
|
10 | 17 | Android-Retainable-Tasks is available on jCenter, just add the following compile dependency to your modules build.gradle file.
|
@@ -140,10 +147,14 @@ public class Main extends AppCompatActivity implements Task.Callback {
|
140 | 147 | ####**How are tasks retained?**
|
141 | 148 | Tasks are are stored in `FragmentManagers` which are stored in a *"no-ui-fragment"* this fragment retained across configuration changes and is added to your Activity's `FragmentManager` the first time you call:
|
142 | 149 |
|
143 |
| - - `TaskActivityCompat.getTaskManager()`; |
144 |
| - - `TaskFragmentCompat.getTaskManager()`; |
145 |
| - - `TaskManager.getActivityTaskManager()` (super-advanced usage); |
146 |
| - - `TaskManager.getFragmentTaskManager()` (super-advanced usage); |
| 150 | + - `getTaskManager()` in the following classes: |
| 151 | + - `TaskActivity` & `TaskActivityCompat` |
| 152 | + - `TaskFragment` & `TaskFragmentCompat` |
| 153 | + - `TaskManagerLifeCycleProxy.getTaskManager()` |
| 154 | + - `TaskManager.getActivityTaskManager()` <sub>(super-advanced usage)</sub> |
| 155 | + - `TaskManager.getFragmentTaskManager()` <sub>(super-advanced usage)</sub> |
| 156 | + |
| 157 | +Essentially any time you request a `TaskManager`. |
147 | 158 |
|
148 | 159 | The *"no-ui-fragment"* is from that point on bound to the Activity's life-cycle and keeps track of all `TaskManager` instances. It also makes sure that all internal `TaskManagers` remove all `Callback` listeners as soon as the Activity is stopping (`onStop()`). It might also throw an exception if a `Fragment` `TaskManger` did not remove the `Callback` listeners, so that you (the developer) know you've messed up.
|
149 | 160 |
|
@@ -239,10 +250,6 @@ public class MyBaseActivity extends SomeActivity implements TaskManagerProvider
|
239 | 250 | }
|
240 | 251 | ```
|
241 | 252 |
|
242 |
| - |
243 |
| - |
244 |
| - |
245 |
| - |
246 | 253 | ## 4. FAQ
|
247 | 254 |
|
248 | 255 | ####**Why does the Task class still have the onPostExecute and onPreExecute etc. methods?**
|
|
0 commit comments