Make preview screens in font/display size settings scrollable

Bug: 27274145
Change-Id: Ib93ff8faa9b14181b9b4f596a8b48cd0804f8f82
This commit is contained in:
Noah Wang
2016-02-23 17:26:13 -08:00
parent 8870706614
commit abf6312b8d
5 changed files with 287 additions and 276 deletions

View File

@@ -14,7 +14,17 @@
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<view class="com.android.settings.TouchBlockingFrameLayout"
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="16dp"
@@ -46,3 +56,5 @@
android:text="@string/font_size_preview_text_body"
android:textAppearance="@android:style/TextAppearance.Material.Body1"/>
</LinearLayout>
</view>
</ScrollView>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->
<view xmlns:android="http://schemas.android.com/apk/res/android"
class="com.android.settings.TouchBlockingFrameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" />

View File

@@ -13,9 +13,18 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<view class="com.android.settings.TouchBlockingFrameLayout"
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/conversation_background"
@@ -64,5 +73,6 @@
app:iconText="@string/screen_zoom_conversation_icon_pete"
app:iconTextColor="@color/message_icon_text_incoming"
app:iconBackgroundColor="@color/message_icon_background_incoming" />
</LinearLayout>
</view>
</ScrollView>

View File

@@ -17,10 +17,15 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:fillViewport="true"
android:background="?android:attr/colorBackgroundFloating"
android:importantForAccessibility="noHideDescendants">
<view class="com.android.settings.TouchBlockingFrameLayout"
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -217,4 +222,5 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
</view>
</ScrollView>

View File

@@ -25,6 +25,8 @@ import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ScrollView;
/**
* A PagerAdapter used by PreviewSeekBarPreferenceFragment that for showing multiple preview screen
@@ -32,7 +34,7 @@ import android.widget.FrameLayout;
*/
public class PreviewPagerAdapter extends PagerAdapter {
private TouchBlockingFrameLayout[] mPreviewFrames;
private FrameLayout[] mPreviewFrames;
/** Duration to use when cross-fading between previews. */
private static final long CROSS_FADE_DURATION_MS = 400;
@@ -45,11 +47,13 @@ public class PreviewPagerAdapter extends PagerAdapter {
public PreviewPagerAdapter(Context context, int[] previewSampleResIds,
Configuration[] configurations) {
mPreviewFrames = new TouchBlockingFrameLayout[previewSampleResIds.length];
mPreviewFrames = new FrameLayout[previewSampleResIds.length];
for (int i = 0; i < previewSampleResIds.length; ++i) {
mPreviewFrames[i] = (TouchBlockingFrameLayout) LayoutInflater.from(context)
.inflate(R.layout.preview_frame_container, null);
mPreviewFrames[i] = new FrameLayout(context);
mPreviewFrames[i].setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
mPreviewFrames[i].setContentDescription(
context.getString(R.string.preview_page_indicator_content_description, i + 1,
previewSampleResIds.length));
@@ -65,7 +69,6 @@ public class PreviewPagerAdapter extends PagerAdapter {
mPreviewFrames[i], false);
sampleView.setAlpha(0);
sampleView.setVisibility(View.INVISIBLE);
mPreviewFrames[i].addView(sampleView);
}
}