当前位置: 首页 > news >正文

android14 设置下连续点击5次Settings标题跳转到拨号界面

部分项目隐藏了拨号器,但开发者需要间距跳转到拨号界面
设置一级界面:
packages/apps/Settings/src/com/android/settings/homepage/SettingsHomepageActivity.java
通过dispatchTouchEvent方法先获取Settings标题的区域X,Y数据。

import java.util.Set;
+import android.view.MotionEvent;/** Settings homepage activity */public class SettingsHomepageActivity extends FragmentActivity implementsCategoryMixin.CategoryHandler {
@@ -675,7 +675,58 @@ public class SettingsHomepageActivity extends FragmentActivity implementsview.setFocusableInTouchMode(true);view.requestFocus();}
-
+    // add 
+    long press_time = 0;
+    int[] xm = new int[5];
+    int[] ym = new int[5];
+    long delta_time;
+    int istep = 0;
+    public boolean dispatchTouchEvent(MotionEvent motionEvent) {
+        int actionMasked = motionEvent.getActionMasked();
+               Log.d(TAG, "dispatchTouchEvent 11 actionMasked="+actionMasked);
+        if (actionMasked == 0) {
+            long currentTimeMillis = System.currentTimeMillis();
+            long j = this.press_time;
+            long j2 = currentTimeMillis - j;
+            this.delta_time = j2;
+            this.press_time = j + j2;                  
+               Log.d(TAG, "actionMasked == 0 j="+j+";j2="+j2+";");
+            if (j2 > 1000) {
+                this.istep = 0;
+            }
+            this.xm[this.istep] = (int) motionEvent.getX();
+            this.ym[this.istep] = (int) motionEvent.getY();
+                       //float x = motionEvent.getX();
+                       //float y = motionEvent.getY();
+                       //Log.d(TAG, "actionMasked == 0 x="+x+";;y="+y);
+               Log.d(TAG, "actionMasked == 0 this.istep="+this.istep+"this.xm[this.istep]="+this.xm[this.istep]+";this.ym[this.istep]"+this.ym[this.istep]);
+            int i = this.istep + 1;
+            this.istep = i;
+            if (i == 5) {
+                int[] iArr = this.xm;
+                int[] yArr = this.ym;
+                               if((iArr[0]>50 && iArr[0]<256)||(iArr[1]>50 && iArr[1]<256) ||(iArr[2]>50 && iArr[2]<256) 
+                                       ||(iArr[3]>50 && iArr[3]<256) ||(iArr[4]>50 && iArr[4]<256)){
+                                               if((yArr[0]>232 && yArr[0]<307)||(yArr[1]>232 && yArr[1]<307) ||(yArr[2]>232 && yArr[2]<307) 
+                                               ||(yArr[3]>232 && yArr[3]<307) ||(yArr[4]>232 && yArr[4]<307) ){
+                                                       Intent mIntent = new Intent();
+                                                       mIntent.setClassName("com.android.dialer","com.android.dialer.main.impl.MainActivity");
+                                                       startActivity(mIntent);
+                                               }
+                                       }                
+                this.istep = 0;
+            }
+        } else if (actionMasked == 1) {
+            long currentTimeMillis2 = System.currentTimeMillis();
+            long j3 = this.press_time;
+            long j4 = currentTimeMillis2 - j3;
+            this.delta_time = j4;
+            this.press_time = j3 + j4;
+        }
+        return super.dispatchTouchEvent(motionEvent);
+    }
+   // add end
+       private void updateHomepageAppBar() {
http://www.lryc.cn/news/576347.html

相关文章:

  • 数字孪生技术赋能UI前端:实现虚拟与现实的无缝对接
  • Flutter基础(Future和async/await)
  • Gemini CLI 项目架构分析
  • 港澳地区,海外服务器ping通可能是地区运营商问题
  • ifconfig返回解析
  • Redis ①④-哨兵
  • Ubuntu20.04离线安装Realtek b852无线网卡驱动
  • HTML表格中<tfoot>标签用法详解
  • OD 算法题 B卷【计算误码率】
  • python解释器 与 pip脚本常遇到的问题汇总
  • 2025年健康医疗大数据开放共享:现状、挑战与未来发展
  • 掌握 MySQL 的基石:全面解读数据类型及其影响
  • ReasonGraph 大模型推理过程可视化开源工具使用探索,大模型幻觉可视化研究
  • zookeeper Curator(1):认识zookeeper和操作命令
  • [论文阅读] 软件工程 | 微前端在电商领域的实践:一项案例研究的深度解析
  • React 第六十六节Router中 StaticRouter使用详解及注意事项
  • 前端React和Vue框架的区别
  • 深入理解C#委托操作:添加、移除与调用全解析
  • 网络 : 传输层【UDP协议】
  • Linux-读者写者问题
  • STM32F103C8T6参数说明
  • Android4的InputReader
  • 一款支持多日志器、多级别、多落地方式的同异步日志系统
  • 搭建Flink分布式集群
  • 零知开源——基于STM32F407VET6零知增强板的四路独立计时器
  • 配置阿里云OSS实现https访问
  • 解决flash-attn安装报错的问题
  • Java-对象的字符串表示
  • Day45 Tensorboard使用介绍
  • 计算机操作系统(十七)内存管理