Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何全局使用? #29

Closed
ve3344 opened this issue Nov 8, 2021 · 2 comments
Closed

如何全局使用? #29

ve3344 opened this issue Nov 8, 2021 · 2 comments

Comments

@ve3344
Copy link

ve3344 commented Nov 8, 2021

我把以下代码添加了,AndroidManifest.xml也设置了Application,但是啥也没发生,也没有日志。

open class App: Application() {
    override fun onCreate() {
        super.onCreate()
        Log.d("AAA", "onCreate: onCreate: ")
        FloatingX.init {
            // 设置context
            setContext(this@App)
            // 设置悬浮窗layout
            setLayout(R.layout.layout_floating)
            // 设置悬浮窗默认方向
            setGravity(Direction.RIGHT_OR_BOTTOM)
            // 设置是否启用日志
            setEnableLog(true)

            // 启用辅助方向
            setEnableAssistDirection(0f, 0f, 0f, 100f)
            // 设置x轴默认坐标
//            setX()
            // 设置y轴默认坐标
//            setY()

            // 设置启用边缘吸附
            setEnableEdgeAdsorption(true)
            // 设置边缘偏移量
            setEdgeOffset(10f)
            // 设置启用悬浮窗可屏幕外回弹
            setEnableScrollOutsideScreen(true)
            // 设置辅助方向辅助
            // 设置点击事件
//            setOnClickListener { }
            // 设置view-lifecycle监听
//            setViewLifecycle()

            // 设置启用悬浮窗位置修复
            setEnableAbsoluteFix(true)
            // 设置启用动画
            setEnableAnimation(true)
            // 设置启用动画实现

            // 设置底部偏移量
            setBottomBorderMargin(100f)
            // 设置顶部偏移量
//            setTopBorderMargin(100f)
            // 设置左侧偏移量
            setLeftBorderMargin(100f)
            // 设置右侧偏移量
            setRightBorderMargin(100f)

            // 设置允许触摸事件
            setEnableTouch(true)

            // 设置悬浮窗LayoutParams
//            setLayoutParams()
            // 设置要显示的activity
            addBlackClass(
                MainActivity::class.java,
            )
            // 设置允许全部activity显示悬浮窗,默认false
            setEnableAllBlackClass(true)

            // 设置tag-Activity生命周期回调时的触发
            setTagActivityLifecycle {
                onCreated { activity, bundle ->
                }
                onResumes { }
            }
            setEnableLog(true)
            // 只有调用了show,默认才会启用fx,否则fx不会自动插入activity
            show()
        }
    }
}
@Petterpx
Copy link
Owner

Petterpx commented Nov 8, 2021

你好,上一个版本全局悬浮窗初始化时逻辑存在问题,已修复。
请依赖 rc-09即可解决。
implementation 'com.github.Petterpx:FloatingX:1.0-rc09'

@Petterpx Petterpx added bug Something isn't working and removed bug Something isn't working labels Nov 8, 2021
@Petterpx
Copy link
Owner

Petterpx commented Nov 8, 2021

感谢你的反馈,这边先关闭这个问题了,如果还有其他问题,再联系我。

@Petterpx Petterpx closed this as completed Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants