如何使状态栏不显示volte图标,只在下拉状态栏显示volte图标

本文介绍了如何在水滴屏或刘海屏项目中,通过隐藏或调整状态栏中的Volte图标,释放空间,以改进手机屏幕顶部的视觉效果。通过修改StatusBarMobileView和StatusIconContainer的代码,实现了状态栏Volte图标的动态控制。
摘要由CSDN通过智能技术生成

水滴屏、刘海屏项目,状态栏图标显示区域空间不够,为解决此问题,可去掉状态栏volte图标,保留下拉状态栏volte图标,以增加状态栏显示区域:

diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
old mode 100755
new mode 100644
index 383d53a…f86f790
— a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
@@ -197,7 +197,7 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver,
}
}
/* @} */

  •    if (mState.mMobileVolteId > 0) {
    
  •    if (mState.mMobileVolteId > 0 && mShowVolte) {
           mMobileVolte.setImageResource(mState.mMobileVolteId);
           mMobileVolte.setVisibility(View.VISIBLE);
       }else {
    

@@ -265,7 +265,7 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver,
/* @} /
}
/
@} */

  •    if (state.mMobileVolteId > 0) {
    
  •    if (state.mMobileVolteId > 0 && mShowVolte) {
           Log.d(TAG, "mMobileVolteId = " + state.mMobileVolteId + " mSubId = " + state.subId);
           mMobileVolte.setImageResource(state.mMobileVolteId);
           mMobileVolte.setVisibility(View.VISIBLE);
    

@@ -394,4 +394,14 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver,
return mobileDataInOutId;
}
/* @} */
+

  • private boolean mShowVolte = true;
  • public void updateVolte(boolean show){
  •    Log.i(TAG,"updateVolte mShowVolte-->"+mShowVolte+";show-->"+show);
    
  •    if(mShowVolte != show){
    
  •        mShowVolte = show;
    
  •        updateState(mState);
    
  •        requestLayout();
    
  •    }
    
  • }
    }

diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
index d061649…56eb542 100644
— a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusIconContainer.java
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone;
import static com.android.systemui.statusbar.StatusBarIconView.STATE_DOT;
import static com.android.systemui.statusbar.StatusBarIconView.STATE_HIDDEN;
import static com.android.systemui.statusbar.StatusBarIconView.STATE_ICON;
+import com.android.systemui.statusbar.StatusBarMobileView;

import android.annotation.Nullable;
import android.content.Context;
@@ -277,6 +278,15 @@ public class StatusIconContainer extends AlphaOptimizedLinearLayout {
StatusIconDisplayable iconView = (StatusIconDisplayable) child;
StatusIconState childState = getViewStateFromChild(child);

  •        if(iconView instanceof  StatusBarMobileView){
    
  •            StatusBarMobileView mobileView = (StatusBarMobileView)iconView;
    
  •            if(translationX < 360){ //此值一般设置为机器分辨率的一半
    
  •                mobileView.updateVolte(false);
    
  •            } else {
    
  •                mobileView.updateVolte(true);
    
  •            }
    
  •        }
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值