vkatz-lib


Source link: https://github.com/vkatz/vkatz-lib

General

My eng aint perfect, sorry for that

Navigation

BackStack and Screen provide a custom backstack with full control over it as abstract clases

FragmentBackStack and FragmentScreen implementations using fragments

How to use:

U may put a backstack into activity or app class depend on your intentions and use it as simple mvp patter with 1 class. Allow to control history, navigation, holding view in memory, history state, animations etc... For more details take a look at sample code

I am use this method by many diffrent reasons, main is - backstack and navigation control, i can simple call parent.go(SomeScreen.with(some params)) to launch screen, parent.back() to back, and parent.backTo(screen name) to back for specific screen, this is much more simplier that default actitvity navigation + allow me to make kid of mvp with data anc callbacks between screen + let me use all power of fragments.

Utils

ActivityNavigator - simple activity navigation

ActivityNavigator.forActivity(activity).withData("field", "String from MainUI").go(ActivityA::class.java) --- ActivityNavigator.getData(this).getString("field") ActivityNavigator.forActivity(this@ActivityB).withData("extra", "String from activity B").backWithResult(1) 

AsyncHelper - helper for asyn operations using corutines

asyncUI {

 val t1 = async {
 1 
}
.await()

  //Int?

 val t2 = async {
 1 
}
.await()!!

//Int

 val t3 = safeAsync {
 1 
}
.onError {
 2 
}
.await()

  //Int

 val t4 = safeAsync<Int?> {
 1 
}
.onError {
 null 
}
.await()
  //Int?

 val t5 = AsyncHelper(newSingleThreadContext("WorkThread")) {
 1 
}
.onError {
 2 
}
.await()

 val t6 = AsyncHelper<Int?>(newFixedThreadPoolContext(5, "WorkThread")) {
 1 
}
.onError {
 2 
}
.await() 
}
 

Delegates - SharedPreferences and Bundle delegates

ExtUtils - various useful functions

Widgets

Extend elements have a bunch of buffs

List of items:

  • ExtendCheckBox
  • ExtendEditText
  • ExtendRadioButton
  • ExtendTextView
  • ExtendImageView
  • ExtendFrameLayout
  • ExtendLinearLayout
  • ExtendRelativeLayout

New widgets:

  • FlowLayout
  • SlideMenuLayout

Core buffs:

  1. app:compoundDrawableWidth and app:compoundDrawableHeight -> specify compound drawable size(one or both)

  1. app:extendBackground1 and app:extendBackground2 -> combine 2 bg into one as layers (useful when u have color + selector)
  2. app:extendEnabled and app:extendActivated -> set relative view state from xml
  3. "text" widgets get app:extendFont param to support ttf fonts from asset

Special buffs

ExtendEditText

app:extendInputMask/setMask(String) allow to provide input mask ("000 000 0000") - where '0' will be input digit, all other chars will stay

addAfterTextChangedListener setAfterTextChangedListener functions and onSelectionChangedListener listener

ExtendImageView

app:touchZoom allow to enable pinchZoom(default false), app:maxZoom and app:minZoom to config it

ExtendSpinner

Completely new spinner that allow to handle - "no selection" and "custom selected" items ps: in case u are using TextView+[height=wrap-content] as list istem - add also line count !! (otherwise u will face ListView measure bug, someday i will fix it)

New widgets

FlowLayout

Allow to place items one by one, in case there is no space in line - item placed at next line. Allow to set horizontal gaps and vertical per line align

SlideMenuLayout

Allow to create expandable menu from any direction, extends ExtendRelativeLayout

onExpandStateChangeListener - expand/collapse listener

onSlideChangeListener - slide change listener (useful to create animations/transitions)

customScrollBehavior - custom scroll logic (used with appropriate flag)

collapse expand toggle - useful fuctions

How to use:

  1. Add layout and specify menu direction using app:slideFrom
  2. Set menu size app:menuHidingSize (how many will be hided { actual menu size } ) or app:menuVisibleSize (how many will not be hided{ group width - menu size } ), default: full size
  3. Optional: config other params app:scrollBehavior app:menuExpanded app:menuEnabled app:startScrollDistance app:scrollerDuration
  4. Config child views: app:applyScroll - indicate that view will be moved on menu opening/closing (default true), interceptTouches - should menu handle touch events over this view (default true)

Examples:

How to thanks

wmz - Z424415381288
wmr - R109844875467

Resources

Code Guide: How to create Snapchat-like stickers for Android.

Create tiny shareable URLs that can be parsed back into the original URLs.

A line of code lets the view to add shadows.

Solution to Remote config Firebase in reactive way.

An RxJava 2 operator which splits an observable into windows using a key selector.

A simple API Wrapper of OpenWeatherMap.org for Android. It uses Retrofit 2.0 and currently supports 5-Day Forecasts and Current Forecast for any Lat/Lon given location.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes