From 1b8d8208f7307d6e03cb0823c04b8da743a16205 Mon Sep 17 00:00:00 2001 From: dylan-muszel <42148418+dylan-muszel@users.noreply.github.com> Date: Wed, 8 Jan 2020 17:45:26 -0300 Subject: [PATCH] Readme features (#63) * Kotlin Migration - Adapter and DI (#50) * Adapter * DI * Converting object to class * Fix pair * Migrate BasePresenter * Migrate LceView and add copyright to BasePresenter * Migrate LeView * Migrate BasePresenterTest * Add deprecated to runIfViewAttached, replace apply for run in tests, clean code * Migration of permissionsManager * Migration of permissionListener * Fix redundant private set * Refactor to clean code * More refactor * Kotlin migration utils (#52) * Keyboard * Logger * Shared preferences * Migration (#53) * WolmoActivityHandler converted to kotlin (#51) * WolmoActivityHandler converted to kotlin * WolmoActivityHandler converted to kotlin * WolmoActivityHandler converted to kotlin * Kotlin migration fragments (#56) * FRagments migrated * Restoring GetImage.java * Restoring java getimage test * To spaces * Indentation * Reformat * Code reformats * fixing tests * Reverting get image fragment * changing imports * Last migration (#58) * FRagments migrated * Restoring GetImage.java * Restoring java getimage test * To spaces * Indentation * Reformat * Code reformats * fixing tests * Last migration * Kotlin migration fixes - update versions (#59) * Fixing overriding base presenter * Presenter as val * Fix tests * Get presnter instead of require * Fixing wolmo fragment inject * DefaultModule as class * Shared preferences string nullable * Android core as api * Reverting modules * Updating version * Updating versions * Fixing tests * Using implmentation * API insteda of implementation revert * Rollback handler * Also adding some minor changes * Another minor change * Updating comments and using requireArgument * Handle arguments nullable on fragment * Fixing url * Adding coroutine base presenter * Coroutines and more * updating get image fragment * Fixing doc * Updating get image fragment * Rollback handler and minor changes (#61) * Rollback handler * Also adding some minor changes * Another minor change * Updating comments and using requireArgument * Handle arguments nullable on fragment * Fixing url * Removing wrong comment * Updating get image * Moving all get image stuff to a helper * Fixing issues * Some fixes * Removing wrong test * Serializable * Importing * Fixing * Reverting image provider * Provider change * More fixes * Removing wrong arguments * More navigation utils * Updating kapt * Removing getimagekt * Reverting get image fragment * Reverting get image fragment test * Reverting spaces * More reverts * More reverts * Reverting tests * More test reverts * Minor fixes * More comments * Removing log * Single lines * Removing imports * Updating gradle * More tests * Features readme * Reformat * View extensions readme * Removing wrong blank line Co-authored-by: igsosa92 <43349271+igsosa92@users.noreply.github.com> Co-authored-by: patofernandez <49655621+patofernandez@users.noreply.github.com> --- FEATURES.md | 89 +++++++++++++++++++ README.md | 2 + core/build.gradle | 4 - .../wolox/wolmo/core/util/NavigationUtils.kt | 3 +- 4 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 FEATURES.md diff --git a/FEATURES.md b/FEATURES.md new file mode 100644 index 0000000..237db95 --- /dev/null +++ b/FEATURES.md @@ -0,0 +1,89 @@ +
+ +
+ +# WOLMO features + +### BasePresenter +Base implementation of a presenter. It contains a nullable view [V] which is attached and detached given fragment’s lifecycle. It provides some callbacks to be overridden if needed: +- `onViewAttached(): Unit`: invoked when the view is attached. +- `onViewDetached(): Unit`: invoked when the view is detached. + +### CoroutineBasePresenter +Coroutine implementation of a `BasePresenter`. It’s a `CoroutineScope` attached to fragment’s lifecycle (it’s cancelled on view detached). It accepts a `CoroutineContext` and uses `MainDispatcher` as default. + +### GetImageHelper +Injectable helper class to open gallery and camera to get an image. +- `fun openGallery(fragment: Fragment, code: Int, onPermissionDenied: () -> Unit = {}, onGalleryNotFound: () -> Unit = {})`: Request read permissions and open the gallery for result with the given [code] app if exists. +- `fun openCamera(fragment: Fragment, code: Int, destinationFilename: String, onPermissionDenied: () -> Unit = {}, onCameraNotFound: () -> Unit = {})`: Request camera permissions and open the camera for result with the given [code] app if exists, saving the picture on the [destinationFilename]. + +### ImageProvider +Singleton injectable utils class to manipulate and retrieve images. +- `addPictureToDeviceGallery(picture: Uri): Unit`: adds the given [picture] to the device images gallery. +- `getImageFromGallery(fragment: Fragment, requestCode: Int): Boolean `: tries to open gallery to retrieve an image. Returns true if successful, false otherwise. Override `onActivityResult` on the given [fragment] and check the given [requestCode] for result. +- `getImageFromCamera(fragment: Fragment, requestCode: Int, file: String): Boolean`: tries to open camera to take a picture to be saved on the given [file]. Returns true if successful, false otherwise. Override `onActivityResult` on the given [fragment] and check the given [requestCode] for result. +- … and more! + +### KeyboardManager +Injectable class to manage the Android's soft keyboard. +- `show(editText: EditText): Unit`: forces the soft keyboard to show for a specific [editText]. +- `hide(view: View): Unit`: forces the soft keyboard to hide, meant to be called from inside a Fragment's [view]. +- `hide(view: View): Unit`: forces the soft keyboard to hide, meant to be called from inside an [activity]. + +### Logger +Injectable wrapper of [Log] to simplify logs in the same class by reusing the tag and to simplify unit tests. + +### NavigationUtils +Provides some context extensions for navigation. +- `Context.jumpTo(clazz: Class<*>, vararg intentExtras: IntentExtra): Unit`: opens a new activity [clazz] sending all the given [intentExtras]. +- `Context.jumpToClearingTask(clazz: Class<*>, transition: ActivityOptionsCompat?, vararg intentExtras: IntentExtra): Unit`: opens a new activity [clazz] with a [transition] sending all the given [intentExtras]. +- `Context.jumpTo(clazz: Class<*>, vararg intentExtras: IntentExtra): Unit`: opens a new activity [clazz] clearing the current task and sending all the given [intentExtras]. +- `Context.openBrowser(url: String?): Unit`: opens browser with the given [url] (if it's null, open a blank page). +- `Context.makeCall(phone: String): Unit`: make a call to the given [phone]. It needs the [CALL_PHONE] permission. +- `Context.openDial(phone: String): Unit`: open the dial with the given [phone]. It doesn't need any extra permission. + +### PermissionManager +Singleton injectable helper class to handler Android’s runtime permissions. +- `requestPermission(fragment: Fragment, listener: PermissionListener?, vararg permissions: String): Unit`: request one or more [permissions] from a [fragment] and invokes the [listener] on complete. +- `requestPermission(activity: Activity, listener: PermissionListener?, vararg permissions: String): Unit`: request one or more [permissions] from an [activity] and invokes the [listener] on complete. +- `onRequestPermissionsResult(requestCode: Int, permissions: Array