Repository
The app provides users with various features from choosing the correct destination to making all the bookings and to easily organising the trip. The app provides solutions for every possible problem a traveller might face during the course of his or her entire journey.
New Features
What feature(s) did you add?
App has some cool features for travellers like weather info, checklist etc. There was a open issue on adding compass utility. Have implemented the compass in utilities section of the App.
How did you implement it/them?
-The smartphones have a small magnetometer built in, which can measure the Earth’s magnetic field. This information is combined with an accelerator that acquires information regarding the phone’s position in space.
- Created compass utility class expending SensorEventListener to read accelerator sensor data.
@Override
public void onSensorChanged(SensorEvent event) {
final float alpha = 0.97f;
synchronized (this) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
mGravity[0] = alpha * mGravity[0] + (1 - alpha)
* event.values[0];
mGravity[1] = alpha * mGravity[1] + (1 - alpha)
* event.values[1];
mGravity[2] = alpha * mGravity[2] + (1 - alpha)
* event.values[2];
}
if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) {
// mGeomagnetic = event.values;
mGeomagnetic[0] = alpha * mGeomagnetic[0] + (1 - alpha)
* event.values[0];
mGeomagnetic[1] = alpha * mGeomagnetic[1] + (1 - alpha)
* event.values[1];
mGeomagnetic[2] = alpha * mGeomagnetic[2] + (1 - alpha)
* event.values[2];
// Log.e(TAG, Float.toString(event.values[0]));
}
boolean success = SensorManager.getRotationMatrix(mR, mI, mGravity,
mGeomagnetic);
if (success) {
float[] orientation = new float[3];
SensorManager.getOrientation(mR, orientation);
// Log.d(TAG, "azimuth (rad): " + azimuth);
mAzimuth = (float) Math.toDegrees(orientation[0]); // orientation
mAzimuth = (mAzimuth + mAzimuthFix + 360) % 360;
// Log.d(TAG, "azimuth (deg): " + azimuth);
if (mListener != null) {
mListener.onNewAzimuth(mAzimuth);
}
}
}
- Created a activity CompassActivity to create and setup compass.
/**
* setup compass
*/
private void setupCompass() {
mCompass = new Compass(this);
Compass.CompassListener cl = new Compass.CompassListener() {
@Override
public void onNewAzimuth(float azimuth) {
adjustArrow(azimuth);
}
};
mCompass.setListener(cl);
}
/**
* adjuts arrow
*
* @param azimuth azimuth
*/
private void adjustArrow(float azimuth) {
Log.d(TAG, "will set rotation from " + mCurrentAzimuth + " to "
+ azimuth);
Animation an = new RotateAnimation(-mCurrentAzimuth, -azimuth,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
mCurrentAzimuth = azimuth;
an.setDuration(500);
an.setRepeatCount(0);
an.setFillAfter(true);
mArrowView.startAnimation(an);
}
Drawables used Compass_dial and compass_hand
Hi, @hiremani. Your account has been excluded from Utopian rewards and therefore this contribution post will not be reviewed. You can contact us at https://support.utopian.io/ if you have any further questions.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @hiremani! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :
Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word
STOP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
@ibar !price steem
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
$0.8365533053797927
Upvote ibar's comment to Support!
Get list of coin ids here and you will use
id
names with commands to make it work.Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
@hiremani !price steem
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit