Add a button for floating tasks to taskbar (behind a flag)
Test: manual - build launcher3, enable the feature flag on tablet with
a valid app installed, open an app, observe that there
is NO button in taskbar because launcher3 doesn't have
populated config
Bug: 237678727
Change-Id: Ic261608898eb9a9220cffacd0c6060a32c10a74f
This commit is contained in:
1 parent
af2fe7fd12
commit
78c899314e
8 files changed
+250
-4
No files matched your search
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.taskbar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ContextThemeWrapper;
|
||||
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
|
||||
/**
|
||||
* Button in Taskbar that opens something in a floating task.
|
||||
*/
|
||||
public class LaunchFloatingTaskButton extends BubbleTextView {
|
||||
|
||||
public LaunchFloatingTaskButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public LaunchFloatingTaskButton(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public LaunchFloatingTaskButton(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
Context theme = new ContextThemeWrapper(context, R.style.AllAppsButtonTheme);
|
||||
Bitmap bitmap = LauncherAppState.getInstance(context).getIconCache().getIconFactory()
|
||||
.createScaledBitmapWithShadow(
|
||||
theme.getDrawable(R.drawable.ic_floating_task_button));
|
||||
setIcon(new FastBitmapDrawable(bitmap));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user