Skip to content

Just an Android project with some stuff that I prefer.

Notifications You must be signed in to change notification settings

oOJohn6Oo/BaseAndroid

Repository files navigation

Just an Android project with some stuff that I prefer.

base-v* contains common utils for Android View system.
compose-v* contains common utils for Android Compose.
v* contains both.

Main Features

JInsetsHelper -- Handling WindowInsets easily

JInsetsHelper

Included in base-*, used for handling WindowInsets.

  • LifeCycle aware, auto-release when activity destroyed.
  • Auto handle WindowInsets.
  • Auto handle SystemBar Scrim.
  • Support Gesture Navigation detection.
  • Support Dark Mode.

Usage:

class MyActivity: AppCompatActivity() { 
    private val insetsHelper = JInsetsHelper() 
    override fun onCreate(savedInstanceState: Bundle?) { 
        super.onCreate(savedInstanceState) 
        lifecycle.addObserver(insetsHelper) 
        // init ViewBinding 
        // Config Inset View 
        insetsHelper.statusBarResponseView = binding.toolBarAttMain 
        insetsHelper.navBarResponseView = binding.recycleViewAttMain 
    }
} 
JLoadingHelper -- LifeCycle aware Progress Dialog

JLoadingHelper

Included in base-*, used to show a normal prompt.

  • Support delay trigger.
  • LifeCycle aware, auto-release when activity destroyed.
  • Avoid duplicate, all components in the same activity share one dialog.
JAppTheme Pre-set Compose Theme

JAppTheme

Included in compose-*, used for quickly handling staff related to the status bar and navigation bar.

JTooltips One line of code to create Tooltips

JTooltips

Included in base-*, used for show tooltips easily.
With the extension function we can auto-calculate view position and tip stick offset

  • JTooltipsLayout extends from FrameLayout, supporting custom material edge treatment.

    attr desc
    tipEdge change tip stick positions, support edgeStart,edgeTop,edgeEnd,edgeBottom,edgeHorizontal,edgeVertical,edgeAll
    tipDrawGravity change tip stick draw direction, support start, center, end
    tipDrawOffset offset tip stick
    tipDrawStyle support triangle,roundTriangle,circle,defaultLine
    tipDrawInside whether tip stick inside or outside view
    tipDepth tip stick height
    tipWidth tip stick width
    shapeCornerRadius support fraction and dimension
    android:insetLeft as the name says
    android:insetTop as the name says
    android:insetRight as the name says
    android:insetBottom as the name says
    android:strokeColor as the name says
    strokeWidth as the name says
    android:backgroundTint as the name says
    android:backgroundTintMode as the name says
    rippleColor as the name says
    android:elevation as the name says
    android:background as the name says, but affects all the other background related attrs
  • JDefaultTooltips extends JTooltipsLayout, and has a fixed inner layout, used to speed up common requirements.

    It is a text followed by a divider and close icon by default, which can be customized using the following attrs.

    attr desc
    android:text as the name says
    android:textColor as the name says
    android:textSize as the name says
    android:drawableStart as the name says
    android:drawablePadding as the name says
    android:src as the name says
    disableTailIcon hide the divider and icon

Using GitHub Actions to push Packages

Deprecated: since GitHub Packages do not allow public access.

implementation

  • add repo maven { url 'https://jitpack.io' }
  • latest version JitPack Icon
  • add implementation("com.github.oOJohn6Oo.BaseAndroid:john-base:<version>")

About

Just an Android project with some stuff that I prefer.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages