A beautifully designed simple Android Compass Implementation
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
And on module build.gradle:
dependencies {
compile 'com.github.tarlanahad:SimpleCompass:1.0'
}
In your AndroidManifest.xml file add:
<activity
android:name="com.tarlanahad.simplecompass.Activities.CompassActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
Finally, to start the activity, build Simple Compass like this:
new SimpleCompass().Builder(this)
.withDestination(fromLocation, toLocation)
.setContainerBackgroundColor(Color.WHITE)
.setInfoText("Bearing from location A is ")
.setCircleColor(Color.BLACK)
.setCurrentDegreeColor(Color.BLACK)
.setInfoTextColor(Color.BLACK)
.setFinishActivityButtonColor(Color.BLACK)
.setArrowColor(Color.DKGRAY)
.build();
To show the Views related to the destination such as bearing and arrow , the codes below have to be written.
.withDestination(fromLocation, toLocation)
.setInfoText("Bearing from location A is ")