Norway


A library to make the map display process easier by entering latitude and longitude only

-  - The Android Arsenal – Maps

Do not forget the star:) ⭐️

GoogleMapView APK Demo

How to download

Gradle

Add it in your root build.gradle at the end of repositories:
    allprojects {
         repositories {
             ...
             maven { url 'https://jitpack.io' }
         }
    }
add this line to your module build.gradle dependecies block:
    compile 'com.github.alirezaashrafi:GoogleMapView:1.0.2'

Maven

Add the JitPack repository to your build file
  <repositories>
    <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
    </repository>
  </repositories>
Add the dependency
    <dependency>
      <groupId>com.github.alirezaashrafi</groupId>
      <artifactId>GoogleMapView</artifactId>
      <version>1.0.2</version>
    </dependency>

Attributes

Attribute Name Type Default Value
setLatitude float .744920
setLongitude float 51.3763
setMapType enum satellite
setMapScale enum high
setMapZoom int 17
setMapWidth int 640px
setMapHeight int 640px

XML

  <com.alirezaashrafi.library.GoogleMapView
      :id="@+id/googleMapView"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      :setLatitude="35.744920"
      app:setLongitude="51.376303"
      app:setMapType="satellite"
      app:setMapScale="high"
      app:setMapZoom="15"
      app:setMapWidth="350"
      app:setMapHeight="350"/>

JAVA

  GoogleMapView googleMapView = (GoogleMapView) findViewById(R.id.googleMapView);
  googleMapView.setLatitude(35.744920f);
  googleMapView.setLongitude(51.376303f);
  googleMapView.setMapType(MapType.SATELLITE);
  googleMapView.setMapScale(MapScale.HIGH);
  googleMapView.setMapZoom(15);
  googleMapView.setMapWidth(350);
  googleMapView.setMapHeight(350);
  googleMapView.setLocation();

  <style name="googleViewStyle" parent="GoogleMapView">
      <item name="android:layout_width">match_parent</item>
      <item name="android:layout_height">match_parent</item>
      <item name="setMapType">roadmap</item>
      <item name="setMapScale">low</item>
      <item name="setLatitude">35.744920</item>
      <item name="setLongitude">51.376303</item>
      <item name="setMapZoom">17</item>
      <item name="setMapWidth">640</item>
      <item name="setMapHeight">640</item>
  </style>

note: better performance if change default values is Application class onCreate

  @Override
  public void onCreate() {
      super.onCreate();

      GoogleMapViewConfigs.setDefaultMapType(MapType.SATELLITE);
      GoogleMapViewConfigs.setDefaultLatitude(35.744920f);
      GoogleMapViewConfigs.setDefaultLongitude(51.376303f);
      GoogleMapViewConfigs.setDefaultMapZoom(17);
      GoogleMapViewConfigs.setDefaultMapScale(MapScale.HIGH);
      GoogleMapViewConfigs.setDefaultMapHeight(350);
      GoogleMapViewConfigs.setDefaultMapWidth(350);
  }

Licence

Copyright Alireza Ashrafi

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, 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.


Author


If you liked this library, do not forget to star and follow me ⭐️❤️💙

Eventually see my other libraries and projects



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here