[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
This commit is contained in:
shaoweishen
2023-12-07 07:37:37 +00:00
parent 013626ebff
commit c08aad0ab4
5 changed files with 99 additions and 5 deletions

View File

@@ -27,6 +27,20 @@ import com.android.settings.dashboard.DashboardFragment;
public class NewKeyboardLayoutPickerContent extends DashboardFragment {
private static final String TAG = "KeyboardLayoutPicker";
private NewKeyboardLayoutPickerController mNewKeyboardLayoutPickerController;
private ControllerUpdateCallback mControllerUpdateCallback;
public interface ControllerUpdateCallback {
/**
* Called when mNewKeyBoardLayoutPickerController been initialized.
*/
void onControllerUpdated(NewKeyboardLayoutPickerController
newKeyboardLayoutPickerController);
}
public void setControllerUpdateCallback(ControllerUpdateCallback controllerUpdateCallback) {
this.mControllerUpdateCallback = controllerUpdateCallback;
}
@Override
public void onAttach(Context context) {
@@ -40,7 +54,11 @@ public class NewKeyboardLayoutPickerContent extends DashboardFragment {
getActivity().finish();
return;
}
use(NewKeyboardLayoutPickerController.class).initialize(this);
mNewKeyboardLayoutPickerController = use(NewKeyboardLayoutPickerController.class);
mNewKeyboardLayoutPickerController.initialize(this);
if (mControllerUpdateCallback != null) {
mControllerUpdateCallback.onControllerUpdated(mNewKeyboardLayoutPickerController);
}
}
@Override
@@ -56,4 +74,8 @@ public class NewKeyboardLayoutPickerContent extends DashboardFragment {
protected int getPreferenceScreenResId() {
return R.xml.new_keyboard_layout_picker_fragment;
}
public NewKeyboardLayoutPickerController getController() {
return mNewKeyboardLayoutPickerController;
}
}