Skip to content

Commit 451b53c

Browse files
committed
Non ndk builds
1 parent bf41068 commit 451b53c

File tree

1,604 files changed

+20234
-6232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,604 files changed

+20234
-6232
lines changed
File renamed without changes.
File renamed without changes.

ActivityLifecycle/app/build.gradle

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 26
5+
buildToolsVersion "26.0.2"
6+
defaultConfig {
7+
applicationId "com.cirosantilli.android_cheat.activitylifecycle"
8+
minSdkVersion 15
9+
targetSdkVersion 26
10+
versionCode 1
11+
versionName "1.0"
12+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
implementation fileTree(dir: 'libs', include: ['*.jar'])
24+
implementation 'com.android.support:appcompat-v7:26.1.0'
25+
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
26+
testImplementation 'junit:junit:4.12'
27+
androidTestImplementation 'com.android.support.test:runner:1.0.1'
28+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
29+
}
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.cirosantilli.android_cheat.activitylifecycle;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumentation test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.cirosantilli.android_cheat.activitylifecycle", appContext.getPackageName());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.cirosantilli.android_cheat.activitylifecycle">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package com.cirosantilli.android_cheat.activitylifecycle;
2+
3+
import android.app.Activity;
4+
import android.content.Intent;
5+
import android.os.Bundle;
6+
import android.util.Log;
7+
import android.view.View;
8+
import android.widget.Button;
9+
import android.widget.Toast;
10+
11+
public class MainActivity extends Activity {
12+
private void toastLog(String s) {
13+
Toast.makeText(this.getApplicationContext(),
14+
s, Toast.LENGTH_SHORT).show();
15+
Log.d("ActivityLifecycle", s);
16+
}
17+
18+
@Override
19+
protected void onCreate(Bundle savedInstanceState) {
20+
super.onCreate(savedInstanceState);
21+
toastLog("onCreate");
22+
final Button button = new Button(this);
23+
button.setText("click me to go to activity 2");
24+
button.setOnClickListener(new View.OnClickListener() {
25+
@Override
26+
public void onClick(View view) {
27+
MainActivity.this.startActivity(new Intent(MainActivity.this, MainActivity.Activity2.class));
28+
}
29+
});
30+
this.setContentView(button);
31+
}
32+
33+
protected void onStart() {
34+
super.onStart();
35+
toastLog("onStart");
36+
}
37+
38+
protected void onRestart() {
39+
super.onRestart();
40+
toastLog("onRestart");
41+
}
42+
43+
protected void onResume() {
44+
super.onResume();
45+
toastLog("onResume");
46+
}
47+
48+
protected void onPause() {
49+
super.onPause();
50+
toastLog("onPause");
51+
}
52+
53+
protected void onStop() {
54+
super.onStop();
55+
toastLog("onStop");
56+
}
57+
58+
protected void onDestroy() {
59+
super.onDestroy();
60+
toastLog("onDestroy");
61+
}
62+
63+
public static class Activity2 extends Activity {
64+
@Override
65+
protected void onCreate(Bundle savedInstanceState) {
66+
super.onCreate(savedInstanceState);
67+
final Button button = new Button(this);
68+
button.setText("click me to go to activity 1");
69+
button.setOnClickListener(new View.OnClickListener() {
70+
@Override
71+
public void onClick(View view) {
72+
MainActivity.Activity2.this.startActivity(new Intent(MainActivity.Activity2.this, MainActivity.class));
73+
}
74+
});
75+
this.setContentView(button);
76+
}
77+
}
78+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
tools:context="com.cirosantilli.android_cheat.activitylifecycle.MainActivity">
8+
9+
<TextView
10+
android:layout_width="wrap_content"
11+
android:layout_height="wrap_content"
12+
android:text="Hello World!"
13+
app:layout_constraintBottom_toBottomOf="parent"
14+
app:layout_constraintLeft_toLeftOf="parent"
15+
app:layout_constraintRight_toRightOf="parent"
16+
app:layout_constraintTop_toTopOf="parent" />
17+
18+
</android.support.constraint.ConstraintLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">ActivityLifecycle</string>
3+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.cirosantilli.android_cheat.activitylifecycle;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.*;
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11+
*/
12+
public class ExampleUnitTest {
13+
@Test
14+
public void addition_isCorrect() throws Exception {
15+
assertEquals(4, 2 + 2);
16+
}
17+
}

ActivityLifecycle/build.gradle

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
repositories {
5+
google()
6+
jcenter()
7+
}
8+
dependencies {
9+
classpath 'com.android.tools.build:gradle:3.0.0'
10+
11+
// NOTE: Do not place your application dependencies here; they belong
12+
// in the individual module build.gradle files
13+
}
14+
}
15+
16+
allprojects {
17+
repositories {
18+
google()
19+
jcenter()
20+
}
21+
}
22+
23+
task clean(type: Delete) {
24+
delete rootProject.buildDir
25+
}
File renamed without changes.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Sun Nov 19 12:09:19 GMT 2017
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

AlertDialog/app/build.gradle

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 26
5+
buildToolsVersion "26.0.2"
6+
defaultConfig {
7+
applicationId "com.cirosantilli.android_cheat.activitylifecycle"
8+
minSdkVersion 15
9+
targetSdkVersion 26
10+
versionCode 1
11+
versionName "1.0"
12+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
implementation fileTree(dir: 'libs', include: ['*.jar'])
24+
implementation 'com.android.support:appcompat-v7:26.1.0'
25+
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
26+
testImplementation 'junit:junit:4.12'
27+
androidTestImplementation 'com.android.support.test:runner:1.0.1'
28+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
29+
}
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.cirosantilli.android_cheat.alertdialog;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumentation test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.cirosantilli.android_cheat.alertdialog", appContext.getPackageName());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.cirosantilli.android_cheat.alertdialog">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.cirosantilli.android_cheat.alertdialog;
2+
3+
import android.app.Activity;
4+
import android.app.AlertDialog;
5+
import android.content.DialogInterface;
6+
import android.os.Bundle;
7+
import android.widget.TextView;
8+
9+
public class MainActivity extends Activity {
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
super.onCreate(savedInstanceState);
13+
final TextView textView = new TextView(this);
14+
textView.setText("before");
15+
this.setContentView(textView);
16+
new AlertDialog.Builder(this)
17+
.setTitle("Title of alert")
18+
.setMessage("Message of the alert. Yes or no?")
19+
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
20+
public void onClick(DialogInterface dialog, int which) {
21+
textView.setText("yes");
22+
}
23+
})
24+
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
25+
public void onClick(DialogInterface dialog, int which) {
26+
textView.setText("no");
27+
}
28+
})
29+
.setIcon(android.R.drawable.ic_dialog_alert)
30+
.show();
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
tools:context="com.cirosantilli.android_cheat.alertdialog.MainActivity">
8+
9+
<TextView
10+
android:layout_width="wrap_content"
11+
android:layout_height="wrap_content"
12+
android:text="Hello World!"
13+
app:layout_constraintBottom_toBottomOf="parent"
14+
app:layout_constraintLeft_toLeftOf="parent"
15+
app:layout_constraintRight_toRightOf="parent"
16+
app:layout_constraintTop_toTopOf="parent" />
17+
18+
</android.support.constraint.ConstraintLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">AlertDialog</string>
3+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.cirosantilli.android_cheat.alertdialog;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.*;
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11+
*/
12+
public class ExampleUnitTest {
13+
@Test
14+
public void addition_isCorrect() throws Exception {
15+
assertEquals(4, 2 + 2);
16+
}
17+
}

0 commit comments

Comments
 (0)