Skip to content

Commit

Permalink
fix #1057
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Jun 8, 2018
1 parent 35880e3 commit 6ea73ab
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import de.westnordost.streetcomplete.data.osm.tql.TagFilterExpression;
import de.westnordost.streetcomplete.quests.AbstractQuestFormAnswerFragment;
import de.westnordost.streetcomplete.util.SphericalEarthMath;
import de.westnordost.streetcomplete.view.CompassView;
import de.westnordost.streetcomplete.view.ListAdapter;
import de.westnordost.streetcomplete.view.StreetSideSelectPuzzle;
import de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder;
Expand All @@ -48,7 +47,7 @@ public class AddCyclewayForm extends AbstractQuestFormAnswerFragment


private StreetSideSelectPuzzle puzzle;
private CompassView compassView;
private ImageView compassView;
private float wayOrientationAtCenter;

private boolean isDefiningBothSides;
Expand Down Expand Up @@ -149,7 +148,8 @@ private void initPuzzleImages(Bundle inState)
}
if(compassView != null)
{
compassView.setOrientation(rotation, tilt);
compassView.setRotation((float) (180*rotation/Math.PI));
compassView.setRotationX((float) (180*tilt/Math.PI));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.ImageButton;
import android.widget.ImageView;

import com.github.florent37.viewtooltip.ViewTooltip;
import com.mapzen.android.lost.api.LocationRequest;
Expand All @@ -30,13 +31,12 @@
import de.westnordost.streetcomplete.location.LocationStateButton;
import de.westnordost.streetcomplete.location.LocationUtil;
import de.westnordost.streetcomplete.location.SingleLocationRequest;
import de.westnordost.streetcomplete.view.CompassView;

public class MapControlsFragment extends Fragment
{
private SingleLocationRequest singleLocationRequest;
private MapFragment mapFragment;
private CompassView compassNeedle;
private ImageView compassNeedle;
private LocationStateButton trackingButton;

@Inject SharedPreferences prefs;
Expand Down Expand Up @@ -175,7 +175,10 @@ public interface Listener

@AnyThread public void onMapOrientation(float rotation, float tilt)
{
compassNeedle.setOrientation(rotation, tilt);
getActivity().runOnUiThread(() -> {
compassNeedle.setRotation((float) (180*rotation/Math.PI));
compassNeedle.setRotationX((float) (180*tilt/Math.PI));
});
}

public void onMapInitialized()
Expand Down
102 changes: 0 additions & 102 deletions app/src/main/java/de/westnordost/streetcomplete/view/CompassView.java

This file was deleted.

5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_compass_needle_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp" android:width="24dp"
android:viewportWidth="2" android:viewportHeight="2">
<path android:fillColor="#000" android:pathData="M1,0L0.3,2L1,1.7L1.7,2z" />
</vector>
11 changes: 6 additions & 5 deletions app/src/main/res/layout/fragment_map_controls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
android:layout_alignParentTop="true"
android:text="@string/compass_north_one_letter"/>

<de.westnordost.streetcomplete.view.CompassView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="-2dp"
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:id="@+id/compassNeedle"
android:src="@drawable/ic_compass_needle_black_24dp"
android:tint="#cc3333"
android:layout_below="@+id/compassNorth"
/>

Expand Down Expand Up @@ -91,4 +92,4 @@



</RelativeLayout>
</RelativeLayout>
11 changes: 6 additions & 5 deletions app/src/main/res/layout/quest_cycleway.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
android:text="@string/compass_north_one_letter"
android:textSize="10dp"/>

<de.westnordost.streetcomplete.view.CompassView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginTop="-2dp"
<ImageView
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_compass_needle_black_24dp"
android:tint="#cc3333"
android:id="@+id/compassNeedle"
android:layout_below="@+id/compassNorth"
/>
</RelativeLayout>

</RelativeLayout>
</RelativeLayout>

0 comments on commit 6ea73ab

Please sign in to comment.