From 787e6a7f501a90a10c7ea043e7d93a84cdef1153 Mon Sep 17 00:00:00 2001 From: adorokhine Date: Tue, 10 Jan 2017 18:19:50 -0800 Subject: Rename example folders so they do not start with a number. (#15) This causes problems for some systems. --- .../mobly/snippet/example2/MainActivity.java | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java (limited to 'examples/ex2_espresso/src/main/java/com/google/android/mobly') diff --git a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java new file mode 100644 index 0000000..40311c3 --- /dev/null +++ b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2016 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.android.mobly.snippet.example2; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +public class MainActivity extends AppCompatActivity { + private TextView mTextView; + private Button mButton; + private int mNumPressed; + + /** + * Attaches a simple listener that increments the text in the textbox whenever the button is + * pressed. + */ + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + mTextView = (TextView) findViewById(R.id.main_text_view); + mButton = (Button) findViewById(R.id.main_button); + mButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mNumPressed++; + mTextView.setText("Button pressed " + mNumPressed + " times"); + } + }); + } +} -- cgit v1.2.3 From aeddc8bcd123ddf6c865622464001fe0f3835b87 Mon Sep 17 00:00:00 2001 From: Keith Dart Date: Fri, 15 Dec 2017 19:40:09 -0800 Subject: Update gradle, dependency versions and fix lint reported issues (#80) * Update to latest build tools. * Fix lint issues and reformat. * Add presubmit target. * Fix IDE reported issues. * Fix test runner versions in example. * Review feedback changes. * Make getPrivateInetAddress a private method. --- .../java/com/google/android/mobly/snippet/example2/MainActivity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/ex2_espresso/src/main/java/com/google/android/mobly') diff --git a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java index 40311c3..940418a 100644 --- a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java +++ b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java @@ -16,6 +16,7 @@ package com.google.android.mobly.snippet.example2; +import java.util.Locale; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; @@ -42,7 +43,7 @@ public class MainActivity extends AppCompatActivity { @Override public void onClick(View v) { mNumPressed++; - mTextView.setText("Button pressed " + mNumPressed + " times"); + mTextView.setText(String.format(Locale.ROOT, "Button pressed %d times.", mNumPressed)); } }); } -- cgit v1.2.3 From c0d86eb455d97c0969291755162cd6c7ae7ca689 Mon Sep 17 00:00:00 2001 From: Ang Li Date: Fri, 15 Dec 2017 20:06:51 -0800 Subject: Revert "Update gradle, dependency versions and fix lint reported issues (#80)" (#82) This reverts commit aeddc8bcd123ddf6c865622464001fe0f3835b87. --- .../java/com/google/android/mobly/snippet/example2/MainActivity.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'examples/ex2_espresso/src/main/java/com/google/android/mobly') diff --git a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java index 940418a..40311c3 100644 --- a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java +++ b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java @@ -16,7 +16,6 @@ package com.google.android.mobly.snippet.example2; -import java.util.Locale; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; @@ -43,7 +42,7 @@ public class MainActivity extends AppCompatActivity { @Override public void onClick(View v) { mNumPressed++; - mTextView.setText(String.format(Locale.ROOT, "Button pressed %d times.", mNumPressed)); + mTextView.setText("Button pressed " + mNumPressed + " times"); } }); } -- cgit v1.2.3 From 4d02684ade1a312b39591a94a92328dc0b65b883 Mon Sep 17 00:00:00 2001 From: Ang Li Date: Fri, 15 Dec 2017 21:12:33 -0800 Subject: Revert "Revert "Update gradle, dependency versions and fix lint reported issues (#80)" (#82)" (#83) This reverts commit c0d86eb455d97c0969291755162cd6c7ae7ca689. --- .../java/com/google/android/mobly/snippet/example2/MainActivity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/ex2_espresso/src/main/java/com/google/android/mobly') diff --git a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java index 40311c3..940418a 100644 --- a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java +++ b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java @@ -16,6 +16,7 @@ package com.google.android.mobly.snippet.example2; +import java.util.Locale; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; @@ -42,7 +43,7 @@ public class MainActivity extends AppCompatActivity { @Override public void onClick(View v) { mNumPressed++; - mTextView.setText("Button pressed " + mNumPressed + " times"); + mTextView.setText(String.format(Locale.ROOT, "Button pressed %d times.", mNumPressed)); } }); } -- cgit v1.2.3 From a337f516cdce2882bb2a9661229f92a14d898fe3 Mon Sep 17 00:00:00 2001 From: Ang Li Date: Mon, 28 Jan 2019 17:30:29 -0800 Subject: Migrate to `androidx`. (#101) --- .../java/com/google/android/mobly/snippet/example2/MainActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/ex2_espresso/src/main/java/com/google/android/mobly') diff --git a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java index 940418a..0cc0b54 100644 --- a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java +++ b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java @@ -17,7 +17,7 @@ package com.google.android.mobly.snippet.example2; import java.util.Locale; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; -- cgit v1.2.3