OPFMaps


Source link: https://github.com/onepf/OPFMaps

OPFMaps

OPFMaps is an open source library which provides an easy way for developers to integrate different android maps into their apps.

Currently OPFMaps supports the following maps: Google Maps, Amazon Maps, Osmdroid, Yandex Maps JavaScript API.

##How To Use

Add dependencies

The main dependencies are the opfmaps module and the OPFUtils library:

compile 'org.onepf:opfmaps:0.1.1@aar' compile 'org.onepf:opfutils:0.1.26'

Then you have to add at least one map provider dependency.

Google Maps Provider:

compile 'org.onepf:opfmaps-google:0.1.1@aar' compile 'com.google.android.gms:play-services-maps:8.1.0'

NOTE: Also for Google Maps you must add Maps API Key to the AndroidManifest.xml file.

Amazon Maps Provider:

compile 'org.onepf:opfmaps-amazon:0.1.1@aar' compile 'com.amazon:amazon-maps-api:2.0'

Osmdroid Provider:

compile 'org.onepf:opfmaps-osmdroid:0.1.1@aar' compile 'org.osmdroid:osmdroid-android:4.3' compile 'org.osmdroid:bonuspack:5.3' compile 'org.slf4j:slf4j-android:1.7.12' compile 'org.apache.commons:commons-lang3:3.4' compile 'com.google.code.gson:gson:2.3.1'

If you use Amazon Maps or/and Osmdroid you have to add the following repo which hosts amazon-maps-api and osmdroid-bounspack jars:

allprojects {

repositories {

  ...
  // third-party dependencies
  maven {
 url 'https://raw.githubusercontent.com/onepf/OPF-mvn-repo/master/' 
}

}
 
}

Yandex Maps Provider:

compile 'org.onepf:opfmaps-yandex-web:0.1.1@aar'

Initialization

You must init OPFMapsHelper before using OPFMaps. You must do it in the Main Thread. Application.onCreate() method is the best place for this.

public class MyApplication extends Application {

 @Override
public void onCreate() {

  super.onCreate();

  OPFLog.setEnabled(BuildConfig.DEBUG, true);
 //Optional. It enables debug logs of the OPFMaps library in the debug build of your apk.

 final OPFMapConfiguration configuration = new OPFMapConfiguration.Builder()

  .addProviders(new YaWebMapProvider(), new OsmdroidMapProvider(), new GoogleMapProvider(), new AmazonMapProvider()) //Add all providers. The priority of the providers corresponds to the order in which they were added.

  .setSelectSystemPreferred(true) //If you set true, the system push provider will get the highest priority. Default value is false.

  .build();

  OPFMapHelper.getInstance().init(this, configuration);

}
 
}

Using

Add the main.xml file which contains a <fragment> element:

<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:name="org.onepf.opfmaps.OPFMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:opf_cameraTargetLat="37.7"
map:opf_cameraTargetLng="-122.4"
map:opf_mapType="hybrid"/>

Get OPFMap object in your activity:

public class MainActivity extends Activity implements OnMapReadyCallback {

@Override
public void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  setContentView(R.layout.main);

 final OPFMapFragment mapFragment = (OPFMapFragment) getFragmentManager().findFragmentById(R.id.map);

  mapFragment.getMapAsync(this);

}

@Override
public void onMapReady(@NonNull final OPFMap opfMap) {

  opfMap.addMarker(new OPFMarkerOptions()

 .position(new OPFLatLng(0, 0))

 .title("Marker"));

}
 
}

You can use OPFMapFragment/ OPFSupportMapFragment or OPFMapView to obtain the instance of OPFMap class (The main Maps API class).

##More Information

The OPFMaps library delegates all methods invokes to the specific map provider which is selected during initialization. It has almost the same API as Google Maps Android API v2. So for more information see Google instructions.

##Restrictions

The OPFMaps library provides all methods which are provided by Google Maps. Not all map providers support whole API. For example Yandex Web Provider doesn't support rotation and tilt gestures and Amazon Map Provider doesn't support draggable markers. See Javadoc of each OPFMapProvider before using to know which methods are stubbed by the specific provider.

License

Copyright 2012-2015 One Platform Foundation  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. 

Resources

Client of iComet server for Java/Android iComet server This project is based the iComet service

Simply, this project is an implements of client for iComet service. You can use it in your java project as well as Android project.

When you apply the plugin and install an app all debug version icons will have flavor, build type and version name.

This library is design to insert cursor row inside another cursor or insert dummy row inside actual cursor.

MathFu is a C++ math library developed primarily for games focused on simplicity and efficiency.

It provides a suite of vector, matrix and quaternion classes to perform basic geometry suitable for game developers. This functionality can be used to construct geometry for graphics libraries like OpenGL or perform calculations for animation or physics systems.

Simple and smooth PDF viewer for Android applications. This project use copy of MuPDF as library module.

Android sample project with Material Design and toolbar. Project uses Appcompat library for material design.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes