use of com.android.launcher3.widget.LocalColorExtractor in project android_packages_apps_Launcher3 by AOSPA.
the class ArrowPopup method initColorExtractionLocations.
private void initColorExtractionLocations(Launcher launcher) {
if (mColorExtractors == null) {
return;
}
Workspace workspace = launcher.getWorkspace();
if (workspace == null) {
return;
}
boolean firstVisibleChild = true;
int screenId = workspace.getScreenIdForPageIndex(workspace.getCurrentPage());
DragLayer dragLayer = launcher.getDragLayer();
final View[] viewAlignedWithArrow = new View[1];
// Order matters here, since we need the arrow to match the color of its adjacent view.
for (final View view : getChildrenForColorExtraction()) {
if (view != null && view.getVisibility() == VISIBLE) {
Rect pos = new Rect();
dragLayer.getDescendantRectRelativeToSelf(view, pos);
if (!pos.isEmpty()) {
LocalColorExtractor extractor = LocalColorExtractor.newInstance(launcher);
extractor.setWorkspaceLocation(pos, dragLayer, screenId);
extractor.setListener(extractedColors -> {
AnimatorSet colors = new AnimatorSet();
int newColor = getExtractedColor(extractedColors);
setChildColor(view, newColor, colors);
int numChildren = view instanceof ViewGroup ? ((ViewGroup) view).getChildCount() : 0;
for (int i = 0; i < numChildren; ++i) {
View childView = ((ViewGroup) view).getChildAt(i);
setChildColor(childView, newColor, colors);
}
if (viewAlignedWithArrow[0] == view) {
mArrowColor = newColor;
updateArrowColor();
}
colors.setDuration(150);
view.post(colors::start);
});
mColorExtractors.add(extractor);
if (mIsAboveIcon || firstVisibleChild) {
viewAlignedWithArrow[0] = view;
}
firstVisibleChild = false;
}
}
}
}
use of com.android.launcher3.widget.LocalColorExtractor in project android_packages_apps_Launcher3 by ArrowOS.
the class ArrowPopup method initColorExtractionLocations.
private void initColorExtractionLocations(Launcher launcher) {
if (mColorExtractors == null) {
return;
}
Workspace workspace = launcher.getWorkspace();
if (workspace == null) {
return;
}
boolean firstVisibleChild = true;
int screenId = workspace.getScreenIdForPageIndex(workspace.getCurrentPage());
DragLayer dragLayer = launcher.getDragLayer();
final View[] viewAlignedWithArrow = new View[1];
// Order matters here, since we need the arrow to match the color of its adjacent view.
for (final View view : getChildrenForColorExtraction()) {
if (view != null && view.getVisibility() == VISIBLE) {
Rect pos = new Rect();
dragLayer.getDescendantRectRelativeToSelf(view, pos);
if (!pos.isEmpty()) {
LocalColorExtractor extractor = LocalColorExtractor.newInstance(launcher);
extractor.setWorkspaceLocation(pos, dragLayer, screenId);
extractor.setListener(extractedColors -> {
AnimatorSet colors = new AnimatorSet();
int newColor = getExtractedColor(extractedColors);
setChildColor(view, newColor, colors);
int numChildren = view instanceof ViewGroup ? ((ViewGroup) view).getChildCount() : 0;
for (int i = 0; i < numChildren; ++i) {
View childView = ((ViewGroup) view).getChildAt(i);
setChildColor(childView, newColor, colors);
}
if (viewAlignedWithArrow[0] == view) {
mArrowColor = newColor;
updateArrowColor();
}
colors.setDuration(150);
view.post(colors::start);
});
mColorExtractors.add(extractor);
if (mIsAboveIcon || firstVisibleChild) {
viewAlignedWithArrow[0] = view;
}
firstVisibleChild = false;
}
}
}
}
use of com.android.launcher3.widget.LocalColorExtractor in project android_packages_apps_404Launcher by P-404.
the class ArrowPopup method initColorExtractionLocations.
private void initColorExtractionLocations(Launcher launcher) {
if (mColorExtractors == null) {
return;
}
Workspace workspace = launcher.getWorkspace();
if (workspace == null) {
return;
}
boolean firstVisibleChild = true;
int screenId = workspace.getScreenIdForPageIndex(workspace.getCurrentPage());
DragLayer dragLayer = launcher.getDragLayer();
final View[] viewAlignedWithArrow = new View[1];
// Order matters here, since we need the arrow to match the color of its adjacent view.
for (final View view : getChildrenForColorExtraction()) {
if (view != null && view.getVisibility() == VISIBLE) {
Rect pos = new Rect();
dragLayer.getDescendantRectRelativeToSelf(view, pos);
if (!pos.isEmpty()) {
LocalColorExtractor extractor = LocalColorExtractor.newInstance(launcher);
extractor.setWorkspaceLocation(pos, dragLayer, screenId);
extractor.setListener(extractedColors -> {
AnimatorSet colors = new AnimatorSet();
int newColor = getExtractedColor(extractedColors);
setChildColor(view, newColor, colors);
int numChildren = view instanceof ViewGroup ? ((ViewGroup) view).getChildCount() : 0;
for (int i = 0; i < numChildren; ++i) {
View childView = ((ViewGroup) view).getChildAt(i);
setChildColor(childView, newColor, colors);
}
if (viewAlignedWithArrow[0] == view) {
mArrowColor = newColor;
updateArrowColor();
}
colors.setDuration(150);
view.post(colors::start);
});
mColorExtractors.add(extractor);
if (mIsAboveIcon || firstVisibleChild) {
viewAlignedWithArrow[0] = view;
}
firstVisibleChild = false;
}
}
}
}
use of com.android.launcher3.widget.LocalColorExtractor in project android_packages_apps_Launcher3 by ProtonAOSP.
the class ArrowPopup method initColorExtractionLocations.
private void initColorExtractionLocations(Launcher launcher) {
if (mColorExtractors == null) {
return;
}
Workspace workspace = launcher.getWorkspace();
if (workspace == null) {
return;
}
boolean firstVisibleChild = true;
int screenId = workspace.getScreenIdForPageIndex(workspace.getCurrentPage());
DragLayer dragLayer = launcher.getDragLayer();
final View[] viewAlignedWithArrow = new View[1];
// Order matters here, since we need the arrow to match the color of its adjacent view.
for (final View view : getChildrenForColorExtraction()) {
if (view != null && view.getVisibility() == VISIBLE) {
Rect pos = new Rect();
dragLayer.getDescendantRectRelativeToSelf(view, pos);
if (!pos.isEmpty()) {
LocalColorExtractor extractor = LocalColorExtractor.newInstance(launcher);
extractor.setWorkspaceLocation(pos, dragLayer, screenId);
extractor.setListener(extractedColors -> {
AnimatorSet colors = new AnimatorSet();
int newColor = getExtractedColor(extractedColors);
setChildColor(view, newColor, colors);
int numChildren = view instanceof ViewGroup ? ((ViewGroup) view).getChildCount() : 0;
for (int i = 0; i < numChildren; ++i) {
View childView = ((ViewGroup) view).getChildAt(i);
setChildColor(childView, newColor, colors);
}
if (viewAlignedWithArrow[0] == view) {
mArrowColor = newColor;
updateArrowColor();
}
colors.setDuration(150);
view.post(colors::start);
});
mColorExtractors.add(extractor);
if (mIsAboveIcon || firstVisibleChild) {
viewAlignedWithArrow[0] = view;
}
firstVisibleChild = false;
}
}
}
}
Aggregations