├── .gitignore ├── LICENSE.txt ├── README.md ├── app ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── amazonaws │ │ └── devicefarm │ │ └── android │ │ └── referenceapp │ │ ├── BaseADFTest.java │ │ ├── Categories │ │ ├── AlertPageTest.java │ │ ├── CrashPageTest.java │ │ ├── FixturesTest.java │ │ ├── HomePageTest.java │ │ ├── Inputs │ │ │ ├── CheckBoxTest.java │ │ │ ├── DatePickerTest.java │ │ │ ├── EditTextTest.java │ │ │ ├── GesturesTest.java │ │ │ ├── InputControlsBase.java │ │ │ ├── PullToRefreshTest.java │ │ │ ├── RadioButtonTest.java │ │ │ ├── SpinnerInputTest.java │ │ │ ├── SubmitButtonTest.java │ │ │ ├── TimePickerTest.java │ │ │ └── ToggleButtonTest.java │ │ ├── LocalWebViewTest.java │ │ ├── LoginPageTest.java │ │ ├── Native │ │ │ ├── CameraPreviewTest.java │ │ │ ├── ImageCollectionTest.java │ │ │ ├── NativeBase.java │ │ │ ├── OutOfContentScrollingTest.java │ │ │ ├── ScrollingContentTest.java │ │ │ └── VideoTest.java │ │ ├── NestedViewTest.java │ │ └── WebViewTests.java │ │ ├── IdlingResources │ │ ├── VideoPlayerIdlingResource.java │ │ ├── ViewPagerIdlingResource.java │ │ └── WebViewIdlingResource.java │ │ ├── RegularExpressionMatcher.java │ │ ├── Util │ │ └── ScreenShot.java │ │ └── ViewPagerTestBase.java │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── www │ │ ├── angular.min.js │ │ ├── app.html │ │ ├── bootstrap.min.css │ │ └── style.css │ ├── java │ └── com │ │ └── amazonaws │ │ └── devicefarm │ │ └── android │ │ └── referenceapp │ │ ├── Activities │ │ ├── BackNavigationActivity.java │ │ ├── MainActivity.java │ │ ├── UpNavigationActivity.java │ │ └── UpNavigationContent.java │ │ ├── Adapters │ │ ├── DrawerAdapter.java │ │ ├── GestureListener.java │ │ ├── ImageGalleryAdapter.java │ │ └── TabAdapter.java │ │ ├── Fragments │ │ ├── FixturesFragment.java │ │ ├── LocalWebView.java │ │ ├── LoginFragment.java │ │ ├── NavigationDrawerFragment.java │ │ ├── NestedFragment.java │ │ ├── NotificationsFragment.java │ │ ├── SimpleFragment.java │ │ ├── TabFragmentContainer.java │ │ ├── Tabs │ │ │ ├── Inputs │ │ │ │ ├── Input_CheckBoxFragment.java │ │ │ │ ├── Input_DatePickerFragment.java │ │ │ │ ├── Input_GestureFragment.java │ │ │ │ ├── Input_RadioButtonFragment.java │ │ │ │ ├── Input_RefreshButtonFragment.java │ │ │ │ ├── Input_SpinnerFragment.java │ │ │ │ ├── Input_SubmitButtonFragment.java │ │ │ │ ├── Input_TimePickerFragment.java │ │ │ │ └── Input_Toggle_ButtonFragment.java │ │ │ ├── Native │ │ │ │ ├── Native_CameraFragment.java │ │ │ │ ├── Native_ImageGalleryFragment.java │ │ │ │ └── Native_MediaPlayer.java │ │ │ └── SupplementalUploads │ │ │ │ ├── SupplementalUploads_AdditionalAppFragment.java │ │ │ │ └── SupplementalUploads_ExtraDataFragment.java │ │ ├── WebViewFragment.java │ │ └── crashFragment.java │ │ ├── Models │ │ ├── DrawerCategoryModel.java │ │ ├── FragmentEnum.java │ │ └── TabViewModel.java │ │ └── Util │ │ ├── JsonParser.java │ │ └── Util.java │ └── res │ ├── drawable-hdpi │ ├── ic_action_account_box.png │ ├── ic_action_bug_report.png │ ├── ic_action_feedback.png │ ├── ic_action_filter_1.png │ ├── ic_action_folder.png │ ├── ic_action_http.png │ ├── ic_action_input.png │ ├── ic_action_photo_camera.png │ ├── ic_action_public.png │ ├── ic_action_settings.png │ └── ic_action_store_mall_directory.png │ ├── drawable-mdpi │ ├── ic_action_account_box.png │ ├── ic_action_bug_report.png │ ├── ic_action_feedback.png │ ├── ic_action_filter_1.png │ ├── ic_action_folder.png │ ├── ic_action_http.png │ ├── ic_action_input.png │ ├── ic_action_photo_camera.png │ ├── ic_action_public.png │ ├── ic_action_settings.png │ └── ic_action_store_mall_directory.png │ ├── drawable-xhdpi │ ├── ic_action_account_box.png │ ├── ic_action_bug_report.png │ ├── ic_action_feedback.png │ ├── ic_action_filter_1.png │ ├── ic_action_folder.png │ ├── ic_action_http.png │ ├── ic_action_input.png │ ├── ic_action_photo_camera.png │ ├── ic_action_public.png │ ├── ic_action_settings.png │ └── ic_action_store_mall_directory.png │ ├── drawable-xxhdpi │ ├── ic_action_account_box.png │ ├── ic_action_bug_report.png │ ├── ic_action_feedback.png │ ├── ic_action_filter_1.png │ ├── ic_action_folder.png │ ├── ic_action_http.png │ ├── ic_action_input.png │ ├── ic_action_photo_camera.png │ ├── ic_action_public.png │ ├── ic_action_settings.png │ └── ic_action_store_mall_directory.png │ ├── drawable-xxxhdpi │ ├── ic_action_account_box.png │ ├── ic_action_bug_report.png │ ├── ic_action_feedback.png │ ├── ic_action_filter_1.png │ ├── ic_action_folder.png │ ├── ic_action_http.png │ ├── ic_action_input.png │ ├── ic_action_photo_camera.png │ ├── ic_action_public.png │ ├── ic_action_settings.png │ └── ic_action_store_mall_directory.png │ ├── drawable │ ├── amber.jpeg │ ├── central_park.jpeg │ ├── chicken.jpeg │ ├── duck.jpeg │ ├── fish.jpeg │ ├── key_west.jpeg │ ├── nelly.jpeg │ └── nola.jpeg │ ├── layout │ ├── activity_main.xml │ ├── back_navigation.xml │ ├── crash_fragment.xml │ ├── drawer_row.xml │ ├── fixtures_layout.xml │ ├── fragment_homepage.xml │ ├── fragment_login.xml │ ├── fragment_navigation_drawer.xml │ ├── input_checkbox_fragment.xml │ ├── input_datepicker_fragment.xml │ ├── input_gesture_fragment.xml │ ├── input_radio_button_fragment.xml │ ├── input_refresh_fragment.xml │ ├── input_spinner_fragment.xml │ ├── input_submit_button_fragment.xml │ ├── input_textfield.xml │ ├── input_timepicker_fragment.xml │ ├── input_toggle_button_fragment.xml │ ├── native_camera_fragment.xml │ ├── native_content_scrolling.xml │ ├── native_imagegallery_fragment.xml │ ├── native_mediaplayer_fragment.xml │ ├── native_out_of_view_scrolling.xml │ ├── nested_fragment.xml │ ├── notifications_fragment.xml │ ├── supplemental_uploads_extra_data_fragment.xml │ ├── tab_fragment_container.xml │ ├── toolbar.xml │ ├── up_navigation.xml │ └── web_fragment.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── raw │ ├── fragments.json │ └── movie.mp4 │ ├── values-large │ └── component_styles.xml │ ├── values-normal │ └── component_styles.xml │ ├── values-small │ └── component_styles.xml │ ├── values-v11 │ └── styles.xml │ ├── values-v21 │ ├── component_styles.xml │ └── styles.xml │ ├── values-xlarge │ └── component_styles.xml │ └── values │ ├── colors.xml │ ├── navigation_drawer.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── prebuilt ├── app-debug-androidTest.apk └── app-debug.apk ├── readme_images ├── assertion-view.png ├── completed-configuration.png ├── edit-configuration.png ├── espresso-android-studio-set-up.gif ├── find-apk.gif ├── recorder-save-assertion.png └── recorder-ui-interactions.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | ### Android template 2 | # Built application files 3 | *.apk 4 | *.ap_ 5 | 6 | # Files for the Dalvik VM 7 | *.dex 8 | 9 | # Java class files 10 | *.class 11 | 12 | # Generated files 13 | bin/ 14 | gen/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | ### JetBrains template 32 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 33 | 34 | *.iml 35 | 36 | ## Directory-based project format: 37 | .idea/ 38 | # if you remove the above rule, at least ignore the following: 39 | 40 | # User-specific stuff: 41 | # .idea/workspace.xml 42 | # .idea/tasks.xml 43 | # .idea/dictionaries 44 | 45 | # Sensitive or high-churn files: 46 | # .idea/dataSources.ids 47 | # .idea/dataSources.xml 48 | # .idea/sqlDataSources.xml 49 | # .idea/dynamic.xml 50 | # .idea/uiDesigner.xml 51 | 52 | # Gradle: 53 | # .idea/gradle.xml 54 | # .idea/libraries 55 | 56 | # Mongo Explorer plugin: 57 | # .idea/mongoSettings.xml 58 | 59 | ## File-based project format: 60 | *.ipr 61 | *.iws 62 | 63 | ## Plugin-specific files: 64 | 65 | # IntelliJ 66 | /out/ 67 | 68 | # mpeltonen/sbt-idea plugin 69 | .idea_modules/ 70 | 71 | # JIRA plugin 72 | atlassian-ide-plugin.xml 73 | 74 | # Crashlytics plugin (for Android Studio and IntelliJ) 75 | com_crashlytics_export_strings.xml 76 | crashlytics.properties 77 | crashlytics-build.properties 78 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion '26.0.2' 6 | 7 | defaultConfig { 8 | applicationId "com.amazonaws.devicefarm.android.referenceapp" 9 | minSdkVersion 10 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | packagingOptions { 23 | exclude 'LICENSE.txt' 24 | } 25 | 26 | 27 | 28 | 29 | lintOptions { 30 | abortOnError false 31 | } 32 | } 33 | 34 | repositories { 35 | mavenCentral() 36 | } 37 | 38 | dependencies { 39 | compile fileTree(dir: 'libs', include: ['*.jar']) 40 | compile 'com.jakewharton:butterknife:6.1.0' 41 | compile 'com.google.code.gson:gson:2.3.1' 42 | compile 'com.android.support:cardview-v7:21.0.3' 43 | compile 'com.android.support:appcompat-v7:22.2.1' 44 | compile 'com.android.support:recyclerview-v7:22.2.0' 45 | compile 'com.android.support:support-v4:22.2.1' 46 | compile 'com.google.android.gms:play-services-location:7.5.0' 47 | compile 'com.squareup.picasso:picasso:2.5.2' 48 | 49 | androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2' 50 | androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2' 51 | androidTestCompile 'com.android.support.test:runner:0.3' 52 | androidTestCompile 'com.android.support.test:rules:0.3' 53 | androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2'){ 54 | exclude group: 'com.android.support', module: 'appcompat' 55 | exclude group: 'com.android.support', module: 'support-v4' 56 | exclude module: 'recyclerview-v7' 57 | } 58 | } 59 | configurations.all { 60 | // Currently espresso is dependent on support-annotations:22.2.0 61 | resolutionStrategy.force 'com.android.support:support-annotations:22.2.1' 62 | } 63 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/scottgo/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/AlertPageTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.BaseADFTest; 19 | import com.amazonaws.devicefarm.android.referenceapp.R; 20 | 21 | import org.junit.Test; 22 | 23 | import static android.support.test.espresso.Espresso.onView; 24 | import static android.support.test.espresso.action.ViewActions.click; 25 | import static android.support.test.espresso.assertion.ViewAssertions.matches; 26 | import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; 27 | import static android.support.test.espresso.matcher.ViewMatchers.withText; 28 | 29 | /** 30 | * Tests for alerts/notifications 31 | */ 32 | public class AlertPageTest extends BaseADFTest{ 33 | @Override 34 | protected String getClassName() { 35 | return "Alerts"; 36 | } 37 | 38 | @Override 39 | public void testSanity() { 40 | checkIfIdDisplayed(R.id.notifications_alert_button); 41 | checkIfIdDisplayed(R.id.notifications_toast_button); 42 | } 43 | 44 | /** 45 | * Clicks the toast button and checks if the toast text is displayed 46 | */ 47 | @Test 48 | public void testToast(){ 49 | clickId(R.id.notifications_toast_button); 50 | verifyToastMessage(R.string.Toast_button_message); 51 | } 52 | 53 | /** 54 | * Clicks the alert button and checks if the alert text is displayed 55 | */ 56 | @Test 57 | public void testAlert(){ 58 | clickId(R.id.notifications_alert_button); 59 | onView(withText(R.string.alert_message)).check(matches(isDisplayed())); 60 | onView(withText("OK")).perform(click()); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/CrashPageTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories; 17 | 18 | import android.support.test.espresso.PerformException; 19 | 20 | import com.amazonaws.devicefarm.android.referenceapp.BaseADFTest; 21 | import com.amazonaws.devicefarm.android.referenceapp.R; 22 | import org.junit.Test; 23 | 24 | /** 25 | * Tests for a crash page 26 | */ 27 | public class CrashPageTest extends BaseADFTest{ 28 | @Override 29 | protected String getClassName() { 30 | return "Crash/Bug"; 31 | } 32 | 33 | @Override 34 | public void testSanity() { 35 | checkIfIdDisplayed(R.id.bug_fragment_message); 36 | checkIfIdDisplayed(R.id.crash_button); 37 | } 38 | 39 | /** 40 | * Tests if the app crashes when the crash button is pressed 41 | */ 42 | @Test(expected = PerformException.class) 43 | public void testVerifyCrash(){ 44 | checkIfIdIsDisplayedWithText(R.id.bug_fragment_message, R.string.crash_headline); 45 | try { 46 | clickId(R.id.crash_button); 47 | fail("App did not crash"); 48 | } catch (PerformException e ){} 49 | } 50 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/FixturesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.BaseADFTest; 19 | import com.amazonaws.devicefarm.android.referenceapp.R; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * Tests for fixtures 25 | */ 26 | public class FixturesTest extends BaseADFTest { 27 | @Override 28 | protected String getClassName() { 29 | return "Fixtures"; 30 | } 31 | 32 | @Override 33 | public void testSanity() { 34 | checkIfIdDisplayed(R.id.lat); 35 | checkIfIdDisplayed(R.id.longitude); 36 | checkIfIdDisplayed(R.id.wifi); 37 | checkIfIdDisplayed(R.id.bluetooth); 38 | checkIfIdDisplayed(R.id.gps); 39 | checkIfIdDisplayed(R.id.nfc); 40 | } 41 | 42 | /** 43 | * Tests if the wifi is on 44 | */ 45 | @Test 46 | public void testWifiOn (){ 47 | assertIdStatus(R.id.wifi, true); 48 | } 49 | 50 | /** 51 | * Tests if the bluetooth is on 52 | */ 53 | @Test 54 | public void testBluetoothOn() { 55 | assertIdStatus(R.id.bluetooth, true); 56 | } 57 | 58 | /** 59 | * Tests if the gps is on 60 | */ 61 | @Test 62 | public void testGpsOn() { 63 | assertIdStatus(R.id.gps, true); 64 | } 65 | 66 | /** 67 | * Tests if the nfc is on. Fails on devices with no nfc support 68 | */ 69 | @Test 70 | public void testNfcOn() { 71 | assertIdStatus(R.id.nfc, true); 72 | } 73 | 74 | /** 75 | * Asserts the status of a specific id 76 | * 77 | * @param id element id 78 | * @param status boolean status 79 | */ 80 | private void assertIdStatus(int id, boolean status){ 81 | checkIfIdIsDisplayedWithText(id, Boolean.toString(status)); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/HomePageTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.BaseADFTest; 19 | import com.amazonaws.devicefarm.android.referenceapp.R; 20 | 21 | import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription; 22 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 23 | import static android.support.test.espresso.matcher.ViewMatchers.withText; 24 | 25 | /** 26 | * Tests for a static homepage 27 | */ 28 | public class HomePageTest extends BaseADFTest { 29 | @Override 30 | protected String getClassName() { 31 | return "Home"; 32 | } 33 | 34 | @Override 35 | public void testSanity() { 36 | checkIfIdIsDisplayedWithText(R.id.homepage_headline, 37 | R.string.adf_homepage_headline); 38 | 39 | checkIfIdIsDisplayedWithText(R.id.homepage_subheadline, 40 | R.string.adf_homepage_subtitle); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/CheckBoxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.R; 19 | 20 | import org.junit.Test; 21 | 22 | /** 23 | * Tests for check boxes 24 | */ 25 | public class CheckBoxTest extends InputControlsBase { 26 | @Override 27 | protected int getPageIndex() { 28 | return 1; 29 | } 30 | 31 | @Override 32 | public void testSanity() { 33 | checkIfIdDisplayed(R.id.input_checkbox); 34 | checkIfIdDisplayed(R.id.input_checkbox_status); 35 | } 36 | 37 | /** 38 | * Tests the check box by checking and unchecking the input then verifying if the text is 39 | * displayed. 40 | */ 41 | @Test 42 | public void testCheckBox(){ 43 | checkIfIdIsDisplayedWithText(R.id.input_checkbox_status, "Unchecked"); 44 | clickId(R.id.input_checkbox); 45 | checkIfIdIsDisplayedWithText(R.id.input_checkbox_status, "Checked"); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/DatePickerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import android.support.test.espresso.contrib.PickerActions; 19 | 20 | import com.amazonaws.devicefarm.android.referenceapp.R; 21 | 22 | import org.junit.Test; 23 | 24 | import static android.support.test.espresso.Espresso.onView; 25 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 26 | 27 | /** 28 | * Tests for a date picker 29 | */ 30 | public class DatePickerTest extends InputControlsBase { 31 | @Override 32 | protected int getPageIndex() { 33 | return 7; 34 | } 35 | 36 | @Override 37 | public void testSanity() { 38 | checkIfIdDisplayed(R.id.input_datepicker); 39 | checkIfIdDisplayed(R.id.input_date_display); 40 | } 41 | 42 | /** 43 | * Tests a date picker by inputting a date in the date picker then validating 44 | * if the date is displayed. 45 | */ 46 | @Test 47 | public void testDatePicker(){ 48 | onView(withId(R.id.input_datepicker)).perform(PickerActions.setDate(2015, 10, 27)); 49 | checkIfIdIsDisplayedWithText(R.id.input_date_display, "10/27/2015"); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/EditTextTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.R; 19 | 20 | import org.junit.Test; 21 | 22 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 23 | import static android.support.test.espresso.matcher.ViewMatchers.withText; 24 | 25 | /** 26 | * Tests a edit text input control 27 | */ 28 | public class EditTextTest extends InputControlsBase { 29 | @Override 30 | protected int getPageIndex() { 31 | return 0; 32 | } 33 | 34 | @Override 35 | public void testSanity() { 36 | checkIfIdDisplayed(R.id.input_edit_text); 37 | } 38 | 39 | /** 40 | * Tests a edit text by inputting text in a text input then 41 | * validating if the text is inside the input 42 | */ 43 | @Test 44 | public void testEditText() { 45 | final String input = "Something"; 46 | writeTextIntoTextBox(R.id.input_edit_text, input); 47 | checkIfIdIsDisplayedWithText(R.id.input_edit_text, input); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/GesturesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import android.support.test.espresso.action.ViewActions; 19 | 20 | import com.amazonaws.devicefarm.android.referenceapp.R; 21 | 22 | import org.junit.Test; 23 | 24 | import static android.support.test.espresso.Espresso.onView; 25 | import static android.support.test.espresso.assertion.ViewAssertions.matches; 26 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 27 | import static android.support.test.espresso.matcher.ViewMatchers.withText; 28 | import static org.hamcrest.CoreMatchers.anyOf; 29 | import static org.hamcrest.core.StringEndsWith.endsWith; 30 | 31 | /** 32 | * Tests for gestures 33 | */ 34 | public class GesturesTest extends InputControlsBase { 35 | @Override 36 | protected int getPageIndex() { 37 | return 9; 38 | } 39 | 40 | @Override 41 | public void testSanity() { 42 | checkIfIdDisplayed(R.id.input_gesture_action_pad); 43 | checkIfIdDisplayed(R.id.input_gesture_content); 44 | checkIfIdDisplayed(R.id.input_gesture_headline); 45 | } 46 | 47 | /** 48 | * Tests a fling gesture by performing it and then checking if the action is displayed 49 | */ 50 | @Test 51 | public void testFling(){ 52 | onView(withId(R.id.input_gesture_action_pad)).perform(ViewActions.swipeUp()); 53 | checkIfEitherActionIsDisplayed("Fling", "Scroll"); 54 | } 55 | 56 | /** 57 | * Tests a long press gesture by performing it and then checking if the action is displayed 58 | */ 59 | @Test 60 | public void testLongPress(){ 61 | onView(withId(R.id.input_gesture_action_pad)).perform(ViewActions.longClick()); 62 | checkIfActionIsDisplayed("Long Press"); 63 | 64 | } 65 | 66 | /** 67 | * Tests a single press gesture by performing it and then checking if the action is displayed 68 | */ 69 | @Test 70 | public void testSinglePress(){ 71 | clickId(R.id.input_gesture_action_pad); 72 | checkIfActionIsDisplayed("Single tap confirmed"); 73 | 74 | } 75 | 76 | /** 77 | * Checks the last gesture text out put with an expected gesture 78 | * 79 | * @param action the gesture string 80 | */ 81 | private void checkIfActionIsDisplayed(String action){ 82 | onView(withId(R.id.input_gesture_content)).check(matches(withText(endsWith(action + "\n")))); 83 | } 84 | 85 | private void checkIfEitherActionIsDisplayed(String action1, String action2){ 86 | onView(withId(R.id.input_gesture_content)).check(matches(anyOf(withText(endsWith(action1 + "\n")), 87 | withText(endsWith(action2 + "\n"))))); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/InputControlsBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.R; 19 | import com.amazonaws.devicefarm.android.referenceapp.ViewPagerTestBase; 20 | 21 | import org.junit.Ignore; 22 | 23 | /** 24 | * A base class for all input controls 25 | */ 26 | @Ignore 27 | public abstract class InputControlsBase extends ViewPagerTestBase { 28 | @Override 29 | protected String getClassName() { 30 | return "Input Controls"; 31 | } 32 | 33 | @Override 34 | protected int getPagerId() { 35 | return R.id.pager_tabstrip; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/PullToRefreshTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import android.support.test.espresso.action.ViewActions; 19 | 20 | import com.amazonaws.devicefarm.android.referenceapp.R; 21 | import com.amazonaws.devicefarm.android.referenceapp.RegularExpressionMatcher; 22 | 23 | import org.junit.Test; 24 | 25 | import static android.support.test.espresso.Espresso.onView; 26 | import static android.support.test.espresso.assertion.ViewAssertions.matches; 27 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 28 | 29 | /** 30 | * Tests for a pull to refresh control 31 | */ 32 | public class PullToRefreshTest extends InputControlsBase { 33 | @Override 34 | protected int getPageIndex() { 35 | return 5; 36 | } 37 | 38 | @Override 39 | public void testSanity() { 40 | checkIfIdDisplayed(R.id.input_refresh); 41 | checkIfIdDisplayed(R.id.input_refresh_display); 42 | checkIfIdDisplayed(R.id.input_refresh_scrollview); 43 | } 44 | 45 | /** 46 | * Tests a pull to refresh control by pulling to refresh and checking if the 47 | * display matches specific pattern for the time. 48 | */ 49 | @Test 50 | public void testRefresh() { 51 | onView(withId(R.id.input_refresh_scrollview)).perform(ViewActions.swipeDown()); 52 | onView(withId(R.id.input_refresh_display)). 53 | check(matches(RegularExpressionMatcher. 54 | matchesPattern("\\d{2}:\\d{2}:\\d{2} (AM|PM)"))); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/RadioButtonTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.R; 19 | 20 | import org.junit.Test; 21 | 22 | /** 23 | * Tests for a radio button 24 | */ 25 | public class RadioButtonTest extends InputControlsBase { 26 | @Override 27 | protected int getPageIndex() { 28 | return 2; 29 | } 30 | 31 | @Override 32 | public void testSanity() { 33 | checkIfIdDisplayed(R.id.radio_button_group); 34 | checkIfIdDisplayed(R.id.radio_button_1); 35 | checkIfIdDisplayed(R.id.radio_button_2); 36 | checkIfIdDisplayed(R.id.radio_button_3); 37 | checkIfIdDisplayed(R.id.input_radio_button_display); 38 | } 39 | 40 | /** 41 | * Clicks a specific radio button then verifies if the text changes 42 | */ 43 | @Test 44 | public void testRadio() { 45 | clickId(R.id.radio_button_1); 46 | assertRadioDisplay(R.string.radio_button_1); 47 | clickId(R.id.radio_button_2); 48 | assertRadioDisplay(R.string.radio_button_2); 49 | clickId(R.id.radio_button_3); 50 | assertRadioDisplay(R.string.radio_button_3); 51 | } 52 | 53 | private void assertRadioDisplay(int id){ 54 | checkIfIdIsDisplayedWithText(R.id.input_radio_button_display, id); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/SpinnerInputTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.R; 19 | 20 | import org.junit.Test; 21 | 22 | import static android.support.test.espresso.Espresso.onData; 23 | import static android.support.test.espresso.action.ViewActions.click; 24 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 25 | import static org.hamcrest.CoreMatchers.allOf; 26 | import static org.hamcrest.CoreMatchers.instanceOf; 27 | import static org.hamcrest.CoreMatchers.is; 28 | 29 | /** 30 | * Tests for a spinner display 31 | */ 32 | public class SpinnerInputTest extends InputControlsBase { 33 | @Override 34 | protected int getPageIndex() { 35 | return 4; 36 | } 37 | 38 | @Override 39 | public void testSanity() { 40 | checkIfIdDisplayed(R.id.input_spinner); 41 | checkIfIdDisplayed(R.id.input_spinner_message); 42 | } 43 | 44 | /** 45 | * Tests a spinner by selecting a specific value then verifying if it's displayed 46 | */ 47 | @Test 48 | public void testInputSpinner(){ 49 | clickId(R.id.input_spinner); 50 | onData(allOf(is(instanceOf(String.class)), is("option 2"))) 51 | .perform(click()); 52 | checkIfIdIsDisplayedWithText(R.id.input_spinner_message, "Selected: option 2"); 53 | 54 | clickId(R.id.input_spinner); 55 | onData(allOf(is(instanceOf(String.class)), is("option 5"))) 56 | .perform(click()); 57 | checkIfIdIsDisplayedWithText(R.id.input_spinner_message, "Selected: option 5"); 58 | 59 | clickId(R.id.input_spinner); 60 | onData(allOf(is(instanceOf(String.class)), is("option 3"))) 61 | .perform(click()); 62 | checkIfIdIsDisplayedWithText(R.id.input_spinner_message, "Selected: option 3"); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/SubmitButtonTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.R; 19 | 20 | import org.junit.Test; 21 | 22 | /** 23 | * Tests for a submit button 24 | */ 25 | public class SubmitButtonTest extends InputControlsBase { 26 | @Override 27 | protected int getPageIndex() { 28 | return 8; 29 | } 30 | 31 | @Override 32 | public void testSanity() { 33 | checkIfIdDisplayed(R.id.input_submit_button); 34 | } 35 | 36 | /** 37 | * Tests a submit button by clicking the button and verifies whether the toast message 38 | * appears. 39 | */ 40 | @Test 41 | public void testSubmitButton() { 42 | clickId(R.id.input_submit_button); 43 | verifyToastMessage(R.string.submit_button_toast_message); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/TimePickerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import android.support.test.espresso.contrib.PickerActions; 19 | 20 | import com.amazonaws.devicefarm.android.referenceapp.R; 21 | 22 | import org.junit.Test; 23 | 24 | import static android.support.test.espresso.Espresso.onView; 25 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 26 | 27 | /** 28 | * Tests for the time picker 29 | */ 30 | public class TimePickerTest extends InputControlsBase { 31 | @Override 32 | protected int getPageIndex() { 33 | return 6; 34 | } 35 | 36 | @Override 37 | public void testSanity() { 38 | checkIfIdDisplayed(R.id.input_timepicker); 39 | checkIfIdDisplayed(R.id.input_time_display); 40 | } 41 | 42 | /** 43 | * Tests a time picker by setting the time and checking the time display 44 | */ 45 | @Test 46 | public void testTimePicker() { 47 | onView(withId(R.id.input_timepicker)).perform(PickerActions.setTime(8, 2)); 48 | checkIfIdIsDisplayedWithText(R.id.input_time_display, "8 : 02"); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Inputs/ToggleButtonTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Inputs; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.R; 19 | 20 | import org.junit.Test; 21 | 22 | /** 23 | * Tests for toggle buttons 24 | */ 25 | public class ToggleButtonTest extends InputControlsBase{ 26 | @Override 27 | protected int getPageIndex() { 28 | return 3; 29 | } 30 | 31 | @Override 32 | public void testSanity() { 33 | checkIfIdDisplayed(R.id.input_switch); 34 | checkIfIdDisplayed(R.id.input_switch_display); 35 | } 36 | 37 | /** 38 | * Tests a toggle button by switching it on and checking it's content description 39 | */ 40 | @Test 41 | public void testInputSwitch(){ 42 | checkIdWithContentDescription(R.id.input_switch_display, R.string.switch_off_text); 43 | clickId(R.id.input_switch); 44 | checkIdWithContentDescription(R.id.input_switch_display, R.string.switch_on_text); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/LoginPageTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.BaseADFTest; 19 | import com.amazonaws.devicefarm.android.referenceapp.R; 20 | 21 | import org.junit.Test; 22 | 23 | import static android.support.test.espresso.action.ViewActions.click; 24 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 25 | import static android.support.test.espresso.matcher.ViewMatchers.withText; 26 | 27 | /** 28 | * Tests for a login page 29 | */ 30 | public class LoginPageTest extends BaseADFTest { 31 | 32 | @Override 33 | protected String getClassName() { 34 | return "Login Page"; 35 | } 36 | 37 | @Override 38 | public void testSanity() { 39 | checkIfAtLogin(); 40 | } 41 | 42 | /** 43 | * tests if the correct message appears when logging in successfully 44 | */ 45 | @Test 46 | public void testLoginPassCheck(){ 47 | loginIn("admin", "password", R.string.login_success_message); 48 | } 49 | 50 | /** 51 | * Tests if the correct message appears when failing to log in 52 | */ 53 | @Test 54 | public void testLoginFailCheck(){ 55 | loginIn("Wrong Username", "12345", R.string.login_fail_message); 56 | } 57 | 58 | /** 59 | * Attemps to log into the form 60 | * 61 | * @param user the username 62 | * @param pass the password 63 | * @param message the expected message 64 | */ 65 | private void loginIn(String user, String pass, int message){ 66 | writeTextIntoTextBox(R.id.username_text_input, user); 67 | writeTextIntoTextBox(R.id.password_text_input, pass); 68 | clickId(R.id.login_button); 69 | checkLoginMessage(message); 70 | clickId(R.id.alt_button); 71 | checkIfAtLogin(); 72 | } 73 | 74 | /** 75 | * checks if the expected message is displayed 76 | * 77 | * @param message the expected message 78 | */ 79 | private void checkLoginMessage(int message){ 80 | checkIfIdIsDisplayedWithText(R.id.login_alt_message_textView, 81 | message); 82 | } 83 | 84 | /** 85 | * Checks if at the main login screen 86 | */ 87 | private void checkIfAtLogin(){ 88 | checkIfIdDisplayed(R.id.login_main_view); 89 | checkIfIdDisplayed(R.id.username_text_input); 90 | checkIfIdDisplayed(R.id.password_text_input); 91 | checkIfIdDisplayed(R.id.login_button); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Native/CameraPreviewTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Native; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.R; 19 | 20 | import org.junit.Test; 21 | 22 | /** 23 | * Tests for a camera preview 24 | */ 25 | public class CameraPreviewTest extends NativeBase { 26 | @Override 27 | protected int getPageIndex() { 28 | return 3; 29 | } 30 | 31 | @Override 32 | public void testSanity() { 33 | checkIfIdDisplayed(R.id.camera_surface_view); 34 | } 35 | 36 | /** 37 | * Tests a camera preview by checking if it's element's content description 38 | * indicates that it's on. Fails on devices with no camera support. 39 | */ 40 | @Test 41 | public void testCheckIfCameraOn() { 42 | checkIdWithContentDescription(R.id.camera_surface_view, R.string.camera_preview_on); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Native/ImageCollectionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Native; 17 | 18 | import android.widget.GridView; 19 | 20 | import com.amazonaws.devicefarm.android.referenceapp.R; 21 | 22 | import org.junit.Test; 23 | 24 | import static android.support.test.espresso.Espresso.onView; 25 | import static android.support.test.espresso.assertion.ViewAssertions.matches; 26 | import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; 27 | import static android.support.test.espresso.matcher.ViewMatchers.withClassName; 28 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 29 | import static org.hamcrest.core.StringStartsWith.startsWith; 30 | 31 | /** 32 | * Tests for an image collection 33 | */ 34 | public class ImageCollectionTest extends NativeBase { 35 | @Override 36 | protected int getPageIndex() { 37 | return 0; 38 | } 39 | 40 | @Override 41 | public void testSanity() { 42 | checkIfIdDisplayed(R.id.native_image_grid_view); 43 | } 44 | 45 | /** 46 | * Tests a image gallery by seeing if a gridview is displayed 47 | */ 48 | @Test 49 | public void testImageGallery(){ 50 | onView(withId(R.id.native_image_grid_view)). 51 | check(matches(withClassName(startsWith(GridView.class.getName())))). 52 | check(matches(isDisplayed())); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Native/NativeBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Native; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.R; 19 | import com.amazonaws.devicefarm.android.referenceapp.ViewPagerTestBase; 20 | 21 | import org.junit.Ignore; 22 | 23 | /** 24 | * Base for native tests 25 | */ 26 | @Ignore 27 | public abstract class NativeBase extends ViewPagerTestBase { 28 | @Override 29 | protected String getClassName() { 30 | return "Native Components"; 31 | } 32 | 33 | @Override 34 | protected int getPagerId() { 35 | return R.id.pager_tabstrip; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Native/OutOfContentScrollingTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Native; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.R; 19 | 20 | import org.junit.Test; 21 | 22 | import static android.support.test.espresso.Espresso.onView; 23 | import static android.support.test.espresso.action.ViewActions.swipeUp; 24 | import static android.support.test.espresso.assertion.ViewAssertions.matches; 25 | import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; 26 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 27 | import static org.hamcrest.CoreMatchers.not; 28 | 29 | /** 30 | * Tests for out of content scrolling tests 31 | */ 32 | public class OutOfContentScrollingTest extends NativeBase { 33 | @Override 34 | protected int getPageIndex() { 35 | return 4; 36 | } 37 | 38 | @Override 39 | public void testSanity() { 40 | checkIfIdDisplayed(R.id.out_of_content_scrollView); 41 | } 42 | 43 | /** 44 | * Tests out of content elements by first verifying whether it's not there, 45 | * then swiping up and then checking if the element is displayed. 46 | */ 47 | @Test 48 | public void testScrollToOutOfContent() { 49 | onView(withId(R.id.hidden_text)).check(matches(not(isDisplayed()))); 50 | onView(withId(R.id.out_of_content_scrollView)).perform(swipeUp()); 51 | onView(withId(R.id.hidden_text)).check(matches(isDisplayed())); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Native/ScrollingContentTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Native; 17 | 18 | import android.support.test.espresso.action.ViewActions; 19 | 20 | import com.amazonaws.devicefarm.android.referenceapp.R; 21 | 22 | import org.junit.Test; 23 | 24 | import static android.support.test.espresso.Espresso.onView; 25 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 26 | 27 | /** 28 | * Tests for a scroll view 29 | */ 30 | public class ScrollingContentTest extends NativeBase { 31 | @Override 32 | protected int getPageIndex() { 33 | return 1; 34 | } 35 | 36 | @Override 37 | public void testSanity() { 38 | checkIfIdDisplayed(R.id.content_scrolling_view); 39 | } 40 | 41 | /** 42 | * scrolls the scroll view 43 | */ 44 | @Test 45 | public void testScroll(){ 46 | onView(withId(R.id.content_scrolling_view)).perform(ViewActions.swipeUp()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/Native/VideoTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories.Native; 17 | 18 | import android.support.test.espresso.Espresso; 19 | import android.widget.VideoView; 20 | 21 | import com.amazonaws.devicefarm.android.referenceapp.IdlingResources.VideoPlayerIdlingResource; 22 | import com.amazonaws.devicefarm.android.referenceapp.R; 23 | 24 | import org.junit.Test; 25 | 26 | /** 27 | * Tests for video view 28 | */ 29 | public class VideoTest extends NativeBase { 30 | private VideoPlayerIdlingResource videoPlayerIdlingResource; 31 | 32 | /** 33 | * Registers a idling resource so it can wait for the video to be loaded/playing 34 | * 35 | * @throws Exception 36 | */ 37 | @Override 38 | protected void setUp() throws Exception { 39 | super.setUp(); 40 | videoPlayerIdlingResource = new VideoPlayerIdlingResource((VideoView) 41 | getActivity().findViewById(R.id.native_video_player)); 42 | Espresso.registerIdlingResources(videoPlayerIdlingResource); 43 | } 44 | 45 | /** 46 | * Unregisters the idling resource 47 | * 48 | * @throws Exception 49 | */ 50 | @Override 51 | protected void tearDown() throws Exception { 52 | Espresso.unregisterIdlingResources(videoPlayerIdlingResource); 53 | super.tearDown(); 54 | } 55 | 56 | @Override 57 | protected int getPageIndex() { 58 | return 2; 59 | } 60 | 61 | @Override 62 | public void testSanity() { 63 | checkIfIdDisplayed(R.id.native_video_player); 64 | } 65 | 66 | /** 67 | * Checks if the video player has the content description indicating 68 | * that the video is playing. 69 | * 70 | * @throws InterruptedException 71 | */ 72 | @Test 73 | public void testCheckVideoPlaying() throws InterruptedException { 74 | checkIdWithContentDescription(R.id.native_video_player, R.string.videoView_playing); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Categories/NestedViewTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Categories; 17 | 18 | import com.amazonaws.devicefarm.android.referenceapp.BaseADFTest; 19 | import com.amazonaws.devicefarm.android.referenceapp.R; 20 | 21 | import org.junit.Test; 22 | 23 | import static android.support.test.espresso.Espresso.pressBack; 24 | 25 | /** 26 | * Tests for nested views 27 | */ 28 | public class NestedViewTest extends BaseADFTest { 29 | @Override 30 | protected String getClassName() { 31 | return "Nested Views"; 32 | } 33 | 34 | @Override 35 | public void testSanity() { 36 | checkMainView(); 37 | } 38 | 39 | /** 40 | * Tests up navigation by going up, checking for expected messages then going back to see 41 | * if the same messages appear. 42 | */ 43 | @Test 44 | public void testUpNavigation() { 45 | checkMainView(); 46 | clickId(R.id.nested_up_button); 47 | checkIfIdIsDisplayedWithText(R.id.up_navigation_content_text, R.string.back_navigation_message); 48 | clickId(R.id.nested_up_button); 49 | checkIfIdIsDisplayedWithText(R.id.up_navigation_content_text, R.string.up_navigation_final); 50 | pressBack(); 51 | checkIfIdIsDisplayedWithText(R.id.up_navigation_content_text, R.string.back_navigation_message); 52 | } 53 | 54 | /** 55 | * Tests by going up by a certain amount of times then going back a calculated amount of times. 56 | * A counter is kept within the app to keep track of the level. 57 | * 58 | * The counter is then verified in order to see if the correct value is displayed. 59 | */ 60 | @Test 61 | public void testBackNavigation() { 62 | checkMainView(); 63 | clickId(R.id.nested_back_button); 64 | checkIfIdIsDisplayedWithText(R.id.back_navigation_counter, "1"); 65 | for (int i = 0; i < 9; i++) { 66 | clickId(R.id.back_navigation_next_button); 67 | } 68 | 69 | checkIfIdIsDisplayedWithText(R.id.back_navigation_counter, "10"); 70 | 71 | for (int i = 0; i < 9; i++) { 72 | pressBack(); 73 | } 74 | 75 | checkIfIdIsDisplayedWithText(R.id.back_navigation_counter, "1"); 76 | } 77 | 78 | /** 79 | * Checks to see if at the main menu 80 | */ 81 | private void checkMainView(){ 82 | checkIfIdDisplayed(R.id.nested_back_button); 83 | checkIfIdDisplayed(R.id.nested_textview); 84 | checkIfIdDisplayed(R.id.nested_up_button); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/IdlingResources/VideoPlayerIdlingResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.IdlingResources; 17 | 18 | import android.support.test.espresso.IdlingResource; 19 | import android.widget.VideoView; 20 | 21 | /** 22 | * Checks to see if the video either loaded or playing before becoming idle 23 | */ 24 | public class VideoPlayerIdlingResource implements IdlingResource{ 25 | private VideoView videoView; 26 | private ResourceCallback resourceCallback; 27 | private boolean isIdle; 28 | 29 | public VideoPlayerIdlingResource(VideoView videoView) { 30 | this.videoView = videoView; 31 | isIdle = videoView.isPlaying(); 32 | } 33 | 34 | @Override 35 | public String getName() { 36 | return "VideoPlayerIdlingResource"; 37 | } 38 | 39 | @Override 40 | public boolean isIdleNow() { 41 | return videoView == null || videoView.isPlaying(); 42 | } 43 | 44 | @Override 45 | public void registerIdleTransitionCallback(ResourceCallback resourceCallback) { 46 | this.resourceCallback = resourceCallback; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/IdlingResources/ViewPagerIdlingResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.IdlingResources; 17 | 18 | import android.support.test.espresso.IdlingResource; 19 | import android.support.v4.view.ViewPager; 20 | 21 | /** 22 | * Used to prevent Espresso from becoming idle when the viewpager is in a animated state 23 | */ 24 | public class ViewPagerIdlingResource implements IdlingResource, ViewPager.OnPageChangeListener { 25 | private ViewPager viewPager; 26 | private boolean isIdle; 27 | private ResourceCallback resourceCallback; 28 | 29 | public ViewPagerIdlingResource(ViewPager pager) { 30 | this.viewPager = pager; 31 | pager.addOnPageChangeListener(this); 32 | isIdle = true; 33 | } 34 | 35 | @Override 36 | public String getName() { 37 | return "ViewPagerIdlingResource"; 38 | } 39 | 40 | @Override 41 | public boolean isIdleNow() { 42 | return viewPager == null || isIdle; 43 | } 44 | 45 | @Override 46 | public void registerIdleTransitionCallback(ResourceCallback resourceCallback) { 47 | this.resourceCallback = resourceCallback; 48 | } 49 | 50 | @Override 51 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {} 52 | 53 | @Override 54 | public void onPageSelected(int position) {} 55 | 56 | /** 57 | * Checks to see if not in a scrolling state 58 | * 59 | * @param state the viewpager's state 60 | */ 61 | @Override 62 | public void onPageScrollStateChanged(int state) { 63 | this.isIdle = state != ViewPager.SCROLL_STATE_SETTLING; 64 | 65 | if (this.isIdle) 66 | this.resourceCallback.onTransitionToIdle(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/IdlingResources/WebViewIdlingResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.IdlingResources; 17 | 18 | import android.support.test.espresso.IdlingResource; 19 | import android.util.Log; 20 | import android.webkit.WebChromeClient; 21 | import android.webkit.WebView; 22 | 23 | /** 24 | * A way to ensure that the website to fully loaded before continuing. 25 | * 26 | */ 27 | public class WebViewIdlingResource extends WebChromeClient implements IdlingResource{ 28 | private static final int FINISHED = 100; 29 | private final WebView webView; 30 | private ResourceCallback resourceCallback; 31 | 32 | public WebViewIdlingResource(WebView webView) { 33 | this.webView = webView; 34 | webView.setWebChromeClient(this); 35 | } 36 | 37 | @Override 38 | public String getName() { 39 | return "WebViewIdlingResource"; 40 | } 41 | 42 | /** 43 | * Idle if the progress is 100% or the window's title is not blank 44 | * @return 45 | */ 46 | @Override 47 | public boolean isIdleNow() { 48 | if (webView == null) return true; 49 | return webView.getProgress() == FINISHED && webView.getTitle() != null; 50 | } 51 | 52 | @Override 53 | public void registerIdleTransitionCallback(ResourceCallback resourceCallback) { 54 | this.resourceCallback = resourceCallback; 55 | } 56 | 57 | /** 58 | * Updates the progress 59 | * 60 | * @param view the webview 61 | * @param newProgress the current progress 62 | */ 63 | @Override 64 | public void onProgressChanged(WebView view, int newProgress) { 65 | Log.i(getName(), "" + newProgress); 66 | if (newProgress == FINISHED && view.getTitle() != null && resourceCallback != null) { 67 | resourceCallback.onTransitionToIdle(); 68 | } 69 | } 70 | 71 | /** 72 | * Called when the web view title is received 73 | * 74 | * @param view the webview 75 | * @param title the web title 76 | */ 77 | @Override 78 | public void onReceivedTitle(WebView view, String title) { 79 | Log.i(getName(), title); 80 | if (webView.getProgress() == FINISHED && resourceCallback != null) { 81 | resourceCallback.onTransitionToIdle(); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/RegularExpressionMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp; 17 | 18 | import android.support.test.espresso.matcher.BoundedMatcher; 19 | import android.view.View; 20 | import android.widget.TextView; 21 | 22 | import org.hamcrest.Description; 23 | import org.hamcrest.Matcher; 24 | 25 | import static android.support.test.espresso.core.deps.guava.base.Preconditions.checkArgument; 26 | import static android.support.test.espresso.core.deps.guava.base.Preconditions.checkNotNull; 27 | import static org.hamcrest.CoreMatchers.is; 28 | 29 | /** 30 | * A custom matcher for regular expressions 31 | */ 32 | public final class RegularExpressionMatcher{ 33 | 34 | /** 35 | * Matches a string to a specific pattern 36 | * 37 | * @param pattern regular expression 38 | * @return the matcher result 39 | */ 40 | public static Matcher matchesPattern(final String pattern){ 41 | checkNotNull(pattern); 42 | return new BoundedMatcher(TextView.class) { 43 | @Override 44 | public void describeTo(final Description description) { 45 | description.appendText("The textview does not conform to the pattern: ") 46 | .appendText(pattern); 47 | } 48 | 49 | @Override 50 | protected boolean matchesSafely(TextView textView) { 51 | return textView.getText().toString().matches(pattern); 52 | } 53 | }; 54 | } 55 | 56 | 57 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/Util/ScreenShot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Util; 17 | 18 | import android.app.Activity; 19 | import android.graphics.Bitmap; 20 | import android.os.Environment; 21 | import android.util.Log; 22 | import android.view.View; 23 | 24 | import java.io.File; 25 | import java.io.FileNotFoundException; 26 | import java.io.FileOutputStream; 27 | import java.io.IOException; 28 | import java.io.OutputStream; 29 | import java.util.UUID; 30 | 31 | /** 32 | * Screenshot taker for Espresso tests within AWS Device Farm 33 | * 34 | * Saves the image with the specified name (or a randomly generated one) and 35 | * saves it into a directory Device Farm will pull from when generating reports. 36 | */ 37 | public class ScreenShot { 38 | private static final String TAG = "SCREENSHOT"; 39 | private static final String DEVICE_FARM_ESPRESSO_SCREEN_DIRECTORY = "/test-screenshots/"; 40 | private static final int SCREEN_SHOT_IMAGE_QUALITY = 100; 41 | 42 | public static void take(Activity activity, String fileName) { 43 | // Create the file path. 44 | final StringBuilder pathBuilder = new StringBuilder() 45 | .append(Environment.getExternalStorageDirectory().getAbsolutePath()) 46 | .append(DEVICE_FARM_ESPRESSO_SCREEN_DIRECTORY) 47 | .append(fileName) 48 | .append(".png"); 49 | 50 | File imageFile = new File(pathBuilder.toString()); 51 | 52 | // Verify that the directory exists and create it if not. 53 | File directoryPath = imageFile.getParentFile(); 54 | if (!directoryPath.isDirectory()) { 55 | Log.i(TAG, "Creating directory: " + directoryPath.toString()); 56 | if (!directoryPath.mkdirs()) { 57 | Log.e(TAG, "Failed to create the directory"); 58 | return; 59 | } 60 | } 61 | 62 | Log.i(TAG, "Saving to path: " + imageFile.toString()); 63 | 64 | View phoneView = activity.getWindow().getDecorView().getRootView(); 65 | phoneView.setDrawingCacheEnabled(true); 66 | Bitmap bitmap = Bitmap.createBitmap(phoneView.getDrawingCache()); 67 | phoneView.setDrawingCacheEnabled(false); 68 | 69 | OutputStream out = null; 70 | 71 | try { 72 | out = new FileOutputStream(imageFile); 73 | bitmap.compress(Bitmap.CompressFormat.PNG, SCREEN_SHOT_IMAGE_QUALITY, out); 74 | out.flush(); 75 | } catch (IOException e) { 76 | Log.e(TAG, e.toString()); 77 | } finally { 78 | try { 79 | if (out != null) { 80 | out.close(); 81 | } 82 | } catch (IOException e) { 83 | Log.e(TAG, e.toString()); 84 | } 85 | } 86 | } 87 | 88 | public static void take(Activity activity) { 89 | take(activity, UUID.randomUUID().toString()); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/amazonaws/devicefarm/android/referenceapp/ViewPagerTestBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp; 17 | 18 | import android.support.test.InstrumentationRegistry; 19 | import android.support.test.espresso.Espresso; 20 | import android.support.v4.view.ViewPager; 21 | 22 | import com.amazonaws.devicefarm.android.referenceapp.IdlingResources.ViewPagerIdlingResource; 23 | 24 | import static android.support.test.espresso.Espresso.onView; 25 | import static android.support.test.espresso.action.ViewActions.click; 26 | import static android.support.test.espresso.action.ViewActions.swipeLeft; 27 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 28 | import static android.support.test.espresso.matcher.ViewMatchers.withText; 29 | import static junit.framework.Assert.fail; 30 | import static org.hamcrest.CoreMatchers.not; 31 | import static org.hamcrest.core.Is.is; 32 | 33 | /** 34 | * A base class for a view pager 35 | */ 36 | public abstract class ViewPagerTestBase extends BaseADFTest{ 37 | 38 | /** 39 | * Gets the index of the page 40 | * @return the index of the page 41 | */ 42 | protected abstract int getPageIndex(); 43 | 44 | /** 45 | * The id of the specific viewpager 46 | * 47 | * @return the id of the pager 48 | */ 49 | protected abstract int getPagerId(); 50 | 51 | /** 52 | * A custom idling resource to ensure the tab is fully loaded before continuing 53 | */ 54 | private ViewPagerIdlingResource viewPagerIdlingResource; 55 | 56 | /** 57 | * Overloads the set up method to go to the specific page index 58 | * within the view pager. 59 | * 60 | * @throws Exception 61 | */ 62 | @Override 63 | protected void setUp() throws Exception { 64 | super.setUp(); 65 | viewPagerIdlingResource = new ViewPagerIdlingResource((ViewPager)getActivity().findViewById(R.id.view_pager1)); 66 | Espresso.registerIdlingResources(viewPagerIdlingResource); 67 | for (int i = 0; i < getPageIndex(); i++) { 68 | onView(withId(getPagerId())).perform(swipeLeft()); 69 | } 70 | InstrumentationRegistry.getInstrumentation().waitForIdleSync(); 71 | } 72 | 73 | /** 74 | * Removed the idling resource 75 | * @throws Exception 76 | */ 77 | @Override 78 | protected void tearDown() throws Exception { 79 | Espresso.unregisterIdlingResources(viewPagerIdlingResource); 80 | super.tearDown(); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/assets/www/app.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 | 26 | 27 | 28 | 29 |
30 |
31 |

