mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
- Refactor some basic scrim logic to Scrim class and have WorkspaceAndHotseatScrim and OverviewScrim extend it - Draw OverviewScrim under recents unless predictions are disabled, in which case draw it under hotseat (since that is in recents) - Remove sysui scrim (behind status bar and nav bar) when overview is peeking Bug: 132455160 Change-Id: Ia5d6f54582a4c5a70e3b2d4a98281567edd68519
71 lines
2.3 KiB
Java
71 lines
2.3 KiB
Java
/*
|
|
* Copyright (C) 2019 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.android.launcher3.graphics;
|
|
|
|
import static android.view.View.VISIBLE;
|
|
|
|
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
|
|
import static com.android.launcher3.LauncherState.OVERVIEW;
|
|
|
|
import android.graphics.Rect;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
|
|
/**
|
|
* View scrim which draws behind overview (recent apps).
|
|
*/
|
|
public class OverviewScrim extends Scrim {
|
|
|
|
private @NonNull View mStableScrimmedView;
|
|
// Might be higher up if mStableScrimmedView is invisible.
|
|
private @Nullable View mCurrentScrimmedView;
|
|
|
|
public OverviewScrim(View view) {
|
|
super(view);
|
|
mStableScrimmedView = mCurrentScrimmedView = mLauncher.getOverviewPanel();
|
|
|
|
onExtractedColorsChanged(mWallpaperColorInfo);
|
|
}
|
|
|
|
public void onInsetsChanged(Rect insets) {
|
|
mStableScrimmedView = (OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0
|
|
? mLauncher.getHotseat()
|
|
: mLauncher.getOverviewPanel();
|
|
}
|
|
|
|
public void updateCurrentScrimmedView(ViewGroup root) {
|
|
// Find the lowest view that is at or above the view we want to show the scrim behind.
|
|
mCurrentScrimmedView = mStableScrimmedView;
|
|
int currentIndex = root.indexOfChild(mCurrentScrimmedView);
|
|
final int childCount = root.getChildCount();
|
|
while (mCurrentScrimmedView.getVisibility() != VISIBLE && currentIndex < childCount) {
|
|
currentIndex++;
|
|
mCurrentScrimmedView = root.getChildAt(currentIndex);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return The view to draw the scrim behind.
|
|
*/
|
|
public View getScrimmedView() {
|
|
return mCurrentScrimmedView;
|
|
}
|
|
}
|