洞察纵观鸿蒙next版本,如何凭借FinClip加强小程序的跨平台管理,确保企业在数字化转型中的高效运营和数据安全?
928
2022-11-03
PanelSwitchHelper✔️一个可帮助键盘平稳过渡到功能面板的框架
README: 中文文档
Introduction to the framework
When developing a chat/video/live/information interface, users are expected to maintain a smooth transition between the input method and the function panel (such as the expression panel/more options panel, etc.). Investigate the mainstream app effects and implementation in the market, and realize a set of input panel switching framework compatible with multiple scenes. Currently the framework has been tested and used.
Framework advantages
Improve the traditional technical solution of using Weight+LinearLayout to dynamically change the layout height to suit the panel, and support multiple native ViewGroup containersIn pursuit of a smoother adaptation effect, when the input method dynamically adjusts the height or dynamically hides the navigation bar, the function panel can be adapted in real timeIn pursuit of a smoother switching effect, the sliding mode is supported, the sliding will be smoother, and the fixed mode is also supportedRich model adaptation, adapt to non-conventional Phone models such as full screen/bang screen/digging screen/PadRich scene support, support Activity/Fragment/Dialog/PopupWindow, apply to chat/video/live broadcast/stream comment, etc.Rich API support, customizable content container, business panel, flexible control panel hiding, flexible control of switching panel speed
For more details, please refer to
Introduction to scenario usageAPI Usage Guide
Demo content is as follows
The Androidx version runs by default. If you need to open non-Androidx, open the app in Settings.gradle and close the Androidx configuration in gradle.properties.
Instructions
Add library dependencies in module script build.gradle
implementation'com.effective.android:panelSwitchHelper:1.3.1'//or for androidximplementation 'com.effective.android:panelSwitchHelper-androidx:1.3.1'
Use the container provided by the framework in the layout file Xml
Initialize the PanelSwitchHelper object, and the framework will automatically collect layout information. At the same time, intercept the processing when the return key is adjusted.
//Activity scene, initialized in onStart method, others such as Fragment/Dialog/PopupWindow refer to Demo private PanelSwitchHelper mHelper; @Override protected void onStart() { super.onStart(); if (mHelper == null) { mHelper = new PanelSwitchHelper.Builder(this) .addKeyboardStateListener { onKeyboardChange { //Optional implementation, monitor input method changes } } .addEditTextFocusChangeListener { onFocusChange { _, hasFocus -> //Optional implementation, monitor input box focus changes } } .addViewClickListener { onClickBefore { //Optional implementation, listen for trigger clicks } } .addPanelChangeListener { onKeyboard { //Optional implementation, input method display callback } onNone { //Optional implementation, default state callback } onPanel { //Optional implementation, panel display callback } onPanelSizeChange { panelView, _, _, _, width, height -> //Optional implementation, dynamic callback of panel height change caused by input method dynamic adjustment } } .contentCanScrollOutside(true) //Optional mode, default true, whether the content area slides up when the panel is implemented .logTrack(true) //Optional, default false, whether to enable log information output .build(true) //Optional, default false, whether to open the input method by default } } @Override public void onBackPressed() { //When the user presses the return key, if the panel is displayed, it needs to be hidden if (mHelper != null && mHelper.hookSystemBackForHindPanel()) { return; } super.onBackPressed(); }
new version update
1.0.1(2019-07-08) Support compatible AndroidQ+ focus conflict, support video mode 1.0.2(2019-11-05) Support WeChat-style sliding list. Collapse the panel while the list responds to sliding events, improving the user experience 1.0.3(2019-11-06) Fix issue scene issue 1.0.4(2019-11-18) Added support for Dialog/Fragment/DialogFragment 1.0.5(2019-11-26) Supports special models such as Huawei/Xiaomi that support dynamic navigation bar hiding 1.1.0(2020-03-18) Pursuing the ultimate switching experienceSupports animation blessing in the switching process, the effect is synchronized with the "WeChat chat" scene, but the supported scenes are far more than these (see Demo), and support custom animation speedOptimize the internal switching process of the framework, abandon the old logic implementation, and the new implementation uses custom drawing to switch the interface without worrying about memory leaksDemo adds a custom title bar scene to optimize the video scene experience 1.1.1(2020-03-29) Supports special scenes such as full screen/bang screen/drop screenOptimize internal calculation of effective area height, compatible with special scenesEliminate the call to bindPanelSwitchLayout api, and customize the logic inside the frameworkDemo adds complex IM interaction scenarios 1.1.2(2020-04-20) Added content sliding mode/content fixed mode dynamic switching apiOptimize hidden panel logic to improve animation fluencyAdded content sliding mode, the content area can dynamically slide to the outside of the interface, class adjustPan, enabled by defaultAdded content fixed mode, content area dynamically adjust drawing area, class adjustResizeSolve the problem of being slid outside due to too little content in IM scenarios, support dynamic switching mode, optimize experience 1.1.3(2020-04-27) Compatible with the use requirements of Google channel non-public SDK-API, optimize the fixed mode drawing implementation 1.2.0(2020-05-08) kotlin version/new content area container that supports multiple layout typesPanel is adjusted to kotlin language implementation, fully compatible with existing functions and Java, and supports DSLAdded content area container, default provides linear/relative/frame layout, supports custom content area containerDemo adds kotlin to use constraint layout to implement custom containers, and adds 4 different layout container scenarios 1.2.2(2020-05-17) Fix known defects and optimizeMerged pr to fix emptyView reference errorOptimize the smoothness of switching in fixed mode 1.2.3(2020-05-24) compatible with android pad models 1.3.0(2020-06-07) Support auto hide panel, open custom panel, optimization adjustmentAdded auto_reset_enable and auto_reset_area api to open auto hide panel and abandon EmptyViewAdd IPanelView interface, externally can realize PanelView independently, more flexibleOptimized animation in sliding mode 1.3.0 is an important version, it is recommended to upgrade, and pay attention to the following Api changesEmptyView removed, please refer to Demo How to realize hidden panel more elegantlyPanel class specification naming, with native Linear/Relative/Frame as a prefix, it is easier to distinguishPanelView migrated to panel package 1.3.1 (2020-06-12) supports using the bottom system layout to capture a copy of the user's gesture. The extra system view at the bottom of the interface in this part of the layout may cause input method calculations to be biased. Rice and other samples.
Expectations
The project was written only to improve the efficiency of daily development and focus on processing business. If you have better practices or suggestions, please write to yummyl.lau@gmail.com.
You can also add WeChat and enter the feedback group to discuss feedback.
If the framework is helpful to you, Amway can give the partners around you, and every star is an affirmation of the framework.
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~