From e173e6f209b44d49bba77c6e02db55ef7dad1198 Mon Sep 17 00:00:00 2001 From: Mark Murphy Date: Sun, 21 Aug 2016 11:13:58 -0400 Subject: [PATCH] completed edition of sample app --- Testing/EspressoIdle/README.markdown | 7 ++ Testing/EspressoIdle/app/build.gradle | 28 ++--- .../commonsware/android/async/AsyncTest.java | 27 ----- .../android/okhttp/OkHttpTests.java | 93 +++++++++++++++ .../app/src/main/AndroidManifest.xml | 19 +-- .../android/async/AsyncDemoFragment.java | 97 --------------- .../AsyncDemo.java => okhttp/Item.java} | 22 ++-- .../android/okhttp/MainActivity.java | 59 ++++++++++ .../android/okhttp/QuestionClickedEvent.java | 23 ++++ .../android/okhttp/QuestionsFragment.java | 110 ++++++++++++++++++ .../android/okhttp/QuestionsLoadedEvent.java | 23 ++++ .../android/okhttp/SOQuestions.java | 21 ++++ .../app/src/main/res/layout/main.xml | 8 -- .../app/src/main/res/values-v21/styles.xml | 8 ++ .../app/src/main/res/values/colors.xml | 8 ++ .../app/src/main/res/values/strings.xml | 7 +- .../app/src/main/res/values/styles.xml | 5 + Testing/EspressoIdle/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 4 +- Testing/EspressoIdle/proguard-project.txt | 20 ++++ Testing/EspressoIdle/proguard.cfg | 40 ------- Testing/EspressoIdle/project.properties | 2 +- 22 files changed, 413 insertions(+), 220 deletions(-) create mode 100644 Testing/EspressoIdle/README.markdown delete mode 100644 Testing/EspressoIdle/app/src/androidTest/java/com/commonsware/android/async/AsyncTest.java create mode 100644 Testing/EspressoIdle/app/src/androidTest/java/com/commonsware/android/okhttp/OkHttpTests.java delete mode 100644 Testing/EspressoIdle/app/src/main/java/com/commonsware/android/async/AsyncDemoFragment.java rename Testing/EspressoIdle/app/src/main/java/com/commonsware/android/{async/AsyncDemo.java => okhttp/Item.java} (55%) create mode 100644 Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/MainActivity.java create mode 100644 Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionClickedEvent.java create mode 100644 Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionsFragment.java create mode 100644 Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionsLoadedEvent.java create mode 100644 Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/SOQuestions.java delete mode 100644 Testing/EspressoIdle/app/src/main/res/layout/main.xml create mode 100644 Testing/EspressoIdle/app/src/main/res/values-v21/styles.xml create mode 100644 Testing/EspressoIdle/app/src/main/res/values/colors.xml create mode 100644 Testing/EspressoIdle/app/src/main/res/values/styles.xml create mode 100644 Testing/EspressoIdle/proguard-project.txt delete mode 100644 Testing/EspressoIdle/proguard.cfg diff --git a/Testing/EspressoIdle/README.markdown b/Testing/EspressoIdle/README.markdown new file mode 100644 index 000000000..5fa2a2701 --- /dev/null +++ b/Testing/EspressoIdle/README.markdown @@ -0,0 +1,7 @@ +This sample Android app demonstrates +the use of OkHttp 3.x. + +This app is covered in +[the chapter on Internet access](https://commonsware.com/Android/previews/internet-access) +in [*The Busy Coder's Guide to Android Development*](https://commonsware.com/Android/). + diff --git a/Testing/EspressoIdle/app/build.gradle b/Testing/EspressoIdle/app/build.gradle index d9dd73794..eb13bb196 100644 --- a/Testing/EspressoIdle/app/build.gradle +++ b/Testing/EspressoIdle/app/build.gradle @@ -1,22 +1,22 @@ apply plugin: 'com.android.application' dependencies { - androidTestCompile 'com.android.support:support-annotations:24.0.0' - androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' + compile 'de.greenrobot:eventbus:2.4.0' + compile 'com.google.code.gson:gson:2.4' + compile 'com.squareup.okhttp3:okhttp:3.4.0' + androidTestCompile 'com.android.support:support-annotations:24.1.1' + androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' + androidTestCompile 'com.jakewharton.espresso:okhttp3-idling-resource:1.0.0' } android { - compileSdkVersion 24 - buildToolsVersion "24.0.0" + compileSdkVersion 24 + buildToolsVersion "24.0.1" - defaultConfig { - minSdkVersion 14 - targetSdkVersion 22 - testApplicationId "com.commonsware.android.async.test" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - } - - packagingOptions { - exclude 'LICENSE.txt' - } + defaultConfig { + minSdkVersion 14 + targetSdkVersion 22 + testApplicationId "com.commonsware.android.espresso.idle" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } } diff --git a/Testing/EspressoIdle/app/src/androidTest/java/com/commonsware/android/async/AsyncTest.java b/Testing/EspressoIdle/app/src/androidTest/java/com/commonsware/android/async/AsyncTest.java deleted file mode 100644 index f81c6ac26..000000000 --- a/Testing/EspressoIdle/app/src/androidTest/java/com/commonsware/android/async/AsyncTest.java +++ /dev/null @@ -1,27 +0,0 @@ -/*** - Copyright (c) 2015-2016 CommonsWare, LLC - Licensed under the Apache License, Version 2.0 (the "License"); you may not - use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required - by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - OF ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. - - From _The Busy Coder's Guide to Android Development_ - https://commonsware.com/Android - */ - -package com.commonsware.android.async; - -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; -import org.junit.Rule; -import org.junit.runner.RunWith; - -@RunWith(AndroidJUnit4.class) -public class AsyncTest { - @Rule - public final ActivityTestRule main - =new ActivityTestRule(AsyncDemo.class, true); -} diff --git a/Testing/EspressoIdle/app/src/androidTest/java/com/commonsware/android/okhttp/OkHttpTests.java b/Testing/EspressoIdle/app/src/androidTest/java/com/commonsware/android/okhttp/OkHttpTests.java new file mode 100644 index 000000000..3b07d69c3 --- /dev/null +++ b/Testing/EspressoIdle/app/src/androidTest/java/com/commonsware/android/okhttp/OkHttpTests.java @@ -0,0 +1,93 @@ +/*** + Copyright (c) 2016 CommonsWare, LLC + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. + + From _The Busy Coder's Guide to Android Development_ + https://commonsware.com/Android + */ + +package com.commonsware.android.okhttp; + +import android.support.test.espresso.Espresso; +import android.support.test.espresso.IdlingResource; +import android.support.test.espresso.NoMatchingViewException; +import android.support.test.espresso.ViewAssertion; +import android.support.test.rule.ActivityTestRule; +import android.support.test.runner.AndroidJUnit4; +import android.view.View; +import android.widget.AdapterView; +import com.jakewharton.espresso.OkHttp3IdlingResource; +import junit.framework.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import java.io.IOException; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.matcher.ViewMatchers.withId; + +@RunWith(AndroidJUnit4.class) +public class OkHttpTests { + @Rule + public final ActivityTestRule main + =new ActivityTestRule(MainActivity.class, true); + + private static final String URL= + "https://wares.commonsware.com/test.json"; + private static final String EXPECTED="{\"Hello\": \"world\"}"; + + @Test + public void syncTest() throws IOException { + OkHttpClient client=new OkHttpClient.Builder().build(); + Request request=new Request.Builder().url(URL).build(); + Response response=client.newCall(request).execute(); + + Assert.assertEquals(EXPECTED, response.body().string()); + } + + @Test + public void unreliableAsyncTest() { + onView(withId(android.R.id.list)) + .check(new AdapterCountAssertion(100)); + } + + @Test + public void moreReliableAsyncTest() { + IdlingResource idleWild= + OkHttp3IdlingResource.create("okhttp3", + main.getActivity().getOkHttpClient()); + + Espresso.registerIdlingResources(idleWild); + + try { + onView(withId(android.R.id.list)) + .check(new AdapterCountAssertion(100)); + } + finally { + Espresso.unregisterIdlingResources(idleWild); + } + } + + static class AdapterCountAssertion implements ViewAssertion { + private final int count; + + AdapterCountAssertion(int count) { + this.count=count; + } + + @Override + public void check(View view, + NoMatchingViewException noViewFoundException) { + Assert.assertTrue(view instanceof AdapterView); + Assert.assertEquals(count, + ((AdapterView)view).getAdapter().getCount()); + } + }} diff --git a/Testing/EspressoIdle/app/src/main/AndroidManifest.xml b/Testing/EspressoIdle/app/src/main/AndroidManifest.xml index 6a4daf48f..bce0bcc43 100644 --- a/Testing/EspressoIdle/app/src/main/AndroidManifest.xml +++ b/Testing/EspressoIdle/app/src/main/AndroidManifest.xml @@ -1,25 +1,18 @@ - - - + + android:theme="@style/Theme.Apptheme"> @@ -29,4 +22,4 @@ - + \ No newline at end of file diff --git a/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/async/AsyncDemoFragment.java b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/async/AsyncDemoFragment.java deleted file mode 100644 index 6b520ad48..000000000 --- a/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/async/AsyncDemoFragment.java +++ /dev/null @@ -1,97 +0,0 @@ -/*** - Copyright (c) 2008-2014 CommonsWare, LLC - Licensed under the Apache License, Version 2.0 (the "License"); you may not - use this file except in compliance with the License. You may obtain a copy - of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required - by applicable law or agreed to in writing, software distributed under the - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - OF ANY KIND, either express or implied. See the License for the specific - language governing permissions and limitations under the License. - - From _The Busy Coder's Guide to Android Development_ - https://commonsware.com/Android - */ - -package com.commonsware.android.async; - -import android.app.ListFragment; -import android.os.AsyncTask; -import android.os.Bundle; -import android.os.SystemClock; -import android.view.View; -import android.widget.ArrayAdapter; -import android.widget.Toast; -import java.util.ArrayList; - -public class AsyncDemoFragment extends ListFragment { - private static final String[] items= { "lorem", "ipsum", "dolor", - "sit", "amet", "consectetuer", "adipiscing", "elit", "morbi", - "vel", "ligula", "vitae", "arcu", "aliquet", "mollis", "etiam", - "vel", "erat", "placerat", "ante", "porttitor", "sodales", - "pellentesque", "augue", "purus" }; - private ArrayList model=new ArrayList(); - private ArrayAdapter adapter=null; - private AddStringTask task=null; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setRetainInstance(true); - - task=new AddStringTask(); - task.execute(); - - adapter= - new ArrayAdapter(getActivity(), - android.R.layout.simple_list_item_1, - model); - } - - @Override - public void onViewCreated(View v, Bundle savedInstanceState) { - super.onViewCreated(v, savedInstanceState); - - getListView().setScrollbarFadingEnabled(false); - setListAdapter(adapter); - } - - @Override - public void onDestroy() { - if (task != null) { - task.cancel(false); - } - - super.onDestroy(); - } - - class AddStringTask extends AsyncTask { - @Override - protected Void doInBackground(Void... unused) { - for (String item : items) { - if (isCancelled()) - break; - - publishProgress(item); - SystemClock.sleep(400); - } - - return(null); - } - - @Override - protected void onProgressUpdate(String... item) { - if (!isCancelled()) { - adapter.add(item[0]); - } - } - - @Override - protected void onPostExecute(Void unused) { - Toast.makeText(getActivity(), R.string.done, Toast.LENGTH_SHORT) - .show(); - - task=null; - } - } -} diff --git a/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/async/AsyncDemo.java b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/Item.java similarity index 55% rename from Testing/EspressoIdle/app/src/main/java/com/commonsware/android/async/AsyncDemo.java rename to Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/Item.java index 7752fbd0c..23726cef4 100644 --- a/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/async/AsyncDemo.java +++ b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/Item.java @@ -1,5 +1,5 @@ /*** - Copyright (c) 2012-14 CommonsWare, LLC + Copyright (c) 2013-2015 CommonsWare, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required @@ -12,20 +12,14 @@ https://commonsware.com/Android */ -package com.commonsware.android.async; +package com.commonsware.android.okhttp; -import android.app.Activity; -import android.os.Bundle; - -public class AsyncDemo extends Activity { +public class Item { + String title; + String link; + @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - if (getFragmentManager().findFragmentById(android.R.id.content) == null) { - getFragmentManager().beginTransaction() - .add(android.R.id.content, - new AsyncDemoFragment()).commit(); - } + public String toString() { + return(title); } } diff --git a/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/MainActivity.java b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/MainActivity.java new file mode 100644 index 000000000..7ae15d77e --- /dev/null +++ b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/MainActivity.java @@ -0,0 +1,59 @@ +/*** + Copyright (c) 2013-2015 CommonsWare, LLC + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. + + From _The Busy Coder's Guide to Android Development_ + https://commonsware.com/Android + */ + +package com.commonsware.android.okhttp; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import de.greenrobot.event.EventBus; +import okhttp3.OkHttpClient; + +public class MainActivity extends Activity { + private final OkHttpClient client= + new OkHttpClient.Builder().build(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + if (getFragmentManager().findFragmentById(android.R.id.content) == null) { + getFragmentManager().beginTransaction() + .add(android.R.id.content, + new QuestionsFragment()).commit(); + } + } + + @Override + public void onResume() { + super.onResume(); + EventBus.getDefault().register(this); + } + + @Override + public void onPause() { + EventBus.getDefault().unregister(this); + super.onPause(); + } + + public void onEventMainThread(QuestionClickedEvent event) { + startActivity(new Intent(Intent.ACTION_VIEW, + Uri.parse(event.item.link))); + } + + OkHttpClient getOkHttpClient() { + return(client); + } +} diff --git a/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionClickedEvent.java b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionClickedEvent.java new file mode 100644 index 000000000..91637a5e7 --- /dev/null +++ b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionClickedEvent.java @@ -0,0 +1,23 @@ +/*** + Copyright (c) 2013-2015 CommonsWare, LLC + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. + + From _The Busy Coder's Guide to Android Development_ + https://commonsware.com/Android + */ + +package com.commonsware.android.okhttp; + +public class QuestionClickedEvent { + final Item item; + + QuestionClickedEvent(Item item) { + this.item=item; + } +} diff --git a/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionsFragment.java b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionsFragment.java new file mode 100644 index 000000000..887361941 --- /dev/null +++ b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionsFragment.java @@ -0,0 +1,110 @@ +/*** + Copyright (c) 2013-2015 CommonsWare, LLC + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. + + From _The Busy Coder's Guide to Android Development_ + https://commonsware.com/Android + */ + +package com.commonsware.android.okhttp; + +import android.app.ListFragment; +import android.os.Bundle; +import android.text.Html; +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.TextView; +import com.google.gson.Gson; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.Reader; +import java.util.List; +import de.greenrobot.event.EventBus; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +public class QuestionsFragment extends ListFragment { + static final String SO_URL= + "https://api.stackexchange.com/2.1/questions?pagesize=100&" + + "order=desc&sort=creation&site=stackoverflow&tagged=android"; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setRetainInstance(true); + } + + @Override + public void onViewCreated(final View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + OkHttpClient client=((MainActivity)getActivity()).getOkHttpClient(); + Request request=new Request.Builder().url(SO_URL).build(); + + client.newCall(request).enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + Log.e(getClass().getSimpleName(), "Exception loading JSON", e); + } + + @Override + public void onResponse(Call call, Response response) + throws IOException { + if (response.isSuccessful()) { + Reader in=response.body().charStream(); + BufferedReader reader=new BufferedReader(in); + final SOQuestions questions= + new Gson().fromJson(reader, SOQuestions.class); + + reader.close(); + + view.post(new Runnable() { + @Override + public void run() { + setListAdapter(new ItemsAdapter(questions.items)); + } + }); + } + else { + Log.e(getClass().getSimpleName(), response.toString()); + } + } + }); + } + + @Override + public void onListItemClick(ListView l, View v, int position, long id) { + Item item=((ItemsAdapter)getListAdapter()).getItem(position); + + EventBus.getDefault().post(new QuestionClickedEvent(item)); + } + + class ItemsAdapter extends ArrayAdapter { + ItemsAdapter(List items) { + super(getActivity(), android.R.layout.simple_list_item_1, items); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View row=super.getView(position, convertView, parent); + TextView title=(TextView)row.findViewById(android.R.id.text1); + + title.setText(Html.fromHtml(getItem(position).title)); + + return(row); + } + } +} diff --git a/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionsLoadedEvent.java b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionsLoadedEvent.java new file mode 100644 index 000000000..a58b8acf6 --- /dev/null +++ b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/QuestionsLoadedEvent.java @@ -0,0 +1,23 @@ +/*** + Copyright (c) 2013-2015 CommonsWare, LLC + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. + + From _The Busy Coder's Guide to Android Development_ + https://commonsware.com/Android + */ + +package com.commonsware.android.okhttp; + +public class QuestionsLoadedEvent { + final SOQuestions questions; + + QuestionsLoadedEvent(SOQuestions questions) { + this.questions=questions; + } +} diff --git a/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/SOQuestions.java b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/SOQuestions.java new file mode 100644 index 000000000..24c1854df --- /dev/null +++ b/Testing/EspressoIdle/app/src/main/java/com/commonsware/android/okhttp/SOQuestions.java @@ -0,0 +1,21 @@ +/*** + Copyright (c) 2013-2015 CommonsWare, LLC + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. + + From _The Busy Coder's Guide to Android Development_ + https://commonsware.com/Android + */ + +package com.commonsware.android.okhttp; + +import java.util.List; + +public class SOQuestions { + List items; +} diff --git a/Testing/EspressoIdle/app/src/main/res/layout/main.xml b/Testing/EspressoIdle/app/src/main/res/layout/main.xml deleted file mode 100644 index 888834357..000000000 --- a/Testing/EspressoIdle/app/src/main/res/layout/main.xml +++ /dev/null @@ -1,8 +0,0 @@ - - diff --git a/Testing/EspressoIdle/app/src/main/res/values-v21/styles.xml b/Testing/EspressoIdle/app/src/main/res/values-v21/styles.xml new file mode 100644 index 000000000..00b1fe634 --- /dev/null +++ b/Testing/EspressoIdle/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/Testing/EspressoIdle/app/src/main/res/values/colors.xml b/Testing/EspressoIdle/app/src/main/res/values/colors.xml new file mode 100644 index 000000000..767e57a91 --- /dev/null +++ b/Testing/EspressoIdle/app/src/main/res/values/colors.xml @@ -0,0 +1,8 @@ + + + #3f51b5 + #1a237e + #ffee58 + #fafafa + #f1f1f1 + \ No newline at end of file diff --git a/Testing/EspressoIdle/app/src/main/res/values/strings.xml b/Testing/EspressoIdle/app/src/main/res/values/strings.xml index 7561da33f..5aa26d20e 100644 --- a/Testing/EspressoIdle/app/src/main/res/values/strings.xml +++ b/Testing/EspressoIdle/app/src/main/res/values/strings.xml @@ -1,5 +1,6 @@ - AsyncTask Demo - Done! - \ No newline at end of file + + OkHttp Demo + + diff --git a/Testing/EspressoIdle/app/src/main/res/values/styles.xml b/Testing/EspressoIdle/app/src/main/res/values/styles.xml new file mode 100644 index 000000000..1a4c79405 --- /dev/null +++ b/Testing/EspressoIdle/app/src/main/res/values/styles.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/Testing/EspressoIdle/build.gradle b/Testing/EspressoIdle/build.gradle index e220f0b80..d14039de2 100644 --- a/Testing/EspressoIdle/build.gradle +++ b/Testing/EspressoIdle/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.2' + classpath 'com.android.tools.build:gradle:2.1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/Testing/EspressoIdle/gradle/wrapper/gradle-wrapper.properties b/Testing/EspressoIdle/gradle/wrapper/gradle-wrapper.properties index d57051703..03a6d0a4d 100644 --- a/Testing/EspressoIdle/gradle/wrapper/gradle-wrapper.properties +++ b/Testing/EspressoIdle/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Thu Aug 18 10:22:37 EDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/Testing/EspressoIdle/proguard-project.txt b/Testing/EspressoIdle/proguard-project.txt new file mode 100644 index 000000000..f2fe1559a --- /dev/null +++ b/Testing/EspressoIdle/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/Testing/EspressoIdle/proguard.cfg b/Testing/EspressoIdle/proguard.cfg deleted file mode 100644 index b1cdf17b5..000000000 --- a/Testing/EspressoIdle/proguard.cfg +++ /dev/null @@ -1,40 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} diff --git a/Testing/EspressoIdle/project.properties b/Testing/EspressoIdle/project.properties index 0a458d4d7..4e1cb586b 100644 --- a/Testing/EspressoIdle/project.properties +++ b/Testing/EspressoIdle/project.properties @@ -1 +1 @@ -target=android-19 +target=android-19 \ No newline at end of file