Skip to content

Commit 6162515

Browse files
committed
init checkin
1 parent 1f86fbb commit 6162515

File tree

23 files changed

+479
-7
lines changed

23 files changed

+479
-7
lines changed

.gitignore

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
*.iml
66
assets
77
bin
8-
gen
98
build
9+
jni
10+
obj
1011
local.properties
1112
gradle.properties
1213
bintray.properties
@@ -17,15 +18,12 @@ bintray.properties
1718
# JAR releases
1819
android/libs/*.jar
1920

21+
# Ignore libraries
22+
libs
23+
2024
# ctags
2125
tags
2226

2327

24-
# Mozilla Special Sauce
25-
# Never commit your private.properties file or your keystore
26-
android/properties/**
27-
28-
*.keystore
29-
3028
# Ignore final release APK builds
3129
outputs/*

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 21
5+
buildToolsVersion "21.0.0"
6+
7+
defaultConfig {
8+
applicationId "com.crankycoder.androidndk1"
9+
minSdkVersion 14
10+
targetSdkVersion 21
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
compile 'com.android.support:appcompat-v7:21.0.3'
25+
}

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/victorng/.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+
#}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.crankycoder.ndk1;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}

app/src/main/AndroidManifest.xml

Lines changed: 21 additions & 0 deletions
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.crankycoder.ndk1" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:theme="@style/AppTheme" >
10+
<activity
11+
android:name="com.crankycoder.ndk1.AndroidNDK1SampleActivity"
12+
android:label="@string/app_name" >
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>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.crankycoder.ndk1;
2+
3+
import android.os.Bundle;
4+
import android.support.v7.app.ActionBarActivity;
5+
import android.view.Menu;
6+
import android.view.MenuItem;
7+
import android.view.View;
8+
import android.widget.Button;
9+
10+
11+
public class AndroidNDK1SampleActivity extends ActionBarActivity {
12+
static {
13+
System.loadLibrary("ndk1");
14+
}
15+
16+
private native void helloLog(String logThis);
17+
18+
19+
@Override
20+
protected void onCreate(Bundle savedInstanceState) {
21+
super.onCreate(savedInstanceState);
22+
setContentView(R.layout.activity_android_ndk1_sample);
23+
24+
Button button = (Button) findViewById(R.id.button);
25+
button.setOnClickListener(new View.OnClickListener() {
26+
@Override
27+
public void onClick(View v) {
28+
helloLog("This will log to LogCat via the native call.");
29+
}
30+
});
31+
32+
}
33+
34+
35+
@Override
36+
public boolean onCreateOptionsMenu(Menu menu) {
37+
// Inflate the menu; this adds items to the action bar if it is present.
38+
getMenuInflater().inflate(R.menu.menu_android_ndk1_sample, menu);
39+
return true;
40+
}
41+
42+
@Override
43+
public boolean onOptionsItemSelected(MenuItem item) {
44+
// Handle action bar item clicks here. The action bar will
45+
// automatically handle clicks on the Home/Up button, so long
46+
// as you specify a parent activity in AndroidManifest.xml.
47+
int id = item.getItemId();
48+
49+
//noinspection SimplifiableIfStatement
50+
if (id == R.id.action_settings) {
51+
return true;
52+
}
53+
54+
return super.onOptionsItemSelected(item);
55+
}
56+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:paddingLeft="@dimen/activity_horizontal_margin"
6+
android:paddingRight="@dimen/activity_horizontal_margin"
7+
android:paddingTop="@dimen/activity_vertical_margin"
8+
android:paddingBottom="@dimen/activity_vertical_margin"
9+
tools:context=".AndroidNDK1SampleActivity">
10+
11+
<TextView
12+
android:text="@string/hello_world"
13+
android:layout_width="wrap_content"
14+
android:layout_height="wrap_content"
15+
android:id="@+id/textView"/>
16+
17+
<Button
18+
android:layout_width="wrap_content"
19+
android:layout_height="wrap_content"
20+
android:text="New Button"
21+
android:id="@+id/button"
22+
android:layout_below="@+id/textView"
23+
android:layout_alignParentLeft="true"
24+
android:layout_alignParentStart="true"
25+
android:layout_marginTop="54dp"/>
26+
27+
</RelativeLayout>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:app="http://schemas.android.com/apk/res-auto"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
tools:context=".AndroidNDK1SampleActivity">
5+
<item android:id="@+id/action_settings"
6+
android:title="@string/action_settings"
7+
android:orderInCategory="100"
8+
app:showAsAction="never"/>
9+
</menu>
3.34 KB
Loading

0 commit comments

Comments
 (0)