GithubHelp home page GithubHelp logo

android-radar's Introduction

Android Radar

The simple way to make radar in your Android app.

          

Installation:

  1. Go to:

File -> Import Module -> choose the folder "android-radar-master".

  1. add this to your gradle file :
	compile project(':android-radar-master')

Usages:

In your xml import an extra namespace on the root of your layout for example "whatever", like this:

	<?xml version="1.0" encoding="utf-8"?>
	<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	    xmlns:whatever="http://schemas.android.com/apk/res-auto"
	    >
	    ....
	    <!-- Your actual layout -->
	    ....
	</LinearLayout>

Whenever you need to use the Radar just do the following in your xml.

    <co.geeksters.radar.Radar
        android:id="@+id/radar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />

In your activity, to create points or pin in this radar:

    radar = (co.geeksters.radar.Radar) findViewById(R.id.radar);
    
    //And here set the reference Point (or for exemple your GPS location)
    radar.setReferencePoint(new RadarPoint("myLocation", 10.00000f,22.0000f));
    
    // the other points in the Radar
    ArrayList<RadarPoint> points = new ArrayList<RadarPoint>();

    points.add(new RadarPoint("identifier1", 10.00200f,22.0000f));
    points.add(new RadarPoint("identifier2", 10.00220f,22.0000f));
    points.add(new RadarPoint("identifier3", 10.00420f,22.0010f));
    
    radar.setPoints(points);

That's is all :)

Advenced usages:

Other Attributes:

    whatever:center_pin_radius="20" // Radius of the pin in the center
    whatever:pins_radius="20" // Radius of pins on the Radar
    whatever:pins_color="@color/light_green" // Color of pins on the Radar
    whatever:center_pin_color="@color/fourth_color" // Color of the pin in the center
  
    whatever:radar_image="@drawable/radar_background" // image of the radar
    whatever:pins_image="@drawable/pin" // pins icon
    whatever:center_pin_image="@drawable/center_pin" //  center pin icon
  
    whatever:max_distance="-1" //  Max distance by metters to cover, -1 to infinit, default velue is 10000

handle clicks:

To handle Pin's clicks on the Radar:

    radar.setOnTouchListener(new View.OnTouchListener() {
      @Override
      public boolean onTouch(View v, MotionEvent event) {
          String pinIdentifier = radar.getTouchedPin(event);
          if (pinIdentifier != null) {
              Toast.makeText(thisActivity, pinIdentifier, Toast.LENGTH_SHORT).show();
          }
          return true;
      }
    });

PS: This will not include the center pin.

Refresh the radar:

After changes you can call refresh method to remake the Radar:

    radar.refresh();

android-radar's People

Contributors

karamsa avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.