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

Commit b556811b authored by Winson's avatar Winson Committed by Winson Chung
Browse files

Hide nav bar buttons in screen pinning dialog when appropriate.

- Also fix wrong hint text to disable screen pinning

Bug: 26314479
Change-Id: I7fc79c92511eba5e6d23dc307bb75c1710ff9e41
parent 322870ff
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4024,7 +4024,7 @@
    <string name="date_picker_day_typeface">sans-serif-medium</string>

    <!-- Notify use that they are in Lock-to-app -->
    <string name="lock_to_app_toast">To unpin this screen, touch and hold Back and Overview at the same time.</string>
    <string name="lock_to_app_toast">To unpin this screen, touch and hold Back.</string>
    <!-- Notify use that they are in Lock-to-app in accessibility mode -->
    <string name="lock_to_app_toast_accessible">To unpin this screen, touch and hold Overview.</string>
    <!-- Notify user that they are locked in lock-to-app mode -->
+8 −3
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.os.RemoteException;
import android.util.DisplayMetrics;
@@ -204,11 +205,15 @@ public class ScreenPinningRequest implements View.OnClickListener {
            // Status bar is always on the right.
            mLayout.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
            // Buttons and text do switch sides though.
            View buttons = mLayout.findViewById(R.id.screen_pinning_buttons);
            buttons.setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE);
            mLayout.findViewById(R.id.screen_pinning_text_area)
                    .setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE);
            View buttons = mLayout.findViewById(R.id.screen_pinning_buttons);
            if (Recents.getSystemServices().hasSoftNavigationBar()) {
                buttons.setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE);
                swapChildrenIfRtlAndVertical(buttons);
            } else {
                buttons.setVisibility(View.GONE);
            }

            ((Button) mLayout.findViewById(R.id.screen_pinning_ok_button))
                    .setOnClickListener(ScreenPinningRequest.this);
+12 −0
Original line number Diff line number Diff line
@@ -503,6 +503,18 @@ public class SystemServicesProxy {
        return false;
    }

    /**
     * Returns whether there is a soft nav bar.
     */
    public boolean hasSoftNavigationBar() {
        try {
            return WindowManagerGlobal.getWindowManagerService().hasNavigationBar();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return false;
    }

    /**
     * Cancels the current window transtion to/from Recents for the given task id.
     */