Merge "Clean up unused PreviewSeekBarPreferenceFragment"
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2015 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
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="16dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48"
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M33.3,36.8H14.7L10.8,48H2.1L20.2,0h7.5l18.2,48h-8.7L33.3,36.8z
|
||||
M17,30.1h13.9l-7-19.9L17,30.1z" />
|
||||
</vector>
|
@@ -1,26 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2015 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
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="48"
|
||||
android:viewportHeight="48"
|
||||
android:tint="?android:attr/colorAccent">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M33.3,36.8H14.7L10.8,48H2.1L20.2,0h7.5l18.2,48h-8.7L33.3,36.8z
|
||||
M17,30.1h13.9l-7-19.9L17,30.1z" />
|
||||
</vector>
|
@@ -1,41 +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.
|
||||
-->
|
||||
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="0dp"
|
||||
android:bottom="0dp"
|
||||
android:right="0dp"
|
||||
android:left="0dp" >
|
||||
<shape
|
||||
android:shape="rectangle" >
|
||||
<stroke
|
||||
android:width="@dimen/preview_pager_padding"
|
||||
android:color="?android:attr/colorBackground" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:bottom="0dp"
|
||||
android:right="0dp"
|
||||
android:left="0dp" >
|
||||
<shape
|
||||
android:shape="rectangle"
|
||||
android:height="?android:attr/actionBarSize" >
|
||||
<solid
|
||||
android:color="?android:attr/colorBackground" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
@@ -1,108 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include layout="@layout/preview_seek_bar_view_pager" />
|
||||
|
||||
<com.android.settings.widget.DotsPageIndicator
|
||||
android:id="@+id/page_indicator"
|
||||
style="@style/PreviewPagerPageIndicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="6dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="6dp"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView"
|
||||
android:elevation="2dp" />
|
||||
|
||||
<com.android.settings.widget.LabeledSeekBar
|
||||
android:id="@+id/seek_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
style="@android:style/Widget.Material.SeekBar.Discrete" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/smaller"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_font_size_16dp"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
android:tintMode="src_in"
|
||||
android:scaleType="center"
|
||||
android:focusable="true"
|
||||
android:contentDescription="@string/font_size_make_smaller_desc" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/larger"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_font_size_24dp"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
android:tintMode="src_in"
|
||||
android:scaleType="center"
|
||||
android:focusable="true"
|
||||
android:contentDescription="@string/font_size_make_larger_desc" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/font_size_summary"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</LinearLayout>
|
@@ -1,110 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="true"
|
||||
android:clipChildren ="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<include layout="@layout/preview_seek_bar_view_pager" />
|
||||
|
||||
<com.android.settings.widget.DotsPageIndicator
|
||||
android:id="@+id/page_indicator"
|
||||
style="@style/PreviewPagerPageIndicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="6dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="6dp"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView"
|
||||
android:elevation="2dp" />
|
||||
|
||||
<com.android.settings.widget.LabeledSeekBar
|
||||
android:id="@+id/seek_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
style="@android:style/Widget.Material.SeekBar.Discrete"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/smaller"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_remove_24dp"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
android:tintMode="src_in"
|
||||
android:scaleType="center"
|
||||
android:focusable="true"
|
||||
android:contentDescription="@string/screen_zoom_make_smaller_desc" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/larger"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_add_24dp"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
android:tintMode="src_in"
|
||||
android:scaleType="center"
|
||||
android:focusable="true"
|
||||
android:contentDescription="@string/screen_zoom_make_larger_desc" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/screen_zoom_summary"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</LinearLayout>
|
@@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 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.
|
||||
-->
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/preview_seek_bar_view_pager"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<com.android.settings.widget.DotsPageIndicator
|
||||
android:id="@+id/page_indicator"
|
||||
style="@style/PreviewPagerPageIndicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="6dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="6dp"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView"
|
||||
android:elevation="2dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/smaller"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_font_size_16dp"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
android:tintMode="src_in"
|
||||
android:scaleType="center"
|
||||
android:focusable="true"
|
||||
android:contentDescription="@string/font_size_make_smaller_desc"/>
|
||||
|
||||
<com.android.settings.widget.LabeledSeekBar
|
||||
android:id="@+id/seek_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
style="@android:style/Widget.Material.SeekBar.Discrete"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/larger"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_font_size_24dp"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
android:tintMode="src_in"
|
||||
android:scaleType="center"
|
||||
android:focusable="true"
|
||||
android:contentDescription="@string/font_size_make_larger_desc"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/font_size_summary"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
@@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 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.
|
||||
-->
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
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:id="@+id/font_size_preview_text_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/font_size_preview_text_headline"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Headline"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/font_size_preview_text_title"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/font_size_preview_text_subtitle"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/font_size_preview_text_body"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"/>
|
||||
</LinearLayout>
|
||||
</view>
|
||||
</androidx.core.widget.NestedScrollView>
|
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 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:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/preview_pager_padding"
|
||||
android:background="@drawable/preview_seek_bar_outline" >
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/preview_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/colorBackground"
|
||||
android:contentDescription="@string/preview_pager_content_description" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/actionBarSize"
|
||||
android:paddingStart="32dp"
|
||||
android:gravity="start|center"
|
||||
android:text="@string/screen_zoom_preview_title"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title"
|
||||
android:importantForAccessibility="no" />
|
||||
</LinearLayout>
|
||||
|
@@ -1,100 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 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.
|
||||
-->
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/preview_seek_bar_view_pager"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<com.android.settings.widget.DotsPageIndicator
|
||||
android:id="@+id/page_indicator"
|
||||
style="@style/PreviewPagerPageIndicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="6dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="6dp"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView"
|
||||
android:elevation="2dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/smaller"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_remove_24dp"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
android:tintMode="src_in"
|
||||
android:scaleType="center"
|
||||
android:focusable="true"
|
||||
android:contentDescription="@string/screen_zoom_make_smaller_desc"/>
|
||||
|
||||
<com.android.settings.widget.LabeledSeekBar
|
||||
android:id="@+id/seek_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
style="@android:style/Widget.Material.SeekBar.Discrete"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/larger"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_add_24dp"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
android:tintMode="src_in"
|
||||
android:scaleType="center"
|
||||
android:focusable="true"
|
||||
android:contentDescription="@string/screen_zoom_make_larger_desc"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/screen_zoom_summary"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
@@ -1,24 +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.
|
||||
-->
|
||||
<com.android.settings.display.AppGridView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="32dp"
|
||||
android:numColumns="3"
|
||||
android:gravity="center"
|
||||
android:nestedScrollingEnabled="true"
|
||||
android:importantForAccessibility="noHideDescendants" />
|
@@ -1,226 +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.
|
||||
-->
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
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"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Wifi Setting -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/ic_settings_wireless"
|
||||
android:tint="?android:attr/colorAccent"
|
||||
android:scaleType="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/wifi_settings"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/wifi_display_status_not_available"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Data usage Setting -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/ic_settings_data_usage"
|
||||
android:tint="?android:attr/colorAccent"
|
||||
android:scaleType="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/data_usage_summary_title"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_data_usage"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Display Setting -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/ic_settings_display"
|
||||
android:tint="?android:attr/colorAccent"
|
||||
android:scaleType="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/display_settings_title"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/display_summary_example"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Sound & Notification Setting -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/ic_settings_sound"
|
||||
android:tint="?android:attr/colorAccent"
|
||||
android:scaleType="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sound_settings"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sound_settings_example_summary"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Apps Setting -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/ic_settings_applications"
|
||||
android:tint="?android:attr/colorAccent"
|
||||
android:scaleType="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/applications_settings"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/apps_summary_example"
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
|
||||
android:textColor="?android:attr/textColorSecondary" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</view>
|
||||
</androidx.core.widget.NestedScrollView>
|
@@ -158,13 +158,6 @@
|
||||
<item>1800000</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="entries_font_size">
|
||||
<item msgid="6490061470416867723">Small</item>
|
||||
<item msgid="3579015730662088893">Default</item>
|
||||
<item msgid="1678068858001018666">Large</item>
|
||||
<item msgid="490158884605093126">Largest</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="entryvalues_font_size" translatable="false">
|
||||
<item>0.85</item>
|
||||
<item>1.0</item>
|
||||
|
@@ -89,9 +89,6 @@
|
||||
<!-- Content description for dot pager indicator for preview pager. [CHAR LIMIT=NONE] -->
|
||||
<string name="preview_page_indicator_content_description">Preview, page <xliff:g id="current_page" example="3">%1$d</xliff:g> of <xliff:g id="num_pages" example="9">%2$d</xliff:g></string>
|
||||
|
||||
<!-- Summary of font size setting screen. [CHAR LIMIT=NONE] -->
|
||||
<string name="font_size_summary">Make the text on screen smaller or larger.</string>
|
||||
|
||||
<!-- Description for the button that makes interface elements smaller. [CHAR_LIMIT=NONE] -->
|
||||
<string name="font_size_make_smaller_desc">Make smaller</string>
|
||||
<!-- Description for the button that makes interface elements larger. [CHAR_LIMIT=NONE] -->
|
||||
@@ -102,30 +99,6 @@
|
||||
|
||||
<!-- Disclaimer for camera based rotate [CHAR_LIMIT=NONE] -->
|
||||
<string name="smart_rotate_text_headline">Face Detection uses the front-facing camera to improve auto-rotate accuracy. Images are never stored or sent to Google.</string>
|
||||
<string name="font_size_preview_text_headline">Sample text</string>
|
||||
<string name="font_size_preview_text_title"
|
||||
translation_description="Title text in sample text used to illustrate how the currently selected font size will appear to the user. NOTE: Translate manually. No not adopt any copyrighted material for translation.">
|
||||
The Wonderful Wizard of Oz
|
||||
</string>
|
||||
<string name="font_size_preview_text_subtitle"
|
||||
translation_description="Subtitle text in sample text used to illustrate how the currently selected font size will appear to the user. NOTE: Translate manually. No not adopt any copyrighted material for translation.">
|
||||
Chapter 11: The Wonderful Emerald City of Oz</string>
|
||||
<string name="font_size_preview_text_body"
|
||||
translation_description="Text in sample text used to illustrate how the currently selected font size will appear to the user. NOTE: Translate manually. No not adopt any copyrighted material for translation.">
|
||||
Even with eyes protected by the green spectacles Dorothy and her friends were at first dazzled by the brilliancy of the wonderful City.
|
||||
The streets were lined with beautiful houses all built of green marble and studded everywhere with sparkling emeralds.
|
||||
They walked over a pavement of the same green marble, and where the blocks were joined together were rows of emeralds, set closely, and glittering in the brightness of the sun.
|
||||
The window panes were of green glass; even the sky above the City had a green tint, and the rays of the sun were green.
|
||||
\n\nThere were many people, men, women and children, walking about, and these were all dressed in green clothes and had greenish skins.
|
||||
They looked at Dorothy and her strangely assorted company with wondering eyes, and the children all ran away and hid behind their mothers when they saw the Lion; but no one spoke to them.
|
||||
Many shops stood in the street, and Dorothy saw that everything in them was green.
|
||||
Green candy and green pop-corn were offered for sale, as well as green shoes, green hats and green clothes of all sorts.
|
||||
At one place a man was selling green lemonade, and when the children bought it Dorothy could see that they paid for it with green pennies.
|
||||
\n\nThere seemed to be no horses nor animals of any kind; the men carried things around in little green carts, which they pushed before them.
|
||||
Everyone seeemed happy and contented and prosperous.
|
||||
</string>
|
||||
<!-- Button. Chosen when they want to save the chosen text size. -->
|
||||
<string name="font_size_save">OK</string>
|
||||
|
||||
<!-- Title for a notification shown. [CHAR LIMIT=25] -->
|
||||
<string name="sdcard_setting" product="nosdcard">USB storage</string>
|
||||
@@ -7959,10 +7932,6 @@
|
||||
<string name="help_url_manage_storage" translatable="false"></string>
|
||||
<!-- Help URL, Android is upgrading [DO NOT TRANSLATE] -->
|
||||
<string name="help_url_upgrading" translatable="false"></string>
|
||||
<!-- Help URL, Font size [DO NOT TRANSLATE] -->
|
||||
<string name="help_url_font_size" translatable="false"></string>
|
||||
<!-- Help URL, Display size [DO NOT TRANSLATE] -->
|
||||
<string name="help_url_display_size" translatable="false"></string>
|
||||
<!-- Help URL, Auto brightness [DO NOT TRANSLATE] -->
|
||||
<string name="help_url_auto_brightness" translatable="false" />
|
||||
<!-- Help URL, Adaptive sleep [DO NOT TRANSLATE] -->
|
||||
@@ -8512,9 +8481,6 @@
|
||||
<!-- Sound: Dashboard summary indicating the volume of ringtone when at 0% with vibrate disabled [CHAR LIMIT=100] -->
|
||||
<string name="sound_settings_summary_silent">Ringer set to silent</string>
|
||||
|
||||
<!-- Sound: Dashboard summary example used in Setup Wizard preview screen. [CHAR LIMIT=100] -->
|
||||
<string name="sound_settings_example_summary">Ring & notification volume at 80%</string>
|
||||
|
||||
<!-- Sound: Title for the option managing media volume. [CHAR LIMIT=30] -->
|
||||
<string name="media_volume_option_title">Media volume</string>
|
||||
|
||||
@@ -11098,8 +11064,6 @@
|
||||
<string name="screen_zoom_short_summary">Make everything bigger or smaller</string>
|
||||
<!-- Keywords for setting that controls screen zoom (e.g. how large interface elements appear). [CHAR LIMIT=NONE] -->
|
||||
<string name="screen_zoom_keywords">display density, screen zoom, scale, scaling</string>
|
||||
<!-- Summary of screen zoom setting screen. [CHAR LIMIT=NONE] -->
|
||||
<string name="screen_zoom_summary">Make the items on your screen smaller or larger. Some apps on your screen may change position.</string>
|
||||
<!-- Title of the screen zoom preview activity. -->
|
||||
<string name="screen_zoom_preview_title">Preview</string>
|
||||
<!-- Description for the button that makes interface elements smaller. [CHAR_LIMIT=NONE] -->
|
||||
@@ -11151,8 +11115,6 @@
|
||||
|
||||
<!-- Summary of apps [CHAR LIMIT=NONE] -->
|
||||
<string name="apps_summary"><xliff:g id="count" example="24">%1$d</xliff:g> apps installed</string>
|
||||
<!-- Example summary of apps used in Setup Wizard preview screen [CHAR LIMIT=NONE] -->
|
||||
<string name="apps_summary_example">24 apps installed</string>
|
||||
|
||||
<!-- Summary of storage usage [CHAR LIMIT=NONE] -->
|
||||
<string name="storage_summary"><xliff:g id="percentage" example="54%">%1$s</xliff:g> used - <xliff:g id="free_space" example="32GB">%2$s</xliff:g> free</string>
|
||||
@@ -11165,9 +11127,6 @@
|
||||
<!-- Summary for Display settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
|
||||
<string name="display_dashboard_summary">Dark theme, font size, brightness</string>
|
||||
|
||||
<!-- Example summary of display used in Setup Wizard preview screen [CHAR LIMIT=NONE] -->
|
||||
<string name="display_summary_example">Sleep after 10 minutes of inactivity</string>
|
||||
|
||||
<!-- Summary of memory screen [CHAR LIMIT=NONE] -->
|
||||
<string name="memory_summary">Avg <xliff:g id="used_memory" example="1.7GB">%1$s</xliff:g> of <xliff:g id="total_memory" example="2GB">%2$s</xliff:g> memory used</string>
|
||||
|
||||
|
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.settings.accessibility;
|
||||
|
||||
import static com.android.settings.display.ToggleFontSizePreferenceFragment.fontSizeValueToIndex;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
@@ -55,4 +53,20 @@ final class FontSizeData extends PreviewSizeData<Float> {
|
||||
Settings.System.putFloat(resolver, Settings.System.FONT_SCALE,
|
||||
getValues().get(currentProgress));
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function that returns the index in a string array with which the represented value is
|
||||
* the closest to a given float value.
|
||||
*/
|
||||
private static int fontSizeValueToIndex(float val, String[] indices) {
|
||||
float lastVal = Float.parseFloat(indices[0]);
|
||||
for (int i = 1; i < indices.length; i++) {
|
||||
float thisVal = Float.parseFloat(indices[i]);
|
||||
if (val < (lastVal + (thisVal - lastVal) * .5f)) {
|
||||
return i - 1;
|
||||
}
|
||||
lastVal = thisVal;
|
||||
}
|
||||
return indices.length - 1;
|
||||
}
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.android.settings.display;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
public class FontSizePreferenceController extends BasePreferenceController {
|
||||
|
||||
public FontSizePreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
final float currentScale = Settings.System.getFloat(mContext.getContentResolver(),
|
||||
Settings.System.FONT_SCALE, 1.0f);
|
||||
final Resources res = mContext.getResources();
|
||||
final String[] entries = res.getStringArray(R.array.entries_font_size);
|
||||
final String[] strEntryValues = res.getStringArray(R.array.entryvalues_font_size);
|
||||
final int index = ToggleFontSizePreferenceFragment.fontSizeValueToIndex(currentScale,
|
||||
strEntryValues);
|
||||
return entries[index];
|
||||
}
|
||||
}
|
@@ -1,287 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
package com.android.settings.display;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.view.Choreographer;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.widget.DotsPageIndicator;
|
||||
import com.android.settings.widget.LabeledSeekBar;
|
||||
|
||||
/**
|
||||
* Preference fragment shows a preview and a seek bar to adjust a specific settings.
|
||||
*/
|
||||
public abstract class PreviewSeekBarPreferenceFragment extends SettingsPreferenceFragment {
|
||||
|
||||
/** List of entries corresponding the settings being set. */
|
||||
protected String[] mEntries;
|
||||
|
||||
/** Index of the entry corresponding to initial value of the settings. */
|
||||
protected int mInitialIndex;
|
||||
|
||||
/** Index of the entry corresponding to current value of the settings. */
|
||||
protected int mCurrentIndex;
|
||||
|
||||
private ViewPager mPreviewPager;
|
||||
private PreviewPagerAdapter mPreviewPagerAdapter;
|
||||
private DotsPageIndicator mPageIndicator;
|
||||
|
||||
private TextView mLabel;
|
||||
private LabeledSeekBar mSeekBar;
|
||||
private View mLarger;
|
||||
private View mSmaller;
|
||||
|
||||
private static final long MIN_COMMIT_INTERVAL_MS = 800;
|
||||
private long mLastCommitTime;
|
||||
|
||||
private class onPreviewSeekBarChangeListener implements OnSeekBarChangeListener {
|
||||
private static final long CHANGE_BY_SEEKBAR_DELAY_MS = 100;
|
||||
private static final long CHANGE_BY_BUTTON_DELAY_MS = 300;
|
||||
|
||||
private boolean mSeekByTouch;
|
||||
private boolean mIsChanged;
|
||||
private long mCommitDelayMs;
|
||||
|
||||
private final Choreographer.FrameCallback mCommit = f -> {
|
||||
commit();
|
||||
mLastCommitTime = SystemClock.elapsedRealtime();
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (mCurrentIndex == progress) {
|
||||
mIsChanged = false;
|
||||
return;
|
||||
}
|
||||
mIsChanged = true;
|
||||
setPreviewLayer(progress, false);
|
||||
if (mSeekByTouch) {
|
||||
mCommitDelayMs = CHANGE_BY_SEEKBAR_DELAY_MS;
|
||||
} else {
|
||||
mCommitDelayMs = CHANGE_BY_BUTTON_DELAY_MS;
|
||||
commitOnNextFrame();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
mSeekByTouch = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
mSeekByTouch = false;
|
||||
if (!mIsChanged) {
|
||||
return;
|
||||
}
|
||||
if (mPreviewPagerAdapter.isAnimating()) {
|
||||
mPreviewPagerAdapter.setAnimationEndAction(this::commitOnNextFrame);
|
||||
} else {
|
||||
commitOnNextFrame();
|
||||
}
|
||||
}
|
||||
|
||||
private void commitOnNextFrame() {
|
||||
if (SystemClock.elapsedRealtime() - mLastCommitTime < MIN_COMMIT_INTERVAL_MS) {
|
||||
mCommitDelayMs += MIN_COMMIT_INTERVAL_MS;
|
||||
}
|
||||
final Choreographer choreographer = Choreographer.getInstance();
|
||||
choreographer.removeFrameCallback(mCommit);
|
||||
choreographer.postFrameCallbackDelayed(mCommit, mCommitDelayMs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putLong("mLastCommitTime", mLastCommitTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
if (savedInstanceState != null) {
|
||||
mLastCommitTime = savedInstanceState.getLong("mLastCommitTime");
|
||||
}
|
||||
final View root = super.onCreateView(inflater, container, savedInstanceState);
|
||||
final ViewGroup listContainer = root.findViewById(android.R.id.list_container);
|
||||
listContainer.removeAllViews();
|
||||
|
||||
final View content = inflater.inflate(getActivityLayoutResId(), listContainer, false);
|
||||
listContainer.addView(content);
|
||||
|
||||
mLabel = content.findViewById(R.id.current_label);
|
||||
|
||||
// The maximum SeekBar value always needs to be non-zero. If there's
|
||||
// only one available value, we'll handle this by disabling the
|
||||
// seek bar.
|
||||
final int max = Math.max(1, mEntries.length - 1);
|
||||
|
||||
mSeekBar = content.findViewById(R.id.seek_bar);
|
||||
mSeekBar.setLabels(mEntries);
|
||||
mSeekBar.setMax(max);
|
||||
|
||||
mSmaller = content.findViewById(R.id.smaller);
|
||||
mSmaller.setOnClickListener(v -> {
|
||||
final int progress = mSeekBar.getProgress();
|
||||
if (progress > 0) {
|
||||
mSeekBar.setProgress(progress - 1, true);
|
||||
}
|
||||
});
|
||||
|
||||
mLarger = content.findViewById(R.id.larger);
|
||||
mLarger.setOnClickListener(v -> {
|
||||
final int progress = mSeekBar.getProgress();
|
||||
if (progress < mSeekBar.getMax()) {
|
||||
mSeekBar.setProgress(progress + 1, true);
|
||||
}
|
||||
});
|
||||
|
||||
if (mEntries.length == 1) {
|
||||
// The larger and smaller buttons will be disabled when we call
|
||||
// setPreviewLayer() later in this method.
|
||||
mSeekBar.setEnabled(false);
|
||||
}
|
||||
|
||||
final Context context = getContext();
|
||||
final Configuration origConfig = context.getResources().getConfiguration();
|
||||
final boolean isLayoutRtl = origConfig.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
|
||||
Configuration[] configurations = new Configuration[mEntries.length];
|
||||
for (int i = 0; i < mEntries.length; ++i) {
|
||||
configurations[i] = createConfig(origConfig, i);
|
||||
}
|
||||
|
||||
final int[] previews = getPreviewSampleResIds();
|
||||
mPreviewPager = content.findViewById(R.id.preview_pager);
|
||||
mPreviewPagerAdapter = new PreviewPagerAdapter(context, isLayoutRtl,
|
||||
previews, configurations);
|
||||
mPreviewPager.setAdapter(mPreviewPagerAdapter);
|
||||
mPreviewPager.setCurrentItem(isLayoutRtl ? previews.length - 1 : 0);
|
||||
mPreviewPager.addOnPageChangeListener(mPreviewPageChangeListener);
|
||||
|
||||
mPageIndicator = content.findViewById(R.id.page_indicator);
|
||||
if (previews.length > 1) {
|
||||
mPageIndicator.setViewPager(mPreviewPager);
|
||||
mPageIndicator.setVisibility(View.VISIBLE);
|
||||
mPageIndicator.setOnPageChangeListener(mPageIndicatorPageChangeListener);
|
||||
} else {
|
||||
mPageIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
setPreviewLayer(mInitialIndex, false);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
// Set SeekBar listener here to avoid onProgressChanged() is called
|
||||
// during onRestoreInstanceState().
|
||||
mSeekBar.setProgress(mCurrentIndex);
|
||||
mSeekBar.setOnSeekBarChangeListener(new onPreviewSeekBarChangeListener());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
mSeekBar.setOnSeekBarChangeListener(null);
|
||||
}
|
||||
|
||||
/** Resource id of the layout for this preference fragment. */
|
||||
protected abstract int getActivityLayoutResId();
|
||||
|
||||
/** Resource id of the layout that defines the contents inside preview screen. */
|
||||
protected abstract int[] getPreviewSampleResIds();
|
||||
|
||||
/**
|
||||
* Creates new configuration based on the current position of the SeekBar.
|
||||
*/
|
||||
protected abstract Configuration createConfig(Configuration origConfig, int index);
|
||||
|
||||
/**
|
||||
* Persists the selected value and sends a configuration change.
|
||||
*/
|
||||
protected abstract void commit();
|
||||
|
||||
private void setPreviewLayer(int index, boolean animate) {
|
||||
mLabel.setText(mEntries[index]);
|
||||
mSmaller.setEnabled(index > 0);
|
||||
mLarger.setEnabled(index < mEntries.length - 1);
|
||||
setPagerIndicatorContentDescription(mPreviewPager.getCurrentItem());
|
||||
mPreviewPagerAdapter.setPreviewLayer(index, mCurrentIndex,
|
||||
mPreviewPager.getCurrentItem(), animate);
|
||||
|
||||
mCurrentIndex = index;
|
||||
}
|
||||
|
||||
private void setPagerIndicatorContentDescription(int position) {
|
||||
mPageIndicator.setContentDescription(
|
||||
getString(R.string.preview_page_indicator_content_description,
|
||||
position + 1, getPreviewSampleResIds().length));
|
||||
}
|
||||
|
||||
private OnPageChangeListener mPreviewPageChangeListener = new OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset,
|
||||
int positionOffsetPixels) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
mPreviewPager.sendAccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT);
|
||||
}
|
||||
};
|
||||
|
||||
private OnPageChangeListener mPageIndicatorPageChangeListener = new OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset,
|
||||
int positionOffsetPixels) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
setPagerIndicatorContentDescription(position);
|
||||
}
|
||||
};
|
||||
}
|
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.
|
||||
*/
|
||||
|
||||
package com.android.settings.display;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.view.Display;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.display.DisplayDensityConfiguration;
|
||||
import com.android.settingslib.display.DisplayDensityUtils;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
/**
|
||||
* Preference fragment used to control screen zoom.
|
||||
*/
|
||||
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
|
||||
public class ScreenZoomSettings extends PreviewSeekBarPreferenceFragment {
|
||||
|
||||
private int mDefaultDensity;
|
||||
private int[] mValues;
|
||||
|
||||
@Override
|
||||
protected int getActivityLayoutResId() {
|
||||
return R.layout.screen_zoom_activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int[] getPreviewSampleResIds() {
|
||||
return getContext().getResources().getBoolean(
|
||||
R.bool.config_enable_extra_screen_zoom_preview)
|
||||
? new int[]{
|
||||
R.layout.screen_zoom_preview_1,
|
||||
R.layout.screen_zoom_preview_2,
|
||||
R.layout.screen_zoom_preview_settings}
|
||||
: new int[]{R.layout.screen_zoom_preview_1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final DisplayDensityUtils density = new DisplayDensityUtils(getContext());
|
||||
|
||||
final int initialIndex = density.getCurrentIndex();
|
||||
if (initialIndex < 0) {
|
||||
// Failed to obtain default density, which means we failed to
|
||||
// connect to the window manager service. Just use the current
|
||||
// density and don't let the user change anything.
|
||||
final int densityDpi = getResources().getDisplayMetrics().densityDpi;
|
||||
mValues = new int[]{densityDpi};
|
||||
mEntries = new String[]{getString(DisplayDensityUtils.SUMMARY_DEFAULT)};
|
||||
mInitialIndex = 0;
|
||||
mDefaultDensity = densityDpi;
|
||||
} else {
|
||||
mValues = density.getValues();
|
||||
mEntries = density.getEntries();
|
||||
mInitialIndex = initialIndex;
|
||||
mDefaultDensity = density.getDefaultDensity();
|
||||
}
|
||||
|
||||
getActivity().setTitle(R.string.screen_zoom_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Configuration createConfig(Configuration origConfig, int index) {
|
||||
// Populate the sample layouts.
|
||||
final Configuration config = new Configuration(origConfig);
|
||||
config.densityDpi = mValues[index];
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persists the selected density and sends a configuration change.
|
||||
*/
|
||||
@Override
|
||||
protected void commit() {
|
||||
final int densityDpi = mValues[mCurrentIndex];
|
||||
if (densityDpi == mDefaultDensity) {
|
||||
DisplayDensityConfiguration.clearForcedDisplayDensity(Display.DEFAULT_DISPLAY);
|
||||
} else {
|
||||
DisplayDensityConfiguration.setForcedDisplayDensity(Display.DEFAULT_DISPLAY, densityDpi);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHelpResource() {
|
||||
return R.string.help_url_display_size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.DISPLAY_SCREEN_ZOOM;
|
||||
}
|
||||
|
||||
/** Index provider used to expose this fragment in search. */
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
@@ -1,121 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
package com.android.settings.display;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
/**
|
||||
* Preference fragment used to control font size.
|
||||
*/
|
||||
@SearchIndexable
|
||||
public class ToggleFontSizePreferenceFragment extends PreviewSeekBarPreferenceFragment {
|
||||
|
||||
private float[] mValues;
|
||||
|
||||
@Override
|
||||
protected int getActivityLayoutResId() {
|
||||
return R.layout.font_size_activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int[] getPreviewSampleResIds() {
|
||||
return new int[]{R.layout.font_size_preview};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final Resources res = getContext().getResources();
|
||||
final ContentResolver resolver = getContext().getContentResolver();
|
||||
// Mark the appropriate item in the preferences list.
|
||||
mEntries = res.getStringArray(R.array.entries_font_size);
|
||||
final String[] strEntryValues = res.getStringArray(R.array.entryvalues_font_size);
|
||||
final float currentScale =
|
||||
Settings.System.getFloat(resolver, Settings.System.FONT_SCALE, 1.0f);
|
||||
mInitialIndex = fontSizeValueToIndex(currentScale, strEntryValues);
|
||||
mValues = new float[strEntryValues.length];
|
||||
for (int i = 0; i < strEntryValues.length; ++i) {
|
||||
mValues[i] = Float.parseFloat(strEntryValues[i]);
|
||||
}
|
||||
getActivity().setTitle(R.string.title_font_size);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Configuration createConfig(Configuration origConfig, int index) {
|
||||
// Populate the sample layouts.
|
||||
final Configuration config = new Configuration(origConfig);
|
||||
config.fontScale = mValues[index];
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persists the selected font size.
|
||||
*/
|
||||
@Override
|
||||
protected void commit() {
|
||||
if (getContext() == null) return;
|
||||
final ContentResolver resolver = getContext().getContentResolver();
|
||||
Settings.System.putFloat(resolver, Settings.System.FONT_SCALE, mValues[mCurrentIndex]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHelpResource() {
|
||||
return R.string.help_url_font_size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.ACCESSIBILITY_FONT_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function that returns the index in a string array with which the represented value is
|
||||
* the closest to a given float value.
|
||||
*/
|
||||
public static int fontSizeValueToIndex(float val, String[] indices) {
|
||||
float lastVal = Float.parseFloat(indices[0]);
|
||||
for (int i = 1; i < indices.length; i++) {
|
||||
float thisVal = Float.parseFloat(indices[i]);
|
||||
if (val < (lastVal + (thisVal - lastVal) * .5f)) {
|
||||
return i - 1;
|
||||
}
|
||||
lastVal = thisVal;
|
||||
}
|
||||
return indices.length - 1;
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@@ -1,3 +1 @@
|
||||
com.android.settings.display.FontSizePreferenceFragmentForSetupWizard
|
||||
com.android.settings.display.ScreenZoomPreferenceFragmentForSetupWizard
|
||||
com.android.settings.search.FakeSettingsFragment
|
||||
|
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
package com.android.settings.display;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class FontSizePreferenceControllerTest {
|
||||
|
||||
private static final String TEST_KEY = "test_key";
|
||||
|
||||
private Context mContext;
|
||||
private FontSizePreferenceController mController;
|
||||
private String[] mFontSizeArray;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new FontSizePreferenceController(mContext, TEST_KEY);
|
||||
mFontSizeArray = mContext.getResources().getStringArray(R.array.entries_font_size);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAlwaysAvailable() {
|
||||
assertThat(mController.getAvailabilityStatus())
|
||||
.isEqualTo(BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_noScale_shouldReturnDefaultSummary() {
|
||||
assertThat(mController.getSummary()).isEqualTo(mFontSizeArray[1]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_smallScale_shouldReturnSmall() {
|
||||
Settings.System.putFloat(mContext.getContentResolver(),
|
||||
Settings.System.FONT_SCALE, 0.5f);
|
||||
assertThat(mController.getSummary()).isEqualTo(mFontSizeArray[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_largeScale_shouldReturnLarge() {
|
||||
Settings.System.putFloat(mContext.getContentResolver(),
|
||||
Settings.System.FONT_SCALE, 1.5f);
|
||||
assertThat(mController.getSummary()).isEqualTo(mFontSizeArray[3]);
|
||||
}
|
||||
}
|
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
package com.android.settings.display;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class ScreenZoomSettingsTest {
|
||||
|
||||
private ScreenZoomSettings mSettings;
|
||||
private Context mContext;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mSettings = spy(new ScreenZoomSettings());
|
||||
doReturn(mContext).when(mSettings).getContext();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPreviewSampleResIds_default_return3Previews() {
|
||||
assertThat(mSettings.getPreviewSampleResIds()).hasLength(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getPreviewSampleResIds_extraPreviewDisabled_return1Preview() {
|
||||
assertThat(mSettings.getPreviewSampleResIds()).hasLength(1);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user