From 9a1ae75cb2ba6fc9eee7a1ca177ee090e64ba73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAymanKh=E2=80=9D?= <“ialkhala@purdue.edu”> Date: Wed, 23 Oct 2013 22:42:19 -0400 Subject: [PATCH 01/10] bounding box --- FieldNotebook/project.properties | 4 +-- .../res/layout/fragment_add_field.xml | 15 ++++---- .../openatk/fieldnotebook/FragmentSlider.java | 34 +++++++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/FieldNotebook/project.properties b/FieldNotebook/project.properties index 928645e..efa00f4 100644 --- a/FieldNotebook/project.properties +++ b/FieldNotebook/project.properties @@ -11,5 +11,5 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-15 -android.library.reference.1=../../android-maps-extensions/android-maps-extensions +target=android-18 +android.library.reference.1=../../android-maps-extensions-1.7.0 2/android-maps-extensions diff --git a/FieldNotebook/res/layout/fragment_add_field.xml b/FieldNotebook/res/layout/fragment_add_field.xml index b34b2cc..df884cc 100644 --- a/FieldNotebook/res/layout/fragment_add_field.xml +++ b/FieldNotebook/res/layout/fragment_add_field.xml @@ -15,13 +15,14 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="20" /> - + + + listPolygons = note.getMyPolygons(); + LatLngBounds.Builder builder = new LatLngBounds.Builder(); + for(int i = 0;i points = listPolygons.get(i).getPoints(); + for(int j=0;j listPolyline = note.getMyPolylines(); + + for(int p=0;p points = listPolyline.get(p).getPoints(); + for(int u = 0;u Date: Tue, 29 Oct 2013 19:03:55 -0400 Subject: [PATCH 02/10] second demo changes --- .../openatk/fieldnotebook/FragmentSlider.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java b/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java index a11766a..555afcc 100644 --- a/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java +++ b/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java @@ -428,8 +428,9 @@ private void SaveNote(Note note){ values.put(TableNotes.COL_LINES, note.getStrPolylines()); Log.d("SaveNote", "StrPolylines:" + note.getStrPolylines()); - //add here - + // Iaman and Patrick added this for demo 2 + + // Get all the polygons, add their vertices to the bounding box List listPolygons = note.getMyPolygons(); LatLngBounds.Builder builder = new LatLngBounds.Builder(); for(int i = 0;i listPolyline = note.getMyPolylines(); - for(int p=0;p points = listPolyline.get(p).getPoints(); for(int u = 0;u Date: Tue, 12 Nov 2013 12:24:23 -0500 Subject: [PATCH 03/10] commit --- FieldNotebook/.classpath | 1 + FieldNotebook/AndroidManifest.xml | 11 +- FieldNotebook/project.properties | 2 +- .../res/layout/fragment_add_field.xml | 57 +- FieldNotebook/res/layout/note_open.xml | 14 + .../fieldnotebook/FragmentAddField.java | 80 +-- .../openatk/fieldnotebook/FragmentSlider.java | 620 +++++++++++------- .../openatk/fieldnotebook/MainActivity.java | 10 +- .../fieldnotebook/drawing/MyPolygon.java | 2 +- .../fieldnotebook/drawing/MyPolyline.java | 4 +- 10 files changed, 500 insertions(+), 301 deletions(-) diff --git a/FieldNotebook/.classpath b/FieldNotebook/.classpath index 572f4f5..cd65889 100644 --- a/FieldNotebook/.classpath +++ b/FieldNotebook/.classpath @@ -5,5 +5,6 @@ + diff --git a/FieldNotebook/AndroidManifest.xml b/FieldNotebook/AndroidManifest.xml index 0d7c0d2..8caa8fd 100644 --- a/FieldNotebook/AndroidManifest.xml +++ b/FieldNotebook/AndroidManifest.xml @@ -6,7 +6,7 @@ + android:targetSdkVersion="18" /> - + + + + + + + android:value="AIzaSyAcsOiq9VHKoi0T8LgURgrh_vKN3W-az6k" /> \ No newline at end of file diff --git a/FieldNotebook/project.properties b/FieldNotebook/project.properties index efa00f4..44e5be1 100644 --- a/FieldNotebook/project.properties +++ b/FieldNotebook/project.properties @@ -11,5 +11,5 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-18 +target=Google Inc.:Google APIs:18 android.library.reference.1=../../android-maps-extensions-1.7.0 2/android-maps-extensions diff --git a/FieldNotebook/res/layout/fragment_add_field.xml b/FieldNotebook/res/layout/fragment_add_field.xml index df884cc..779cf49 100644 --- a/FieldNotebook/res/layout/fragment_add_field.xml +++ b/FieldNotebook/res/layout/fragment_add_field.xml @@ -14,14 +14,18 @@ + android:layout_weight="20" /> + + - + + + android:gravity="center" + android:orientation="horizontal"> - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FieldNotebook/res/layout/note_open.xml b/FieldNotebook/res/layout/note_open.xml index 8f9f5c3..cdb1747 100644 --- a/FieldNotebook/res/layout/note_open.xml +++ b/FieldNotebook/res/layout/note_open.xml @@ -63,6 +63,20 @@ android:src="@drawable/select_color" /> + + + + + 0) { - intAcres = Integer.parseInt(strAcres); - } - listener.AddFieldDone(name.getText().toString(), intAcres); +// String strAcres = acres.getText().toString(); +// strAcres = strAcres.replace(" ", ""); +// strAcres = strAcres.replace("ac", ""); +// if (strAcres.length() > 0) { +// intAcres = Integer.parseInt(strAcres); +// } + listener.AddFieldDone(name.getText().toString()); } else if (v.getId() == R.id.add_field_undo) { listener.AddFieldUndo(); } else if (v.getId() == R.id.add_field_delete) { @@ -166,28 +166,34 @@ public void onClick(DialogInterface dialog, } } - public void autoAcres(float acres){ +/* public void autoAcres(float acres){ Log.d("FragmentAddField", "autoAcres:" + Float.toString(acres)); autoAcresValue = acres; if(this.autoAcres != null && this.autoAcres.isChecked()){ int newAcres = (int) acres; this.acres.setText(Integer.toString(newAcres) + " ac"); } - } + }*/ @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - Log.d("FragmentAddField", "Check click"); - if(buttonView.getId() == R.id.add_field_chkAutoAcres){ - Log.d("FragmentAddField", "Check Auto acres"); - if(isChecked){ - Log.d("FragmentAddField", "Checked"); - int newAcres = (int) autoAcresValue; - this.acres.setText(Integer.toString(newAcres) + " ac"); - this.acres.setEnabled(false); - } else { - this.acres.setEnabled(true); - } - } + public void onCheckedChanged(CompoundButton arg0, boolean arg1) { + // TODO Auto-generated method stub + } + +// @Override +// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { +// Log.d("FragmentAddField", "Check click"); +// if(buttonView.getId() == R.id.add_field_chkAutoAcres){ +// Log.d("FragmentAddField", "Check Auto acres"); +// if(isChecked){ +// Log.d("FragmentAddField", "Checked"); +// int newAcres = (int) autoAcresValue; +// this.acres.setText(Integer.toString(newAcres) + " ac"); +// this.acres.setEnabled(false); +// } else { +// this.acres.setEnabled(true); +// } +// } +// } } diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java b/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java index 555afcc..f8a5d4e 100644 --- a/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java +++ b/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java @@ -1,13 +1,23 @@ package com.openatk.fieldnotebook; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.OnMapClickListener; import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; import com.google.android.gms.maps.GoogleMap.OnMarkerDragListener; +import com.google.android.gms.maps.model.BitmapDescriptor; +import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLngBounds; +import com.google.android.gms.maps.model.Marker; +import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.PolygonOptions; import com.google.android.gms.maps.model.PolylineOptions; import com.openatk.fieldnotebook.db.DatabaseHelper; @@ -18,11 +28,19 @@ import com.openatk.fieldnotebook.drawing.MyPolygon; import com.openatk.fieldnotebook.drawing.MyPolyline; +import android.R.integer; import android.app.Activity; import android.content.ContentValues; import android.content.Context; +import android.content.Intent; import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.media.ExifInterface; +import android.net.Uri; import android.os.Bundle; +import android.os.Environment; +import android.provider.MediaStore; import android.support.v4.app.Fragment; import android.util.Log; import android.view.KeyEvent; @@ -43,85 +61,104 @@ import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; -public class FragmentSlider extends Fragment implements OnClickListener, OnTouchListener { +public class FragmentSlider extends Fragment implements OnClickListener, + OnTouchListener { - + private static final int REQUEST_CODE = 1337; + private static final int CAMERA_PIC_REQUEST = 1337; private GoogleMap map; private TextView tvName; private TextView tvAcres; private ImageButton butEditField; - + private Button butShowElevation; private Button butShowSoilType; private Button butAddNote; private ScrollAutoView svNotes; private LinearLayout listNotes; - + private Button openCamera; + private SliderListener listener; private Field currentField = null; private List notes = null; - + private DatabaseHelper dbHelper; private Note currentNote = null; OpenNoteView currentOpenNoteView = null; private RelativeLayout currentNoteView = null; - + private Bitmap bitmap; + private File image; + LayoutInflater vi; - + private Boolean addingPolygon = false; private Boolean addingPolyline = false; - private Boolean addingNote = false; //Or editing note - + private Boolean addingNote = false; // Or editing note + private MyPolyline currentPolyline = null; - + // Interface for receiving data public interface SliderListener { public void SliderDragDown(int start); + public void SliderDragDragging(int whereY); + public void SliderDragUp(int whereY); + public void SliderEditField(); + public void SliderRequestData(); - public void SliderCompletePolygon(); + + public void SliderCompletePolygon(); + public void SliderAddPolygon(); + public void SliderEditPolygon(MyPolygon poly); + public void SliderAddNote(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_slider, container, - false); + View view = inflater + .inflate(R.layout.fragment_slider, container, false); tvName = (TextView) view.findViewById(R.id.slider_tvName); tvAcres = (TextView) view.findViewById(R.id.slider_tvAcres); - + view.setOnTouchListener(this); tvName.setOnTouchListener(this); tvAcres.setOnTouchListener(this); - - butEditField = (ImageButton) view.findViewById(R.id.slider_butEditField); - butShowElevation = (Button) view.findViewById(R.id.slider_butShowElevation); - butShowSoilType = (Button) view.findViewById(R.id.slider_butShowSoilType); + + butEditField = (ImageButton) view + .findViewById(R.id.slider_butEditField); + butShowElevation = (Button) view + .findViewById(R.id.slider_butShowElevation); + butShowSoilType = (Button) view + .findViewById(R.id.slider_butShowSoilType); butAddNote = (Button) view.findViewById(R.id.slider_butAddNote); svNotes = (ScrollAutoView) view.findViewById(R.id.slider_scrollView); listNotes = (LinearLayout) view.findViewById(R.id.slider_listNotes); - - svNotes.setOverScrollMode(ScrollView.OVER_SCROLL_NEVER); //Visual bottom of scroll effect - + svNotes.setOverScrollMode(ScrollView.OVER_SCROLL_NEVER); // Visual + // bottom of + // scroll + // effect + butEditField.setOnClickListener(this); butShowElevation.setOnClickListener(this); butShowSoilType.setOnClickListener(this); butAddNote.setOnClickListener(this); - + dbHelper = new DatabaseHelper(this.getActivity()); - vi = (LayoutInflater) this.getActivity().getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); - + vi = (LayoutInflater) this.getActivity().getApplicationContext() + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + return view; } - + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); @@ -130,25 +167,27 @@ public void onActivityCreated(Bundle savedInstanceState) { public void populateData(Integer currentFieldId, GoogleMap map) { this.map = map; - - //Clear current + + // Clear current listNotes.removeAllViews(); this.onClose(); - - //Get current field + + // Get current field currentField = null; - if(currentFieldId != null){ - currentField = Field.FindFieldById(dbHelper.getReadableDatabase(), currentFieldId); + if (currentFieldId != null) { + currentField = Field.FindFieldById(dbHelper.getReadableDatabase(), + currentFieldId); dbHelper.close(); } if (currentField != null) { tvName.setText(currentField.getName()); tvAcres.setText(Integer.toString(currentField.getAcres()) + " ac"); - //Add all notes for this field - notes = Note.FindNotesByFieldName(dbHelper.getReadableDatabase(), currentField.getName()); + // Add all notes for this field + notes = Note.FindNotesByFieldName(dbHelper.getReadableDatabase(), + currentField.getName()); dbHelper.close(); - for(int i=0; i myPolygons = note.getMyPolygons(); - if(myPolygons.isEmpty()){ - List polygons = note.getPolygons(); //Gets map polygons - for(int i=0; i polygons = note.getPolygons(); // Gets map + // polygons + for (int i = 0; i < polygons.size(); i++) { + note.addMyPolygon(new MyPolygon(map, map.addPolygon(polygons + .get(i)))); // Adds back my polygons } } else { - for(int i =0; i myPolylines = note.getMyPolylines(); - if(myPolylines.isEmpty()){ - List polylines = note.getPolylines(); //Gets map polygons - for(int i=0; i polylines = note.getPolylines(); // Gets map + // polygons + for (int i = 0; i < polylines.size(); i++) { + note.addMyPolyline(new MyPolyline(map.addPolyline(polylines + .get(i)), map)); // Adds back my polygons } } else { - for(int i =0; i listPolygons = note.getMyPolygons(); LatLngBounds.Builder builder = new LatLngBounds.Builder(); - for(int i = 0;i points = listPolygons.get(i).getPoints(); - for(int j=0;j listPolyline = note.getMyPolylines(); - for(int p=0;p points = listPolyline.get(p).getPoints(); - for(int u = 0;u polys = this.currentNote.getMyPolygons(); MyPolygon touchedPoly = null; - for(int i=0; i 0){ + + public boolean hasNotes() { + if (notes != null && notes.size() > 0) { return true; } else { return false; @@ -558,54 +731,51 @@ public void onClick(View v) { if (v.getId() == R.id.slider_butEditField) { listener.SliderEditField(); } else if (v.getId() == R.id.slider_butAddNote) { - if(addingNote == false){ + if (addingNote == false) { this.addingNote = true; - //Add a new note + // Add a new note Note newNote = new Note(currentField.getName()); notes.add(newNote); - + View newView = inflateOpenNote(newNote); currentOpenNoteView = (OpenNoteView) newView.getTag(); listNotes.addView(newView, 0); listener.SliderAddNote(); - + svNotes.scrollTo(0, 0); - //InputMethodManager inputMethodManager = (InputMethodManager) this.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); - //inputMethodManager.showSoftInput(newOpenNote.etComment, 0); + // InputMethodManager inputMethodManager = (InputMethodManager) + // this.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); + // inputMethodManager.showSoftInput(newOpenNote.etComment, 0); } } else if (v.getId() == R.id.slider_butShowElevation) { - + } else if (v.getId() == R.id.slider_butShowSoilType) { - + } } - + @Override public boolean onTouch(View v, MotionEvent event) { float eventY = event.getRawY(); - - switch (event.getAction()) - { - case MotionEvent.ACTION_DOWN: - { - listener.SliderDragDown((int)eventY); - break; - } - case MotionEvent.ACTION_UP: - { - listener.SliderDragUp((int)(eventY)); - break; - } - case MotionEvent.ACTION_MOVE: - { - listener.SliderDragDragging((int)(eventY)); - break; - } - } - return true; + + switch (event.getAction()) { + case MotionEvent.ACTION_DOWN: { + listener.SliderDragDown((int) eventY); + break; + } + case MotionEvent.ACTION_UP: { + listener.SliderDragUp((int) (eventY)); + break; + } + case MotionEvent.ACTION_MOVE: { + listener.SliderDragDragging((int) (eventY)); + break; + } + } + return true; } - - public boolean isAddingNote(){ + + public boolean isAddingNote() { return this.addingNote; } diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java b/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java index 29edc34..ca528cc 100644 --- a/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java +++ b/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java @@ -1059,7 +1059,7 @@ public void AddFieldUndo() { } @Override - public void AddFieldDone(String name, Integer acres) { + public void AddFieldDone(String name) { // Check if field name is valid and doesn't exist already if (name.length() == 0) { // Tell them to input a name @@ -1085,9 +1085,9 @@ public void AddFieldDone(String name, Integer acres) { wasAnEdit = true; } currentField.setName(name); - currentField.setAcres(acres); +// currentField.setAcres(acres); - Log.d("MainActivity", "Acres:" + Integer.toString(acres)); +// Log.d("MainActivity", "Acres:" + Integer.toString(acres)); String strNewBoundary = ""; if(points != null && points.isEmpty() == false){ // Generate boundary @@ -1138,7 +1138,7 @@ public void AddFieldDone(String name, Integer acres) { if (FieldsOnMap.get(i).getId() == currentField.getId()) { FieldsOnMap.get(i).setName(name); FieldsOnMap.get(i).setPolygon(this.currentPolygon); - FieldsOnMap.get(i).setAcres(acres); +// FieldsOnMap.get(i).setAcres(acres); FieldsOnMap.get(i).setBoundary(points); } } @@ -1263,7 +1263,7 @@ public boolean onMarkerClick(Marker arg0) { @Override public void MyPolygonUpdateAcres(Float acres) { if(this.fragmentAddField != null){ - this.fragmentAddField.autoAcres(acres); +// this.fragmentAddField.autoAcres(acres); } } diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/drawing/MyPolygon.java b/FieldNotebook/src/com/openatk/fieldnotebook/drawing/MyPolygon.java index c1a3186..b0e4345 100644 --- a/FieldNotebook/src/com/openatk/fieldnotebook/drawing/MyPolygon.java +++ b/FieldNotebook/src/com/openatk/fieldnotebook/drawing/MyPolygon.java @@ -384,7 +384,7 @@ public void setLabel(String label, Boolean selected){ paint.getTextBounds(label, 0, label.length(), bounds); Bitmap.Config conf = Bitmap.Config.ARGB_8888; - Bitmap bitmap = Bitmap.createBitmap(bounds.width() + 5, bounds.height(), conf); //TODO create blank new bitmap + Bitmap bitmap = Bitmap.createBitmap(bounds.width() + 5, bounds.height()+1, conf); //TODO create blank new bitmap float x = 0; float y = -1.0f * bounds.top + (bitmap.getHeight() * 0.06f); diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/drawing/MyPolyline.java b/FieldNotebook/src/com/openatk/fieldnotebook/drawing/MyPolyline.java index fe85924..0fc8cc3 100644 --- a/FieldNotebook/src/com/openatk/fieldnotebook/drawing/MyPolyline.java +++ b/FieldNotebook/src/com/openatk/fieldnotebook/drawing/MyPolyline.java @@ -159,13 +159,13 @@ private void selectMarker(Integer markerIndex) { Log.d("MarkerSelected:", Integer.toString(markerSelected)); // Change icon of last selected marker Marker oldMarker = markers.get(markerSelected.intValue()); - oldMarker.setIcon(icon); + //oldMarker.setIcon(icon); } if (markerIndex != null) { Log.d("MarkerIndex:", Integer.toString(markerIndex)); // Change icon on new selected marker Marker oldMarker = this.markers.get(markerIndex.intValue()); - oldMarker.setIcon(iconSelected); + //oldMarker.setIcon(iconSelected); } markerSelected = markerIndex; } From a0e3e7dfb784b791bd1a764a9565da9955d7652a Mon Sep 17 00:00:00 2001 From: AymanKh Date: Tue, 19 Nov 2013 12:20:50 -0500 Subject: [PATCH 04/10] Commit --- .../drawable-hdpi/10_device_access_camera.png | Bin 0 -> 1762 bytes .../res/drawable-hdpi/add_picture.png | Bin 0 -> 3983 bytes FieldNotebook/res/layout/fragment_drawing.xml | 156 ++++--- FieldNotebook/res/layout/note_open.xml | 71 --- .../fieldnotebook/FragmentDrawing.java | 4 +- .../openatk/fieldnotebook/FragmentSlider.java | 425 +++--------------- 6 files changed, 153 insertions(+), 503 deletions(-) create mode 100644 FieldNotebook/res/drawable-hdpi/10_device_access_camera.png create mode 100644 FieldNotebook/res/drawable-hdpi/add_picture.png diff --git a/FieldNotebook/res/drawable-hdpi/10_device_access_camera.png b/FieldNotebook/res/drawable-hdpi/10_device_access_camera.png new file mode 100644 index 0000000000000000000000000000000000000000..b119b1999cce483202e2503f979e0669f0c76480 GIT binary patch literal 1762 zcmaJ?X;2eq7!E-cLBJ6WNCCIOiz?aO7=#1@-lCkFN$5@ z;^gH-AP`*mQQSCug>0|mSp1tn9N362Q!$9fe;#Q(1;~U1Ot+gWQCeZepz>p3@D^bazda0 z5@MHE~1lY z6&g%|ssS6LI0;R~m}ETD4<)EHqqJ(>$2Q>&0}Wyg2vZ~X&4+WBF0dy5Jgi)y0}P=VyI4zY5-1rAO!{lVu?a+ zvkW5y0tR2L!^CO{!sjx{I0r?ckTR&Oc^nRnJwK2QabcJT(`hiBM`LqXk%4d!jSY`r zxu_&ng{ZL+tn?E$=!;mJ7*rZOG8fS*(hzB+7F7YmMKcti%Z1LNvVz#`FY4|3!Wi7pNTUL;FrNP~^=r?Iqr_BGdbGTeKv%o03+rO{0BH+8qo+`Sn)q z+C6RX-RfER=3GORmz{ez)j&+oT5@1oiv5<}>j#$^y$1PqcN$&mlbf3^T2B*KYGwV| zVU>kGbxX2I(RmMU>4VRUL-s#kSM<1~xMf2uH1?<95~uK$rs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)B{rhMb5%b zx?($0FD<~^9Pguf!za-O(^Ifa{?MkJnyL(0Fi=ia!Ll*=L${B0Zcs3Mfb$sXQQW24 p!d@~TpbyXo=mYct`Zl-yI{^9WZ7o1Gyhs25002ovPDHLkV1gG8gL(h} literal 0 HcmV?d00001 diff --git a/FieldNotebook/res/layout/fragment_drawing.xml b/FieldNotebook/res/layout/fragment_drawing.xml index 044b294..ea5f212 100644 --- a/FieldNotebook/res/layout/fragment_drawing.xml +++ b/FieldNotebook/res/layout/fragment_drawing.xml @@ -1,80 +1,88 @@ + android:background="#EEE" + android:clickable="true" > + - - - - - - - - - - - - - - - - - - + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_marginBottom="5dp" + android:layout_marginTop="5dp" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FieldNotebook/res/layout/note_open.xml b/FieldNotebook/res/layout/note_open.xml index 1950f2a..26f8ca9 100644 --- a/FieldNotebook/res/layout/note_open.xml +++ b/FieldNotebook/res/layout/note_open.xml @@ -10,76 +10,6 @@ android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginTop="10dp"> -<<<<<<< HEAD - - - - - - - - - - - - - - - - - - - -======= ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 >>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 import com.google.android.gms.maps.model.PolygonOptions; import com.google.android.gms.maps.model.PolylineOptions; import com.openatk.fieldnotebook.FragmentDrawing.DrawingListener; import com.openatk.fieldnotebook.db.DatabaseHelper; import com.openatk.fieldnotebook.db.Field; import com.openatk.fieldnotebook.db.Note; -import com.openatk.fieldnotebook.db.TableFields; import com.openatk.fieldnotebook.db.TableNotes; import com.openatk.fieldnotebook.drawing.MyMarker; import com.openatk.fieldnotebook.drawing.MyPolygon; import com.openatk.fieldnotebook.drawing.MyPolyline; -import android.R.integer; import android.app.Activity; import android.app.AlertDialog; import android.content.ContentValues; import android.content.Context; -<<<<<<< HEAD import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.media.ExifInterface; import android.net.Uri; -======= import android.content.DialogInterface; -import android.database.sqlite.SQLiteDatabase; import android.graphics.Color; ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.support.v4.app.Fragment; import android.util.Log; -import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; @@ -73,19 +59,12 @@ import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.TextView; -import android.widget.TextView.OnEditorActionListener; - -<<<<<<< HEAD -public class FragmentSlider extends Fragment implements OnClickListener, - OnTouchListener { - private static final int REQUEST_CODE = 1337; - private static final int CAMERA_PIC_REQUEST = 1337; -======= public class FragmentSlider extends Fragment implements OnClickListener, OnTouchListener, DrawingListener { private FragmentDrawing fragmentDrawing = null; private FragmentSlider me = null; ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 + private static final int REQUEST_CODE = 1337; + private static final int CAMERA_PIC_REQUEST = 1337; private GoogleMap map; private TextView tvName; private TextView tvAcres; @@ -113,12 +92,6 @@ public class FragmentSlider extends Fragment implements OnClickListener, OnTouch private Boolean addingPolygon = false; private Boolean addingPolyline = false; -<<<<<<< HEAD - private Boolean addingNote = false; // Or editing note - - private MyPolyline currentPolyline = null; - -======= private Boolean addingPoint = false; private Boolean addingNote = false; //Or editing note @@ -126,8 +99,6 @@ public class FragmentSlider extends Fragment implements OnClickListener, OnTouch private MyPolyline currentPolyline = null; private MyMarker currentPoint = null; - ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 // Interface for receiving data public interface SliderListener { public void SliderDragDown(int start); @@ -139,13 +110,7 @@ public interface SliderListener { public void SliderEditField(); public void SliderRequestData(); -<<<<<<< HEAD - - public void SliderCompletePolygon(); - -======= public void SliderCompletePolygon(); ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 public void SliderAddPolygon(); public void SliderEditPolygon(MyPolygon poly); @@ -191,13 +156,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, butAddNote.setOnClickListener(this); dbHelper = new DatabaseHelper(this.getActivity()); -<<<<<<< HEAD - vi = (LayoutInflater) this.getActivity().getApplicationContext() - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - -======= vi = (LayoutInflater) this.getActivity().getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 return view; } @@ -238,17 +197,10 @@ public void populateData(Integer currentFieldId, GoogleMap map) { notes = null; } } -<<<<<<< HEAD - - public void finishPolygon(MyPolygon newPolygon) { - if (currentNote != null) { - // TODO handle edit finish? Maybe not, i think i removed on edit? -======= public void finishPolygon(MyPolygon newPolygon){ if(currentNote != null){ //TODO handle edit finish? Maybe not, i think i removed on edit? ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 newPolygon.setStrokeColor(Field.STROKE_COLOR); currentNote.addMyPolygon(newPolygon); // Adds a mypolygon } @@ -258,18 +210,9 @@ private View inflateNote(Note note) { View view = vi.inflate(R.layout.note, null); NoteView noteView = new NoteView(); noteView.layNote = (RelativeLayout) view.findViewById(R.id.note); -<<<<<<< HEAD - noteView.butEdit = (ImageButton) view.findViewById(R.id.note_butEdit); - noteView.butShowHide = (ImageButton) view - .findViewById(R.id.note_butShowHide); - noteView.tvComment = (TextView) view.findViewById(R.id.note_txtComment); - noteView.tvComment2 = (TextView) view - .findViewById(R.id.note_txtComment2); -======= noteView.imgColor = (ImageView) view.findViewById(R.id.note_imgColor); noteView.butShowHide = (ImageButton) view.findViewById(R.id.note_butShowHide); noteView.tvComment = (TextView) view.findViewById(R.id.note_txtComment); ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 noteView.imgPoints = (ImageView) view.findViewById(R.id.note_imgPoints); noteView.imgLines = (ImageView) view.findViewById(R.id.note_imgLines); noteView.imgPolygons = (ImageView) view @@ -280,40 +223,17 @@ private View inflateNote(Note note) { noteView.note = note; noteView.tvComment.setText(note.getComment()); -<<<<<<< HEAD - - noteView.butEdit.setTag(noteView); -======= - ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 noteView.butShowHide.setTag(noteView); noteView.layNote.setTag(noteView); noteView.butShowHide.setOnClickListener(noteClickListener); -<<<<<<< HEAD - noteView.row1.setOnClickListener(noteClickListener); - - if (note.getVisible() == 1) { -======= noteView.layNote.setOnClickListener(noteClickListener); if(note.getVisible() == 1){ ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 noteView.butShowHide.setImageResource(R.drawable.note_but_hide); } else { noteView.butShowHide.setImageResource(R.drawable.note_but_show); } -<<<<<<< HEAD - - // Add polygons from note to map - List myPolygons = note.getMyPolygons(); - if (myPolygons.isEmpty()) { - List polygons = note.getPolygons(); // Gets map - // polygons - for (int i = 0; i < polygons.size(); i++) { - note.addMyPolygon(new MyPolygon(map, map.addPolygon(polygons - .get(i)))); // Adds back my polygons -======= //Add polygons from note to map List myPolygons = note.getMyPolygons(); @@ -322,7 +242,6 @@ private View inflateNote(Note note) { for(int i=0; i>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 } } else { for (int i = 0; i < myPolygons.size(); i++) { @@ -343,9 +262,6 @@ private View inflateNote(Note note) { myPolylines.get(i).unselect(); } } -<<<<<<< HEAD - -======= //Add points from note to map List myMarkers = note.getMyMarkers(); if(myMarkers.isEmpty()){ @@ -361,8 +277,6 @@ private View inflateNote(Note note) { note.setColor(note.getColor()); noteView.imgColor.setBackgroundColor(note.getColor()); - ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 noteView.me = view; view.setTag(noteView); return view; @@ -374,21 +288,12 @@ private View inflateNote(Note note) { @Override public void onClick(View v) { NoteView noteView = (NoteView) v.getTag(); -<<<<<<< HEAD - if (v.getId() == R.id.note_butShowHide) { - - } else if (v.getId() == R.id.note_row1) { - if (addingNote == false) { - addingNote = true; - -======= if(v.getId() == R.id.note_butShowHide){ } else if(v.getId() == R.id.note){ if(addingNote == false){ addingNote = true; ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 svNotes.scrollToAfterAdd(noteView.me.getTop()); // Edit this note int index = listNotes.indexOfChild(noteView.me); @@ -397,20 +302,10 @@ public void onClick(View v) { View newView = inflateOpenNote(currentNote); listNotes.addView(newView, index); currentOpenNoteView = (OpenNoteView) newView.getTag(); -<<<<<<< HEAD - Log.d("Current Scroll:", - Float.toString(svNotes.getScrollY())); - Log.d("v Top:", Integer.toString(v.getTop())); - Log.d("v Bottom:", Integer.toString(v.getBottom())); - Log.d("me Top:", Integer.toString(newView.getTop())); - Log.d("me Bottom:", Integer.toString(newView.getBottom())); - -======= //Show drawing fragment fragmentDrawing = listener.SliderShowDrawing(); fragmentDrawing.setListener(me); ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 } } @@ -419,14 +314,9 @@ public void onClick(View v) { }; -<<<<<<< HEAD - static class NoteView { - ImageButton butEdit; -======= static class NoteView { ImageView imgColor; ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 ImageButton butShowHide; TextView tvComment; ImageView imgPoints; @@ -443,61 +333,6 @@ private View inflateOpenNote(Note note) { View view = vi.inflate(R.layout.note_open, null); final OpenNoteView noteView = new OpenNoteView(); noteView.layNote = (RelativeLayout) view.findViewById(R.id.note_open); -<<<<<<< HEAD - noteView.butPoint = (ImageButton) view - .findViewById(R.id.note_open_butPoint); - noteView.butLine = (ImageButton) view - .findViewById(R.id.note_open_butLine); - noteView.butPolygon = (ImageButton) view - .findViewById(R.id.note_open_butPolygon); - noteView.butColor = (ImageButton) view - .findViewById(R.id.note_open_butColor); - noteView.butDone = (ImageButton) view - .findViewById(R.id.note_open_butDone); - noteView.butDelete = (ImageButton) view - .findViewById(R.id.note_open_butDelete); - noteView.etComment = (EditText) view - .findViewById(R.id.note_open_etComment); - noteView.openCamera = (ImageButton) view - .findViewById(R.id.note_take_picture); - - noteView.note = note; - - noteView.etComment.setText(note.getComment()); - noteView.etComment.setImeActionLabel("Done", KeyEvent.KEYCODE_ENTER); - noteView.etComment - .setOnEditorActionListener(new OnEditorActionListener() { - @Override - public boolean onEditorAction(TextView v, int keyCode, - KeyEvent event) { - if (event != null - && (event.getAction() == KeyEvent.ACTION_DOWN) - && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) { - // hide virtual keyboard - InputMethodManager imm = (InputMethodManager) getActivity() - .getApplicationContext().getSystemService( - Context.INPUT_METHOD_SERVICE); - imm.hideSoftInputFromWindow( - noteView.etComment.getWindowToken(), 0); - return true; - } - return false; - } - }); - - noteView.butPoint.setTag(noteView); - noteView.butLine.setTag(noteView); - noteView.butPolygon.setTag(noteView); - noteView.butColor.setTag(noteView); - noteView.butDone.setTag(noteView); - noteView.butDelete.setTag(noteView); - noteView.openCamera.setTag(noteView); - - noteView.butPoint.setOnClickListener(openNoteClickListener); - noteView.butLine.setOnClickListener(openNoteClickListener); - noteView.butPolygon.setOnClickListener(openNoteClickListener); - noteView.butColor.setOnClickListener(openNoteClickListener); -======= noteView.butDone = (ImageButton) view.findViewById(R.id.note_open_butDone); noteView.butDelete = (ImageButton) view.findViewById(R.id.note_open_butDelete); noteView.etComment = (EditText) view.findViewById(R.id.note_open_etComment); @@ -524,11 +359,8 @@ public boolean onEditorAction(TextView v, int keyCode, KeyEvent event) { noteView.butDone.setTag(noteView); noteView.butDelete.setTag(noteView); - ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 noteView.butDone.setOnClickListener(openNoteClickListener); noteView.butDelete.setOnClickListener(openNoteClickListener); - noteView.openCamera.setOnClickListener(openNoteClickListener); noteView.me = view; view.setTag(noteView); @@ -543,8 +375,8 @@ private File createImageFile() throws IOException { String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss") .format(new Date()); String imageFileName = "IMG_" + timeStamp + "_"; - image = File.createTempFile(imageFileName, ".jpg", storageDir); + Log.w("createimagefile", Boolean.toString(image == null)); // mCurrentPhotoPath = image.getAbsolutePath(); return image; } @@ -562,73 +394,9 @@ private void galleryAddPic() { @Override public void onClick(View v) { OpenNoteView noteView = (OpenNoteView) v.getTag(); -<<<<<<< HEAD - currentNote = noteView.note; - if (v.getId() == R.id.note_open_butPoint) { - - } else if (v.getId() == R.id.note_open_butLine) { - if (addingPolyline == false) { - currentPolyline = new MyPolyline(map); - currentPolyline.edit(); - noteView.butLine.setImageResource(R.drawable.close_line_v1); - addingPolyline = true; - } else { - if (currentPolyline != null) - currentPolyline.complete(); - map.setOnMapClickListener((OnMapClickListener) listener); - map.setOnMarkerClickListener((OnMarkerClickListener) listener); - map.setOnMarkerDragListener((OnMarkerDragListener) listener); - - if (currentNote != null) { - // TODO handle edit finish? Maybe not, i think i removed - // on edit? - currentPolyline.setColor(Field.STROKE_COLOR); - currentNote.addMyPolyline(currentPolyline); // Adds a - // myPolyline - } - noteView.butLine.setImageResource(R.drawable.add_line_v1); - addingPolyline = false; - } - } else if (v.getId() == R.id.note_open_butPolygon) { - if (addingPolygon == false) { - noteView.butPolygon - .setImageResource(R.drawable.close_polygon); - listener.SliderAddPolygon(); - addingPolygon = true; - } else { - noteView.butPolygon - .setImageResource(R.drawable.add_polygon); - listener.SliderCompletePolygon(); - addingPolygon = false; - } - } else if (v.getId() == R.id.note_open_butColor) { - - } else if (v.getId() == R.id.note_take_picture) { - - // Capture image from camera - added 10/31 - int CAMERA_PIC_REQUEST = 1337; - Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); - - File f = null; - try { - f = createImageFile(); - Log.w("click_listener",f.toString()); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f)); - startActivityForResult(intent, CAMERA_PIC_REQUEST); - - } else if (v.getId() == R.id.note_open_butDone) { - if (addingPolygon) { - noteView.butPolygon - .setImageResource(R.drawable.add_polygon); -======= if(v.getId() == R.id.note_open_butDone){ if(addingPolygon){ fragmentDrawing.setPolygonIcon(R.drawable.add_polygon); ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 listener.SliderCompletePolygon(); addingPolygon = false; } @@ -650,77 +418,19 @@ public void onClick(View v) { fragmentDrawing.setPolylineIcon(R.drawable.add_line_v1); addingPolygon = false; } -<<<<<<< HEAD - - // Save the note -======= // hide virtual keyboard InputMethodManager imm = (InputMethodManager)getActivity().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(noteView.etComment.getWindowToken(), 0); //Save the note ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 currentNote.setComment(noteView.etComment.getText().toString()); SaveNote(currentNote); // Close the note int index = listNotes.indexOfChild(noteView.me); listNotes.removeView(noteView.me); listNotes.addView(inflateNote(currentNote), index); -<<<<<<< HEAD - } else if (v.getId() == R.id.note_open_butDelete) { - } - } - }; - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - Log.w("onActivityResult", "1"); - Log.w("RESULT_OK",Integer.toString(resultCode)); - if (resultCode == Activity.RESULT_OK) { - Log.w("REQUEST_OK",Integer.toString(requestCode)); - if (requestCode == REQUEST_CODE) { - Log.w("REQUEST_OK","got in"); - // We need to recycle unused bitmaps - if (bitmap != null) { - bitmap.recycle(); - } -// Bundle extras = data.getExtras(); -// bitmap = (Bitmap) extras.get("data"); - - - //InputStream stream = getActivity().getContentResolver().openInputStream(data.getData()); - Log.w("InputStream","2"); - //bitmap = BitmapFactory.decodeStream(stream); - //stream.close(); -// galleryAddPic(); - try { - ExifInterface xint = new ExifInterface(image.getAbsolutePath().toString()); - Log.w("image",image.getAbsolutePath().toString()); - - bitmap = BitmapFactory.decodeByteArray(xint.getThumbnail(),0,xint.getThumbnail().length); - float[] ltlng = new float[2]; - xint.getLatLong(ltlng); -// LatLng picLoc = new LatLng(Double.parseDouble(xint.getAttribute(xint.TAG_GPS_LATITUDE)),Double.parseDouble(xint.getAttribute(xint.TAG_GPS_LONGITUDE))); - LatLng picLoc = new LatLng(ltlng[0],ltlng[1]); - //Log.w("picLoc",picLoc.toString()); - //Log.w("bitmap", bitmap.toString()); - Marker imageMarker = map.addMarker(new MarkerOptions().position(picLoc).icon(BitmapDescriptorFactory.fromBitmap(bitmap))); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - super.onActivityResult(requestCode, resultCode, data); - } - - static class OpenNoteView { - ImageButton butPoint; - ImageButton butLine; - ImageButton butPolygon; - ImageButton butColor; -======= //Hide drawing fragment listener.SliderHideDrawing(); @@ -734,7 +444,6 @@ static class OpenNoteView { }; static class OpenNoteView { ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 ImageButton butDone; ImageButton butDelete; EditText etComment; @@ -749,28 +458,11 @@ private void SaveNote(Note note) { SQLiteDatabase database = dbHelper.getWritableDatabase(); ContentValues values = new ContentValues(); -<<<<<<< HEAD - values.put(TableNotes.COL_COMMENT, note.getComment()); - values.put(TableNotes.COL_FIELD_NAME, note.getFieldName()); - - // Save current my polygons to strpolygons -======= values.put(TableNotes.COL_COMMENT,note.getComment()); values.put(TableNotes.COL_FIELD_NAME,note.getFieldName()); values.put(TableNotes.COL_COLOR,note.getColor()); //Save current my polygons to strpolygons ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 - note.myPolygonsToStringPolygons(); - // Save the polygons - values.put(TableNotes.COL_POLYGONS, note.getStrPolygons()); - Log.d("SaveNote", "StrPolygons:" + note.getStrPolygons()); - // Save current my polylines to strpolylines - note.myPolylinesToStringPolylines(); - // Save the polylines - values.put(TableNotes.COL_LINES, note.getStrPolylines()); - Log.d("SaveNote", "StrPolylines:" + note.getStrPolylines()); -<<<<<<< HEAD // Iaman and Patrick added this for demo 2 @@ -817,13 +509,6 @@ private void SaveNote(Note note) { + "'"; database.update(TableFields.TABLE_NAME, valuesField, whereField, null);*/ -======= - //Save current my polylines to strpolylines - note.myMarkersToStringMarkers(); - //Save the polylines - values.put(TableNotes.COL_POINTS, note.getStrMarkers()); - Log.d("SaveNote", "StrPoints:" + note.getStrMarkers()); ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 // map.clear(); // MainActivity.drawFields(); @@ -845,29 +530,6 @@ private void SaveNote(Note note) { public void onMapClick(LatLng position) { Log.d("Here", "FragmentSlider - onMapClick"); -<<<<<<< HEAD - // Check if clicked on any of current notes objects - if (this.currentNote != null) { - // Loop through current notes polygons checking if touched - List polys = this.currentNote.getMyPolygons(); - MyPolygon touchedPoly = null; - for (int i = 0; i < polys.size(); i++) { - if (polys.get(i).wasTouched(position)) { - touchedPoly = polys.get(i); - break; - } - } - if (touchedPoly != null) { - touchedPoly.edit(); - if (this.currentOpenNoteView != null) { - this.currentOpenNoteView.butPolygon - .setImageResource(R.drawable.close_polygon); - } - // Shouldn't recieve touch if already adding so this is fine - this.currentNote.removePolygon(touchedPoly); - listener.SliderEditPolygon(touchedPoly); - addingPolygon = true; -======= //Check if clicked on any of current notes objects if(this.currentNote != null){ //Loop through current notes polygons checking if touched @@ -911,7 +573,6 @@ public void onMapClick(LatLng position) { listener.SliderEditPolygon(touchedPoly); addingPolygon = true; } ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 } @@ -979,31 +640,19 @@ public void onClick(View v) { this.addingNote = true; // Add a new note Note newNote = new Note(currentField.getName()); - notes.add(newNote); -<<<<<<< HEAD - -======= - currentNote = newNote; - ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 + notes.add(newNote); View newView = inflateOpenNote(newNote); currentOpenNoteView = (OpenNoteView) newView.getTag(); listNotes.addView(newView, 0); listener.SliderAddNote(); svNotes.scrollTo(0, 0); -<<<<<<< HEAD - // InputMethodManager inputMethodManager = (InputMethodManager) - // this.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); - // inputMethodManager.showSoftInput(newOpenNote.etComment, 0); -======= //InputMethodManager inputMethodManager = (InputMethodManager) this.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); //inputMethodManager.showSoftInput(newOpenNote.etComment, 0); //Show drawing fragment fragmentDrawing = listener.SliderShowDrawing(); fragmentDrawing.setListener(me); ->>>>>>> 0fa31143e972d9356aa4635f4471e96a2b2fc814 } } else if (v.getId() == R.id.slider_butShowElevation) { @@ -1130,12 +779,32 @@ public void onClick(DialogInterface dialog, int which) { @Override public void DrawingClickCamera() { + Log.w("drawclickcam imageest", Boolean.toString(image == null)); + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("Geotag Photo?"); builder.setMessage("Would you like to associate this picture with a point?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { - + // Capture image from camera - added 10/31 + int CAMERA_PIC_REQUEST = 1337; + Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); + + File f = null; + try { + f = createImageFile(); + Log.w("after createimage ", Boolean.toString(image == null)); + Log.w("click_listener", image.toString()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f)); + Log.w("after putextra", Boolean.toString(image == null)); + startActivityForResult(intent, CAMERA_PIC_REQUEST); + + Log.w("after startact", Boolean.toString(image == null)); + } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { @@ -1146,5 +815,49 @@ public void onClick(DialogInterface dialog, int id) { AlertDialog dialog = builder.create(); dialog.show(); } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + Log.w("onact imagetest", Boolean.toString(image == null)); + Log.w("onActivityResult", "1"); + Log.w("RESULT_OK",Integer.toString(resultCode)); + if (resultCode == Activity.RESULT_OK) { + Log.w("REQUEST_OK",Integer.toString(requestCode)); + if (requestCode == REQUEST_CODE) { + // We need to recycle unused bitmaps + if (bitmap != null) { + bitmap.recycle(); + } +// Bundle extras = data.getExtras(); +// bitmap = (Bitmap) extras.get("data"); + + + //InputStream stream = getActivity().getContentResolver().openInputStream(data.getData()); + Log.w("InputStream","2"); + //bitmap = BitmapFactory.decodeStream(stream); + //stream.close(); +// galleryAddPic(); + try { + Log.w("exif", Boolean.toString(image == null)); + ExifInterface xint = new ExifInterface(image.getAbsolutePath().toString()); + Log.w("image",image.getAbsolutePath().toString()); + + bitmap = BitmapFactory.decodeByteArray(xint.getThumbnail(),0,xint.getThumbnail().length); + float[] ltlng = new float[2]; + xint.getLatLong(ltlng); +// LatLng picLoc = new LatLng(Double.parseDouble(xint.getAttribute(xint.TAG_GPS_LATITUDE)),Double.parseDouble(xint.getAttribute(xint.TAG_GPS_LONGITUDE))); + LatLng picLoc = new LatLng(ltlng[0],ltlng[1]); + //Log.w("picLoc",picLoc.toString()); + //Log.w("bitmap", bitmap.toString()); + Marker imageMarker = map.addMarker(new MarkerOptions().position(picLoc).icon(BitmapDescriptorFactory.fromBitmap(bitmap))); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + super.onActivityResult(requestCode, resultCode, data); + } + } \ No newline at end of file From 220f12e331326629d53e3998f5d8654ec2c61c64 Mon Sep 17 00:00:00 2001 From: AymanKh Date: Thu, 21 Nov 2013 20:08:39 -0500 Subject: [PATCH 05/10] fkjn --- ...e_access_camera.png => device_access_camera.png} | Bin FieldNotebook/res/layout/fragment_drawing.xml | 2 +- .../com/openatk/fieldnotebook/FragmentSlider.java | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) rename FieldNotebook/res/drawable-hdpi/{10_device_access_camera.png => device_access_camera.png} (100%) diff --git a/FieldNotebook/res/drawable-hdpi/10_device_access_camera.png b/FieldNotebook/res/drawable-hdpi/device_access_camera.png similarity index 100% rename from FieldNotebook/res/drawable-hdpi/10_device_access_camera.png rename to FieldNotebook/res/drawable-hdpi/device_access_camera.png diff --git a/FieldNotebook/res/layout/fragment_drawing.xml b/FieldNotebook/res/layout/fragment_drawing.xml index ea5f212..14ed1a1 100644 --- a/FieldNotebook/res/layout/fragment_drawing.xml +++ b/FieldNotebook/res/layout/fragment_drawing.xml @@ -79,7 +79,7 @@ android:layout_width="80dp" android:layout_height="80dp" android:layout_centerInParent="true" - android:src="@drawable/add_picture" /> + android:src="@drawable/device_access_camera" /> diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java b/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java index 2fa5bf0..19a1d60 100644 --- a/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java +++ b/FieldNotebook/src/com/openatk/fieldnotebook/FragmentSlider.java @@ -640,6 +640,7 @@ public void onClick(View v) { this.addingNote = true; // Add a new note Note newNote = new Note(currentField.getName()); + currentNote = newNote; notes.add(newNote); View newView = inflateOpenNote(newNote); currentOpenNoteView = (OpenNoteView) newView.getTag(); @@ -843,6 +844,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.w("image",image.getAbsolutePath().toString()); bitmap = BitmapFactory.decodeByteArray(xint.getThumbnail(),0,xint.getThumbnail().length); + bitmap=Bitmap.createScaledBitmap(bitmap, bitmap.getWidth()/2,bitmap.getHeight()/2, false); float[] ltlng = new float[2]; xint.getLatLong(ltlng); // LatLng picLoc = new LatLng(Double.parseDouble(xint.getAttribute(xint.TAG_GPS_LATITUDE)),Double.parseDouble(xint.getAttribute(xint.TAG_GPS_LONGITUDE))); From 3bccabc5114febb90198c31241fa1c68c84c041b Mon Sep 17 00:00:00 2001 From: AymanKh Date: Thu, 21 Nov 2013 23:04:39 -0500 Subject: [PATCH 06/10] jhjh --- FieldNotebook/res/layout/fragment_slider.xml | 109 ++++++++++-------- .../openatk/fieldnotebook/MainActivity.java | 12 ++ .../notelist/FragmentNoteList.java | 22 ++-- .../fieldnotebook/slider/FragmentSlider.java | 80 +++++++++---- .../fieldnotebook/slider/SliderListener.java | 6 +- 5 files changed, 148 insertions(+), 81 deletions(-) diff --git a/FieldNotebook/res/layout/fragment_slider.xml b/FieldNotebook/res/layout/fragment_slider.xml index 83ca57b..4f0a3dc 100644 --- a/FieldNotebook/res/layout/fragment_slider.xml +++ b/FieldNotebook/res/layout/fragment_slider.xml @@ -5,54 +5,64 @@ android:clickable="true" android:background="#D1D1D1"> - + android:layout_alignParentTop="true" + android:visibility="gone"> + - - -