Android11(MTK) SystemUI下拉栏背景高斯模糊

本文介绍了Android11在MediaTek平台(SystemUI)下拉通知栏实现背景高斯模糊的处理逻辑。当状态栏状态改变时,监听器 StatusBarStateListener 调整Keyguard显示和隐藏的状态,同时根据是否锁屏决定高斯模糊背景的可见性。在keyguard显示时,高斯模糊背景会隐藏,反之则显示。
status_bar_expanded.xml布局中
<com.android.systemui.statusbar.phone.NotificationPanelView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/notification_panel"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent">

    <!-- 添加高斯模糊背景 -->
    <ImageView
        android:id="@+id/blur_view"
        android:alpha="0"
        android:layout_width="match_parent"
        android:scaleType="fitXY"
        android:layout_height="match_parent"/>

    <!-- 添加添加高斯模糊背景 -->

    <FrameLayout
        android:id="@+id/big_clock_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

    <include
        layout="@layout/keyguard_status_view"
        android:visibility="gone" />


NotificationPanelViewController.java类
private static final int BLUR_START = 200;
private static final int BLUR_END = 700;
/**
 * 高斯模糊背景
 */
private ImageView mBlurView;
createTouchHandler()方法中
public boolean onTouch(View v, MotionEvent event) {
    if (mBlockTouches || (mQsFullyExpanded && mQs != null
            && mQs.disallowPanelTouches())) {
        return false;
    }

    // Do not allow panel expansion if bouncer is scrimmed, otherwise user would be able
    // to pull down QS or expand the shade.
    if (mStatusBar.isBouncerShowingScrimmed()) {
        return false;
    }

    // Make sure the next touch won't the blocked after the current ends.
    if (event.getAction() == MotionEvent.ACTION_UP
            || event.getAction() == MotionEvent.ACTION_CANCEL) {
        mBlockingExpansionForCurrentTouch = false;
    }
    // When touch focus transfer happens, ACTION_DOWN->ACTION_UP may happen immediately
    // without any ACTION_MOVE event.
    // In such case, simply expand the panel instead of being stuck at the bottom bar.
    if (mLastEventSynthesizedDown && event.getAction() == MotionEvent.ACTION_UP) {
        expand(true /* animate */);
    }
    initDownStates(event);
    if (!mIsExpanding && !shouldQuickSettingsIntercept(mDownX, mDownY, 0)
            && mPulseExpansionHandler.onTouchEvent(event)) {
        // We're expanding all the other ones shouldn't get this anymore
        return true;
    }
    if (mListenForHeadsUp && !mHeadsUpTouchHelper.isTrackingHeadsUp()
            && mHeadsUpTouchHelper.onInterceptTouchEvent(event)) {
        mMetricsLogger.count(COUNTER_PANEL_OPEN_PEEK, 1);
    }
    boolean handled = false;
    if ((!mIsExpanding || mHintAnimationRunning) && !mQsExpanded
            && mBarState != StatusBarState.SHADE && !mDozing) {
        handled |= mAffordanc
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值