diff options
Diffstat (limited to 'packages')
4 files changed, 30 insertions, 15 deletions
diff --git a/packages/SystemUI/res/layout/screen_pinning_request.xml b/packages/SystemUI/res/layout/screen_pinning_request.xml index fea45cc..af203ce 100644 --- a/packages/SystemUI/res/layout/screen_pinning_request.xml +++ b/packages/SystemUI/res/layout/screen_pinning_request.xml @@ -28,12 +28,6 @@ android:layout_height="wrap_content" layout="@layout/screen_pinning_request_text_area" /> - <View - android:id="@+id/spacer" - android:layout_width="@dimen/screen_pinning_request_width" - android:layout_height="18dp" - android:background="@color/screen_pinning_request_bg" /> - <include android:layout_width="@dimen/screen_pinning_request_width" android:layout_height="wrap_content" diff --git a/packages/SystemUI/res/layout/screen_pinning_request_text_area.xml b/packages/SystemUI/res/layout/screen_pinning_request_text_area.xml index 8bf742a..7dbdb9f 100644 --- a/packages/SystemUI/res/layout/screen_pinning_request_text_area.xml +++ b/packages/SystemUI/res/layout/screen_pinning_request_text_area.xml @@ -29,7 +29,7 @@ android:layout_height="wrap_content" android:paddingEnd="48dp" android:paddingStart="48dp" - android:paddingTop="43dp" + android:paddingTop="18dp" android:text="@string/screen_pinning_title" android:textColor="@color/screen_pinning_primary_text" android:textSize="24sp" /> @@ -50,7 +50,7 @@ android:id="@+id/screen_pinning_ok_button" style="@android:style/Widget.Material.Button" android:layout_width="wrap_content" - android:layout_height="36dp" + android:layout_height="54dp" android:layout_alignParentEnd="true" android:layout_below="@+id/screen_pinning_description" android:layout_marginEnd="40dp" @@ -66,7 +66,7 @@ android:id="@+id/screen_pinning_cancel_button" style="@android:style/Widget.Material.Button" android:layout_width="wrap_content" - android:layout_height="36dp" + android:layout_height="54dp" android:layout_alignTop="@id/screen_pinning_ok_button" android:layout_marginEnd="4dp" android:layout_toStartOf="@id/screen_pinning_ok_button" diff --git a/packages/SystemUI/res/values/cm_strings.xml b/packages/SystemUI/res/values/cm_strings.xml index b2f3def..bba5d96 100644 --- a/packages/SystemUI/res/values/cm_strings.xml +++ b/packages/SystemUI/res/values/cm_strings.xml @@ -77,4 +77,7 @@ <string name="quick_settings_edit_label">Edit Tiles</string> <string name="quick_settings_cannot_delete_edit_tile">Cannot delete the Edit tile</string> <string name="qs_tiles_reset_confirmation">Reset quick settings tiles to default configuration?</string> + + <!-- Screen pinning dialog description (for devices without navbar) --> + <string name="screen_pinning_description_no_navbar">This keeps it in view until you unpin. Touch and hold the Back button to unpin.</string> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java index cbf5c05..b1413c9 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +++ b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java @@ -30,9 +30,11 @@ import android.graphics.drawable.ColorDrawable; import android.os.RemoteException; import android.util.DisplayMetrics; import android.view.Gravity; +import android.view.IWindowManager; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; +import android.view.WindowManagerGlobal; import android.view.accessibility.AccessibilityManager; import android.view.animation.DecelerateInterpolator; import android.widget.Button; @@ -49,6 +51,7 @@ public class ScreenPinningRequest implements View.OnClickListener { private final AccessibilityManager mAccessibilityService; private final WindowManager mWindowManager; + private final IWindowManager mWindowManagerService; private RequestWindowView mRequestWindow; @@ -58,6 +61,7 @@ public class ScreenPinningRequest implements View.OnClickListener { mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); + mWindowManagerService = WindowManagerGlobal.getWindowManagerService(); } public void clearPrompt() { @@ -215,19 +219,33 @@ public class ScreenPinningRequest implements View.OnClickListener { .setVisibility(View.INVISIBLE); } - final int description = mAccessibilityService.isEnabled() + final int description; + if (hasNavigationBar()) { + description = mAccessibilityService.isEnabled() ? R.string.screen_pinning_description_accessible : R.string.screen_pinning_description; + final int backBgVis = + mAccessibilityService.isEnabled() ? View.INVISIBLE : View.VISIBLE; + mLayout.findViewById(R.id.screen_pinning_back_bg).setVisibility(backBgVis); + mLayout.findViewById(R.id.screen_pinning_back_bg_light).setVisibility(backBgVis); + } else { + description = R.string.screen_pinning_description_no_navbar; + ((ViewGroup) buttons.getParent()).removeView(buttons); + } ((TextView) mLayout.findViewById(R.id.screen_pinning_description)) .setText(description); - final int backBgVisibility = - mAccessibilityService.isEnabled() ? View.INVISIBLE : View.VISIBLE; - mLayout.findViewById(R.id.screen_pinning_back_bg).setVisibility(backBgVisibility); - mLayout.findViewById(R.id.screen_pinning_back_bg_light).setVisibility(backBgVisibility); - + addView(mLayout, getRequestLayoutParams(isLandscape)); } + private boolean hasNavigationBar() { + try { + return mWindowManagerService.hasNavigationBar(); + } catch (RemoteException e) { + //ignore + } + return false; + } private void swapChildrenIfRtlAndVertical(View group) { if (mContext.getResources().getConfiguration().getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) { |