Commit e8cf6b8bd26af52d7664c54434b6334bd627fbae

Authored by florian staine
2 parents c006882e d9714300

Merge remote-tracking branch 'origin/master'

app/src/main/java/fr/utbm/lo53/p2017/positionningapp/Calibration.java
@@ -14,7 +14,7 @@ import android.widget.Button; @@ -14,7 +14,7 @@ import android.widget.Button;
14 import android.widget.ImageView; 14 import android.widget.ImageView;
15 15
16 public class Calibration extends BaseActivity { 16 public class Calibration extends BaseActivity {
17 - 17 + float height,width;
18 @Override 18 @Override
19 protected void onCreate(Bundle savedInstanceState) { 19 protected void onCreate(Bundle savedInstanceState) {
20 20
@@ -23,15 +23,6 @@ public class Calibration extends BaseActivity { @@ -23,15 +23,6 @@ public class Calibration extends BaseActivity {
23 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 23 Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
24 setSupportActionBar(toolbar); 24 setSupportActionBar(toolbar);
25 25
26 - FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);  
27 - fab.setOnClickListener(new View.OnClickListener() {  
28 - @Override  
29 - public void onClick(View view) {  
30 - Snackbar.make(view, "Salut ! :) Ce bouton ne sert à rien.", Snackbar.LENGTH_LONG)  
31 - .setAction("Action", null).show();  
32 - }  
33 - });  
34 -  
35 final ImageView Map = (ImageView) findViewById(R.id.Map); 26 final ImageView Map = (ImageView) findViewById(R.id.Map);
36 final ImageView MapMarker = (ImageView) findViewById(R.id.MapMarker); 27 final ImageView MapMarker = (ImageView) findViewById(R.id.MapMarker);
37 final Button setPointButton = (Button) findViewById(R.id.setPointButton); 28 final Button setPointButton = (Button) findViewById(R.id.setPointButton);
@@ -42,16 +33,20 @@ public class Calibration extends BaseActivity { @@ -42,16 +33,20 @@ public class Calibration extends BaseActivity {
42 cancelButton.setVisibility(cancelButton.INVISIBLE); 33 cancelButton.setVisibility(cancelButton.INVISIBLE);
43 measureButton.setVisibility(measureButton.INVISIBLE); 34 measureButton.setVisibility(measureButton.INVISIBLE);
44 35
  36 + //Map.setMaxHeight(50);
  37 +
45 Map.setOnTouchListener(new View.OnTouchListener() { 38 Map.setOnTouchListener(new View.OnTouchListener() {
46 @Override 39 @Override
47 public boolean onTouch(View view, MotionEvent motionEvent) { 40 public boolean onTouch(View view, MotionEvent motionEvent) {
48 /*motionEvent.getAction()==motionEvent.ACTION_MOVE &&*/ 41 /*motionEvent.getAction()==motionEvent.ACTION_MOVE &&*/
49 if( setPointButton.getVisibility() == setPointButton.INVISIBLE && motionEvent.getX() <= Map.getWidth() && motionEvent.getY() <= Map.getHeight() && motionEvent.getX() >= 0 && motionEvent.getY() >= 0) { 42 if( setPointButton.getVisibility() == setPointButton.INVISIBLE && motionEvent.getX() <= Map.getWidth() && motionEvent.getY() <= Map.getHeight() && motionEvent.getX() >= 0 && motionEvent.getY() >= 0) {
50 MapMarker.setVisibility(MapMarker.VISIBLE); 43 MapMarker.setVisibility(MapMarker.VISIBLE);
51 - Snackbar.make(view, " X : " + motionEvent.getX() + " Y : " + motionEvent.getY(), Snackbar.LENGTH_LONG) 44 + height = motionEvent.getX();
  45 + width = motionEvent.getY();
  46 + Snackbar.make(view, " X : " + height + " Y : " + width, Snackbar.LENGTH_LONG)
52 .setAction("Action", null).show(); 47 .setAction("Action", null).show();
53 - MapMarker.setX(motionEvent.getX()-(MapMarker.getWidth()/4));  
54 - MapMarker.setY(motionEvent.getY()); 48 + MapMarker.setX(motionEvent.getX()- (view.getWidth()- Map.getWidth())/2 -40);//- MapMarker.getWidth()/2);
  49 + MapMarker.setY(motionEvent.getY()+ (view.getHeight()/5));//+(MapMarker.getWidth()/(5/4)));
55 } 50 }
56 return true; 51 return true;
57 } 52 }
@@ -84,7 +79,7 @@ public class Calibration extends BaseActivity { @@ -84,7 +79,7 @@ public class Calibration extends BaseActivity {
84 } 79 }
85 }); 80 });
86 } 81 }
87 - 82 +
88 @Override 83 @Override
89 public boolean onCreateOptionsMenu(Menu menu) { 84 public boolean onCreateOptionsMenu(Menu menu) {
90 super.onCreateOptionsMenu(menu); 85 super.onCreateOptionsMenu(menu);
@@ -93,18 +88,8 @@ public class Calibration extends BaseActivity { @@ -93,18 +88,8 @@ public class Calibration extends BaseActivity {
93 return true; 88 return true;
94 } 89 }
95 90
96 - @Override  
97 - public boolean onOptionsItemSelected(MenuItem item) {  
98 - // Handle action bar item clicks here. The action bar will  
99 - // automatically handle clicks on the Home/Up button, so long  
100 - // as you specify a parent activity in AndroidManifest.xml.  
101 - int id = item.getItemId();  
102 -  
103 - //noinspection SimplifiableIfStatement  
104 - if (id == R.id.action_settings) {  
105 - return true;  
106 - }  
107 -  
108 - return super.onOptionsItemSelected(item); 91 + public void sendCalibrateRequest(View v) {
  92 + Snackbar.make(v, "Coucou, X :" + height + " Y : " + width, Snackbar.LENGTH_LONG)
  93 + .setAction("Action", null).show();
109 } 94 }
110 } 95 }
app/src/main/java/fr/utbm/lo53/p2017/positionningapp/TranslateCoordinate.java 0 → 100644
  1 +package fr.utbm.lo53.p2017.positionningapp;
  2 +
  3 +/**
  4 + * Created by Valentin on 14/06/2017.
  5 + */
  6 +
  7 +public class TranslateCoordinate {
  8 + private int mapWidth, mapHeight;
  9 + public class Point {
  10 + float x,y;
  11 + }
  12 + public Point PointToGeo(float xA, float yA)
  13 + {
  14 + Point p = new Point();
  15 + p.x = (xA/mapWidth)*100;
  16 + p.y = (yA/mapWidth)*100;
  17 + return p;
  18 + }
  19 +}
0 \ No newline at end of file 20 \ No newline at end of file
app/src/main/res/drawable/map.png

4.55 KB | W: | H:

24.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable/map2.png 0 → 100644

4.55 KB

app/src/main/res/layout/activity_calibration.xml
@@ -23,12 +23,4 @@ @@ -23,12 +23,4 @@
23 23
24 <include layout="@layout/content_calibration"/> 24 <include layout="@layout/content_calibration"/>
25 25
26 - <android.support.design.widget.FloatingActionButton  
27 - android:id="@+id/fab"  
28 - android:layout_width="wrap_content"  
29 - android:layout_height="wrap_content"  
30 - android:layout_gravity="bottom|end"  
31 - android:layout_margin="@dimen/fab_margin"  
32 - app:srcCompat="@android:drawable/ic_dialog_email" />  
33 -  
34 </android.support.design.widget.CoordinatorLayout> 26 </android.support.design.widget.CoordinatorLayout>
app/src/main/res/layout/content_calibration.xml
@@ -29,19 +29,22 @@ @@ -29,19 +29,22 @@
29 29
30 <ImageView 30 <ImageView
31 android:id="@+id/MapMarker" 31 android:id="@+id/MapMarker"
32 - android:layout_width="42dp"  
33 - android:layout_height="46dp"  
34 - app:srcCompat="@drawable/map_marker"  
35 - android:layout_marginRight="8dp"  
36 - app:layout_constraintRight_toRightOf="parent" 32 + android:layout_width="0dp"
  33 + android:layout_height="50dp"
  34 + android:layout_marginEnd="8dp"
37 android:layout_marginLeft="8dp" 35 android:layout_marginLeft="8dp"
  36 + android:layout_marginRight="8dp"
  37 + android:layout_marginStart="8dp"
  38 + android:adjustViewBounds="false"
  39 + android:cropToPadding="false"
  40 + app:layout_constraintHorizontal_bias="0.15"
38 app:layout_constraintLeft_toLeftOf="parent" 41 app:layout_constraintLeft_toLeftOf="parent"
  42 + app:layout_constraintRight_toRightOf="parent"
  43 + app:srcCompat="@drawable/map_marker"
39 app:layout_constraintTop_toTopOf="@+id/Map" 44 app:layout_constraintTop_toTopOf="@+id/Map"
40 android:layout_marginTop="8dp" 45 android:layout_marginTop="8dp"
41 app:layout_constraintBottom_toBottomOf="@+id/Map" 46 app:layout_constraintBottom_toBottomOf="@+id/Map"
42 - android:layout_marginBottom="8dp"  
43 - android:layout_marginStart="8dp"  
44 - android:layout_marginEnd="8dp" /> 47 + android:layout_marginBottom="8dp" />
45 48
46 <Button 49 <Button
47 android:id="@+id/setPointButton" 50 android:id="@+id/setPointButton"
@@ -52,12 +55,12 @@ @@ -52,12 +55,12 @@
52 android:layout_marginLeft="8dp" 55 android:layout_marginLeft="8dp"
53 android:layout_marginRight="8dp" 56 android:layout_marginRight="8dp"
54 android:layout_marginStart="8dp" 57 android:layout_marginStart="8dp"
55 - android:layout_marginTop="50dp"  
56 android:text="Set Point" 58 android:text="Set Point"
57 app:layout_constraintHorizontal_bias="0.0" 59 app:layout_constraintHorizontal_bias="0.0"
58 app:layout_constraintLeft_toLeftOf="parent" 60 app:layout_constraintLeft_toLeftOf="parent"
59 app:layout_constraintRight_toRightOf="parent" 61 app:layout_constraintRight_toRightOf="parent"
60 - app:layout_constraintTop_toBottomOf="@+id/Map" /> 62 + android:layout_marginBottom="8dp"
  63 + app:layout_constraintBottom_toTopOf="@+id/cancelButton" />
61 64
62 <Button 65 <Button
63 android:id="@+id/cancelButton" 66 android:id="@+id/cancelButton"
@@ -67,11 +70,12 @@ @@ -67,11 +70,12 @@
67 android:layout_marginLeft="8dp" 70 android:layout_marginLeft="8dp"
68 android:layout_marginRight="8dp" 71 android:layout_marginRight="8dp"
69 android:layout_marginStart="8dp" 72 android:layout_marginStart="8dp"
70 - android:layout_marginTop="8dp"  
71 android:text="Cancel" 73 android:text="Cancel"
72 app:layout_constraintLeft_toLeftOf="parent" 74 app:layout_constraintLeft_toLeftOf="parent"
73 app:layout_constraintRight_toRightOf="parent" 75 app:layout_constraintRight_toRightOf="parent"
74 - app:layout_constraintTop_toBottomOf="@+id/measureButton" /> 76 + app:layout_constraintHorizontal_bias="0.0"
  77 + app:layout_constraintBottom_toBottomOf="parent"
  78 + android:layout_marginBottom="8dp" />
75 79
76 <Button 80 <Button
77 android:id="@+id/measureButton" 81 android:id="@+id/measureButton"
@@ -81,10 +85,12 @@ @@ -81,10 +85,12 @@
81 android:layout_marginLeft="8dp" 85 android:layout_marginLeft="8dp"
82 android:layout_marginRight="8dp" 86 android:layout_marginRight="8dp"
83 android:layout_marginStart="8dp" 87 android:layout_marginStart="8dp"
84 - android:layout_marginTop="50dp" 88 + android:onClick="sendCalibrateRequest"
85 android:text="Measure" 89 android:text="Measure"
86 app:layout_constraintLeft_toLeftOf="parent" 90 app:layout_constraintLeft_toLeftOf="parent"
87 app:layout_constraintRight_toRightOf="parent" 91 app:layout_constraintRight_toRightOf="parent"
88 - app:layout_constraintTop_toBottomOf="@+id/Map" /> 92 + app:layout_constraintHorizontal_bias="0.0"
  93 + android:layout_marginBottom="8dp"
  94 + app:layout_constraintBottom_toTopOf="@+id/cancelButton" />
89 95
90 </android.support.constraint.ConstraintLayout> 96 </android.support.constraint.ConstraintLayout>
@@ -5,7 +5,7 @@ buildscript { @@ -5,7 +5,7 @@ buildscript {
5 jcenter() 5 jcenter()
6 } 6 }
7 dependencies { 7 dependencies {
8 - classpath 'com.android.tools.build:gradle:2.3.2' 8 + classpath 'com.android.tools.build:gradle:2.3.3'
9 9
10 // NOTE: Do not place your application dependencies here; they belong 10 // NOTE: Do not place your application dependencies here; they belong
11 // in the individual module build.gradle files 11 // in the individual module build.gradle files