From c08aad0ab48d88e32cbf377763088a23a3e91190 Mon Sep 17 00:00:00 2001 From: shaoweishen Date: Thu, 7 Dec 2023 07:37:37 +0000 Subject: [PATCH] [PK Setting] add keyboard review under keyboard selection page Demo video as attached in bug. Add new image view for keyboard layout review. Reuse NewKeyboardLayoutPickerController under NewKeyboardLayoutPickerFragment when get update for keyboard layout, get preview image from inputManager and set to the view. This feature will be guided with keyboard_layout_preview_flag, if the flag is off, preview image from InputManager will be null. Bug: 305588594 Test: Verified on device Change-Id: Ic6f8e469d3cf7114dab6935304706ad42bf83608 --- res/layout/keyboard_layout_picker.xml | 7 +++ .../settings/SettingsPreferenceFragment.java | 5 ++- .../NewKeyboardLayoutPickerContent.java | 24 +++++++++- .../NewKeyboardLayoutPickerController.java | 24 +++++++++- .../NewKeyboardLayoutPickerFragment.java | 44 ++++++++++++++++++- 5 files changed, 99 insertions(+), 5 deletions(-) diff --git a/res/layout/keyboard_layout_picker.xml b/res/layout/keyboard_layout_picker.xml index 6b163da250c..b25c228bf34 100644 --- a/res/layout/keyboard_layout_picker.xml +++ b/res/layout/keyboard_layout_picker.xml @@ -20,6 +20,13 @@ android:id="@+id/keyboard_layout_picker_container" android:orientation="vertical"> + + { + if (newKeyboardLayoutPickerController != null) { + newKeyboardLayoutPickerController.registerKeyboardSelectedCallback( + mKeyboardLayoutSelectedCallback); + } + }; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - + mInputManager = requireContext().getSystemService(InputManager.class); ViewGroup fragmentView = (ViewGroup) inflater.inflate( R.layout.keyboard_layout_picker, container, false); + mKeyboardLayoutPreview = fragmentView.findViewById(R.id.keyboard_layout_preview); getActivity().getSupportFragmentManager() .beginTransaction() .replace(R.id.keyboard_layout_title, new NewKeyboardLayoutPickerTitle()) .commit(); NewKeyboardLayoutPickerContent fragment = new NewKeyboardLayoutPickerContent(); + fragment.setControllerUpdateCallback(mControllerUpdateCallback); fragment.setArguments(getArguments()); getActivity().getSupportFragmentManager() .beginTransaction() .replace(R.id.keyboard_layouts, fragment) .commit(); - return fragmentView; } }