Prototyping : Demo Image on color setting
Implement prototyping of demo image on color setting
Bug: 182797883
Test: adb shell am instrument -w -e class com.android.settings.display.ColorModePreferenceFragmentTest com.android.settings.tests.unit/androidx.test.runner.AndroidJUnitRunner test pass
Change-Id: Iebaaa6867f2039a25a5e1fd280a89b5bc9297e6b
diff --git a/res/drawable-nodpi/color_mode_preview.jpg b/res/drawable-nodpi/color_mode_preview.jpg
deleted file mode 100644
index 804bcf1..0000000
--- a/res/drawable-nodpi/color_mode_preview.jpg
+++ /dev/null
Binary files differ
diff --git a/res/drawable-nodpi/color_mode_preview1.jpg b/res/drawable-nodpi/color_mode_preview1.jpg
new file mode 100644
index 0000000..71bcb7e
--- /dev/null
+++ b/res/drawable-nodpi/color_mode_preview1.jpg
Binary files differ
diff --git a/res/drawable-nodpi/color_mode_preview2.jpg b/res/drawable-nodpi/color_mode_preview2.jpg
new file mode 100644
index 0000000..4153d8e
--- /dev/null
+++ b/res/drawable-nodpi/color_mode_preview2.jpg
Binary files differ
diff --git a/res/drawable-nodpi/color_mode_preview3.jpg b/res/drawable-nodpi/color_mode_preview3.jpg
new file mode 100644
index 0000000..ab83f08
--- /dev/null
+++ b/res/drawable-nodpi/color_mode_preview3.jpg
Binary files differ
diff --git a/res/drawable/ic_color_arrow_left_lt.xml b/res/drawable/ic_color_arrow_left_lt.xml
new file mode 100644
index 0000000..237a1a3
--- /dev/null
+++ b/res/drawable/ic_color_arrow_left_lt.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2021 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="24"
+ android:viewportHeight="24">
+ <path
+ android:pathData="M0,0h24v24h-24z"/>
+ <path
+ android:pathData="M16.41,18.59L15,20L7,12L15,4L16.41,5.41L9.83,12"
+ android:fillColor="?android:attr/colorAccent"
+ android:fillType="evenOdd"/>
+</vector>
diff --git a/res/drawable/ic_color_arrow_right_lt.xml b/res/drawable/ic_color_arrow_right_lt.xml
new file mode 100644
index 0000000..5107243
--- /dev/null
+++ b/res/drawable/ic_color_arrow_right_lt.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2021 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="24"
+ android:viewportHeight="24">
+ <path
+ android:pathData="M0,0h24v24h-24z"/>
+ <path
+ android:pathData="M7.59,5.41L9,4L17,12L9,20L7.59,18.59L14.17,12"
+ android:fillColor="?android:attr/colorAccent"
+ android:fillType="evenOdd"/>
+</vector>
diff --git a/res/drawable/ic_color_page_indicator_focused.xml b/res/drawable/ic_color_page_indicator_focused.xml
new file mode 100644
index 0000000..6173358
--- /dev/null
+++ b/res/drawable/ic_color_page_indicator_focused.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2021 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="6dp"
+ android:height="6dp"
+ android:viewportWidth="6"
+ android:viewportHeight="6">
+ <path
+ android:pathData="M3,0C4.65686,0 6,1.34315 6,3C6,4.65686 4.65685,6 3,6C1.34315,6 0,4.65685 0,3C0,1.34315 1.34315,0 3,0Z"
+ android:fillColor="?android:attr/colorAccent"
+ android:fillType="evenOdd"/>
+</vector>
diff --git a/res/drawable/ic_color_page_indicator_unfocused.xml b/res/drawable/ic_color_page_indicator_unfocused.xml
new file mode 100644
index 0000000..57a13d8
--- /dev/null
+++ b/res/drawable/ic_color_page_indicator_unfocused.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2021 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="6dp"
+ android:height="6dp"
+ android:viewportWidth="6"
+ android:viewportHeight="6">
+ <path
+ android:pathData="M3,0C4.65686,0 6,1.34315 6,3C6,4.65686 4.65685,6 3,6C1.34315,6 0,4.65685 0,3C0,1.34315 1.34315,0 3,0Z"
+ android:fillColor="?android:attr/colorAccent"
+ android:fillAlpha="0.24"
+ android:fillType="evenOdd"/>
+</vector>
diff --git a/res/layout/color_mode_preview.xml b/res/layout/color_mode_preview.xml
index 88b8281..b8601c9 100644
--- a/res/layout/color_mode_preview.xml
+++ b/res/layout/color_mode_preview.xml
@@ -14,16 +14,55 @@
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <ImageView
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="@dimen/color_mode_preview_height"
- android:scaleType="centerCrop"
- android:cropToPadding="true"
- android:src="@drawable/color_mode_preview"
- android:contentDescription="@null" />
+ android:layout_height="wrap_content">
-</FrameLayout>
+ <androidx.viewpager.widget.ViewPager
+ android:id="@+id/viewpager"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/color_mode_preview_height"/>
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="48dp">
+
+ <FrameLayout
+ android:id="@+id/arrow_previous"
+ android:layout_width="wrap_content"
+ android:layout_height="48dp"
+ android:paddingLeft="24dp"
+ android:layout_gravity="center_vertical|left"
+ android:contentDescription="@string/previous_page_content_description">
+
+ <ImageView
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_color_arrow_left_lt"/>
+ </FrameLayout>
+
+ <LinearLayout
+ android:id="@+id/viewGroup"
+ android:layout_width="fill_parent"
+ android:layout_height="48dp"
+ android:gravity="center"/>
+
+ <FrameLayout
+ android:id="@+id/arrow_next"
+ android:layout_width="wrap_content"
+ android:layout_height="48dp"
+ android:paddingRight="24dp"
+ android:layout_gravity="center_vertical|right"
+ android:contentDescription="@string/next_page_content_description">
+
+ <ImageView
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_color_arrow_right_lt"/>
+ </FrameLayout>
+ </FrameLayout>
+
+</LinearLayout>
diff --git a/res/layout/color_mode_view1.xml b/res/layout/color_mode_view1.xml
new file mode 100644
index 0000000..4bdaec1
--- /dev/null
+++ b/res/layout/color_mode_view1.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:foregroundGravity="center_horizontal">
+
+ <ImageView
+ android:id="@+id/image1"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/color_mode_preview_height"
+ android:scaleType="centerCrop"
+ android:cropToPadding="true"
+ android:src="@drawable/color_mode_preview1"
+ android:contentDescription="@null" />
+
+ </FrameLayout>
+</LinearLayout>
diff --git a/res/layout/color_mode_view2.xml b/res/layout/color_mode_view2.xml
new file mode 100644
index 0000000..c70fa75
--- /dev/null
+++ b/res/layout/color_mode_view2.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:foregroundGravity="center_horizontal">
+
+ <ImageView
+ android:id="@+id/image2"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/color_mode_preview_height"
+ android:scaleType="centerCrop"
+ android:cropToPadding="true"
+ android:src="@drawable/color_mode_preview2"
+ android:contentDescription="@null" />
+
+ </FrameLayout>
+</LinearLayout>
diff --git a/res/layout/color_mode_view3.xml b/res/layout/color_mode_view3.xml
new file mode 100644
index 0000000..430e3b2
--- /dev/null
+++ b/res/layout/color_mode_view3.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:foregroundGravity="center_horizontal">
+
+ <ImageView
+ android:id="@+id/image3"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/color_mode_preview_height"
+ android:scaleType="centerCrop"
+ android:cropToPadding="true"
+ android:src="@drawable/color_mode_preview3"
+ android:contentDescription="@null" />
+
+ </FrameLayout>
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index df409db..044d30f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -13542,6 +13542,15 @@
<!-- Summary for Game settings entry. [CHAR_LIMIT=NONE] -->
<string name="game_settings_summary">Turn on Game Dashboard shortcut, etc</string>
+ <!-- Content description of the previous button to bring user to the previous preview page. -->
+ <string name="previous_page_content_description">Previous</string>
+
+ <!-- Content description of the next button to bring user to the next preview page. -->
+ <string name="next_page_content_description">Next</string>
+
+ <!-- Content description of preview pager in colors preview -->
+ <string name="colors_viewpager_content_description">Color preview</string>
+
<!-- Bluetooth sim card permission alert for notification title [CHAR LIMIT=none] -->
<string name="bluetooth_sim_card_access_notification_title">SIM card access request</string>
<!-- Bluetooth sim card permission alert for notification content [CHAR LIMIT=none] -->
diff --git a/src/com/android/settings/display/ColorModePreferenceFragment.java b/src/com/android/settings/display/ColorModePreferenceFragment.java
index b8fa0b9..ce33e67 100644
--- a/src/com/android/settings/display/ColorModePreferenceFragment.java
+++ b/src/com/android/settings/display/ColorModePreferenceFragment.java
@@ -28,12 +28,18 @@
import android.graphics.drawable.Drawable;
import android.hardware.display.ColorDisplayManager;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings.Secure;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
import androidx.annotation.VisibleForTesting;
import androidx.preference.PreferenceScreen;
+import androidx.viewpager.widget.PagerAdapter;
+import androidx.viewpager.widget.ViewPager;
import com.android.settings.R;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -43,6 +49,7 @@
import com.android.settingslib.widget.LayoutPreference;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -54,10 +61,25 @@
private static final int COLOR_MODE_FALLBACK = COLOR_MODE_NATURAL;
+ static final String PAGE_VIEWER_SELECTION_INDEX = "page_viewer_selection_index";
+
+ private static final int DOT_INDICATOR_SIZE = 12;
+ private static final int DOT_INDICATOR_LEFT_PADDING = 6;
+ private static final int DOT_INDICATOR_RIGHT_PADDING = 6;
+
private ContentObserver mContentObserver;
private ColorDisplayManager mColorDisplayManager;
private Resources mResources;
+ private View mViewArrowPrevious;
+ private View mViewArrowNext;
+ private ViewPager mViewPager;
+
+ private ArrayList<View> mPageList;
+
+ private ImageView[] mDotIndicators;
+ private View[] mViewPagerImages;
+
@Override
public void onAttach(Context context) {
super.onAttach(context);
@@ -86,6 +108,16 @@
}
@Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (savedInstanceState != null) {
+ final int selectedPosition = savedInstanceState.getInt(PAGE_VIEWER_SELECTION_INDEX);
+ mViewPager.setCurrentItem(selectedPosition);
+ updateIndicator(selectedPosition);
+ }
+ }
+
+ @Override
public void onDetach() {
if (mContentObserver != null) {
getContext().getContentResolver().unregisterContentObserver(mContentObserver);
@@ -95,6 +127,12 @@
}
@Override
+ public void onSaveInstanceState(Bundle outState){
+ super.onSaveInstanceState(outState);
+ outState.putInt(PAGE_VIEWER_SELECTION_INDEX, mViewPager.getCurrentItem());
+ }
+
+ @Override
protected int getPreferenceScreenResId() {
return R.xml.color_mode_settings;
}
@@ -105,11 +143,69 @@
screen.addPreference(preview);
}
+ @VisibleForTesting
+ public ArrayList<Integer> getViewPagerResource() {
+ return new ArrayList<Integer>(
+ Arrays.asList(
+ R.layout.color_mode_view1,
+ R.layout.color_mode_view2,
+ R.layout.color_mode_view3));
+ }
+
+ void addViewPager(LayoutPreference preview) {
+ final ArrayList<Integer> tmpviewPagerList = getViewPagerResource();
+ mViewPager = preview.findViewById(R.id.viewpager);
+
+ mViewPagerImages = new View[3];
+ for (int idx = 0; idx < tmpviewPagerList.size(); idx++) {
+ mViewPagerImages[idx] =
+ getLayoutInflater().inflate(tmpviewPagerList.get(idx), null /* root */);
+ }
+
+ mPageList = new ArrayList<View>();
+ mPageList.add(mViewPagerImages[0]);
+ mPageList.add(mViewPagerImages[1]);
+ mPageList.add(mViewPagerImages[2]);
+
+ mViewPager.setAdapter(new ColorPagerAdapter(mPageList));
+
+ mViewArrowPrevious = preview.findViewById(R.id.arrow_previous);
+ mViewArrowPrevious.setOnClickListener(v -> {
+ final int previousPos = mViewPager.getCurrentItem() - 1;
+ mViewPager.setCurrentItem(previousPos, true);
+ });
+
+ mViewArrowNext = preview.findViewById(R.id.arrow_next);
+ mViewArrowNext.setOnClickListener(v -> {
+ final int nextPos = mViewPager.getCurrentItem() + 1;
+ mViewPager.setCurrentItem(nextPos, true);
+ });
+
+ mViewPager.addOnPageChangeListener(createPageListener());
+
+ final ViewGroup viewGroup = (ViewGroup) preview.findViewById(R.id.viewGroup);
+ mDotIndicators = new ImageView[mPageList.size()];
+ for (int i = 0; i < mPageList.size(); i++) {
+ final ImageView imageView = new ImageView(getContext());
+ final ViewGroup.MarginLayoutParams lp =
+ new ViewGroup.MarginLayoutParams(DOT_INDICATOR_SIZE, DOT_INDICATOR_SIZE);
+ lp.setMargins(DOT_INDICATOR_LEFT_PADDING, 0, DOT_INDICATOR_RIGHT_PADDING, 0);
+ imageView.setLayoutParams(lp);
+ mDotIndicators[i] = imageView;
+
+ viewGroup.addView(mDotIndicators[i]);
+ }
+
+ updateIndicator(mViewPager.getCurrentItem());
+ }
+
@Override
protected void addStaticPreferences(PreferenceScreen screen) {
final LayoutPreference preview = new LayoutPreference(screen.getContext(),
R.layout.color_mode_preview);
configureAndInstallPreview(preview, screen);
+
+ addViewPager(preview);
}
@Override
@@ -207,6 +303,88 @@
}
}
+ private ViewPager.OnPageChangeListener createPageListener() {
+ return new ViewPager.OnPageChangeListener() {
+ @Override
+ public void onPageScrolled(
+ int position, float positionOffset, int positionOffsetPixels) {
+ if (positionOffset != 0) {
+ for (int idx = 0; idx < mPageList.size(); idx++) {
+ mViewPagerImages[idx].setVisibility(View.VISIBLE);
+ }
+ } else {
+ mViewPagerImages[position].setContentDescription(
+ getContext().getString(R.string.colors_viewpager_content_description));
+ updateIndicator(position);
+ }
+ }
+
+ @Override
+ public void onPageSelected(int position) {}
+
+ @Override
+ public void onPageScrollStateChanged(int state) {}
+ };
+ }
+
+ private void updateIndicator(int position) {
+ for (int i = 0; i < mPageList.size(); i++) {
+ if (position == i) {
+ mDotIndicators[i].setBackgroundResource(
+ R.drawable.ic_color_page_indicator_focused);
+
+ mViewPagerImages[i].setVisibility(View.VISIBLE);
+ } else {
+ mDotIndicators[i].setBackgroundResource(
+ R.drawable.ic_color_page_indicator_unfocused);
+
+ mViewPagerImages[i].setVisibility(View.INVISIBLE);
+ }
+ }
+
+ if (position == 0) {
+ mViewArrowPrevious.setVisibility(View.INVISIBLE);
+ mViewArrowNext.setVisibility(View.VISIBLE);
+ } else if (position == (mPageList.size() - 1)) {
+ mViewArrowPrevious.setVisibility(View.VISIBLE);
+ mViewArrowNext.setVisibility(View.INVISIBLE);
+ } else {
+ mViewArrowPrevious.setVisibility(View.VISIBLE);
+ mViewArrowNext.setVisibility(View.VISIBLE);
+ }
+ }
+
+ static class ColorPagerAdapter extends PagerAdapter {
+ private final ArrayList<View> mPageViewList;
+
+ ColorPagerAdapter(ArrayList<View> pageViewList) {
+ mPageViewList = pageViewList;
+ }
+
+ @Override
+ public void destroyItem(ViewGroup container, int position, Object object) {
+ if (mPageViewList.get(position) != null) {
+ container.removeView(mPageViewList.get(position));
+ }
+ }
+
+ @Override
+ public Object instantiateItem(ViewGroup container, int position) {
+ container.addView(mPageViewList.get(position));
+ return mPageViewList.get(position);
+ }
+
+ @Override
+ public int getCount() {
+ return mPageViewList.size();
+ }
+
+ @Override
+ public boolean isViewFromObject(View view, Object object) {
+ return object == view;
+ }
+ }
+
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.color_mode_settings) {
diff --git a/tests/unit/src/com/android/settings/display/ColorModePreferenceFragmentTest.java b/tests/unit/src/com/android/settings/display/ColorModePreferenceFragmentTest.java
index cfdedc7..450525c 100644
--- a/tests/unit/src/com/android/settings/display/ColorModePreferenceFragmentTest.java
+++ b/tests/unit/src/com/android/settings/display/ColorModePreferenceFragmentTest.java
@@ -39,6 +39,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.ArrayList;
import java.util.List;
@RunWith(AndroidJUnit4.class)
@@ -232,4 +233,15 @@
verify(mFragment).setColorMode(ColorDisplayManager.COLOR_MODE_AUTOMATIC);
}
+
+ @Test
+ @UiThreadTest
+ public void checkViewPagerTotalCount() throws Throwable {
+ final ArrayList<Integer> viewPagerResList = mFragment.getViewPagerResource();
+
+ assertThat(viewPagerResList.size()).isEqualTo(3);
+ for (int idx = 0; idx < viewPagerResList.size(); idx++) {
+ assertThat(viewPagerResList.get(idx) > 0).isTrue();
+ }
+ }
}