MapScaleView


Source link: https://github.com/pengrad/MapScaleView

Map Scale View

Scale view for any Android Maps SDK (not only Google Maps)

Include in layout file over map

<FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/activity_main"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

<fragment

android:id="@+id/mapFragment"

class="com.google.android.gms.maps.SupportMapFragment"

android:layout_width="match_parent"

android:layout_height="match_parent"/>

<com.github.pengrad.mapscaleview.MapScaleView

android:id="@+id/scaleView"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="bottom|end"

android:layout_margin="4dp"/> </FrameLayout>

With miles or custom style

<com.github.pengrad.mapscaleview.MapScaleView

android:id="@+id/scaleView"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="bottom|end"

android:layout_margin="4dp"

app:scale_color="#009"

app:scale_miles="true"

app:scale_strokeWidth="3dp"

app:scale_textSize="20sp"/>

Update on map changed

MapScaleView scaleView = (MapScaleView) findViewById(R.id.scaleView);
 CameraPosition cameraPosition = map.getCameraPosition();
 // need to pass zoom and latitude scaleView.update(cameraPosition.zoom, cameraPosition.target.latitude);

Full example with subscribing to map events and updating scale view

@Override public void onMapReady(GoogleMap googleMap) {

  map = googleMap;
  googleMap.setOnCameraMoveListener(this);

  googleMap.setOnCameraIdleListener(this);

  googleMap.setOnCameraChangeListener(this);
 
}
  @Override public void onCameraMove() {

  CameraPosition cameraPosition = map.getCameraPosition();

  scaleView.update(cameraPosition.zoom, cameraPosition.target.latitude);
 
}
  @Override public void onCameraIdle() {

  CameraPosition cameraPosition = map.getCameraPosition();

  scaleView.update(cameraPosition.zoom, cameraPosition.target.latitude);
 
}
  @Override public void onCameraChange(CameraPosition cameraPosition) {

  scaleView.update(cameraPosition.zoom, cameraPosition.target.latitude);
 
}

Download

dependencies {

  compile 'com.github.pengrad:mapscaleview:1.2.1' 
}

Resources

Cheerleader is an Android open source library designed to easily support an artist in an Android application thanks to a SoundCloud account.

IntentBuilder is a type safe way of creating intents and populating them with extras. Intents were created to be very dynamic but often times the dynamic nature of intents is not needed and just gets in the way of writing safe code.

Simple Visualizer from mic input for Android.

A material Switch with icon animations and color transitions.

TarsosDSP is a Java library for audio processing. Its aim is to provide an easy-to-use interface to practical music processing algorithms implemented, as simply as possible, in pure Java and without any other external dependencies.

ExpandableSelector is an Android library created to show a list of Button/ImageButton widgets inside a animated container which can be collapsed or expanded.

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