Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 3 additions & 5 deletions README-zh.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![](https://travis-ci.org/YummyLau/PanelSwitchHelper.svg?branch=master)](https://travis-ci.org/YummyLau/panelSwitchHelper)
![Language](https://img.shields.io/badge/language-java-orange.svg)
![Language](https://img.shields.io/badge/language-kotlin-orange.svg)
![Version](https://img.shields.io/badge/version-1.3.13-blue.svg)
![Version](https://img.shields.io/badge/version-1.4.0-blue.svg)
![Size](https://img.shields.io/badge/size-14K-brightgreen.svg)

README: [English Doc](https://github.com/YummyLau/PanelSwitchHelper/blob/master/README.md)
Expand Down Expand Up @@ -41,10 +41,8 @@ Demo 内容如下
1. 在模块脚本 `build.gradle` 添加库依赖

```
implementation 'com.effective.android:panelSwitchHelper:1.3.13'

//or for androidx
implementation 'com.effective.android:panelSwitchHelper-androidx:1.3.13'
//1.4.0 版本及后续,仅支持 Androidx
implementation 'com.github.YummyLau:PanelSwitchHelper:1.4.0'
```

2. 在布局文件 Xml 中使用框架提供的容器
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![](https://travis-ci.org/YummyLau/PanelSwitchHelper.svg?branch=master)](https://travis-ci.org/YummyLau/panelSwitchHelper)
![Language](https://img.shields.io/badge/language-java-orange.svg)
![Language](https://img.shields.io/badge/language-kotlin-orange.svg)
![Version](https://img.shields.io/badge/version-1.3.13-blue.svg)
![Version](https://img.shields.io/badge/version-1.4.0-blue.svg)
![Size](https://img.shields.io/badge/size-14K-brightgreen.svg)

README: [中文文档](https://github.com/YummyLau/PanelSwitchHelper/blob/master/README-zh.md)
Expand All @@ -24,7 +24,7 @@ For more details, please refer to

* [Introduction to scenario usage](https://github.com/YummyLau/PanelSwitchHelper/blob/master/README_SENCE.md)
* [API Usage Guide](https://github.com/YummyLau/PanelSwitchHelper/blob/master/README_API.md)
* [Library version update log] (https://github.com/YummyLau/PanelSwitchHelper/blob/master/README_UPDATE.md)
* [Library version update log](https://github.com/YummyLau/PanelSwitchHelper/blob/master/README_UPDATE.md)

Demo content is as follows

Expand All @@ -41,10 +41,8 @@ The Androidx version runs by default. If you need to open non-Androidx, open the
1. Add library dependencies in module script `build.gradle`

```
implementation'com.effective.android:panelSwitchHelper:1.3.13'

//or for androidx
implementation 'com.effective.android:panelSwitchHelper-androidx:1.3.13'
// Version 1.4.0 and later, only supports Androidx
implementation 'com.github.YummyLau:PanelSwitchHelper:1.4.0'
```

2. Use the container provided by the framework in the layout file Xml
Expand Down
1 change: 1 addition & 0 deletions README_API-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ PanelSwitchHelper mHelper = new PanelSwitchHelper.Builder(this)
5. resetState,隐藏所有面板
6. hookSystemBackByPanelSwitcher 拦截返回,如果当前用户按下返回或者业务返回键,则优先隐藏面板
7. addSecondaryInputView/removeSecondaryInputView 添加额外输入源,用于驱动输入法显示
8. setTriggerViewClickInterceptor 支持动态控制 TriggerView 是否自动响应"点击触发切换面板"行为,默认相应



Expand Down
3 changes: 2 additions & 1 deletion README_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,5 @@ In addition to the functions provided in the above construction process, the fol
4. toPanelState, switch to the corresponding function panel
5. resetState, hide all panels
6. hookSystemBackByPanelSwitcher intercepts the return, if the current user presses the return or business return button, the panel is preferentially hidden
7. addSecondaryInputView/removeSecondaryInputView to add an additional input source to drive the input method display
7. addSecondaryInputView/removeSecondaryInputView to add an additional input source to drive the input method display
8. setTriggerViewClickInterceptor supports dynamic control of whether TriggerView automatically responds to the "click to trigger the switch panel" behavior, the default is corresponding
4 changes: 4 additions & 0 deletions README_UPDATE-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@
* 1.3.11 修复部分 MiUI 手机横屏状态栏拉起输入法异常问题,优化 Log 显示,统一所有自定义面板容器属性命名的前缀
* 1.3.12 兼容悬浮键盘场景
* 1.3.13 兼容部分手机锁屏收起输入法问题;兼容华为定制平板问题;优化全屏显示速度;
* 1.4.0 该版本起仅支持 Androidx,非 Androidx 不再维护
* 修复三星部分设备的兼容问题
* 新增 `setTriggerViewClickInterceptor` 支持动态控制 TriggerView 是否自动响应"点击触发切换面板"行为,默认相应
* 新增 `DisUtils#setCompatSizeProxy` 支持动态设置像素转化逻辑
6 changes: 5 additions & 1 deletion README_UPDATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@
* 1.3.10 Supports full screen mode, supports additional setting of EditText to invoke the panel, and fixes known issues
* 1.3.11 Fixed some MiUI mobile phone horizontal screen status bar pull up the input method abnormal problem, optimize the Log display, unify the prefix of all custom panel container property names
* 1.3.12 compatible with floating keyboard scene
* 1.3.12 Compatible with some mobile phone lock screen input method issues; compatible with Huawei customized tablet issues; optimize the full screen display speed;
* 1.3.12 Compatible with some mobile phone lock screen input method issues; compatible with Huawei customized tablet issues; optimize the full screen display speed;
* Starting from 1.4.0, only Androidx is supported, non-Androidx is no longer maintained
* Fix the compatibility issue of some Samsung devices
* Added `setTriggerViewClickInterceptor` to support dynamic control of whether TriggerView automatically responds to the "click to trigger switch panel" behavior, the default is corresponding
* Added `DisUtils#setCompatSizeProxy` to support dynamic setting of pixel conversion logic
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.effective.android.panel.PanelSwitchHelper;
import com.effective.android.panel.interfaces.ContentScrollMeasurer;
import com.effective.android.panel.interfaces.PanelHeightMeasurer;
import com.effective.android.panel.interfaces.TriggerViewClickInterceptor;
import com.effective.android.panel.interfaces.listener.OnPanelChangeListener;
import com.effective.android.panel.utils.DisplayUtil;
import com.effective.android.panel.view.panel.IPanelView;
Expand All @@ -47,7 +48,7 @@
*/
public class ChatActivity extends AppCompatActivity {

public static void start(Context context, @ChatPageType int type) {
public static void start(Context context, @ChatPageType int type) {
Intent intent = new Intent(context, ChatActivity.class);
intent.putExtra(Constants.KEY_PAGE_TYPE, type);
context.startActivity(intent);
Expand Down Expand Up @@ -147,6 +148,13 @@ protected void onStart() {
scrollToBottom();
}
})
.setTriggerViewClickInterceptor((TriggerViewClickInterceptor) triggerId -> {
if (R.id.emotion_btn == triggerId) {
Toast.makeText(ChatActivity.this, "R.id.emotion_btn 被拦截,可在 setTriggerViewClickInterceptor 解除", Toast.LENGTH_SHORT).show();
return true;
}
return false;
})
//可选
.addViewClickListener(view -> {
switch (view.getId()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,61 +29,17 @@ public AutoHidePanelRecyclerView(Context context, @Nullable AttributeSet attrs)
this(context, attrs, 0);
}


public AutoHidePanelRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setLayoutManager(new LinearLayoutManager(context));
addOnItemTouchListener(new OnItemTouchListener() {

public boolean isTouchInView(View view, MotionEvent event) {
if (view == null) {
return false;
}
int[] location = new int[2];
view.getLocationOnScreen(location);
int x = location[0];
int y = location[1];
return x < event.getRawX() && event.getRawX() < x + view.getWidth()
&& y < event.getRawY() && event.getRawY() < y + view.getHeight();
}

public void hidePanel() {
if (panelSwitchHelper != null) {
panelSwitchHelper.hookSystemBackByPanelSwitcher();
}
}

@Override
public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {
int action = e.getAction();
if (action == MotionEvent.ACTION_DOWN) {
View view = rv.findChildViewUnder(e.getX(), e.getY());
if (view == null) {
hidePanel();
return false;
}
View text = view.findViewById(R.id.text);
View avatar = view.findViewById(R.id.avatar);
if (text == null || avatar == null) {
hidePanel();
return false;
}

if (!isTouchInView(text, e) && !isTouchInView(avatar, e)) {
hidePanel();
}
}
return false;
}

@Override
public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) {

}

@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}

}
});
@Override
public boolean onTouchEvent(MotionEvent e) {
if(panelSwitchHelper != null){
panelSwitchHelper.hookSystemBackByPanelSwitcher();
}
return super.onTouchEvent(e);
}
}
1 change: 0 additions & 1 deletion app/.gitignore

This file was deleted.

65 changes: 0 additions & 65 deletions app/build.gradle

This file was deleted.

21 changes: 0 additions & 21 deletions app/proguard-rules.pro

This file was deleted.

74 changes: 0 additions & 74 deletions app/src/main/AndroidManifest.xml

This file was deleted.

6 changes: 0 additions & 6 deletions app/src/main/java/com/example/demo/Constants.java

This file was deleted.

Loading