Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Add java files
Browse files Browse the repository at this point in the history
  • Loading branch information
ljbade committed Nov 5, 2014
1 parent 0da778d commit bff63d4
Show file tree
Hide file tree
Showing 38 changed files with 3,645 additions and 0 deletions.
14 changes: 14 additions & 0 deletions android/java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Gradle files
.gradle/

# IntelliJ files
.idea
*.iml

# Build files
build/
*/build/
*.so

# Local settings
local.properties
23 changes: 23 additions & 0 deletions android/java/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion "21.1.0"

defaultConfig {
applicationId "com.mapbox.mapboxgl.app"
minSdkVersion 19
targetSdkVersion 20
}

buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile project(':lib')
}
4 changes: 4 additions & 0 deletions android/java/app/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<lint>
<issue id="HardcodedDebugMode" severity="warning" />
</lint>
33 changes: 33 additions & 0 deletions android/java/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mapbox.mapboxgl.app"
android:versionCode="1"
android:versionName="1.0" >

<uses-feature android:glEsVersion="0x00020000" />

<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.mapbox.mapboxgl.app.MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize">
</activity>
<activity
android:name="com.mapbox.mapboxgl.app.FragmentActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.mapbox.mapboxgl.app;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class FragmentActivity extends Activity {

//
// Static members
//

// Tag used for logging
private static final String TAG = "FragmentActivity";

//
// Lifecycle events
//

// Called when activity is created
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v(TAG, "onCreate");

// Load the layout
setContentView(R.layout.activity_fragment);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package com.mapbox.mapboxgl.app;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

import com.mapbox.mapboxgl.lib.MapView;

public class MainActivity extends Activity {

//
// Static members
//

// Tag used for logging
private static final String TAG = "MainActivity";

// The map
private MapView mMapView;

//
// Lifecycle events
//

// Called when the activity is created
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v(TAG, "onCreate");

// Load the layout
setContentView(R.layout.activity_main);
mMapView = (MapView) findViewById(R.id.map);

// Need to pass on any saved state to the map
mMapView.onCreate(savedInstanceState);
}

// Called when the activity is destroyed
@Override
protected void onDestroy() {
super.onDestroy();
Log.v(TAG, "onDestroy");

// Need to pass on to view
mMapView.onDestroy();
}

// Called when the activity is visible
@Override
protected void onStart() {
super.onStart();
Log.v(TAG, "onStart");

// Need to pass on to view
mMapView.onStart();
}

// Called when the activity is invisible
@Override
protected void onStop() {
super.onStop();
Log.v(TAG, "onStop");

// Need to pass on to view
mMapView.onStop();
}

// Called when the activity is in the background
@Override
protected void onPause() {
super.onPause();
Log.v(TAG, "onPause");

// Need to pass on to view
mMapView.onPause();
}

// Called when the activity is no longer in the background
@Override
protected void onResume() {
super.onResume();
Log.v(TAG, "onResume");

// Need to pass on to view
mMapView.onResume();
}

// Called before activity is destroyed
@Override
protected void onSaveInstanceState(Bundle outState) {
Log.v(TAG, "onSaveInstanceState");

// Need to retrieve any saved state from the map
mMapView.onSaveInstanceState(outState);
super.onSaveInstanceState(outState);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions android/java/app/src/main/res/layout/activity_fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="${packageName}.${activityClass}" >

<fragment
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.mapbox.mapboxgl.lib.MapFragment"
android:id="@+id/map_fragment" />

</merge>
11 changes: 11 additions & 0 deletions android/java/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="${packageName}.${activityClass}" >

<view
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.mapbox.mapboxgl.lib.MapView"
android:id="@+id/map" />

</merge>
11 changes: 11 additions & 0 deletions android/java/app/src/main/res/values-v11/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<resources>

<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>

</resources>
12 changes: 12 additions & 0 deletions android/java/app/src/main/res/values-v14/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<resources>

<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>

</resources>
6 changes: 6 additions & 0 deletions android/java/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">Mapbox GL</string>

</resources>
20 changes: 20 additions & 0 deletions android/java/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<resources>

<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

</resources>
15 changes: 15 additions & 0 deletions android/java/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.2'
}
}

allprojects {
repositories {
jcenter()
}
}
Binary file added android/java/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions android/java/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip
Loading

0 comments on commit bff63d4

Please sign in to comment.