diff --git a/README.md b/README.md index e6b8940..e20ecfa 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,9 @@ app/libs/WhirlyGlobeMaply.aar ## Setup 1. Clone the repo and open Android Studio. -2. Select __Import project (Eclipse ADT, Gradle, etc.)__. -3. Navigate to the root of the repo. +2. Select __File__ / __Open__. +3. Navigate to and select the root directory of the repository. 4. Build and Run in Android Studio That's it! + diff --git a/app/.gitignore b/app/.gitignore index 796b96d..42afabf 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1 @@ -/build +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 8c127d9..a2e69cd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,29 +1,38 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 - buildToolsVersion "23.0.3" + compileSdkVersion 30 + buildToolsVersion "30.0.2" defaultConfig { - applicationId "io.theoutpost.helloearth" - minSdkVersion 17 - targetSdkVersion 24 + applicationId "com.mousebirdconsulting.helloearth" + minSdkVersion 28 + targetSdkVersion 30 versionCode 1 versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + buildTypes { release { minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - testCompile 'junit:junit:4.12' - compile(name: 'WhirlyGlobeMaply', ext: 'aar') - compile 'com.android.support:appcompat-v7:24.0.0' - compile 'com.android.support:support-v4:24.0.0' - compile 'com.squareup.okhttp:okhttp:2.3.0' -} + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.1' + implementation 'com.squareup.okhttp3:okhttp:3.14.2' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + implementation(name:'WhirlyGlobeMaply', ext:'aar') +} \ No newline at end of file diff --git a/app/libs/WhirlyGlobeMaply.aar b/app/libs/WhirlyGlobeMaply.aar index c932c49..5d66673 100644 Binary files a/app/libs/WhirlyGlobeMaply.aar and b/app/libs/WhirlyGlobeMaply.aar differ diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 255353f..481bb43 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,17 +1,21 @@ # Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/njh/Library/Android/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. # # 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 *; #} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/mousebirdconsulting/helloearth/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/mousebirdconsulting/helloearth/ExampleInstrumentedTest.java new file mode 100644 index 0000000..04f23e3 --- /dev/null +++ b/app/src/androidTest/java/com/mousebirdconsulting/helloearth/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.mousebirdconsulting.helloearth; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.mousebirdconsulting.helloearth", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/androidTest/java/io/theoutpost/helloearth/ApplicationTest.java b/app/src/androidTest/java/io/theoutpost/helloearth/ApplicationTest.java deleted file mode 100644 index ca7046a..0000000 --- a/app/src/androidTest/java/io/theoutpost/helloearth/ApplicationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package io.theoutpost.helloearth; - -import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * Testing Fundamentals - */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index dc5d7f8..d4866e3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,15 +1,15 @@ - - + package="com.mousebirdconsulting.helloearth"> + android:theme="@style/AppTheme" + android:usesCleartextTraffic="true"> @@ -18,5 +18,5 @@ - + \ No newline at end of file diff --git a/app/src/main/assets/mbtiles/geography-class_medres.mbtiles b/app/src/main/assets/mbtiles/geography-class_medres.mbtiles new file mode 100644 index 0000000..d39a044 Binary files /dev/null and b/app/src/main/assets/mbtiles/geography-class_medres.mbtiles differ diff --git a/app/src/main/java/com/mousebirdconsulting/helloearth/GeoJsonHttpTask.java b/app/src/main/java/com/mousebirdconsulting/helloearth/GeoJsonHttpTask.java new file mode 100644 index 0000000..4223be6 --- /dev/null +++ b/app/src/main/java/com/mousebirdconsulting/helloearth/GeoJsonHttpTask.java @@ -0,0 +1,63 @@ +package com.mousebirdconsulting.helloearth; + +import android.graphics.Color; +import android.os.AsyncTask; + +import com.mousebird.maply.BaseController; +import com.mousebird.maply.VectorInfo; +import com.mousebird.maply.VectorObject; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +@SuppressWarnings("deprecation") +public class GeoJsonHttpTask extends AsyncTask { + + private BaseController controller; + + public GeoJsonHttpTask(BaseController baseController) { + controller = baseController; + } + + @Override + protected String doInBackground(String... params) { + HttpURLConnection urlConnection; + try { + String urlStr = params[0]; + URL url = new URL(urlStr); + urlConnection = (HttpURLConnection) url.openConnection(); + urlConnection.setConnectTimeout(3000); + urlConnection.setReadTimeout(7000); + int statusCode = urlConnection.getResponseCode(); + + // 200 represents HTTP OK + if (statusCode == 200) { + BufferedReader r = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); + StringBuilder response = new StringBuilder(); + String line; + while ((line = r.readLine()) != null) { + response.append(line); + } + return response.toString(); + } + } catch (Exception e) { + // didn't work + } + return null; + } + + @Override + protected void onPostExecute(String json) { + VectorObject object = new VectorObject(); + if (object.fromGeoJSON(json)) { + object.setSelectable(true); + + VectorInfo vectorInfo = new VectorInfo(); + vectorInfo.setColor(Color.RED); + vectorInfo.setLineWidth(4.f); + controller.addVector(object, vectorInfo, BaseController.ThreadMode.ThreadAny); + } + } +} diff --git a/app/src/main/java/com/mousebirdconsulting/helloearth/HelloGeoJsonFragment.java b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloGeoJsonFragment.java new file mode 100644 index 0000000..410ece6 --- /dev/null +++ b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloGeoJsonFragment.java @@ -0,0 +1,86 @@ +package com.mousebirdconsulting.helloearth; + +import android.graphics.Color; +import android.os.AsyncTask; +import android.widget.Toast; + +import com.mousebird.maply.AttrDictionary; +import com.mousebird.maply.BaseController; +import com.mousebird.maply.ComponentObject; +import com.mousebird.maply.GlobeController; +import com.mousebird.maply.Point2d; +import com.mousebird.maply.SelectedObject; +import com.mousebird.maply.VectorInfo; +import com.mousebird.maply.VectorObject; + +public class HelloGeoJsonFragment extends HelloGlobeFragment { + + @Override + protected void controlHasStarted() { + super.controlHasStarted(); + + double latitude = 60 * Math.PI / 180; + double longitude = 90 * Math.PI / 180; + double zoom_earth_radius = 2.0; + globeControl.animatePositionGeo(longitude, latitude, zoom_earth_radius, 1.0); + + final String url = "https://s3.amazonaws.com/whirlyglobedocs/tutorialsupport/RUS.geojson"; + + if (loadTask != null) { + loadTask.cancel(true); + loadTask = null; + } + loadTask = new GeoJsonHttpTask(globeControl); + + loadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, url); + + // Tell the controller that this object is the gesture delegate. + globeControl.gestureDelegate = this; + } + + @Override + public void userDidSelect(GlobeController globeControl, SelectedObject[] selObjs, Point2d loc, Point2d screenLoc) { + super.userDidSelect(globeControl, selObjs, loc, screenLoc); + + String msg = "Selected feature count: " + selObjs.length; + for (SelectedObject obj : selObjs) { + // GeoJSON + if (obj.selObj instanceof VectorObject) { + VectorObject vectorObject = (VectorObject) obj.selObj; + AttrDictionary attributes = vectorObject.getAttributes(); + String adminName = attributes.getString("ADMIN"); + msg += "\nVector Object: " + adminName; + addSelectedObject(vectorObject); + } + } + + Toast.makeText(getActivity(), msg, Toast.LENGTH_LONG).show(); + } + + private void addSelectedObject(VectorObject vectorObject) { + // remove any previously-selected object + if (selectedComponentObject != null) { + globeControl.removeObject(selectedComponentObject, BaseController.ThreadMode.ThreadAny); + } + + // Re-add the object with different info + VectorInfo vectorInfo = new VectorInfo(); + vectorInfo.setColor(Color.argb(255,255,140,0)); // Gold + vectorInfo.setLineWidth(10.f); + vectorInfo.setDrawPriority(Integer.MAX_VALUE); // Make sure it draws on top of unselected vector + selectedComponentObject = globeControl.addVector(vectorObject, vectorInfo, BaseController.ThreadMode.ThreadAny); + } + + @Override + public void onDestroy() { + if (loadTask != null) { + loadTask.cancel(true); + loadTask = null; + } + super.onDestroy(); + } + + private GeoJsonHttpTask loadTask = null; + + private ComponentObject selectedComponentObject; +} diff --git a/app/src/main/java/com/mousebirdconsulting/helloearth/HelloGlobeFragment.java b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloGlobeFragment.java new file mode 100644 index 0000000..e4c83de --- /dev/null +++ b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloGlobeFragment.java @@ -0,0 +1,68 @@ +package com.mousebirdconsulting.helloearth; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.mousebird.maply.GlobeMapFragment; +import com.mousebird.maply.QuadImageLoader; +import com.mousebird.maply.RemoteTileInfoNew; +import com.mousebird.maply.RenderController; +import com.mousebird.maply.SamplingParams; +import com.mousebird.maply.SphericalMercatorCoordSystem; + +import java.io.File; + +public class HelloGlobeFragment extends GlobeMapFragment { + + protected MapDisplayType chooseDisplayType() { + return MapDisplayType.Globe; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle inState) { + super.onCreateView(inflater, container, inState); + + // Do app specific setup logic. + + return baseControl.getContentView(); + } + + @Override + protected void controlHasStarted() { + // Set up the local cache directory + String cacheDirName = "stamen_watercolor6"; + File cacheDir = new File(getActivity().getCacheDir(), cacheDirName); + cacheDir.mkdir(); + + // Set up access to the tile images + RemoteTileInfoNew tileInfo = + new RemoteTileInfoNew("http://tile.stamen.com/watercolor/{z}/{x}/{y}.png",0, 18); + tileInfo.cacheDir = cacheDir; + + // Set up the globe parameters + SamplingParams params = new SamplingParams(); + params.setCoordSystem(new SphericalMercatorCoordSystem()); + params.setCoverPoles(true); + params.setEdgeMatching(true); + params.setMinZoom(tileInfo.minZoom); + params.setMaxZoom(tileInfo.maxZoom); + params.setSingleLevel(true); + + // Set up an image loader, tying all the previous together. + QuadImageLoader loader = new QuadImageLoader(params, tileInfo, baseControl); + loader.setImageFormat(RenderController.ImageFormat.MaplyImageUShort565); + + // Go to a specific location with animation + // + // `globeControl` is the controller when using MapDisplayType.Globe + // `mapControl` is the controller when using MapDisplayType.Map + // `baseControl` refers to whichever of them is used. + double latitude = 40.5023056 * Math.PI / 180; + double longitude = -3.6704803 * Math.PI / 180; + double zoom_earth_radius = 0.5; + globeControl.animatePositionGeo(longitude, latitude, zoom_earth_radius, 1.0); + } +} diff --git a/app/src/main/java/com/mousebirdconsulting/helloearth/HelloLabelFragment.java b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloLabelFragment.java new file mode 100644 index 0000000..52bd811 --- /dev/null +++ b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloLabelFragment.java @@ -0,0 +1,76 @@ +package com.mousebirdconsulting.helloearth; + +import android.graphics.Color; +import android.graphics.Typeface; + +import com.mousebird.maply.BaseController; +import com.mousebird.maply.ComponentObject; +import com.mousebird.maply.LabelInfo; +import com.mousebird.maply.Point2d; +import com.mousebird.maply.ScreenLabel; + +import java.util.ArrayList; +import java.util.List; + +public class HelloLabelFragment extends HelloMarkerFragment { + + @Override + protected void controlHasStarted() { + super.controlHasStarted(); + + // Insert Labels + insertLabels(); + } + + private void insertLabels() { + List labels = new ArrayList<>(); + + LabelInfo labelInfo = new LabelInfo(); + labelInfo.setFontSize(30f); + labelInfo.setTextColor(Color.BLACK); + labelInfo.setTypeface(Typeface.SERIF); + labelInfo.setLayoutPlacement(LabelInfo.LayoutRight); + labelInfo.setOutlineColor(Color.WHITE); + labelInfo.setOutlineSize(1.f); + + float layoutImportance = 1.f; + + // Moscow - Москва + ScreenLabel label = new ScreenLabel(); + label.loc = Point2d.FromDegrees(37.616667, 55.75); // Longitude, Latitude + label.text = "Москва"; + label.layoutImportance = layoutImportance++; + labels.add(label); + + // Saint Petersburg - Санкт-Петербург + label = new ScreenLabel(); + label.loc = Point2d.FromDegrees(30.3, 59.95); + label.text = "Санкт-Петербург"; + label.layoutImportance = layoutImportance++; + labels.add(label); + + // Novosibirsk - Новосибирск + label = new ScreenLabel(); + label.loc = Point2d.FromDegrees(82.95, 55.05); + label.text = "Новосибирск"; + label.layoutImportance = layoutImportance++; + labels.add(label); + + // Yekaterinburg - Екатеринбург + label = new ScreenLabel(); + label.loc = Point2d.FromDegrees(60.583333, 56.833333); + label.text = "Екатеринбург"; + label.layoutImportance = layoutImportance++; + labels.add(label); + + // Nizhny Novgorod - Нижний Новгород + label = new ScreenLabel(); + label.loc = Point2d.FromDegrees(44.0075, 56.326944); + label.text = "Нижний Новгород"; + label.layoutImportance = layoutImportance++; + label.rotation = Math.PI / 8; + labels.add(label); + + // Add your markers to the map controller. + ComponentObject co = globeControl.addScreenLabels(labels, labelInfo, BaseController.ThreadMode.ThreadAny); } +} diff --git a/app/src/main/java/com/mousebirdconsulting/helloearth/HelloMapFragment.java b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloMapFragment.java new file mode 100644 index 0000000..071c27a --- /dev/null +++ b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloMapFragment.java @@ -0,0 +1,68 @@ +package com.mousebirdconsulting.helloearth; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.mousebird.maply.GlobeMapFragment; +import com.mousebird.maply.QuadImageLoader; +import com.mousebird.maply.RemoteTileInfoNew; +import com.mousebird.maply.RenderController; +import com.mousebird.maply.SamplingParams; +import com.mousebird.maply.SphericalMercatorCoordSystem; + +import java.io.File; + +public class HelloMapFragment extends GlobeMapFragment { + + protected MapDisplayType chooseDisplayType() { + return MapDisplayType.Map; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle inState) { + super.onCreateView(inflater, container, inState); + + // Do app specific setup logic. + + return baseControl.getContentView(); + } + + @Override + protected void controlHasStarted() { + // Set up the local cache directory + String cacheDirName = "stamen_watercolor6"; + File cacheDir = new File(getActivity().getCacheDir(), cacheDirName); + cacheDir.mkdir(); + + // Set up access to the tile images + RemoteTileInfoNew tileInfo = + new RemoteTileInfoNew("http://tile.stamen.com/watercolor/{z}/{x}/{y}.png",0, 18); + tileInfo.cacheDir = cacheDir; + + // Set up the map parameters + SamplingParams params = new SamplingParams(); + params.setCoordSystem(new SphericalMercatorCoordSystem()); + params.setCoverPoles(true); + params.setEdgeMatching(true); + params.setMinZoom(tileInfo.minZoom); + params.setMaxZoom(tileInfo.maxZoom); + params.setSingleLevel(true); + + // Set up an image loader, tying all the previous together. + QuadImageLoader loader = new QuadImageLoader(params, tileInfo, baseControl); + loader.setImageFormat(RenderController.ImageFormat.MaplyImageUShort565); + + // Go to a specific location with animation + // + // `globeControl` is the controller when using MapDisplayType.Globe + // `mapControl` is the controller when using MapDisplayType.Map + // `baseControl` refers to whichever of them is used. + double latitude = 40.5023056 * Math.PI / 180; + double longitude = -3.6704803 * Math.PI / 180; + double zoom_earth_radius = 2.0; + mapControl.animatePositionGeo(longitude, latitude, zoom_earth_radius, 1.0); + } +} diff --git a/app/src/main/java/com/mousebirdconsulting/helloearth/HelloMarkerFragment.java b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloMarkerFragment.java new file mode 100644 index 0000000..e204aba --- /dev/null +++ b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloMarkerFragment.java @@ -0,0 +1,147 @@ +package com.mousebirdconsulting.helloearth; + +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.widget.Toast; + +import com.mousebird.maply.AttrDictionary; +import com.mousebird.maply.BaseController; +import com.mousebird.maply.ComponentObject; +import com.mousebird.maply.GlobeController; +import com.mousebird.maply.MarkerInfo; +import com.mousebird.maply.Point2d; +import com.mousebird.maply.ScreenMarker; +import com.mousebird.maply.SelectedObject; +import com.mousebird.maply.VectorObject; + +import java.util.ArrayList; +import java.util.List; + +public class HelloMarkerFragment extends HelloGeoJsonFragment { + + @Override + protected void controlHasStarted() { + super.controlHasStarted(); + + // Insert Markers + insertMarkers(); + + globeControl.gestureDelegate = this; + } + + private void insertMarkers() { + List markers = new ArrayList<>(); + MarkerInfo markerInfo = new MarkerInfo(); + Bitmap icon = BitmapFactory.decodeResource(getActivity().getResources(), R.drawable.ic_city); + Point2d markerSize = new Point2d(144, 144); + + // Moscow - Москва + MarkerProperties properties = new MarkerProperties(); + properties.city = "Moscow"; + properties.subject = "Москва"; + ScreenMarker marker = new ScreenMarker(); + marker.loc = Point2d.FromDegrees(37.616667, 55.75); // Longitude, Latitude + marker.image = icon; + marker.size = markerSize; + marker.selectable = true; + marker.userObject = properties; + markers.add(marker); + + // Saint Petersburg - Санкт-Петербург + properties = new MarkerProperties(); + properties.city = "Saint Petersburg"; + properties.subject = "Санкт-Петербург"; + marker = new ScreenMarker(); + marker.loc = Point2d.FromDegrees(30.3, 59.95); + marker.image = icon; + marker.size = markerSize; + marker.selectable = true; + marker.userObject = properties; + markers.add(marker); + + // Novosibirsk - Новосибирск + properties = new MarkerProperties(); + properties.city = "Novosibirsk"; + properties.subject = "Новосибирск"; + marker = new ScreenMarker(); + marker.loc = Point2d.FromDegrees(82.95, 55.05); + marker.image = icon; + marker.size = markerSize; + marker.selectable = true; + marker.userObject = properties; + markers.add(marker); + + // Yekaterinburg - Екатеринбург + properties = new MarkerProperties(); + properties.city = "Yekaterinburg"; + properties.subject = "Екатеринбург"; + marker = new ScreenMarker(); + marker.loc = Point2d.FromDegrees(60.583333, 56.833333); + marker.image = icon; + marker.size = markerSize; + marker.selectable = true; + marker.userObject = properties; + markers.add(marker); + + // Nizhny Novgorod - Нижний Новгород + properties = new MarkerProperties(); + properties.city = "Nizhny Novgorod"; + properties.subject = "Нижний Новгород"; + marker = new ScreenMarker(); + marker.loc = Point2d.FromDegrees(44.0075, 56.326944); + marker.image = icon; + marker.size = markerSize; + marker.rotation = Math.PI; + marker.selectable = true; + marker.userObject = properties; + markers.add(marker); + + // Add your markers to the map controller. + ComponentObject co = globeControl.addScreenMarkers(markers, markerInfo, BaseController.ThreadMode.ThreadAny); + } + + @Override + public void userDidSelect(GlobeController globeControl, SelectedObject[] selObjs, + Point2d loc, Point2d screenLoc) { + String msg = "Selected feature count: " + selObjs.length; + for (SelectedObject obj : selObjs) { + // GeoJSON + if (obj.selObj instanceof VectorObject) { + VectorObject vectorObject = (VectorObject) obj.selObj; + AttrDictionary attributes = vectorObject.getAttributes(); + String adminName = attributes.getString("ADMIN"); + msg += "\nVector Object: " + adminName; + } + // Screen Marker + else if (obj.selObj instanceof ScreenMarker) { + ScreenMarker screenMarker = (ScreenMarker) obj.selObj; + MarkerProperties properties = (MarkerProperties) screenMarker.userObject; + msg += "\nScreen Marker: " + properties.city + ", " + properties.subject; + //addSelectedMarker(screenMarker); + } + } + + Toast.makeText(getActivity(), msg, Toast.LENGTH_LONG).show(); + } + + public void addSelectedMarker(ScreenMarker screenMarker) { + if (selectedMarkerComponent != null) { + globeControl.removeObject(selectedMarkerComponent, BaseController.ThreadMode.ThreadAny); + } + MarkerInfo markerInfo = new MarkerInfo(); + markerInfo.setDrawPriority(Integer.MAX_VALUE); + Bitmap icon = BitmapFactory.decodeResource(getActivity().getResources(), android.R.drawable.star_on); + Point2d markerSize = new Point2d(100, 100); + screenMarker.image = icon; + screenMarker.size = markerSize; + screenMarker.selectable = true; + selectedMarkerComponent= globeControl.addScreenMarker(screenMarker, markerInfo, BaseController.ThreadMode.ThreadAny); + } + + public class MarkerProperties { + public String city; + public String subject; + } + + ComponentObject selectedMarkerComponent; +} diff --git a/app/src/main/java/com/mousebirdconsulting/helloearth/HelloSphereFragment.java b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloSphereFragment.java new file mode 100644 index 0000000..59d43b1 --- /dev/null +++ b/app/src/main/java/com/mousebirdconsulting/helloearth/HelloSphereFragment.java @@ -0,0 +1,60 @@ +package com.mousebirdconsulting.helloearth; + +import com.mousebird.maply.BaseController; +import com.mousebird.maply.ComponentObject; +import com.mousebird.maply.Point2d; +import com.mousebird.maply.Shape; +import com.mousebird.maply.ShapeInfo; +import com.mousebird.maply.ShapeSphere; + +import java.util.ArrayList; +import java.util.List; + +public class HelloSphereFragment extends HelloGlobeFragment { + + @Override + protected void controlHasStarted() { + super.controlHasStarted(); + + insertSpheres(); + } + + private void insertSpheres() { + List shapes = new ArrayList<>(); + + // Kansas City + ShapeSphere shape = new ShapeSphere(); + shape.setLoc(Point2d.FromDegrees(-94.58, 39.1)); + shape.setRadius(0.04f); // 1.0 is the radius of the Earth + shapes.add(shape); + + // Washington D.C. + shape = new ShapeSphere(); + shape.setLoc(Point2d.FromDegrees(-77.036667, 38.895111)); + shape.setRadius(0.1f); + shapes.add(shape); + + // McMurdo Station + shape = new ShapeSphere(); + shape.setLoc(Point2d.FromDegrees(166.666667, -77.85)); + shape.setRadius(0.2f); + shapes.add(shape); + + // Windhoek + shape = new ShapeSphere(); + shape.setLoc(Point2d.FromDegrees(17.083611, -22.57)); + shape.setRadius(0.08f); + shapes.add(shape); + + ShapeInfo shapeInfo = new ShapeInfo(); + shapeInfo.setColor(0.7f, 0.2f, 0.7f, 0.8f); // R,G,B,A - values [0.0 => 1.0] + shapeInfo.setDrawPriority(1000000); + + ComponentObject co = globeControl.addShapes(shapes, shapeInfo, BaseController.ThreadMode.ThreadAny); + + double latitude = 40 * Math.PI / 180; + double longitude = -100 * Math.PI / 180; + double zoom_earth_radius = 1.0; + globeControl.animatePositionGeo(longitude, latitude, zoom_earth_radius, 1.0); + } +} diff --git a/app/src/main/java/com/mousebirdconsulting/helloearth/LocalGlobeFragment.java b/app/src/main/java/com/mousebirdconsulting/helloearth/LocalGlobeFragment.java new file mode 100644 index 0000000..dac145b --- /dev/null +++ b/app/src/main/java/com/mousebirdconsulting/helloearth/LocalGlobeFragment.java @@ -0,0 +1,71 @@ +package com.mousebirdconsulting.helloearth; + +import android.content.Context; +import android.content.ContextWrapper; +import android.util.Log; + +import com.mousebird.maply.MBTileFetcher; +import com.mousebird.maply.QuadImageLoader; +import com.mousebird.maply.SamplingParams; +import com.mousebird.maply.SphericalMercatorCoordSystem; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +public class LocalGlobeFragment extends HelloGlobeFragment { + + @Override + protected void controlHasStarted() { + + File mbTileFile; + try { + mbTileFile = getMBTileAsset("geography-class_medres.mbtiles"); + } catch (IOException e) { + Log.d("HelloEarth", e.getMessage()); + return; + } + + MBTileFetcher mbTileFetcher = new MBTileFetcher(mbTileFile); + + SamplingParams params = new SamplingParams(); + params.setCoordSystem(new SphericalMercatorCoordSystem()); + params.setCoverPoles(true); + params.setEdgeMatching(true); + params.setSingleLevel(true); + params.setMinZoom(0); + params.setMaxZoom(mbTileFetcher.maxZoom); + + QuadImageLoader loader = new QuadImageLoader(params,mbTileFetcher.getTileInfo(), baseControl); + loader.setTileFetcher(mbTileFetcher); + + double latitude = 40.5023056 * Math.PI / 180; + double longitude = -3.6704803 * Math.PI / 180; + double zoom_earth_radius = 0.5; + globeControl.animatePositionGeo(longitude, latitude, zoom_earth_radius, 1.0); + } + + private File getMBTileAsset(String name) throws IOException { + ContextWrapper wrapper = new ContextWrapper(getActivity()); + File mbTilesDirectory = wrapper.getDir("mbtiles", Context.MODE_PRIVATE); + + InputStream is = getActivity().getAssets().open("mbtiles/" + name); + File of = new File(mbTilesDirectory, name); + + if (!of.exists()) { + OutputStream os = new FileOutputStream(of); + byte[] mBuffer = new byte[4096]; + int length; + while ((length = is.read(mBuffer)) > 0) { + os.write(mBuffer, 0, length); + } + os.flush(); + os.close(); + is.close(); + } + + return of; + } +} diff --git a/app/src/main/java/io/theoutpost/helloearth/MainActivity.java b/app/src/main/java/com/mousebirdconsulting/helloearth/MainActivity.java similarity index 72% rename from app/src/main/java/io/theoutpost/helloearth/MainActivity.java rename to app/src/main/java/com/mousebirdconsulting/helloearth/MainActivity.java index 2a2294f..20928ee 100644 --- a/app/src/main/java/io/theoutpost/helloearth/MainActivity.java +++ b/app/src/main/java/com/mousebirdconsulting/helloearth/MainActivity.java @@ -1,6 +1,7 @@ -package io.theoutpost.helloearth; +package com.mousebirdconsulting.helloearth; + +import androidx.appcompat.app.AppCompatActivity; -import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @@ -10,4 +11,4 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } -} +} \ No newline at end of file diff --git a/app/src/main/java/io/theoutpost/helloearth/HelloGlobeFragment.java b/app/src/main/java/io/theoutpost/helloearth/HelloGlobeFragment.java deleted file mode 100644 index c30f7fb..0000000 --- a/app/src/main/java/io/theoutpost/helloearth/HelloGlobeFragment.java +++ /dev/null @@ -1,57 +0,0 @@ -package io.theoutpost.helloearth; - -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import com.mousebird.maply.GlobeMapFragment; -import com.mousebird.maply.QuadImageTileLayer; -import com.mousebird.maply.RemoteTileInfo; -import com.mousebird.maply.RemoteTileSource; -import com.mousebird.maply.SphericalMercatorCoordSystem; - -import java.io.File; - - -public class HelloGlobeFragment extends GlobeMapFragment { - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle inState) { - super.onCreateView(inflater, container, inState); - - // Do app specific setup logic. - - return baseControl.getContentView(); - } - - @Override - protected MapDisplayType chooseDisplayType() { - return MapDisplayType.Globe; - } - - @Override - protected void controlHasStarted() { - // setup base layer tiles - String cacheDirName = "stamen_watercolor"; - File cacheDir = new File(getActivity().getCacheDir(), cacheDirName); - cacheDir.mkdir(); - RemoteTileSource remoteTileSource = new RemoteTileSource(new RemoteTileInfo("http://tile.stamen.com/watercolor/", "png", 0, 18)); - remoteTileSource.setCacheDir(cacheDir); - SphericalMercatorCoordSystem coordSystem = new SphericalMercatorCoordSystem(); - - // globeControl is the controller when using MapDisplayType.Globe - // mapControl is the controller when using MapDisplayType.Map - QuadImageTileLayer baseLayer = new QuadImageTileLayer(globeControl, coordSystem, remoteTileSource); - baseLayer.setImageDepth(1); - baseLayer.setSingleLevelLoading(false); - baseLayer.setUseTargetZoomLevel(false); - baseLayer.setCoverPoles(true); - baseLayer.setHandleEdges(true); - - // add layer and position - globeControl.addLayer(baseLayer); - globeControl.animatePositionGeo(-3.6704803, 40.5023056, 5, 1.0); - } - -} diff --git a/app/src/main/java/io/theoutpost/helloearth/HelloMapFragment.java b/app/src/main/java/io/theoutpost/helloearth/HelloMapFragment.java deleted file mode 100644 index c12fdc5..0000000 --- a/app/src/main/java/io/theoutpost/helloearth/HelloMapFragment.java +++ /dev/null @@ -1,101 +0,0 @@ -package io.theoutpost.helloearth; - -import android.Manifest; -import android.app.Activity; -import android.content.DialogInterface; -import android.content.pm.PackageManager; -import android.os.Bundle; -import android.os.Environment; -import android.support.v4.app.ActivityCompat; -import android.support.v7.app.AlertDialog; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import com.mousebird.maply.GlobeMapFragment; -import com.mousebird.maply.MBTiles; -import com.mousebird.maply.MBTilesImageSource; -import com.mousebird.maply.QuadImageTileLayer; -import com.mousebird.maply.RemoteTileInfo; -import com.mousebird.maply.RemoteTileSource; -import com.mousebird.maply.SphericalMercatorCoordSystem; - -import java.io.File; - - -public class HelloMapFragment extends GlobeMapFragment { - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle inState) { - super.onCreateView(inflater, container, inState); - - // Do app specific setup logic. - - return baseControl.getContentView(); - } - - @Override - protected MapDisplayType chooseDisplayType() { - return MapDisplayType.Map; - } - - @Override - protected void controlHasStarted() { - Activity activity = getActivity(); - final int REQUEST_EXTERNAL_STORAGE = 1; - String[] PERMISSIONS_STORAGE = { - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE - }; - int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE); - - if (permission != PackageManager.PERMISSION_GRANTED) { - // We don't have permission so prompt the user - ActivityCompat.requestPermissions( - activity, - PERMISSIONS_STORAGE, - REQUEST_EXTERNAL_STORAGE - ); - } - - File storageDir = Environment.getExternalStorageDirectory(); - File mbtilesDir = new File(storageDir, "mbtiles"); - File mbtilesFile = new File(mbtilesDir, "geography-class_medres.mbtiles"); - if (!mbtilesFile.exists()) { - new AlertDialog.Builder(activity) - .setTitle("Missing MBTiles") - .setMessage("Could not find MBTiles file.") - .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - // do nothing - } - }).show(); - } - MBTiles mbtiles = new MBTiles(mbtilesFile); - MBTilesImageSource localTileSource = new MBTilesImageSource(mbtiles); - - - // setup base layer tiles - String cacheDirName = "stamen_watercolor"; - File cacheDir = new File(getActivity().getCacheDir(), cacheDirName); - cacheDir.mkdir(); - RemoteTileSource remoteTileSource = new RemoteTileSource(new RemoteTileInfo("http://tile.stamen.com/watercolor/", "png", 0, 18)); - remoteTileSource.setCacheDir(cacheDir); - SphericalMercatorCoordSystem coordSystem = new SphericalMercatorCoordSystem(); - - // globeControl is the controller when using MapDisplayType.Globe - // mapControl is the controller when using MapDisplayType.Map - QuadImageTileLayer baseLayer = new QuadImageTileLayer(mapControl, coordSystem, localTileSource); - baseLayer.setImageDepth(1); - baseLayer.setSingleLevelLoading(false); - baseLayer.setUseTargetZoomLevel(false); - baseLayer.setCoverPoles(true); - baseLayer.setHandleEdges(true); - - // add layer and position - mapControl.addLayer(baseLayer); - mapControl.animatePositionGeo(-3.6704803, 40.5023056, 5, 1.0); - mapControl.setAllowRotateGesture(false); - } - -} diff --git a/app/src/main/res/drawable-hdpi/ic_city.png b/app/src/main/res/drawable-hdpi/ic_city.png new file mode 100644 index 0000000..83d5569 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_city.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_city.png b/app/src/main/res/drawable-mdpi/ic_city.png new file mode 100644 index 0000000..14487d5 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_city.png differ diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-xhdpi/ic_city.png b/app/src/main/res/drawable-xhdpi/ic_city.png new file mode 100644 index 0000000..3c84e34 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_city.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_city.png b/app/src/main/res/drawable-xxhdpi/ic_city.png new file mode 100644 index 0000000..8b539c7 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_city.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_city.png b/app/src/main/res/drawable-xxxhdpi/ic_city.png new file mode 100644 index 0000000..bbf84d8 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_city.png differ diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 69dcf2a..47bba0f 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,23 +1,20 @@ - - - - - - - - - + tools:context=".MainActivity"> - + android:name="com.mousebirdconsulting.helloearth.HelloMarkerFragment" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_constraintBottom_toTopOf="parent" + app:layout_constraintEnd_toStartOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index cde69bc..a571e60 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..61da551 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index c133a0c..c41dd28 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..db5080a Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index bfa42f0..6dba46d 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..da31a87 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 324e72c..15ac681 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..b216f2d Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index aee44e1..f25a419 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..e96783c Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml deleted file mode 100644 index 63fc816..0000000 --- a/app/src/main/res/values-w820dp/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 64dp - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 3ab3e9c..4faecfa 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,6 +1,6 @@ - #3F51B5 - #303F9F - #FF4081 - + #6200EE + #3700B3 + #03DAC5 + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml deleted file mode 100644 index 47c8224..0000000 --- a/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 16dp - 16dp - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f22761c..2ef2116 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,3 @@ HelloEarth - - - Hello blank fragment - + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 5885930..fac9291 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,5 +1,4 @@ - - + \ No newline at end of file diff --git a/app/src/test/java/com/mousebirdconsulting/helloearth/ExampleUnitTest.java b/app/src/test/java/com/mousebirdconsulting/helloearth/ExampleUnitTest.java new file mode 100644 index 0000000..b87051c --- /dev/null +++ b/app/src/test/java/com/mousebirdconsulting/helloearth/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.mousebirdconsulting.helloearth; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/app/src/test/java/io/theoutpost/helloearth/ExampleUnitTest.java b/app/src/test/java/io/theoutpost/helloearth/ExampleUnitTest.java deleted file mode 100644 index bcaa821..0000000 --- a/app/src/test/java/io/theoutpost/helloearth/ExampleUnitTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.theoutpost.helloearth; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * To work on unit tests, switch the Test Artifact in the Build Variants view. - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() throws Exception { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 186e070..ed52541 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,11 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { repositories { + google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.2' + classpath "com.android.tools.build:gradle:4.0.1" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -14,6 +14,7 @@ buildscript { allprojects { repositories { + google() jcenter() flatDir { dirs 'libs' @@ -23,4 +24,4 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/build/generated/mockable-android-24.jar b/build/generated/mockable-android-24.jar deleted file mode 100644 index e627532..0000000 Binary files a/build/generated/mockable-android-24.jar and /dev/null differ diff --git a/build/intermediates/dex-cache/cache.xml b/build/intermediates/dex-cache/cache.xml deleted file mode 100644 index e66fc3d..0000000 --- a/build/intermediates/dex-cache/cache.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/gradle.properties b/gradle.properties index 1d3591c..c52ac9b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,19 @@ # Project-wide Gradle settings. - # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. - # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html - # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - +org.gradle.jvmargs=-Xmx2048m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 13372ae..f6b961f 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 122a0dc..9a1dd26 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 28 10:00:20 PST 2015 +#Wed Oct 07 09:55:45 PDT 2020 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-6.1.1-all.zip diff --git a/gradlew b/gradlew index 9d82f78..cccdd3d 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,26 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -85,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -150,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index aec9973..e95643d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/settings.gradle b/settings.gradle index e7b4def..920c973 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,2 @@ include ':app' +rootProject.name = "HelloEarth" \ No newline at end of file