Hello!
{{firstName + " " + lastName}}

32 | 33 |
34 | 35 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /app/src/main/assets/www/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | body{ padding-left: 5em; padding-right: 5em;} -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Activities/BackNavigationActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Activities; 17 | 18 | import android.content.Intent; 19 | import android.os.Bundle; 20 | import android.support.v4.app.NavUtils; 21 | import android.support.v7.app.AppCompatActivity; 22 | import android.support.v7.widget.Toolbar; 23 | import android.view.MenuItem; 24 | import android.widget.TextView; 25 | 26 | import com.amazonaws.devicefarm.android.referenceapp.R; 27 | 28 | import butterknife.ButterKnife; 29 | import butterknife.InjectView; 30 | import butterknife.OnClick; 31 | 32 | /** 33 | *

Back Navigation Activity

34 | *

35 | * A activity which is used to display back navigation. 36 | *
37 | * A simple activity with a button which increments a counter for each new 38 | * activity pushed to the stack 39 | *

40 | */ 41 | public class BackNavigationActivity extends AppCompatActivity { 42 | private int PeerCount; 43 | 44 | @InjectView(R.id.toolbar) 45 | Toolbar toolbar; 46 | 47 | @InjectView(R.id.back_navigation_counter) 48 | TextView counter; 49 | 50 | @InjectView(R.id.toolbar_title) 51 | TextView toolbarTitle; 52 | 53 | @Override 54 | protected void onCreate(final Bundle savedInstanceState) { 55 | super.onCreate(savedInstanceState); 56 | setContentView(R.layout.back_navigation); 57 | ButterKnife.inject(this); 58 | setSupportActionBar(toolbar); 59 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 60 | getSupportActionBar().setDisplayShowTitleEnabled(false); 61 | toolbarTitle.setText(R.string.back_navigation_activity_title); 62 | 63 | 64 | PeerCount = getIntent().getIntExtra(getString(R.string.PEER_COUNT), 0) + 1; 65 | counter.setText(String.format("%d",PeerCount)); 66 | } 67 | 68 | /** 69 | * Returns to the previous activity when the hardware back button 70 | * is pressed 71 | */ 72 | @Override 73 | public boolean onOptionsItemSelected(MenuItem item) { 74 | if (item.getItemId() == android.R.id.home) { 75 | NavUtils.navigateUpFromSameTask(this); 76 | return true; 77 | } 78 | return super.onOptionsItemSelected(item); 79 | } 80 | /** 81 | * Creates a new activity with a incremented number 82 | */ 83 | @OnClick(R.id.back_navigation_next_button) 84 | public void nextButtonOnClick(){ 85 | Intent target = new Intent(this, BackNavigationActivity.class); 86 | target.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); 87 | target.putExtra(getString(R.string.PEER_COUNT), PeerCount); 88 | startActivity(target); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Activities/UpNavigationActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Activities; 17 | 18 | import android.content.Intent; 19 | import android.os.Bundle; 20 | import android.support.v4.app.NavUtils; 21 | import android.support.v7.app.AppCompatActivity; 22 | import android.support.v7.widget.Toolbar; 23 | import android.view.MenuItem; 24 | import android.widget.TextView; 25 | 26 | import com.amazonaws.devicefarm.android.referenceapp.R; 27 | 28 | import butterknife.ButterKnife; 29 | import butterknife.InjectView; 30 | import butterknife.OnClick; 31 | 32 | /** 33 | *

Up Navigation Activity

34 | *

35 | * An activity demonstating Up navigation 36 | *

37 | */ 38 | public class UpNavigationActivity extends AppCompatActivity { 39 | @InjectView(R.id.toolbar) 40 | Toolbar toolbar; 41 | 42 | @InjectView(R.id.toolbar_title) 43 | TextView toolbarTitle; 44 | 45 | @Override 46 | protected void onCreate(final Bundle savedInstanceState) { 47 | super.onCreate(savedInstanceState); 48 | setContentView(R.layout.up_navigation); 49 | ButterKnife.inject(this); 50 | setSupportActionBar(toolbar); 51 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 52 | getSupportActionBar().setDisplayShowTitleEnabled(false); 53 | 54 | toolbarTitle.setText(getString(R.string.first_level)); 55 | } 56 | 57 | /** 58 | * Support for the back hardware button 59 | */ 60 | @Override 61 | public boolean onOptionsItemSelected(final MenuItem item) { 62 | if (item.getItemId() == android.R.id.home) { 63 | Intent intent = new Intent(getApplication(), MainActivity.class); 64 | intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); 65 | NavUtils.navigateUpTo(this, intent); 66 | return true; 67 | } 68 | return super.onOptionsItemSelected(item); 69 | } 70 | 71 | /** 72 | * Pushes up to the next class 73 | */ 74 | @OnClick(R.id.nested_up_button) 75 | public void onNextButton(){ 76 | startActivity(new Intent(this, UpNavigationContent.class)); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Activities/UpNavigationContent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Activities; 17 | 18 | import android.content.Intent; 19 | import android.os.Bundle; 20 | import android.support.v4.app.NavUtils; 21 | import android.support.v7.app.AppCompatActivity; 22 | import android.support.v7.widget.Toolbar; 23 | import android.view.MenuItem; 24 | import android.view.View; 25 | import android.widget.Button; 26 | import android.widget.TextView; 27 | 28 | import com.amazonaws.devicefarm.android.referenceapp.R; 29 | 30 | import butterknife.ButterKnife; 31 | import butterknife.InjectView; 32 | 33 | /** 34 | *

Up Navigation Content Activity

35 | *

36 | * The content for the up navigation demonstration 37 | *

38 | */ 39 | public class UpNavigationContent extends AppCompatActivity{ 40 | @InjectView(R.id.toolbar) 41 | Toolbar toolbar; 42 | 43 | @InjectView(R.id.nested_up_button) 44 | Button nextButton; 45 | 46 | @InjectView(R.id.toolbar_title) 47 | TextView toolbarTitle; 48 | 49 | @InjectView(R.id.up_navigation_content_text) 50 | TextView content_text; 51 | 52 | @Override 53 | protected void onCreate(final Bundle savedInstanceState) { 54 | super.onCreate(savedInstanceState); 55 | setContentView(R.layout.up_navigation); 56 | ButterKnife.inject(this); 57 | setSupportActionBar(toolbar); 58 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 59 | getSupportActionBar().setDisplayShowTitleEnabled(false); 60 | toolbarTitle.setText(R.string.up_navigation_final); 61 | content_text.setText(R.string.up_navigation_final); 62 | nextButton.setVisibility(View.GONE); 63 | } 64 | 65 | @Override 66 | /** 67 | * Support for the back button 68 | */ 69 | public boolean onOptionsItemSelected(final MenuItem item) { 70 | if (item.getItemId() == android.R.id.home) { 71 | Intent intent = new Intent(getApplication(), UpNavigationActivity.class); 72 | intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); 73 | NavUtils.navigateUpTo(this, intent); 74 | return true; 75 | } 76 | return super.onOptionsItemSelected(item); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Adapters/ImageGalleryAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Adapters; 17 | 18 | import android.content.Context; 19 | import android.content.res.TypedArray; 20 | import android.view.View; 21 | import android.view.ViewGroup; 22 | import android.widget.BaseAdapter; 23 | import android.widget.GridView; 24 | import android.widget.ImageView; 25 | 26 | import com.amazonaws.devicefarm.android.referenceapp.R; 27 | import com.squareup.picasso.Picasso; 28 | 29 | /** 30 | * A base adapter for the image gallery. Uses the Glide library to load the images in asynchronously. 31 | */ 32 | public class ImageGalleryAdapter extends BaseAdapter { 33 | 34 | private final Context context; 35 | private final TypedArray galleryIds; 36 | 37 | public ImageGalleryAdapter(Context context){ 38 | this.context = context; 39 | galleryIds = context.getResources().obtainTypedArray(R.array.image_gallery_image_ids); 40 | } 41 | 42 | @Override 43 | public int getCount() { 44 | return galleryIds.length(); 45 | } 46 | 47 | @Override 48 | public Object getItem(int position) { 49 | return galleryIds.getDrawable(position); 50 | } 51 | 52 | @Override 53 | public long getItemId(int position) { 54 | return position; 55 | } 56 | 57 | @Override 58 | public View getView(int position, View convertView, ViewGroup parent) { 59 | ImageView imageView; 60 | if (convertView == null){ 61 | imageView = new ImageView(context); 62 | imageView.setLayoutParams(new GridView.LayoutParams(300, 300)); 63 | imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); 64 | imageView.setPadding(8, 8, 8, 8); 65 | } 66 | else{ 67 | imageView = (ImageView) convertView; 68 | } 69 | Picasso.with(context).load(galleryIds.getResourceId(position, -1)).resize(300,300).into(imageView); 70 | return imageView; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Adapters/TabAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Adapters; 17 | 18 | 19 | import android.support.v4.app.Fragment; 20 | import android.support.v4.app.FragmentManager; 21 | import android.support.v4.app.FragmentPagerAdapter; 22 | 23 | import com.amazonaws.devicefarm.android.referenceapp.Models.FragmentEnum; 24 | import com.amazonaws.devicefarm.android.referenceapp.Models.TabViewModel; 25 | 26 | import java.util.List; 27 | 28 | /** 29 | * An adapter for the pageview 30 | */ 31 | public class TabAdapter extends FragmentPagerAdapter { 32 | 33 | List tabs; 34 | public TabAdapter(FragmentManager fragmentManager, List tabs){ 35 | super(fragmentManager); 36 | this.tabs = tabs; 37 | } 38 | 39 | /** 40 | * Gets the fragment for a specific tab 41 | * @param position 42 | * @return the fragment for a specific position 43 | */ 44 | @Override 45 | public Fragment getItem(int position) { 46 | return FragmentEnum.valueOf(tabs.get(position).getTab_id()).getFragment(); 47 | } 48 | 49 | /** 50 | * Gets the number of tabs 51 | * @return tab size 52 | */ 53 | @Override 54 | public int getCount() { 55 | return tabs.size(); 56 | } 57 | 58 | /** 59 | * Gets the title for a tab at a specific position 60 | * @param position 61 | * @return 62 | */ 63 | @Override 64 | public CharSequence getPageTitle(int position) { 65 | return tabs.get(position).getTab_name(); 66 | } 67 | } -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/LocalWebView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | import android.webkit.WebSettings; 24 | import android.webkit.WebView; 25 | import android.widget.EditText; 26 | 27 | import com.amazonaws.devicefarm.android.referenceapp.R; 28 | 29 | import butterknife.ButterKnife; 30 | import butterknife.InjectView; 31 | 32 | 33 | public class LocalWebView extends Fragment { 34 | 35 | @InjectView(R.id.website_input) 36 | EditText websiteInput; 37 | 38 | @InjectView(R.id.webView_browser) 39 | WebView webView; 40 | 41 | @Override 42 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 43 | View view = inflater.inflate(R.layout.web_fragment, container, false); 44 | ButterKnife.inject(this, view); 45 | websiteInput.setVisibility(View.GONE); 46 | setUpWebView(); 47 | return view; 48 | } 49 | 50 | /** 51 | * Sets up a web view 52 | */ 53 | private void setUpWebView(){ 54 | WebSettings settings = webView.getSettings(); 55 | settings.setJavaScriptEnabled(true); 56 | webView.loadUrl(getString(R.string.local_web_view_url)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/NestedFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments; 17 | 18 | import android.content.Intent; 19 | import android.os.Bundle; 20 | import android.support.v4.app.Fragment; 21 | import android.view.LayoutInflater; 22 | import android.view.View; 23 | import android.view.ViewGroup; 24 | 25 | import com.amazonaws.devicefarm.android.referenceapp.Activities.BackNavigationActivity; 26 | import com.amazonaws.devicefarm.android.referenceapp.Activities.UpNavigationActivity; 27 | import com.amazonaws.devicefarm.android.referenceapp.R; 28 | 29 | import butterknife.ButterKnife; 30 | import butterknife.OnClick; 31 | 32 | public class NestedFragment extends Fragment { 33 | 34 | public NestedFragment() {} 35 | 36 | @Override 37 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 38 | View view = inflater.inflate(R.layout.nested_fragment, container, false); 39 | ButterKnife.inject(this, view); 40 | return view; 41 | } 42 | 43 | /** 44 | * displays the back button activity 45 | */ 46 | @OnClick(R.id.nested_back_button) 47 | public void backButtonOnClick() { 48 | getActivity().startActivity(new Intent(getActivity(), BackNavigationActivity.class)); 49 | } 50 | 51 | /** 52 | * Displays the up navigation activity 53 | */ 54 | @OnClick(R.id.nested_up_button) 55 | public void upButtonOnClick() { 56 | getActivity().startActivity(new Intent(getActivity(), UpNavigationActivity.class)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/NotificationsFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments; 17 | 18 | import android.app.AlertDialog; 19 | import android.content.DialogInterface; 20 | import android.os.Bundle; 21 | import android.support.v4.app.Fragment; 22 | import android.view.LayoutInflater; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | import android.widget.Toast; 26 | 27 | import com.amazonaws.devicefarm.android.referenceapp.R; 28 | 29 | import butterknife.ButterKnife; 30 | import butterknife.OnClick; 31 | 32 | /** 33 | * A fragment used to demonstrate notications 34 | */ 35 | public class NotificationsFragment extends Fragment { 36 | 37 | @Override 38 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 39 | View view = inflater.inflate(R.layout.notifications_fragment, container, false); 40 | ButterKnife.inject(this, view); 41 | return view; 42 | } 43 | 44 | /** 45 | * Toast button clicked; shows toast 46 | */ 47 | @OnClick(R.id.notifications_toast_button) 48 | public void onToastButtonClick(){ 49 | Toast.makeText(getActivity(), getString(R.string.Toast_button_message), Toast.LENGTH_SHORT).show(); 50 | 51 | } 52 | 53 | /** 54 | * Alert button clicked; shows alert 55 | */ 56 | @OnClick(R.id.notifications_alert_button) 57 | public void onAlertButton(){ 58 | new AlertDialog.Builder(getActivity()).setTitle(getString(R.string.alert_title)). 59 | setMessage(getString(R.string.alert_message)).setPositiveButton(getString(R.string.alert_button), new DialogInterface.OnClickListener() { 60 | @Override 61 | public void onClick(DialogInterface dialog, int which) { 62 | dialog.cancel(); 63 | } 64 | }).show(); 65 | 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/SimpleFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | 24 | import com.amazonaws.devicefarm.android.referenceapp.R; 25 | 26 | /** 27 | * A simple fragment for static content 28 | */ 29 | public class SimpleFragment extends Fragment { 30 | 31 | private int layoutID; 32 | 33 | public SimpleFragment() {} 34 | 35 | 36 | @Override 37 | public void onCreate(Bundle savedInstanceState) { 38 | super.onCreate(savedInstanceState); 39 | layoutID = getArguments().getInt(getResources().getString(R.string.FRAGMENT_ID_BUNDLE_KEY)); 40 | } 41 | 42 | /** 43 | * Loads the layout from the passed resource int 44 | * @param inflater 45 | * @param container 46 | * @param savedInstanceState 47 | * @return 48 | */ 49 | @Override 50 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 51 | return inflater.inflate(layoutID, container, false); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/TabFragmentContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.support.v4.view.ViewPager; 21 | import android.view.LayoutInflater; 22 | import android.view.View; 23 | import android.view.ViewGroup; 24 | 25 | import com.amazonaws.devicefarm.android.referenceapp.Adapters.TabAdapter; 26 | import com.amazonaws.devicefarm.android.referenceapp.Models.TabViewModel; 27 | import com.amazonaws.devicefarm.android.referenceapp.R; 28 | 29 | import java.util.List; 30 | 31 | import butterknife.ButterKnife; 32 | import butterknife.InjectView; 33 | 34 | /** 35 | * A fragment container for fragments with tabs 36 | * Uses a page view for tab switching 37 | */ 38 | public class TabFragmentContainer extends Fragment { 39 | 40 | @InjectView(R.id.view_pager1) 41 | ViewPager pager; 42 | 43 | public TabFragmentContainer() {} 44 | 45 | @Override 46 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {//TODO SINGLETON or single instance? 47 | View view = inflater.inflate(R.layout.tab_fragment_container, container, false); 48 | ButterKnife.inject(this, view); 49 | return view; 50 | } 51 | 52 | @Override 53 | public void onStart() { 54 | super.onStart(); 55 | Bundle args = getArguments(); 56 | List data = args.getParcelableArrayList(getString(R.string.tab_fragment_bundle_key)); 57 | setUp(data); 58 | } 59 | 60 | private void setUp(List dataModel){ 61 | TabAdapter tabAdapter = new TabAdapter(getChildFragmentManager(), dataModel); 62 | pager.setAdapter(tabAdapter); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/Inputs/Input_CheckBoxFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Inputs; 17 | 18 | 19 | import android.os.Bundle; 20 | import android.support.v4.app.Fragment; 21 | import android.view.LayoutInflater; 22 | import android.view.View; 23 | import android.view.ViewGroup; 24 | import android.widget.CheckBox; 25 | import android.widget.CompoundButton; 26 | import android.widget.TextView; 27 | 28 | import com.amazonaws.devicefarm.android.referenceapp.R; 29 | 30 | import butterknife.ButterKnife; 31 | import butterknife.InjectView; 32 | 33 | /** 34 | * A fragment demonstrating a checkbox input 35 | */ 36 | public class Input_CheckBoxFragment extends Fragment implements CheckBox.OnCheckedChangeListener{ 37 | @InjectView(R.id.input_checkbox_status) 38 | TextView checkbox_display; 39 | 40 | @InjectView(R.id.input_checkbox) 41 | CheckBox checkBox; 42 | 43 | @Override 44 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 45 | View view = inflater.inflate(R.layout.input_checkbox_fragment, container, false); 46 | ButterKnife.inject(this, view); 47 | changeDisplay(); 48 | checkBox.setOnCheckedChangeListener(this); 49 | return view; 50 | } 51 | 52 | /** 53 | * Changes the display, reflecting a checkbox's status 54 | */ 55 | private void changeDisplay(){ 56 | if (checkBox.isChecked()) { 57 | checkbox_display.setText("Checked"); 58 | } else { 59 | checkbox_display.setText("Unchecked"); 60 | } 61 | } 62 | 63 | @Override 64 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 65 | changeDisplay(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/Inputs/Input_DatePickerFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Inputs; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | import android.widget.DatePicker; 24 | import android.widget.TextView; 25 | 26 | import com.amazonaws.devicefarm.android.referenceapp.R; 27 | 28 | import butterknife.ButterKnife; 29 | import butterknife.InjectView; 30 | 31 | /** 32 | * Fragment which represents datepicker input 33 | */ 34 | public class Input_DatePickerFragment extends Fragment implements DatePicker.OnDateChangedListener{ 35 | @InjectView(R.id.input_datepicker) 36 | DatePicker datePicker; 37 | 38 | @InjectView(R.id.input_date_display) 39 | TextView timeDisplay; 40 | 41 | @Override 42 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 43 | View view = inflater.inflate(R.layout.input_datepicker_fragment, container, false); 44 | ButterKnife.inject(this,view); 45 | datePicker.init(1994,6,5,this); 46 | changeDisplay(datePicker.getYear(),datePicker.getMonth(),datePicker.getDayOfMonth()); 47 | return view; 48 | } 49 | 50 | /** 51 | * Event when date picker is changed 52 | * @param view 53 | * @param year 54 | * @param monthOfYear 55 | * @param dayOfMonth 56 | */ 57 | @Override 58 | public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) { 59 | changeDisplay(year,monthOfYear,dayOfMonth); 60 | } 61 | 62 | /** 63 | * changes the date display 64 | * @param year 65 | * @param monthOfYear 66 | * @param dayOfMonth 67 | */ 68 | private void changeDisplay(int year, int monthOfYear, int dayOfMonth) { 69 | timeDisplay.setText(String.format("%d/%d/%d", ++monthOfYear, dayOfMonth, year)); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/Inputs/Input_GestureFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Inputs; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.view.GestureDetector; 21 | import android.view.LayoutInflater; 22 | import android.view.MotionEvent; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | import android.widget.FrameLayout; 26 | import android.widget.TextView; 27 | 28 | import com.amazonaws.devicefarm.android.referenceapp.Adapters.GestureListener; 29 | import com.amazonaws.devicefarm.android.referenceapp.R; 30 | 31 | import butterknife.ButterKnife; 32 | import butterknife.InjectView; 33 | 34 | /** 35 | * Fragment demonstrating a touch inputs 36 | */ 37 | public class Input_GestureFragment extends Fragment{ 38 | @InjectView(R.id.input_gesture_action_pad) 39 | FrameLayout actionPad; 40 | 41 | @InjectView(R.id.input_gesture_content) 42 | TextView gestureContent; 43 | 44 | @Override 45 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 46 | View view = inflater.inflate(R.layout.input_gesture_fragment, container, false); 47 | ButterKnife.inject(this, view); 48 | actionPad.setClickable(true); 49 | actionPad.setFocusable(true); 50 | 51 | GestureDetector.SimpleOnGestureListener gestureListener = new GestureListener(gestureContent, getActivity()); 52 | final GestureDetector gd = new GestureDetector(getActivity(), gestureListener); 53 | 54 | actionPad.setOnTouchListener(new View.OnTouchListener() { 55 | @Override 56 | public boolean onTouch(View view, MotionEvent motionEvent) { 57 | gd.onTouchEvent(motionEvent); 58 | return false; 59 | } 60 | }); 61 | return view; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/Inputs/Input_RadioButtonFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Inputs; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | import android.widget.RadioButton; 24 | import android.widget.RadioGroup; 25 | import android.widget.TextView; 26 | 27 | import com.amazonaws.devicefarm.android.referenceapp.R; 28 | 29 | import butterknife.ButterKnife; 30 | import butterknife.InjectView; 31 | 32 | /** 33 | * A fragment demonstrating radio button input 34 | */ 35 | public class Input_RadioButtonFragment extends Fragment implements RadioGroup.OnCheckedChangeListener{ 36 | @InjectView(R.id.radio_button_group) 37 | RadioGroup radioGroup; 38 | 39 | @InjectView(R.id.input_radio_button_display) 40 | TextView radioButtonDisplay; 41 | 42 | 43 | @Override 44 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 45 | View view = inflater.inflate(R.layout.input_radio_button_fragment, container, false); 46 | ButterKnife.inject(this,view); 47 | radioGroup.setOnCheckedChangeListener(this); 48 | radioButtonDisplay.setText(getString(R.string.radio_button_1)); 49 | return view; 50 | } 51 | 52 | /** 53 | * When a radio button is selected 54 | * @param group 55 | * @param checkedId 56 | */ 57 | @Override 58 | public void onCheckedChanged(RadioGroup group, int checkedId) { 59 | setDisplay(checkedId); 60 | } 61 | 62 | /** 63 | * Changes display based upon the given radio button id 64 | * @param radio_id 65 | */ 66 | private void setDisplay(int radio_id){ 67 | RadioButton radioButton = (RadioButton) getActivity().findViewById(radio_id); 68 | radioButtonDisplay.setText(radioButton.getText()); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/Inputs/Input_RefreshButtonFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Inputs; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.widget.SwipeRefreshLayout; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | import android.widget.TextView; 24 | 25 | import com.amazonaws.devicefarm.android.referenceapp.R; 26 | 27 | import java.text.DateFormat; 28 | import java.text.SimpleDateFormat; 29 | import java.util.Calendar; 30 | import java.util.Date; 31 | import java.util.TimeZone; 32 | 33 | import butterknife.ButterKnife; 34 | import butterknife.InjectView; 35 | 36 | /** 37 | * A fragment representing a refresh input 38 | */ 39 | public class Input_RefreshButtonFragment extends android.support.v4.app.Fragment implements 40 | SwipeRefreshLayout.OnRefreshListener{ 41 | @InjectView(R.id.input_refresh) 42 | SwipeRefreshLayout swipeRefreshLayout; 43 | 44 | @InjectView(R.id.input_refresh_display) 45 | TextView textView; 46 | 47 | @Override 48 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 49 | View view = inflater.inflate(R.layout.input_refresh_fragment, container, false); 50 | ButterKnife.inject(this, view); 51 | swipeRefreshLayout.setOnRefreshListener(this); 52 | return view; 53 | } 54 | 55 | /** 56 | * Called when refreshing 57 | */ 58 | @Override 59 | public void onRefresh() { 60 | Calendar cal = Calendar.getInstance(TimeZone.getDefault()); 61 | Date currentLocalTime = cal.getTime(); 62 | DateFormat date = new SimpleDateFormat("hh:mm:ss a"); 63 | date.setTimeZone(TimeZone.getDefault()); 64 | textView.setText(date.format(currentLocalTime)); 65 | swipeRefreshLayout.setRefreshing(false); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/Inputs/Input_SpinnerFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Inputs; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | import android.widget.AdapterView; 24 | import android.widget.ArrayAdapter; 25 | import android.widget.Spinner; 26 | import android.widget.TextView; 27 | 28 | import com.amazonaws.devicefarm.android.referenceapp.R; 29 | 30 | import butterknife.ButterKnife; 31 | import butterknife.InjectView; 32 | 33 | /** 34 | * A fragment representing a spinner input 35 | */ 36 | public class Input_SpinnerFragment extends Fragment implements Spinner.OnItemSelectedListener{ 37 | @InjectView(R.id.input_spinner) 38 | Spinner spinner; 39 | 40 | @InjectView(R.id.input_spinner_message) 41 | TextView textView; 42 | 43 | @Override 44 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 45 | View view = inflater.inflate(R.layout.input_spinner_fragment, container, false); 46 | ButterKnife.inject(this, view); 47 | spinnerAdapter(); 48 | spinner.setOnItemSelectedListener(this); 49 | return view; 50 | } 51 | 52 | public void spinnerAdapter(){ 53 | ArrayAdapter adapter = new ArrayAdapter(getActivity(), R.layout.support_simple_spinner_dropdown_item, getResources().getStringArray(R.array.spinner_array)); 54 | adapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item); 55 | spinner.setAdapter(adapter); 56 | } 57 | 58 | @Override 59 | public void onItemSelected(AdapterView parent, View view, int position, long id) { 60 | String message = String.valueOf(spinner.getItemAtPosition(position)); 61 | textView.setText(String.format(getString(R.string.spinner_display), message)); 62 | } 63 | 64 | @Override 65 | public void onNothingSelected(AdapterView parent) {} 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/Inputs/Input_SubmitButtonFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Inputs; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | import android.widget.Toast; 24 | 25 | import com.amazonaws.devicefarm.android.referenceapp.R; 26 | 27 | import butterknife.ButterKnife; 28 | import butterknife.OnClick; 29 | 30 | /** 31 | * A fragment demonstrating a simple submit button 32 | * The submit button sends out a submit toast 33 | */ 34 | public class Input_SubmitButtonFragment extends Fragment { 35 | 36 | @Override 37 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 38 | View view = inflater.inflate(R.layout.input_submit_button_fragment, container, false); 39 | ButterKnife.inject(this, view); 40 | return view; 41 | } 42 | 43 | @OnClick(R.id.input_submit_button) 44 | public void onClick(){ 45 | Toast.makeText(getActivity(), getString(R.string.submit_button_toast_message), Toast.LENGTH_SHORT).show(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/Inputs/Input_TimePickerFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Inputs; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | import android.widget.TextView; 24 | import android.widget.TimePicker; 25 | 26 | import com.amazonaws.devicefarm.android.referenceapp.R; 27 | 28 | import butterknife.ButterKnife; 29 | import butterknife.InjectView; 30 | 31 | /** 32 | * A fragment demonstrating a time picker input 33 | */ 34 | public class Input_TimePickerFragment extends Fragment implements TimePicker.OnTimeChangedListener{ 35 | @InjectView(R.id.input_timepicker) 36 | TimePicker timePicker; 37 | 38 | @InjectView(R.id.input_time_display) 39 | TextView timeDisplay; 40 | 41 | @Override 42 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 43 | View view = inflater.inflate(R.layout.input_timepicker_fragment, container, false); 44 | ButterKnife.inject(this,view); 45 | timePicker.setOnTimeChangedListener(this); 46 | timeDisplay.setText(getString(R.string.time_picker_default_display)); 47 | return view; 48 | } 49 | 50 | @Override 51 | public void onTimeChanged(TimePicker view, int hourOfDay, int minute) { 52 | timeDisplay.setText(String.format("%d : %02d", hourOfDay, minute)); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/Inputs/Input_Toggle_ButtonFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Inputs; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.support.v7.widget.SwitchCompat; 21 | import android.view.LayoutInflater; 22 | import android.view.View; 23 | import android.view.ViewGroup; 24 | 25 | import com.amazonaws.devicefarm.android.referenceapp.R; 26 | 27 | import butterknife.ButterKnife; 28 | import butterknife.InjectView; 29 | import butterknife.OnClick; 30 | 31 | /** 32 | * A fragment demonstrating the toggle button 33 | */ 34 | public class Input_Toggle_ButtonFragment extends Fragment { 35 | @InjectView(R.id.input_switch_display) 36 | View switchDisplay; 37 | 38 | @Override 39 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 40 | View view = inflater.inflate(R.layout.input_toggle_button_fragment, container, false); 41 | ButterKnife.inject(this, view); 42 | switchDisplay.setBackgroundColor(getResources().getColor(R.color.custom_grey)); 43 | switchDisplay.setContentDescription("OFF"); 44 | return view; 45 | } 46 | 47 | /** 48 | * Switches the frame's background color 49 | * 50 | * @param view 51 | */ 52 | @OnClick(R.id.input_switch) 53 | public void onToggleClicked(View view){ 54 | if (((SwitchCompat)view).isChecked()) { 55 | switchDisplay.setBackgroundColor(getResources().getColor(R.color.custom_yellow)); 56 | switchDisplay.setContentDescription("ON"); 57 | } else { 58 | switchDisplay.setBackgroundColor(getResources().getColor(R.color.custom_grey)); 59 | switchDisplay.setContentDescription("OFF"); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/Native/Native_ImageGalleryFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.Native; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | import android.widget.GridView; 24 | 25 | import com.amazonaws.devicefarm.android.referenceapp.Adapters.ImageGalleryAdapter; 26 | import com.amazonaws.devicefarm.android.referenceapp.R; 27 | 28 | import butterknife.ButterKnife; 29 | import butterknife.InjectView; 30 | 31 | /** 32 | * A fragment that demonstrates a root image gallery view 33 | */ 34 | public class Native_ImageGalleryFragment extends Fragment { 35 | @InjectView(R.id.native_image_grid_view) 36 | GridView imageGalley; 37 | 38 | @Override 39 | public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) { 40 | View view = inflater.inflate(R.layout.native_imagegallery_fragment, container, false); 41 | ButterKnife.inject(this, view); 42 | imageGalley.setAdapter(new ImageGalleryAdapter(getActivity())); 43 | return view; 44 | } 45 | } -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/SupplementalUploads/SupplementalUploads_AdditionalAppFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.SupplementalUploads; 17 | 18 | import android.support.v4.app.Fragment; 19 | 20 | public class SupplementalUploads_AdditionalAppFragment extends Fragment { 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/Tabs/SupplementalUploads/SupplementalUploads_ExtraDataFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments.Tabs.SupplementalUploads; 17 | 18 | import android.graphics.Color; 19 | import android.os.Bundle; 20 | import android.support.v4.app.ListFragment; 21 | import android.view.LayoutInflater; 22 | import android.view.View; 23 | import android.view.ViewGroup; 24 | import android.widget.ArrayAdapter; 25 | import android.widget.TextView; 26 | 27 | import com.amazonaws.devicefarm.android.referenceapp.R; 28 | 29 | import java.io.File; 30 | import java.util.ArrayList; 31 | import java.util.Arrays; 32 | 33 | /** 34 | * Fragment that displays the directory where users' extra data is uploaded. 35 | */ 36 | public class SupplementalUploads_ExtraDataFragment extends ListFragment { 37 | private static final String EXTRA_DATA_PATH = "/sdcard/"; 38 | 39 | @Override 40 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 41 | View view = inflater.inflate(R.layout.supplemental_uploads_extra_data_fragment, container, false); 42 | return view; 43 | } 44 | 45 | @Override 46 | public void onActivityCreated(Bundle savedInstanceState) { 47 | super.onActivityCreated(savedInstanceState); 48 | ArrayAdapter arrayAdapter = new ArrayAdapter(getActivity().getApplicationContext(), 49 | android.R.layout.simple_list_item_1, getDirectoryContents(EXTRA_DATA_PATH)) { 50 | // Set text color to black 51 | @Override 52 | public View getView(int position, View convertView, ViewGroup parent) { 53 | TextView row = (TextView) super.getView(position, convertView, parent); 54 | row.setTextColor(Color.BLACK); 55 | return row; 56 | } 57 | }; 58 | 59 | setListAdapter(arrayAdapter); 60 | } 61 | 62 | /** 63 | * Retrieve the directory contents as an ArrayList of filenames. 64 | * 65 | * @param path 66 | * @return ArrayList 67 | */ 68 | private ArrayList getDirectoryContents(String path) { 69 | File file = new File(path); 70 | return new ArrayList<>(Arrays.asList(file.list())); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Fragments/crashFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Fragments; 17 | 18 | import android.os.Bundle; 19 | import android.support.v4.app.Fragment; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | 24 | import com.amazonaws.devicefarm.android.referenceapp.R; 25 | 26 | import butterknife.ButterKnife; 27 | import butterknife.OnClick; 28 | 29 | /** 30 | * A fragment with a known error 31 | */ 32 | public class crashFragment extends Fragment { 33 | 34 | public crashFragment() {} 35 | 36 | @Override 37 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 38 | View view = inflater.inflate(R.layout.crash_fragment, container, false); 39 | ButterKnife.inject(this, view); 40 | return view; 41 | } 42 | 43 | /** 44 | * Button to crash the app 45 | */ 46 | @OnClick(R.id.crash_button) 47 | public void onCrashButton(){ 48 | //will crash the app (dividing by zero) 49 | int i = 1 / 0; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Models/DrawerCategoryModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Models; 17 | 18 | import android.os.Parcel; 19 | import android.os.Parcelable; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * A model of a drawer category 25 | */ 26 | public final class DrawerCategoryModel implements Parcelable{ 27 | 28 | private String fragment_id; 29 | private String category_name; 30 | private String headline; 31 | private String icon_name; 32 | private boolean has_tabs; 33 | private List tabs; 34 | 35 | public List getTabs() { 36 | return tabs; 37 | } 38 | 39 | public boolean isHas_tabs() { 40 | return has_tabs; 41 | } 42 | 43 | public String getHeadline() { 44 | return headline; 45 | } 46 | 47 | public String getCategory_name() { 48 | return category_name; 49 | } 50 | 51 | public String getFragment_id() { 52 | return fragment_id; 53 | } 54 | 55 | public String getIcon_name() { 56 | return icon_name; 57 | } 58 | 59 | public DrawerCategoryModel() {} 60 | 61 | @Override 62 | public int describeContents() { 63 | return 0; 64 | } 65 | 66 | @Override 67 | public void writeToParcel(Parcel dest, int flags) { 68 | dest.writeString(this.fragment_id); 69 | dest.writeString(this.category_name); 70 | dest.writeString(this.headline); 71 | dest.writeString(this.icon_name); 72 | dest.writeByte(has_tabs ? (byte) 1 : (byte) 0); 73 | dest.writeTypedList(tabs); 74 | } 75 | 76 | protected DrawerCategoryModel(Parcel in) { 77 | this.fragment_id = in.readString(); 78 | this.category_name = in.readString(); 79 | this.headline = in.readString(); 80 | this.icon_name = in.readString(); 81 | this.has_tabs = in.readByte() != 0; 82 | this.tabs = in.createTypedArrayList(TabViewModel.CREATOR); 83 | } 84 | 85 | public static final Creator CREATOR = new Creator() { 86 | public DrawerCategoryModel createFromParcel(Parcel source) { 87 | return new DrawerCategoryModel(source); 88 | } 89 | 90 | public DrawerCategoryModel[] newArray(int size) { 91 | return new DrawerCategoryModel[size]; 92 | } 93 | }; 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Models/TabViewModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Models; 17 | 18 | import android.os.Parcel; 19 | import android.os.Parcelable; 20 | 21 | /** 22 | * Model representing a tab within the viewpager 23 | */ 24 | public final class TabViewModel implements Parcelable{ 25 | private String tab_id; 26 | private String tab_name; 27 | private String tab_headline; 28 | 29 | public String getTab_id() { 30 | return tab_id; 31 | } 32 | 33 | public String getTab_name() { 34 | return tab_name; 35 | } 36 | 37 | public String getTab_headline() { 38 | return tab_headline; 39 | } 40 | 41 | @Override 42 | public int describeContents() { 43 | return 0; 44 | } 45 | 46 | @Override 47 | public void writeToParcel(Parcel dest, int flags) { 48 | dest.writeString(this.tab_id); 49 | dest.writeString(this.tab_name); 50 | dest.writeString(this.tab_headline); 51 | } 52 | 53 | public TabViewModel() { 54 | } 55 | 56 | protected TabViewModel(Parcel in) { 57 | this.tab_id = in.readString(); 58 | this.tab_name = in.readString(); 59 | this.tab_headline = in.readString(); 60 | } 61 | 62 | public static final Creator CREATOR = new Creator() { 63 | public TabViewModel createFromParcel(Parcel source) { 64 | return new TabViewModel(source); 65 | } 66 | 67 | public TabViewModel[] newArray(int size) { 68 | return new TabViewModel[size]; 69 | } 70 | }; 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Util/JsonParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Util; 17 | 18 | import android.content.Context; 19 | 20 | import com.amazonaws.devicefarm.android.referenceapp.Models.DrawerCategoryModel; 21 | import com.google.gson.Gson; 22 | import com.google.gson.GsonBuilder; 23 | import com.google.gson.reflect.TypeToken; 24 | 25 | import java.io.IOException; 26 | import java.io.InputStreamReader; 27 | import java.io.Reader; 28 | import java.lang.reflect.Type; 29 | import java.util.List; 30 | 31 | /** 32 | * Parses Json into the data models 33 | */ 34 | public class JsonParser { 35 | 36 | private Context context; 37 | private int resId; 38 | 39 | public JsonParser(Context context, int resId) { 40 | this.context = context; 41 | this.resId = resId; 42 | } 43 | 44 | /** 45 | * Parses the JSON file into data models 46 | * @return List of DrawerCategory Models 47 | */ 48 | public List serializeJson(){ 49 | try { 50 | Reader reader = new InputStreamReader(context.getResources().openRawResource(resId)); 51 | Gson gson = new GsonBuilder().create(); 52 | Type listType = new TypeToken>(){}.getType(); 53 | List list = gson.fromJson(reader,listType); 54 | reader.close(); 55 | return list; 56 | } catch (IOException e) { 57 | e.printStackTrace(); 58 | } 59 | return null; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/amazonaws/devicefarm/android/referenceapp/Util/Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://aws.amazon.com/apache2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | package com.amazonaws.devicefarm.android.referenceapp.Util; 17 | 18 | import android.content.Context; 19 | import android.view.inputmethod.InputMethodManager; 20 | import android.widget.EditText; 21 | 22 | /** 23 | * Utility class 24 | */ 25 | public final class Util { 26 | 27 | /** 28 | * Hides the software keyboard 29 | * @param editText the editText editText 30 | * @param context the fragment's context 31 | */ 32 | public static void hideKeyboard(EditText editText, Context context){ 33 | InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); 34 | inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(), 0); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_account_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_account_box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_bug_report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_bug_report.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_feedback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_feedback.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_filter_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_filter_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_folder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_http.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_http.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_input.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_photo_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_photo_camera.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_public.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_public.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_store_mall_directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-hdpi/ic_action_store_mall_directory.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_account_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_account_box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_bug_report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_bug_report.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_feedback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_feedback.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_filter_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_filter_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_folder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_http.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_http.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_input.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_photo_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_photo_camera.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_public.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_public.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_store_mall_directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-mdpi/ic_action_store_mall_directory.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_account_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_account_box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_bug_report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_bug_report.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_feedback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_feedback.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_filter_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_filter_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_folder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_http.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_http.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_input.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_photo_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_photo_camera.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_public.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_public.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_store_mall_directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xhdpi/ic_action_store_mall_directory.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_account_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_account_box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_bug_report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_bug_report.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_feedback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_feedback.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_filter_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_filter_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_folder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_http.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_http.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_input.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_photo_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_photo_camera.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_public.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_public.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_store_mall_directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxhdpi/ic_action_store_mall_directory.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_account_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_account_box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_bug_report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_bug_report.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_feedback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_feedback.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_filter_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_filter_1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_folder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_http.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_http.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_input.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_photo_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_photo_camera.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_public.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_public.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_store_mall_directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable-xxxhdpi/ic_action_store_mall_directory.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/amber.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable/amber.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable/central_park.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable/central_park.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable/chicken.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable/chicken.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable/duck.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable/duck.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable/fish.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable/fish.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable/key_west.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable/key_west.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable/nelly.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable/nelly.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable/nola.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/aws-device-farm-sample-app-for-android/f3025888cec435e547e85abc965e040f5da85910/app/src/main/res/drawable/nola.jpeg -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 19 | 20 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/back_navigation.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 16 |