[Physical Keyboard Setting] Update layout for one pane land screen
If device is one pane and is land orientation, set new layout for it to match with UX markup, this change will not effect on tablet, which is two pane setting. Bug: 325878673 Test: verify on device Screenshot: https://screenshot.googleplex.com/BkETMhqp9GXM3cc.png Change-Id: I066c3d782a2de8993a3fe9632676b67c2203d638
This commit is contained in:
committed by
Shaowei Shen
parent
b3646a4957
commit
6c02c6ab25
@@ -16,9 +16,11 @@
|
||||
|
||||
package com.android.settings.inputmethod;
|
||||
|
||||
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.hardware.input.InputManager;
|
||||
import android.hardware.input.KeyboardLayout;
|
||||
@@ -35,6 +37,7 @@ import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.android.hardware.input.Flags;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
||||
|
||||
//TODO: b/316243168 - [Physical Keyboard Setting] Refactor NewKeyboardLayoutPickerFragment
|
||||
public class NewKeyboardLayoutPickerFragment extends Fragment {
|
||||
@@ -81,7 +84,7 @@ public class NewKeyboardLayoutPickerFragment extends Fragment {
|
||||
Bundle savedInstanceState) {
|
||||
mInputManager = requireContext().getSystemService(InputManager.class);
|
||||
ViewGroup fragmentView = (ViewGroup) inflater.inflate(
|
||||
R.layout.keyboard_layout_picker, container, false);
|
||||
getPickerLayout(getResources().getConfiguration()), container, false);
|
||||
mKeyboardLayoutPreview = fragmentView.findViewById(R.id.keyboard_layout_preview);
|
||||
mKeyboardLayoutPreviewText = fragmentView.findViewById(R.id.keyboard_layout_preview_name);
|
||||
if (!Flags.keyboardLayoutPreviewFlag()) {
|
||||
@@ -102,6 +105,12 @@ public class NewKeyboardLayoutPickerFragment extends Fragment {
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
private int getPickerLayout(Configuration configuration) {
|
||||
return !ActivityEmbeddingUtils.isAlreadyEmbedded(this.getActivity())
|
||||
&& configuration.orientation == ORIENTATION_LANDSCAPE
|
||||
? R.layout.keyboard_layout_picker_one_pane_land : R.layout.keyboard_layout_picker;
|
||||
}
|
||||
|
||||
private void updateViewMarginForPreviewFlagOff(ViewGroup fragmentView) {
|
||||
LinearLayout previewContainer = fragmentView.findViewById(
|
||||
R.id.keyboard_layout_picker_container);
|
||||
|
Reference in New Issue
Block a user