Naitbit / SecretSauce

Collection of utility classes that are common for multiple android projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SecretSauce

Maven Central Maven Central master: Build Status develop: Build Status

Collection of utility classes that are common for multiple android projects.

Contains:

  • Activity Extension functions for hiding and showing keyboards, showing fragments with animations, default date picker, and more
  • WebViewActivity (for displaying basic full screen webview, that accepts URL and data to post)
  • WaitLayout - Displays spinner on any item, can synchronize with CachedFields and CachedEndpoints. This part is available in separate artifact
  • PicassoScrollListener (that stops loading images during fast scroll)
  • LogUtils (for situation when Timber is not appropriate)
  • NetworkChangeReceiver - wrapper from BroadcastReceiver that sets current state to Android ObservableBoolean
  • AnimationRunnable (helps with custom view transitions between two states)
  • Checkable views
  • LinkTextView (TextView where URLs are clickable)
  • RoundedDrawable, RoundedImageView
  • ViewUtils (set styled text fragments, convert dp to px, convert dp to pixel, and more)
  • Toast Context extension functions
  • JdkBasedTimeZoneProvider (for faster loading of JodaTime)
  • BindingAdapters - Common Android DataBinding adapters
    • onClick that does not pass view to listener (to avoid spill Android dependencies do viewModel)
    • showView (setVisibility VISIBLE/GONE)
    • error (editText.setError)
    • active (setActivated)
  • RxLifecycle extension functions - allows invoking certain action on Fragment/Activity pause (commonly used to detach view from viewModel, or similar cleanups)
  • Android Dagger Lifecycle common classes like [ViewModelFactory] and extension functions

initialization

Some feature are more convenient to use if you declare some parameters up front.

SecretSauceSettings.set(debug = BuildConfig.DEBUG,
                containerViewId = R.id.container,
                bindingViewModelId = BR.viewModel,
                viewModelFactoryProvider = { viewModelFactory })

Settings any of those values is optional. If you don't use given feature you can skip given parameter. However if you attempt to use given feature later you will either have to pass optional param to function or the exception will be thrown. debug is used by logs and Toasts containerViewId used by showFragment methods bindingViewModelId and viewModelFactoryProvider use by viewModel extension functions.

About

Collection of utility classes that are common for multiple android projects.

License:Apache License 2.0


Languages

Language:Java 61.3%Language:Kotlin 36.6%Language:Shell 1.4%Language:Ruby 0.6%