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

Commit 6d80b7d6 authored by Maryam's avatar Maryam Committed by Maryam Dehaini
Browse files

Adding A Minimize Button

Added minimize button in the new WM shell to current caption and set its visibility to gone since Andoid UX is still debating on whether they will have it on by default in captions.

Bug: 242094334
Test: Used acloud to visualize and manually test changes
Change-Id: Iabeb0e94ae4adb2009dcfe7a365f9c8c9a7aa38f
parent 2701e807
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
<!--
  ~ 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.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24"
        android:tint="?attr/colorControlNormal">
    <path
        android:fillColor="@android:color/white" android:pathData="M6,21V19H18V21Z"/>
</vector>
+11 −1
Original line number Diff line number Diff line
@@ -21,6 +21,17 @@
    android:layout_height="wrap_content"
    android:gravity="end"
    android:background="@drawable/decor_caption_title">
    <Button
        android:id="@+id/minimize_window"
        android:visibility="gone"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:layout_margin="5dp"
        android:padding="4dp"
        android:layout_gravity="top|end"
        android:contentDescription="@string/maximize_button_text"
        android:background="@drawable/decor_minimize_button_dark"
        android:duplicateParentState="true"/>
    <Button
        android:id="@+id/maximize_window"
        android:layout_width="32dp"
@@ -42,4 +53,3 @@
        android:background="@drawable/decor_close_button_dark"
        android:duplicateParentState="true"/>
</com.android.wm.shell.windowdecor.WindowDecorLinearLayout>
+2 −0
Original line number Diff line number Diff line
@@ -192,6 +192,8 @@
    <!-- Freeform window caption strings -->
    <!-- Accessibility text for the maximize window button [CHAR LIMIT=NONE] -->
    <string name="maximize_button_text">Maximize</string>
     <!-- Accessibility text for the minimize window button [CHAR LIMIT=NONE] -->
     <string name="minimize_button_text">Minimize</string>
    <!-- Accessibility text for the close window button [CHAR LIMIT=NONE] -->
    <string name="close_button_text">Close</string>
</resources>
+16 −0
Original line number Diff line number Diff line
@@ -91,6 +91,12 @@ public class FreeformTaskTransitionHandler
        mPendingTransitionTokens.add(token);
    }

    @Override
    public void startMinimizedModeTransition(WindowContainerTransaction wct) {
        final int type = WindowManager.TRANSIT_TO_BACK;
        mPendingTransitionTokens.add(mTransitions.startTransition(type, wct, this));
    }

    @Override
    public boolean startAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
            @NonNull SurfaceControl.Transaction startT,
@@ -121,6 +127,8 @@ public class FreeformTaskTransitionHandler
                            transition, info.getType(), change, startT, finishT);
                    break;
                case WindowManager.TRANSIT_TO_BACK:
                    transitionHandled |= startMinimizeTransition(transition);
                    break;
                case WindowManager.TRANSIT_TO_FRONT:
                    break;
            }
@@ -169,6 +177,13 @@ public class FreeformTaskTransitionHandler
        return false;
    }

    private boolean startMinimizeTransition(IBinder transition) {
        if (!mPendingTransitionTokens.contains(transition)) {
            return false;
        }
        return true;
    }

    private boolean startChangeTransition(
            IBinder transition,
            int type,
@@ -243,4 +258,5 @@ public class FreeformTaskTransitionHandler
                return null;
        }
    }

}
+10 −1
Original line number Diff line number Diff line
@@ -29,6 +29,15 @@ public interface FreeformTaskTransitionStarter {
     *
     * @param targetWindowingMode the target windowing mode
     * @param wct the {@link WindowContainerTransaction} that changes the windowing mode
     *
     */
    void startWindowingModeTransition(int targetWindowingMode, WindowContainerTransaction wct);

    /**
     * Starts window minimization transition
     *
     * @param wct the {@link WindowContainerTransaction} that changes the windowing mode
     *
     */
    void startMinimizedModeTransition(WindowContainerTransaction wct);
}
 No newline at end of file
Loading