Hide nav bar buttons in screen pinning dialog when appropriate.

- Also fix wrong hint text to disable screen pinning

Bug: 26314479
Change-Id: I7fc79c92511eba5e6d23dc307bb75c1710ff9e41
This commit is contained in:
Winson
2016-04-14 21:17:23 -07:00
committed by Winson Chung
parent 322870ff5c
commit b556811b86
3 changed files with 21 additions and 4 deletions

View File

@@ -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 -->

View File

@@ -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);
swapChildrenIfRtlAndVertical(buttons);
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);

View File

@@ -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.
*/