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

Commit 97f12f7e authored by Toshiki Kikuchi's avatar Toshiki Kikuchi
Browse files

Add unmaximize icon on CaptionWindowDecor

This CL adds an unmaximize icon to differentiate the icon of the
[un]maximize button icon depending on the target windowing mode.

Demo: https://screenshot.googleplex.com/56c2X9M9gNoVSWm

Bug: 358207467
Test: manual
Flag: EXEMPT Dev Tools
Change-Id: Ica1e4c7b163e8ab20d582c95e5fc798942e3f039
parent b97bb884
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -17,19 +17,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="32.0dp"
        android:height="32.0dp"
        android:viewportWidth="32.0"
        android:viewportHeight="32.0"
        android:tint="@color/decor_button_dark_color">
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <group android:scaleX="0.5"
            android:scaleY="0.5"
            android:translateX="8.0"
            android:translateY="8.0" >
            android:translateX="6.0"
            android:translateY="6.0" >
        <path
            android:fillColor="@android:color/white"
            android:pathData="M2.0,4.0l0.0,16.0l28.0,0.0L30.0,4.0L2.0,4.0zM26.0,16.0L6.0,16.0L6.0,8.0l20.0,0.0L26.0,16.0z"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M2.0,24.0l28.0,0.0l0.0,4.0l-28.0,0.0z"/>
            android:fillColor="@android:color/black"
            android:fillType="evenOdd"
            android:pathData="M23.0,1.0v22.0H1V1h22zm-3,19H4V4h16v16z"/>
    </group>
</vector>

+31 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2024 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="32.0dp"
        android:height="32.0dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <group android:scaleX="0.5"
            android:scaleY="0.5"
            android:translateX="6.0"
            android:translateY="6.0" >
        <path
            android:fillColor="@android:color/black"
            android:fillType="evenOdd"
            android:pathData="M23,16H8V1h15v15zm-12,-3V4h9v9h-9zM4,8H1v15h15v-3H4V8z"/>
    </group>
</vector>
+10 −0
Original line number Diff line number Diff line
@@ -260,6 +260,8 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
            setupRootView();
        }

        bindData(mResult.mRootView, taskInfo);

        if (!isDragResizeable) {
            closeDragResizeListener();
            return;
@@ -305,6 +307,14 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
        maximize.setOnClickListener(mOnCaptionButtonClickListener);
    }

    private void bindData(View rootView, RunningTaskInfo taskInfo) {
        final boolean isFullscreen =
                taskInfo.getWindowingMode() == WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
        rootView.findViewById(R.id.maximize_window)
                .setBackgroundResource(isFullscreen ? R.drawable.decor_restore_button_dark
                        : R.drawable.decor_maximize_button_dark);
    }

    void setCaptionColor(int captionColor) {
        if (mResult.mRootView == null) {
            return;