当前位置:网站首页>Slide left from small window to large windowdispatchframelayout
Slide left from small window to large windowdispatchframelayout
2022-06-24 03:37:00 【Zhaojian ZJ】
DispatchFrameLayout
/* * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. */
package com.qisi.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import lombok.Setter;
/** * 【 Typing flip chart 】 Content container , Set up dispatchTouchEvent monitor * * @author zhaojian * @since 2022-06-15 */
public class DispatchFrameLayout extends FrameLayout {
@Setter
private OnTouchListener dispatchOnTouchListener;
/** * Constructors * * @param context Context */
public DispatchFrameLayout(@NonNull Context context) {
super(context);
}
/** * Constructors * * @param context Context * @param attrs AttributeSet */
public DispatchFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
/** * Constructors * * @param context Context * @param attrs attrs * @param defStyleAttr defStyleAttr */
public DispatchFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (dispatchOnTouchListener != null) {
return dispatchOnTouchListener.onTouch(this, ev) || super.dispatchTouchEvent(ev);
}
return super.dispatchTouchEvent(ev);
}
}
@SuppressLint("ClickableViewAccessibility")
private void showBigWhenRecyclerViewMove() {
DispatchFrameLayout typingContent = findViewById(R.id.typing_content);
OnTouchListener dispatchOnTouchListener = new OnTouchListener() {
private boolean isFirstIntercept = false;
private int dx; // Record last dx Distance of
@Override
public boolean onTouch(View v, MotionEvent event) {
// Only the expression window , To intercept events
if (event == null || isFirstIntercept || !isExpress() || rotateTransitionListener.isExpand()) {
return false; // Don't deal with
}
int action = event.getAction();
if (action == MotionEvent.ACTION_DOWN) {
dx = (int) event.getX();
} else if (action == MotionEvent.ACTION_MOVE) {
final int distance = 10;
isFirstIntercept = Math.abs(event.getX() - dx) > distance;
} else {
LogUtil.logV(TAG, MSG_DO_NOTHING);
}
if (isFirstIntercept) {
clickLeftButton();
}
return isFirstIntercept;
}
};
typingContent.setDispatchOnTouchListener(dispatchOnTouchListener);
}

边栏推荐
- Summary of common SSH commands
- web渗透测试----5、暴力破解漏洞--(7)MYSQL密码破解
- EIP maximum EIP EIP remote desktop access
- What is an edge calculator? How is the unit price of the edge calculator calculated?
- Create a telepresence USB drive using the DD command
- [Tencent cloud update] against 11.11! Here comes the 1.1% discount for enterprises!
- hprofStringCache
- Tencent cloud ASR product -php realizes the authentication request of the extremely fast version of recording file identification
- MySQL stored procedure + function
- Build a small program + management background in 7 days, and this goose factory HR is blessed!
猜你喜欢

内存泄漏之KOOM

ModStartCMS 主题入门开发教程

老弹出explorer.exe遇到问题已停止工作,怎么办?

618大促:手机品牌“神仙打架”,高端市场“谁主沉浮”?

Community pycharm installation visual database

Ar 3D map technology

Sorting out of key vulnerabilities identified by CMS in the peripheral management of red team (I)

浅谈游戏安全 (一)

Get to know MySQL database

On Sunday, I rolled up the uni app "uview excellent UI framework"
随机推荐
What technology does cloud computing elasticity scale? What are the advantages of elastic scaling in cloud computing?
Record the creation process of a joke widget (I)
你了解TLS协议吗?
Supply chain system platform: two management areas
Clickhouse optimize table comprehensive analysis
高斯光束及其MATLAB仿真
What is the impact on the server rental or server hosting price?
元气森林推“有矿”,农夫山泉们跟着“卷”?
What does elastic public IP mean? The advantages of elastic public IP
Cloud development RMB 1 purchase activity is in progress
Use lightweight application server to automatically download and upload to onedrive
What is the difference between server leasing and hosting?
Paste board based on curl and COS
What is an edge calculator? How is the unit price of the edge calculator calculated?
Highlights of future cloud native CIF Forum
How much is a fortress machine? Why do you need a fortress machine?
How to apply for trademark registration? What are the steps?
Which brand is a good backup all-in-one machine price
What are the advantages of EIP? What is the relationship between EIP and fixed IP?
Why do I need a code signing certificate? Where can I get a code signing certificate?