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.
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.
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].
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. OverrideonActivityResulton 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. OverrideonActivityResulton the given [fragment] and check the given [requestCode] for result.- … and more!
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].
Injectable wrapper of [Log] to simplify logs in the same class by reusing the tag and to simplify unit tests.
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.
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<String>, grantResults: IntArray): Unit: should be invoked on fragment/activity onRequestPermissionsResult. It’s already implemented onWolmoActivityso, sincePermissionManageris a singleton, by usingWolmoActivityno importance should be given to this.
Singleton injectable utility class to query and store values in [SharedPreferences].
Base implementation of a FragmentStatePagerAdapter for a ViewPager that allows, simply, to add fragments:
addFragment(fragment: Fragment, title: String): Unit: adds a single fragment with its titile to the adapter.addFragments(fragments: List<Pair<Fragment, String>>): Unit: adds multiple fragments with theirs titles to the adapter.
Note: The fragments given to this should be injected.
Singleton injectable utility class to simplify work with Android's [Toast] messages.
Provides some view extensions.
ViewGroup.inflate(@LayoutRes layoutRes: Int, attachToRoot: Boolean = false): View: inflates a layout inside the [ViewGroup].TextView.setTextOrGone(newText: String?): Unit: set text and show if text is not null or empty or hide otherwise.
Base implementation of a DaggerActivity that provides these extra features:
replaceFragment(@IdRes resId: Int, fragment: Fragment): Unit: replace the [resId] with the given [fragment].requireArgument(key: String): T: get the argument from the intent extras by the given [key] and returns it as a non-null [T].
Singleton injectable utils class for managing [File]s.
getNewCachePictureFilename(name: String, imageType: ImageType): String: returns a new picture filename inside the app cache. The filename will be [name]_[System.nanoTime()].getNewCacheVideoFilename(name: String): String: returns a new video filename inside the app cache. The filename will be [name]_[System.nanoTime()].getNewPictureName(name: String, imageType: ImageType): String: returns a new picture filename inside the DCIM folder. The filename will be [name]_[System.nanoTime()].getNewVideoName(name: String): String: returns a new video filename inside the Videos folder. The filename will be [name]_[System.nanoTime()].- … and more!
Base implementation of a DaggerFragment that is MVP-ready (you can access the presenter [T] by presenter) and provides some extra callbacks to be overridden if needed:
init(): Unit: invoked on view created and used to initialize everything necessary.setListeners(): Unit: invoked on view created and used to set listeners likeonClick.handleArguments(arguments: Bundle?): Boolean: invoked on create and used to verify if arguments contains what fragment requires. Returning null or false will end the execution.
It also provides this extra feature:
requireArgument(key: String): T: get argument by the given [key] and returns it as a non-null [T].
A base that setups the environment for a Wolmo's [BasePresenter] test. It also provides a prepared environment for annotated mocks.
A Junit Test Rule that allows to use Coroutines main dispatcher on a test. If [runOnAllTests] is false then all tests will have this configuration, otherwise just those that have [CoroutineTest] annotation.
