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

An Android annotation processing and code generation library to retain complex objects which cannot be parceled nor serialized into a Bundle across configuration changes.

Common Utils library is developed to reduce efforts to achieve common features of the android apps.

OpenPlayer is an Android library developed by AudioNow Digital, for playing audio in your mobile applications. You can use it for:

  • Music
  • Radio streaming

It delivers support for the following codecs:

  • OPUS
  • VORBIS
  • MP3

A Material Drawer implementation (Like gMail App). Based on MaterialNavigationDrawer

Features:

  • Unlimit Head-Items (Accounts)
  • Every Head-Item can has his own menu
  • Add and remove Head-Items at runtime.
  • Theming
  • Labels
  • Sections at the bottom

A VideoView based on the official Android 4.4.2_r3 sources using a TextureView instead of a SurfaceView.

Just interesting HorizontalScrollView.

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