当前位置:网站首页>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);
}

边栏推荐
- Coding Ci of Devops
- web渗透测试----5、暴力破解漏洞--(1)SSH密码破解
- What is the difference between elasticity and scalability of cloud computing? What does elastic scaling of cloud computing mean?
- Chapter 4: LED flash case of PS bare metal and FreeRTOS case development
- Troubleshooting and resolution of errors in easycvr calling batch deletion interface
- 高斯光束及其MATLAB仿真
- Dialogue with Google technical experts: soundstream is expected to be used for general audio coding in the future
- What does elastic public IP mean? The advantages of elastic public IP
- How to select a server with appropriate configuration when planning to build a live broadcast platform
- 2021-10-02: word search. Given an M x n two-dimensional character grid boa
猜你喜欢

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

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

内存泄漏之KOOM

ModStartCMS 主题入门开发教程

halcon知识:区域(Region)上的轮廓算子(2)
Thank you for your recognition! One thank-you note after another

On Sunday, I rolled up the uni app "uview excellent UI framework"

【代码随想录-动态规划】T392.判断子序列
随机推荐
Go program lifecycle
Paste board based on curl and COS
Why do I need a code signing certificate? Where can I get a code signing certificate?
Why can't the fortress machine log in? What are the ways to solve the problem
Understand Devops from the perspective of leader
Chapter 5: key led demo case of PS bare metal and FreeRTOS case development
What is fortress resource authorization? What is barrier machine?
Grpc: how to make grpc provide swagger UI?
What is the edge calculator force? What about the edge calculator?
Technical dry goods - how to use AI technology to accurately identify mining Trojans
News | detailed explanation of network security vulnerabilities of branch enterprises
4. go deep into tidb: detailed explanation of the implementation process of the implementation plan
What are the advantages of EIP? What is the relationship between EIP and fixed IP?
What protocols do fortress computers have and what protocols do fortress computers generally use
左滑从小窗到大窗口DispatchFrameLayout
The medical technology giant was blackmailed and Microsoft announced 74 security vulnerabilities | global network security hotspot
What is the difference between elasticity and scalability of cloud computing? What does elastic scaling of cloud computing mean?
MySQL stored procedure + function
EIP maximum EIP EIP remote desktop access
Live broadcast Reservation: cloud hosting or cloud function, how can the business do a good job in technology selection?