Merge "[Physical Keyboard Setting] Update layout for one pane land screen" into main
This commit is contained in:
75
res/layout/keyboard_layout_picker_one_pane_land.xml
Normal file
75
res/layout/keyboard_layout_picker_one_pane_land.xml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ Copyright (C) 2024 The Android Open Source Project
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/keyboard_layout_picker_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="@dimen/keyboard_picker_margin_one_pane"
|
||||||
|
android:layout_marginVertical="@dimen/keyboard_picker_margin_one_pane_large"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/keyboard_layout_preview_container"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginEnd="@dimen/keyboard_picker_margin_one_pane"
|
||||||
|
android:background="@drawable/keyboard_review_layout_background">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/keyboard_layout_preview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="@dimen/keyboard_picker_margin_small"
|
||||||
|
android:layout_marginTop="@dimen/keyboard_picker_margin_small"
|
||||||
|
android:layout_marginBottom="@dimen/keyboard_picker_margin_large"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="fitCenter" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/keyboard_layout_preview_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/keyboard_picker_margin_large"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textSize="@dimen/keyboard_picker_text_size" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="@dimen/keyboard_picker_margin_one_pane"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/keyboard_layout_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?android:attr/colorBackground"
|
||||||
|
android:elevation="1dp"
|
||||||
|
android:outlineAmbientShadowColor="@android:color/transparent"
|
||||||
|
android:outlineSpotShadowColor="@android:color/transparent" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/keyboard_layouts"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/keyboard_picker_margin_small"
|
||||||
|
android:background="?android:attr/colorBackground" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -168,6 +168,8 @@
|
|||||||
<!-- Keyboard -->
|
<!-- Keyboard -->
|
||||||
<dimen name="keyboard_picker_margin_large">68dp</dimen>
|
<dimen name="keyboard_picker_margin_large">68dp</dimen>
|
||||||
<dimen name="keyboard_picker_margin">24dp</dimen>
|
<dimen name="keyboard_picker_margin">24dp</dimen>
|
||||||
|
<dimen name="keyboard_picker_margin_one_pane_large">48dp</dimen>
|
||||||
|
<dimen name="keyboard_picker_margin_one_pane">24dp</dimen>
|
||||||
<dimen name="keyboard_picker_margin_small">16dp</dimen>
|
<dimen name="keyboard_picker_margin_small">16dp</dimen>
|
||||||
<dimen name="keyboard_picker_radius">28dp</dimen>
|
<dimen name="keyboard_picker_radius">28dp</dimen>
|
||||||
<dimen name="keyboard_picker_text_size">16sp</dimen>
|
<dimen name="keyboard_picker_text_size">16sp</dimen>
|
||||||
|
|||||||
@@ -16,9 +16,11 @@
|
|||||||
|
|
||||||
package com.android.settings.inputmethod;
|
package com.android.settings.inputmethod;
|
||||||
|
|
||||||
|
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||||
import static android.view.View.GONE;
|
import static android.view.View.GONE;
|
||||||
import static android.view.View.VISIBLE;
|
import static android.view.View.VISIBLE;
|
||||||
|
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.hardware.input.InputManager;
|
import android.hardware.input.InputManager;
|
||||||
import android.hardware.input.KeyboardLayout;
|
import android.hardware.input.KeyboardLayout;
|
||||||
@@ -35,6 +37,7 @@ import androidx.fragment.app.Fragment;
|
|||||||
|
|
||||||
import com.android.hardware.input.Flags;
|
import com.android.hardware.input.Flags;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
||||||
|
|
||||||
//TODO: b/316243168 - [Physical Keyboard Setting] Refactor NewKeyboardLayoutPickerFragment
|
//TODO: b/316243168 - [Physical Keyboard Setting] Refactor NewKeyboardLayoutPickerFragment
|
||||||
public class NewKeyboardLayoutPickerFragment extends Fragment {
|
public class NewKeyboardLayoutPickerFragment extends Fragment {
|
||||||
@@ -81,7 +84,7 @@ public class NewKeyboardLayoutPickerFragment extends Fragment {
|
|||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
mInputManager = requireContext().getSystemService(InputManager.class);
|
mInputManager = requireContext().getSystemService(InputManager.class);
|
||||||
ViewGroup fragmentView = (ViewGroup) inflater.inflate(
|
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);
|
mKeyboardLayoutPreview = fragmentView.findViewById(R.id.keyboard_layout_preview);
|
||||||
mKeyboardLayoutPreviewText = fragmentView.findViewById(R.id.keyboard_layout_preview_name);
|
mKeyboardLayoutPreviewText = fragmentView.findViewById(R.id.keyboard_layout_preview_name);
|
||||||
if (!Flags.keyboardLayoutPreviewFlag()) {
|
if (!Flags.keyboardLayoutPreviewFlag()) {
|
||||||
@@ -102,6 +105,12 @@ public class NewKeyboardLayoutPickerFragment extends Fragment {
|
|||||||
return fragmentView;
|
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) {
|
private void updateViewMarginForPreviewFlagOff(ViewGroup fragmentView) {
|
||||||
LinearLayout previewContainer = fragmentView.findViewById(
|
LinearLayout previewContainer = fragmentView.findViewById(
|
||||||
R.id.keyboard_layout_picker_container);
|
R.id.keyboard_layout_picker_container);
|
||||||
|
|||||||
Reference in New Issue
Block a user