Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c0f738c authored by Helen Cheuk's avatar Helen Cheuk Committed by Android (Google) Code Review
Browse files

Merge "Add focus outline to launcher" into main

parents 8379c985 b4626f46
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -42,6 +42,13 @@ flag {
    bug: "257950105"
}

flag {
    name: "enable_focus_outline"
    namespace: "launcher"
    description: "Enables focus states outline for launcher."
    bug: "310953377"
}

flag {
    name: "enable_taskbar_no_recreate"
    namespace: "launcher"
+2 −1
Original line number Diff line number Diff line
@@ -19,7 +19,8 @@
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:focusable="true" >
    android:focusable="true"
    android:defaultFocusHighlightEnabled="false">
    <com.android.launcher3.views.DoubleShadowBubbleTextView
        style="@style/BaseIcon.Workspace"
        android:id="@+id/folder_icon_name"
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
    <color name="uninstall_target_hover_tint">#FFF0592B</color>

    <color name="focused_background">#80c6c5c5</color>
    <color name="focus_outline_color">@color/material_color_on_secondary_container</color>

    <color name="default_shadow_color_no_alpha">#FF000000</color>

+3 −0
Original line number Diff line number Diff line
@@ -436,6 +436,9 @@
    <dimen name="split_instructions_bottom_margin_phone_portrait">60dp</dimen>
    <dimen name="split_instructions_start_margin_cancel">8dp</dimen>

    <dimen name="focus_outline_radius">16dp</dimen>
    <dimen name="focus_outline_stroke_width">3dp</dimen>

    <!-- Workspace grid visualization parameters -->
    <dimen name="grid_visualization_rounding_radius">16dp</dimen>
    <dimen name="grid_visualization_horizontal_cell_spacing">6dp</dimen>
+15 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.graphics.Rect;
import android.view.View;
import android.view.View.OnFocusChangeListener;

import com.android.launcher3.Flags;
import com.android.launcher3.R;

/**
@@ -29,7 +30,8 @@ public abstract class FocusIndicatorHelper extends ItemFocusIndicatorHelper<View
        implements OnFocusChangeListener {

    public FocusIndicatorHelper(View container) {
        super(container, container.getResources().getColor(R.color.focused_background));
        super(container, container.getResources().getColor(Flags.enableFocusOutline()
                ? R.color.focus_outline_color : R.color.focused_background));
    }

    @Override
@@ -53,7 +55,18 @@ public abstract class FocusIndicatorHelper extends ItemFocusIndicatorHelper<View

        @Override
        public void viewToRect(View v, Rect outRect) {
            if (Flags.enableFocusOutline()) {
                // Ensure the left and top would not be negative and drawn outside of canvas
                outRect.set(Math.max(0, v.getLeft()), Math.max(0, v.getTop()), v.getRight(),
                        v.getBottom());
                // Stroke is drawn with half outside and half inside the view. Inset by half
                // stroke width to move the whole stroke inside the view and avoid other views
                // occluding it
                int halfStrokeWidth = (int) mPaint.getStrokeWidth() / 2;
                outRect.inset(halfStrokeWidth, halfStrokeWidth);
            } else {
                outRect.set(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
            }
        }
    }
}
Loading