Support non-default back-disposition in ThemedNavBarKeyboard

With this CL, you can let ThemedNavBarKeyboard call

  InputMethodService#setBackDisposition(int)

with either the following values

  * BACK_DISPOSITION_DEFAULT
  * BACK_DISPOSITION_ADJUST_NOTHING

so that you can see how those two flags work.

Bug: 213337792
Test: Manually verified as follows
 1. Flash aosp_coral-userdebug into the device
 2. make -j ThemedNavBarKeyboard
 3. adb install -r $ANDROID_PRODUCT_OUT/system/app/ThemedNavBarKeyboard/ThemedNavBarKeyboard.apk
 4. adb shell ime enable com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard
 5. adb shell ime set com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard
 6. Tap any edit field
 7. Make sure that the back button is left-pointing triangle
 8. Tap "BACK_DISPOSITION_ADJUST_NOTHING" on the IME
 9. Make sure that the back button is down-pointing triangle
Change-Id: I71aa1dd23d72e8891cb3887efe5db1a48b6a017d
This commit is contained in:
Yohei Yukawa
2022-01-05 15:34:50 -08:00
parent 4cc03020a5
commit bb7d04778d

View File

@@ -189,6 +189,29 @@ public class ThemedNavBarKeyboard extends InputMethodService {
switchToSeparateNavBarMode(Color.DKGRAY, false /* lightNavBar */);
setBackgroundColor(MINT_COLOR);
{
final LinearLayout subLayout = new LinearLayout(context);
{
final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
lp.weight = 50;
subLayout.addView(createButton("BACK_DISPOSITION\nDEFAULT", () -> {
setBackDisposition(BACK_DISPOSITION_DEFAULT);
}), lp);
}
{
final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
lp.weight = 50;
subLayout.addView(createButton("BACK_DISPOSITION\nADJUST_NOTHING", () -> {
setBackDisposition(BACK_DISPOSITION_ADJUST_NOTHING);
}), lp);
}
addView(subLayout);
}
addView(createButton("Floating Mode", () -> {
switchToFloatingMode();
setBackgroundColor(Color.TRANSPARENT);