Giter VIP home page Giter VIP logo

basepopup's Introduction

中文 | English

Logo图片似乎加载不出来

BasePopup - Android下打造通用便捷的PopupWindow

Release Candy License Api Author


Compat组件 support(已终止迭代) lifecycle(已终止迭代) androidx
Release
Candy

导航



特性

  • 更简单更精准的控制显示位置,通过Gravityoffset来控制您的PopupWindow
  • 本库为抽象类,对子类几乎没有约束,您完全可以像定制Activity一样来定制您的PopupWindow
  • 支持AnimationAnimator,随意控制您的PopupWindow的动画,再也不用去写蛋疼的xml了
  • 顺滑的背景定制,支持背景模糊局部模糊展开变暗或者修改颜色甚至是贴图,这一切仅仅需要您通过一句Api完成
  • 不再担心PopupWindow蛋疼的事件拦截,返回键控制点击外部Dismiss控制外部事件响应控制三者分离
  • PopupWindow自动锚定AnchorView,滑动到屏幕外自动跟随AnchorView消失,不需要复杂的逻辑设置,只需要通过Link方法告诉BasePopup
  • 简单的PopupWindow不想新建一个类,希望拥有链式调用?没问题,QuickPopupBuilder为此而生,相信你会越用越爱~

注意事项

  • 请务必仔细阅读本README,每个版本升级请务必查阅更新日志,这可以为您减少不必要弯路
  • 请注意引用版本的问题,Release版本是稳定版,Candy是预览版。
    • Release版本:一般在Candy版本反复验证修复后发布到Release,如果您对稳定性要求较高,请使用Release版本。
    • Candy版本:一般新功能、issue修复都会发布到Candy版本,Candy版本发布比较频繁,但通常会拥有新的功能,如果您喜欢试验新功能同时对稳定性要求不高,请使用Candy版本。
    • Release和Candy两个版本互相切换可能会导致Build失败,这时候您Clean一下Project即可
  • 如果您是以前1.x版本的用户,现在想更新到2.x,请在更新前查阅:1.x迁移到2.x帮助文档
  • 从16年第一次提交到现在,本人技术也一直在进步,BasePopup也会一直迭代更新,所以,请谨慎选择版本哦~一不小心就颠覆了之前的实现。

环境依赖

请把下述 {$latestVersion} 替换为上面表格中对应的版本。

自2.2.2版本开始,BasePopup将不再支持support,同时BasePopup建议您尽早迁移到AndroidX

  • Release:

    • 基础库(必选):implementation 'com.github.razerdp:BasePopup:{$latestVersion}'
    • support支持库(可选):implementation 'com.github.razerdp:BasePopup-compat-support:{$latestVersion}'
    • lifecycle支持库(可选):implementation 'com.github.razerdp:BasePopup-compat-lifecycle:{$latestVersion}'
    • androidx支持库(可选,不可跟别的支持库同时存在):implementation 'com.github.razerdp:BasePopup-compat-androidx:{$latestVersion}'
  • Candy

    • 基础库(必选):implementation 'com.github.razerdp:BasePopup_Candy:{$latestVersion}'
    • support支持库(可选):implementation 'com.github.razerdp:BasePopup_Candy-compat-support:{$latestVersion}'
    • lifecycle支持库(可选):implementation 'com.github.razerdp:BasePopup_Candy-compat-lifecycle:{$latestVersion}'
    • androidx支持库(可选,不可跟别的支持库同时存在):implementation 'com.github.razerdp:BasePopup_Candy-compat-androidx:{$latestVersion}'

快速入门

请参考文档:BasePopup手册


Api(请看Wiki,后续迁移至文档)

Link👉WIKI


