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

Modern AS3 Game Engine.

With the Buildbox, creating games is simple. There is no programming or scripting needed. Just import images, assign them properties and build out your game. Use one of our many presets to get started and preview your game in real time.

Fully featured customizable XMPP framework for iOS and Android. It includes an XMPP server and client code to quickly add text, picture and location messaging functionality to your app.

Features:

  • Text, Picture and location messages
  • Group chat room
  • Private messages
  • Copy/Paste
  • Automatic highlighting of emails addresses and phone numbers
  • Flexible architecture
  • Messages saved with core data / GreenDAO
  • Social login
  • Search by user name
  • Tabbed interface - profile page, contacts page, search page etc...
  • Full XMPP stack provided

This is a really simple and funny animation for Android. You could find similar animations when sending "Happy birthday" or something else special in WeChat app.

Now you are able to add this funny thing to your own app as well. Give a surprise to your users on Christmas Day by dropping emojis!

The most advanced set of mobile SDKs for WebRTC.

How you can use it:

  • Build powerful mobile versions of your application.
  • Give more connection options to your customers.
  • Enable users to connect on the go.
  • Inject external audio and video streams into your calls.

A stack of cards similar to Tinder.

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