Skip to content

Latest commit

 

History

History
178 lines (119 loc) · 6.54 KB

README_EN.md

File metadata and controls

178 lines (119 loc) · 6.54 KB

FloatingX

image-20210810161316095

Codacy Badge Maven Central ktlint

FloatingX A flexible and powerful permission-free hover window solution.

"Note: After version 1.3.4, the repository has been migrated to Maven. Make sure to update your dependency accordingly."

中文简介

中午使用文档见这里

👏 Features

  • Single instance holding floating window view
  • Support for various callback listeners
  • Chain calls, senseless insertion
  • Support customizing whether to save history position and restore
  • Support inserting ViewGroup , Fragment , Activity
  • Allow custom hover window indicators, custom hidden display animation
  • Support cross-border rebound, multi-finger touch, small screen adaptation, screen rotation
  • Support custom position direction, with auxiliary positioning display coordinates
  • Perfect kotlin build extensions, and friendly compatibility with Java.
  • Support display location [force fix], for special models (need to open separately)
  • Perfect logging system, open to see different levels of Fx running process, more convenient to find problems
  • ...

👨‍💻‍ Dependencies

Gradle

dependencies {
    implementation 'io.github.petterpx:floatingx:2.1.1'
}

🏄‍♀️ 效果图

全屏,activity,fragment,单view 小屏展示 非正常比例缩放屏幕
效果-展示1 演示-小屏 非正常比例缩放
屏幕旋转 功能演示
演示-旋转 演示-局部功能

Complete log-viewer

Open the log viewer, you will see the whole track of Fx, which is easier to find the problem and track the solution. Also support custom log tag。

App Activity ViewGroup
image-20210808123000851 image-20210808123414921 image-20210808123553402

👨‍🔧‍ Usage

Global hover window management

AndroidManifest

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />

kt

FloatingX.install {
				setContext(context)
        setLayout(R.layout.item_floating)
  			setScopeType(FxScopeType.SYSTEM_AUTO)
}.show()

Java

AppHelper helper = AppHelper.builder()
				.setContext(context)
        .setLayout(R.layout.item_floating)
  			.setScopeType(FxScopeType.SYSTEM_AUTO)
        .build();
FloatingX.install(helper).show();

Local hover window management

Generic creation method

kt

ScopeHelper.builder {
  setLayout(R.layout.item_floating)
}.toControl(activity)

kt && java

ScopeHelper.builder()
            .setLayout(R.layout.item_floating)
            .build()
            .toControl(activity)
            .toControl(fragment)
            .toControl(viewgroup)

extended support for kt

activity create hover window
private val activityFx by activityToFx(activity) {
    setLayout(R.layout.item_floating)
}
fragment to create a hover window
private val fragment by fragmentToFx(fragment) {
    setLayout(R.layout.item_floating)
}
viewGroup creates a hover window
private val viewFx by createFx({
        init(viewGroup)
    }) {
        setLayout(R.layout.item_floating)
        setEnableLog(true, "main_fx")
    }
Quickly create an arbitrary scope hover window
private val customCreateFx by createFx {
    setLayout(R.layout.item_floating)
    build().toControl(activity)
    build().toControl(fragment)
    build().toControl(viewgroup)

Thanks

Base HoverView sourced from FloatingMagnetView of EnFloatingView implementation with some improvements on top of it.

For the measurement of the navigation bar part of the code from, wenlu, and on top of it added more adaptations, has covered 95% of the market models, can be said to be the only tool that can be searched for accurate measurement.

About me

Welcome to follow my public number, look forward to progress together, if there are any problems in use, you can also add me WeChat.

Wechat: Petterpx

Petterp-wechat