diff --git a/app/app.iml b/app/app.iml index 9edbefb..574add0 100644 --- a/app/app.iml +++ b/app/app.iml @@ -89,7 +89,7 @@ - + @@ -127,4 +127,4 @@ - + \ No newline at end of file diff --git a/app/src/main/java/red5pro/org/testandroidproject/TestListFragment.java b/app/src/main/java/red5pro/org/testandroidproject/TestListFragment.java index 1634c2e..2594c8a 100644 --- a/app/src/main/java/red5pro/org/testandroidproject/TestListFragment.java +++ b/app/src/main/java/red5pro/org/testandroidproject/TestListFragment.java @@ -34,6 +34,7 @@ import android.widget.ListView; import red5pro.org.testandroidproject.tests.TestContent; +import red5pro.org.testandroidproject.tests.TestItemAdapter; /** * A list fragment representing a list of Tests. This fragment @@ -101,12 +102,13 @@ public void onCreate(Bundle savedInstanceState) { //Load XML TESTS TestContent.LoadTests(res.openRawResource(R.raw.tests)); // TODO: replace with a real list adapter. + // AND DONE! see onViewCreated - setListAdapter(new ArrayAdapter( - getActivity(), - android.R.layout.simple_list_item_activated_1, - android.R.id.text1, - TestContent.ITEMS)); +// setListAdapter(new ArrayAdapter( +// getActivity(), +// android.R.layout.simple_list_item_activated_1, +// android.R.id.text1, +// TestContent.ITEMS)); } @Override @@ -118,6 +120,10 @@ public void onViewCreated(View view, Bundle savedInstanceState) { && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) { setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION)); } + + // Added to be able to assign accessibility id for appium testing. + TestItemAdapter adapter = new TestItemAdapter(this.getActivity(), TestContent.ITEMS); + setListAdapter(adapter); } @Override diff --git a/app/src/main/java/red5pro/org/testandroidproject/tests/PublishCameraSwapBlinkTest/PublishCameraSwapBlinkTest.java b/app/src/main/java/red5pro/org/testandroidproject/tests/PublishCameraSwapBlinkTest/PublishCameraSwapBlinkTest.java index 695328e..0e0b333 100644 --- a/app/src/main/java/red5pro/org/testandroidproject/tests/PublishCameraSwapBlinkTest/PublishCameraSwapBlinkTest.java +++ b/app/src/main/java/red5pro/org/testandroidproject/tests/PublishCameraSwapBlinkTest/PublishCameraSwapBlinkTest.java @@ -1,3 +1,28 @@ +// +// Copyright © 2015 Infrared5, Inc. All rights reserved. +// +// The accompanying code comprising examples for use solely in conjunction with Red5 Pro (the "Example Code") +// is licensed to you by Infrared5 Inc. in consideration of your agreement to the following +// license terms and conditions. Access, use, modification, or redistribution of the accompanying +// code constitutes your acceptance of the following license terms and conditions. +// +// Permission is hereby granted, free of charge, to you to use the Example Code and associated documentation +// files (collectively, the "Software") without restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the following conditions: +// +// The Software shall be used solely in conjunction with Red5 Pro. Red5 Pro is licensed under a separate end +// user license agreement (the "EULA"), which must be executed with Infrared5, Inc. +// An example of the EULA can be found on our website at: https://account.red5pro.com/assets/LICENSE.txt. +// +// The above copyright notice and this license shall be included in all copies or portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL INFRARED5, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// package red5pro.org.testandroidproject.tests.PublishCameraSwapBlinkTest; import android.hardware.Camera; diff --git a/app/src/main/java/red5pro/org/testandroidproject/tests/TestContent.java b/app/src/main/java/red5pro/org/testandroidproject/tests/TestContent.java index d3258c1..8ce23ac 100644 --- a/app/src/main/java/red5pro/org/testandroidproject/tests/TestContent.java +++ b/app/src/main/java/red5pro/org/testandroidproject/tests/TestContent.java @@ -26,7 +26,10 @@ package red5pro.org.testandroidproject.tests; +import android.content.Context; import android.util.Log; +import android.widget.ArrayAdapter; + import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -75,7 +78,7 @@ public static void LoadTests(InputStream stream){ NodeList tests = doc.getDocumentElement().getElementsByTagName("Test"); for (int i = 0; i < tests.getLength() ; i++) { Element testElement = (Element)tests.item(i); - TestItem test = new TestItem( ""+i , testElement );//.getAttribute("title") , testElement.toString() ); + TestItem test = new TestItem(""+i , testElement );//.getAttribute("title") , testElement.toString() ); ITEMS.add( test ); } @@ -163,6 +166,7 @@ public static void SetTestItem( int id ) { public static class TestItem { public String id; + public String title; public String content; public String className; public String description; @@ -176,6 +180,7 @@ public TestItem( String _id, String _content) { public TestItem( String _id, Element contentXML) { id = _id; + title = contentXML.getAttribute("title"); content = contentXML.getElementsByTagName("name").item(0).getTextContent(); className = contentXML.getElementsByTagName("class").item(0).getTextContent(); description = contentXML.getElementsByTagName("description").item(0).getTextContent(); @@ -187,4 +192,5 @@ public String toString() { return content; } } + } diff --git a/app/src/main/java/red5pro/org/testandroidproject/tests/TestItemAdapter.java b/app/src/main/java/red5pro/org/testandroidproject/tests/TestItemAdapter.java new file mode 100644 index 0000000..c9728bc --- /dev/null +++ b/app/src/main/java/red5pro/org/testandroidproject/tests/TestItemAdapter.java @@ -0,0 +1,64 @@ +// +// Copyright © 2015 Infrared5, Inc. All rights reserved. +// +// The accompanying code comprising examples for use solely in conjunction with Red5 Pro (the "Example Code") +// is licensed to you by Infrared5 Inc. in consideration of your agreement to the following +// license terms and conditions. Access, use, modification, or redistribution of the accompanying +// code constitutes your acceptance of the following license terms and conditions. +// +// Permission is hereby granted, free of charge, to you to use the Example Code and associated documentation +// files (collectively, the "Software") without restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the following conditions: +// +// The Software shall be used solely in conjunction with Red5 Pro. Red5 Pro is licensed under a separate end +// user license agreement (the "EULA"), which must be executed with Infrared5, Inc. +// An example of the EULA can be found on our website at: https://account.red5pro.com/assets/LICENSE.txt. +// +// The above copyright notice and this license shall be included in all copies or portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL INFRARED5, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +package red5pro.org.testandroidproject.tests; + +import android.content.Context; +import android.content.res.Resources; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.List; + +import red5pro.org.testandroidproject.R; + +public class TestItemAdapter extends ArrayAdapter { + public TestItemAdapter(Context context, List tests) { + super(context, 0, tests); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + // Get the data item for this position + TestContent.TestItem test = getItem(position); + // Check if an existing view is being reused, otherwise inflate the view + if (convertView == null) { + convertView = LayoutInflater.from(getContext()).inflate(R.layout.test_list_item, parent, false); + } + // Lookup view for data population +// TextView title = (TextView) convertView.findViewWithTag("textfield"); + TextView title = (TextView) convertView.findViewById(R.id.txt); + // Populate the data into the template view using the data object + title.setText(test.content); + title.setContentDescription(test.title); + Resources res = title.getResources(); + // Return the completed view to render on screen + return convertView; + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/test_list_item.xml b/app/src/main/res/layout/test_list_item.xml new file mode 100644 index 0000000..cc1089a --- /dev/null +++ b/app/src/main/res/layout/test_list_item.xml @@ -0,0 +1,11 @@ + + \ No newline at end of file