Lcom/android/internal/R$drawable;->decor_close_button_light:I
Lcom/android/internal/R$drawable;->decor_maximize_button_dark:I
Lcom/android/internal/R$drawable;->decor_maximize_button_light:I
+Lcom/android/internal/R$drawable;->decor_back_button_dark:I
+Lcom/android/internal/R$drawable;->decor_back_button_light:I
Lcom/android/internal/R$drawable;->default_lock_wallpaper:I
Lcom/android/internal/R$drawable;->default_wallpaper:I
Lcom/android/internal/R$drawable;->dialog_frame:I
}
private void setLightDecorCaptionShade(DecorCaptionView view) {
- view.findViewById(R.id.pip_window).setBackgroundResource(
+ // region @boringdroid
+ view.findViewById(R.id.back_window).setBackgroundResource(
+ R.drawable.decor_back_button_light
+ );
+ // endregion
+ view.findViewById(R.id.pip_window).setBackgroundResource(
R.drawable.decor_pip_button_light);
view.findViewById(R.id.minimize_window).setBackgroundResource(
R.drawable.decor_minimize_button_light);
}
private void setDarkDecorCaptionShade(DecorCaptionView view) {
+ // region @boringdroid
+ view.findViewById(R.id.back_window).setBackgroundResource(
+ R.drawable.decor_back_button_dark
+ );
+ // endregion
view.findViewById(R.id.pip_window).setBackgroundResource(
R.drawable.decor_pip_button_dark);
view.findViewById(R.id.minimize_window).setBackgroundResource(
package com.android.internal.widget;
+import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Rect;
private final Rect mMinimizeRect = new Rect();
private final Rect mPipRect = new Rect();
private View mClickTarget;
+ // region @boringdroid
+ private View mBack;
+ private final Rect mBackRect = new Rect();
+ // endregion
public DecorCaptionView(Context context) {
super(context);
// By changing the outline provider to BOUNDS, the window can remove its
// background without removing the shadow.
mOwner.getDecorView().setOutlineProvider(ViewOutlineProvider.BOUNDS);
+ // region @boringdroid
+ mBack = findViewById(R.id.back_window);
+ // endregion
mPip = findViewById(R.id.pip_window);
mMinimize = findViewById(R.id.minimize_window);
mMaximize = findViewById(R.id.maximize_window);
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
final int x = (int) ev.getX();
final int y = (int) ev.getY();
+ // region @boringdroid
+ if (mBackRect.contains(x, y)) {
+ mClickTarget = mBack;
+ }
+ // endregion
// Only offset y for containment tests because the actual views are already translated.
if (mPipRect.contains(x, y)) {
mClickTarget = mPip;
if (mCaption.getVisibility() != View.GONE) {
mCaption.layout(0, 0, mCaption.getMeasuredWidth(), mCaption.getMeasuredHeight());
captionHeight = mCaption.getBottom() - mCaption.getTop();
+ // region @boringdroid
+ mBack.getHitRect(mBackRect);
+ // endregion
mPip.getHitRect(mPipRect);
mMinimize.getHitRect(mMinimizeRect);
mMaximize.getHitRect(mMaximizeRect);
mClose.getHitRect(mCloseRect);
} else {
captionHeight = 0;
+ // region @boringdroid
+ mBackRect.setEmpty();
+ // endregion
mPipRect.setEmpty();
mMinimizeRect.setEmpty();
mMaximizeRect.setEmpty();
}
// This assumes that the caption bar is at the top.
- mOwner.notifyRestrictedCaptionAreaCallback(mPip.getLeft(), mMaximize.getTop(),
+ // region @boringdroid
+ // mOwner.notifyRestrictedCaptionAreaCallback(mPip.getLeft(), mMaximize.getTop(),
+ // mClose.getRight(), mClose.getBottom());
+ mOwner.notifyRestrictedCaptionAreaCallback(mBack.getLeft(), mBack.getTop(),
mClose.getRight(), mClose.getBottom());
+ // endregion
}
/**
* Determine if the workspace is entirely covered by the window.
@Override
public boolean onSingleTapUp(MotionEvent e) {
+ // region @boringdroid
+ if (mClickTarget == mBack) {
+ Window.WindowControllerCallback callback = mOwner.getWindowControllerCallback();
+ if (callback instanceof Activity) {
+ Activity activity = (Activity) callback;
+ activity.onBackPressed();
+ }
+ return true;
+ }
+ // endregion
if (mClickTarget == mMinimize) {
minimizeWindow();
} else if (mClickTarget == mPip) {
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+ Copyright (C) 2020 boringdroid
+
+ 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="32.0"
+ android:viewportHeight="32.0"
+ android:tint="@color/decor_button_dark_color">
+ <group android:scaleX="0.5"
+ android:scaleY="0.5"
+ android:translateX="8.0"
+ android:translateY="8.0">
+ <path
+ android:fillColor="@color/white"
+ android:pathData="M2.0,16.0l28.0,14.0l0.0,-28z" />
+ </group>
+</vector>
+
+
--- /dev/null
+<!-- Copyright (C) 2015 The Android Open Source Project
+ Copyright (C) boringdroid
+
+ 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="32.0"
+ android:viewportHeight="32.0"
+ android:tint="@color/decor_button_light_color">
+ <group android:scaleX="0.5"
+ android:scaleY="0.5"
+ android:translateX="8.0"
+ android:translateY="8.0">
+ <path
+ android:fillColor="@color/white"
+ android:pathData="M2.0,16.0l28.0,14.0l0.0,-28z" />
+ </group>
+</vector>
android:background="@drawable/decor_caption_title"
android:focusable="false"
android:descendantFocusability="blocksDescendants" >
+ <!-- region @boringdroid -->
+ <Button
+ android:id="@+id/back_window"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_margin="5dp"
+ android:padding="4dp"
+ android:layout_gravity="center_vertical|start"
+ android:contentDescription="@string/back_button_text"
+ android:background="@drawable/decor_back_button_dark" />
+ <Space
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:background="@color/transparent" />
+ <!-- endregion -->
<Button
android:id="@+id/pip_window"
android:layout_width="32dp"
<item>@drawable/decor_minimize_button_light</item>
<item>@drawable/decor_pip_button_dark</item>
<item>@drawable/decor_pip_button_light</item>
+ <!-- region @boringdroid -->
+ <item>@drawable/decor_back_button_dark</item>
+ <item>@drawable/decor_back_button_light</item>
+ <!-- endregion -->
</array>
<!-- Used in LocalePicker -->
<string name="floating_toolbar_close_overflow_description">Close overflow</string>
<!-- Free style window strings -->
+ <!-- region @boringdroid -->
+ <string name="back_button_text">Back</string>
+ <!-- endregion -->
<!-- Accessibility text for the minimize window button -->
<string name="pip_button_text">Picture In Picture</string>
<!-- Accessibility text for the minimize window button -->
<java-symbol type="drawable" name="decor_maximize_button_light" />
<java-symbol type="drawable" name="decor_pip_button_dark" />
<java-symbol type="drawable" name="decor_pip_button_light" />
+ <!-- region @boringdroid -->
+ <java-symbol type="id" name="back_window" />
+ <java-symbol type="drawable" name="decor_back_button_dark" />
+ <java-symbol type="drawable" name="decor_back_button_light" />
+ <!-- endregion -->
<java-symbol type="color" name="decor_button_dark_color" />
<java-symbol type="color" name="decor_button_light_color" />