更新日志 (历史更新)

  • 近期正在重构BasePopup,旨在代码更容易读,因此近期更新可能较慢,新版本将会对issue统一处理

  • 【Candy】2.2.2

    • 【Candy】190704
      • 修复AnimatorSet的时间问题 fix #203
    • 【Candy】190722
      • 回滚#188修复
      • 经检查,#188修复带来的问题比较严重,建议升级到该版本
    • 【Candy】190816
      • 考虑到很多用户提出全面屏会有蒙层无法填充的问题,因此增加setMaskLayoutWidthsetMaskLayoutHeight方法,该方法允许您自定义蒙层的高度
      • 开始重构BasePopupWindow,本次重构将会解决遗留问题同时缩减冗余代码,并提高代码可读性
    • 【Candy】190904
      • 重构屏幕宽高获取逻辑
      • 修改supporter名字为component
    • 【Candy】190912
      • 重构键盘逻辑,现在键盘对齐支持选择模式了~
      • 相关文档请查阅文档 键盘(输入法)
    • 2019/09/20
      • Demo大翻新
    • 2019/09/22
      • 增加输入法Demo
      • Demo支持更新
      • Demo增加issue修复测试用例
    • 2019/09/26
      • 取消对support的支持
    • 2019/09/27
      • 增加手势导航栏支持
    • 2019/09/29
      • 发布新版candy
    • 2019/10/09
      • 添加issue #230测试用例
    • 2019/10/31
      • 优化autoLocate
      • 优化超出屏幕的位移问题
      • 添加setResize()方法
      • 添加onAutoLocationChange()方法
  • 【Release】2.2.1(2019/06/24)

    • 支持Service或者非ActivityContext里弹窗
    • 优化PopupUiUtils,优化获取屏幕宽高算法
    • 修改并优化键盘判断逻辑
    • 优化全屏状态下点击范围的判定,fixed #200
  • 【Release】2.2.0(2019/05/15)

    • 正式版2.2.0隆重归来,这次正式版又是一个重构版本哦~
    • 优化输入法对齐逻辑
    • 重构模糊逻辑:
      • 经测试,720p的手机在默认参数下全屏模糊时间平均在6ms~16ms之间
      • 增大默认参数的模糊程度
      • 模糊淡入淡出时间跟随Popup的动画时间
      • 修复模糊偶尔失效的情况
    • 测量/布局相关:
      • 重构测量逻辑:
        • 现在在clipToScreen的情况下,会根据剩余空间对PopupDecor进行重新测量,以保证Popup完整的显示,如果您需要保持原始的测量值,请调用keepSize(true)
        • 重构layout逻辑,针对outSideTouch优化
        • 适配屏幕旋转,fix #180
        • 采取flag代替各种boolean,清爽更简洁
        • 减少冗余代码
    • 优化相关:
      • 增加GravityMode值,现在允许您配置PopupGravity的参考模式啦~
        • RELATIVE_TO_ANCHOR:默认模式,以Anchor为参考点,指定PopupWindow显示在Anchor的方位
        • ALIGN_TO_ANCHOR_SIDE:对齐模式,以Anchor的边为参考点,指定PopupWindow的边与Anchor的哪条边对齐
      • 增加minWidth/minHeight 方法,增加maxWidth/maxHeight 方法,让他们相互对应~
      • 修复高度为match_parent和wrap_content的测量差异,现在可以安心地玩耍啦
      • 部分Api标记过时:
        • setAllowDismissWhenTouchOutside -> setOutSideDismiss
        • setAllowInterceptTouchEvent -> setOutSideTouchable
      • 增加setBackgroundView(View)方法,现在BasePopup的背景控件可以随意由你定制啦~当然PopupWindow的背景动画控制方法依旧生效
    • 包拆分:
      • 现在BasePopup将会进行包的拆分,源工程仅针对没有任何依赖的原生Android进行适配,如果您需要别的适配,请分别依赖以下模块或多个模块:
        • 如果您需要support库的支持,比如DialogFragment支持,请依赖
          • implementation 'com.github.razerdp:BasePopup-compat-support:{$latestVersion}'
        • 如果您需要lifecycle库的支持,比如destroy里自动释放或者关闭等,请依赖
          • implementation 'com.github.razerdp:BasePopup-compat-lifecycle:{$latestVersion}'
        • 如果您需要androidX库的支持,请依赖
          • implementation 'com.github.razerdp:BasePopup-compat-androidx:{$latestVersion}'
        • 请注意,如果您依赖了androidX支持组件,请不要依赖另外两个支持组件,否则会冲突
    • Bug fixed:
    • Other:
      • add 996 license

例子预览


更多例子请下载Demo:apk体验下载


Coming soon

打赏(看在我那么努力维护的份上。。。给个零食呗~)

支付宝

交流群

因QQ没时间管理,因此解散,同时开通微信群,主要用于交流和BasePopup的反馈,为了保证微信群的质量,因此只有打赏了之后才能进群~


常见问题

请查阅手册:常见问题


License

Apache-2.0

basepopup's People

Contributors

430public avatar bryant1410 avatar dadengpao avatar hshare avatar parfoismeng avatar razerdp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.