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$-~sf#cQ*VVTp8FPmVY
z#y_laVyvE6d^O1-<@XEs!+I-EK1$qF-eYmRE9eHS71Kors5;n1a-#SN8l_4(CZoIkG}iELEn{>);{3aqjmcbcuSY}_S?Zs|~4
z1}67vEHAU?bj9b)?wi;wO(*UA<6IW2`NEYf)84E8EthFS=90F{&=!83YyFYZRvPgE
z;H&*UKaEfrd~0dr)XEc0X3{;=VaN8E%#Ko@cv;5DNb{ta34`qiR`oGM7TUQw#Pk_w
zhz`}dU#t-sjNKc|m;qv#CbptsB6K?gSjDR+;lv!`sQ)he1KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T
zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p
z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&nehQ1i
z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW
zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X
zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4
zfg=2N-7=cNnjjOr{yriy6mMFgG#l
znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U
zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya?
z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y
zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB
zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt
z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C
z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB
zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe
zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0
z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$
z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4
z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu
zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu
z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E
ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw
zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX
z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i&
z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01
z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R
z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw
zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD
zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3|
zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy
zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z
zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F}
z000EKNkl>K4fK!;>c}ZN6k)WyPoQZD_@|RawVg#{pw7J3v;_1_8CpM%LwywhkPYg{M;mw?
zX+Y%1%K^}|1pKM5;jO-g;aIY@R%4)|F;MY)a|4^|Ii9QMiw*Fko5ucS9z9bgy6$i+
z;g9A94zE|RU78@gXaG%1z;BlYRNFbK_vx83ItGwfB!E3r#xL);&>DrYs74K7+feZH
z#n-2P=AR||aRQ3ZI~P2unMBfpq1*Vdiz*uN|+T`_?ez`yjhg^#$@g2;Hn<85o5
zy0fRv*-=;$K7HL71DX!-+ytuB1IIB2u-3_7U{l*Z#D4r~cA9fnq}KGC&vN)Kdxm_p
z&ej&DEz?LEXGs{kUfUYW+CT-C`SHy{~%i;3w&`ZGf{1qAVIopKSy5Vx^@u
z3b6z5+E6?P@Y-Mq;L!43V~?cIwpY68p0QxF@#6M<
z5g9rI0U#f3cm^QJVk$9!g{TIBvzUh`a25(tjXi*}V4x7wm(bg+$Q>IIv{g#U?j
zOz>^y5IjQ#2A-Sx#9_idz?(d4D}Krhz^(WxRk=x}9{4hGf|%5I9bQc8<0XZ_K^>sL
zS=h}SxejnQb3{EqrB;#7DLS6Im>WKgX~-!${WF&4;-%CvmDJ%ODOD+T>`aiNxp;s#
z@j6{~9N_D86#?G#K0pB2hOM03+f6uf9O$y-L=Ij%IisAOJj%pCc)EW?q++JFfjd
z4ATIo-Mssy*zGlpjTAF8WS*2e*o=Sv>DqkYQ@XSOr!ud0=lE?z9H7YP)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">
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
\ No newline at end of file
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java b/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java
index 85ad44f..6de80d5 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java
@@ -1222,6 +1222,18 @@ public void FieldListSelectField(Field selectedField) {
this.NoteListRequestData(null); //Populate notes again
}
+ @Override
+ public void SliderBackToFieldsList() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void SliderAddField() {
+ // TODO Auto-generated method stub
+
+ }
+
}
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/notelist/FragmentNoteList.java b/FieldNotebook/src/com/openatk/fieldnotebook/notelist/FragmentNoteList.java
index 5b9839b..b490fe8 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/notelist/FragmentNoteList.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/notelist/FragmentNoteList.java
@@ -75,7 +75,7 @@
import com.openatk.fieldnotebook.drawing.MyPolygon;
import com.openatk.fieldnotebook.drawing.MyPolyline;
-public class FragmentNoteList extends Fragment implements OnClickListener, DrawingListener {
+public class FragmentNoteList extends Fragment implements DrawingListener {
private static final int REQUEST_CODE = 1;
private FragmentDrawing fragmentDrawing = null;
@@ -713,16 +713,16 @@ public boolean hasNotes() {
}
}
- @Override
- public void onClick(View v) {
-
- if (v.getId() == R.id.slider_butShowElevation) {
-
-
- } else if (v.getId() == R.id.slider_butShowSoilType) {
-
- }
- }
+// @Override
+// public void onClick(View v) {
+//
+// if (v.getId() == R.id.slider_butShowElevation) {
+//
+//
+// } else if (v.getId() == R.id.slider_butShowSoilType) {
+//
+// }
+// }
public boolean isAddingNote(){
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/slider/FragmentSlider.java b/FieldNotebook/src/com/openatk/fieldnotebook/slider/FragmentSlider.java
index efbd58a..2bd470d 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/slider/FragmentSlider.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/slider/FragmentSlider.java
@@ -3,7 +3,9 @@
import com.openatk.fieldnotebook.R;
import com.openatk.fieldnotebook.MainActivity.DropDownAnim;
import com.openatk.fieldnotebook.db.Field;
+import com.openatk.fieldnotebook.fieldlist.FragmentFieldList;
import com.openatk.fieldnotebook.notelist.FragmentNoteList;
+import com.openatk.fieldnotebook.sidebar.FragmentSidebar;
import android.app.Activity;
import android.graphics.Point;
@@ -35,9 +37,10 @@ public class FragmentSlider extends Fragment implements OnClickListener, OnTouch
private TextView tvName;
private TextView tvAcres;
private ImageButton butEditField;
- private Button butShowElevation;
- private Button butShowSoilType;
private Button butAddNote;
+ private ImageButton butBackToFields;
+ private ViewGroup fieldMenu;
+ private ViewGroup noteMenu;
private SliderListener listener;
private Field currentField = null;
@@ -46,7 +49,9 @@ public class FragmentSlider extends Fragment implements OnClickListener, OnTouch
private Boolean initialCreate;
private ViewGroup noteListContainer;
+ private ViewGroup fieldListContainer;
FragmentNoteList fragmentNoteList;
+ FragmentFieldList fragmentFieldList;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -64,23 +69,47 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
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);
+ tvName = (TextView) view.findViewById(R.id.sidebar_tvName);
+ tvAcres = (TextView) view.findViewById(R.id.sidebar_tvAcres);
- view.setOnTouchListener(this);
- tvName.setOnTouchListener(this);
- tvAcres.setOnTouchListener(this);
+ //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);
- butAddNote = (Button) view.findViewById(R.id.slider_butAddNote);
-
+ butEditField = (ImageButton) view.findViewById(R.id.sidebar_butEditField);
+ butAddNote = (Button) view.findViewById(R.id.sidebar_butAddNote);
+ butBackToFields = (ImageButton) view.findViewById(R.id.sidebar_butBackToFields);
+ fieldMenu = (ViewGroup) view.findViewById(R.id.sidebar_layMenuFields);
+ noteMenu = (ViewGroup) view.findViewById(R.id.sidebar_layMenuNotes);
+ fieldListContainer = (ViewGroup) view.findViewById(R.id.slider_fragment_listFields_container);
+ noteListContainer = (ViewGroup) view.findViewById(R.id.slider_fragment_listNotes_container);
butEditField.setOnClickListener(this);
- butShowElevation.setOnClickListener(this);
- butShowSoilType.setOnClickListener(this);
butAddNote.setOnClickListener(this);
+ butBackToFields.setOnClickListener(this);
+
+ // If this is the first creation of the fragment, add child fragments
+ if (initialCreate) {
+ initialCreate = false;
+ // Prepare a transaction to add fragments to this fragment
+ FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
+
+ // Add the list fragment to this fragment's layout
+ if (fieldListContainer != null) {
+ Log.i(TAG, "onCreate: adding FragmentFieldList to FragmentSidebar");
+ // Add the fragment to the this fragment's container layout
+ fragmentFieldList = new FragmentFieldList();
+ fragmentTransaction.replace(fieldListContainer.getId(), fragmentFieldList, FragmentFieldList.class.getName());
+ }
+ if (noteListContainer != null) {
+ Log.i(TAG, "onCreate: adding FragmentNoteList to FragmentSidebar");
+ // Add the fragment to the this fragment's container layout
+ fragmentNoteList = new FragmentNoteList();
+ fragmentTransaction.replace(noteListContainer.getId(), fragmentNoteList, FragmentNoteList.class.getName());
+ }
+ // Commit the transaction
+ fragmentTransaction.commit();
+ }
// If this is the first creation of the fragment, add child fragments
if (initialCreate) {
@@ -128,17 +157,24 @@ public void onActivityCreated(Bundle savedInstanceState) {
}
public void populateData(Field theField, View container) {
- Log.d("FragmentSlider", "Populate Data");
+ Log.d("FragmentSidebar", "Populate Data");
//Get current field
currentField = theField;
this.container = container;
-
if (currentField != null) {
tvName.setText(currentField.getName());
tvAcres.setText(Integer.toString(currentField.getAcres()) + " ac");
+ fieldListContainer.setVisibility(View.GONE);
+ fieldMenu.setVisibility(View.GONE);
+ noteListContainer.setVisibility(View.VISIBLE);
+ noteMenu.setVisibility(View.VISIBLE);
} else {
tvName.setText("");
tvAcres.setText("");
+ fieldListContainer.setVisibility(View.VISIBLE);
+ fieldMenu.setVisibility(View.VISIBLE);
+ noteListContainer.setVisibility(View.GONE);
+ noteMenu.setVisibility(View.GONE);
}
}
@@ -154,14 +190,14 @@ public int oneNoteHeight() {
@Override
public void onClick(View v) {
- if (v.getId() == R.id.slider_butEditField) {
+ if (v.getId() == R.id.sidebar_butEditField) {
listener.SliderEditField();
- } else if (v.getId() == R.id.slider_butAddNote) {
+ } else if (v.getId() == R.id.sidebar_butAddField) {
+ listener.SliderAddField();
+ } else if (v.getId() == R.id.sidebar_butBackToFields){
+ listener.SliderBackToFieldsList();
+ } else if (v.getId() == R.id.sidebar_butAddNote){
listener.SliderAddNote();
- } else if (v.getId() == R.id.slider_butShowElevation) {
-
- } else if (v.getId() == R.id.slider_butShowSoilType) {
-
}
}
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/slider/SliderListener.java b/FieldNotebook/src/com/openatk/fieldnotebook/slider/SliderListener.java
index 1ebf0b1..8913314 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/slider/SliderListener.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/slider/SliderListener.java
@@ -1,5 +1,7 @@
package com.openatk.fieldnotebook.slider;
+import com.openatk.fieldnotebook.sidebar.FragmentSidebar;
+
/**
* Interface to dispatch image selections.
*
@@ -14,6 +16,8 @@ public interface SliderListener {
* @param position
*/
public void SliderAddNote();
- public void SliderRequestData(FragmentSlider requester);
+ public void SliderRequestData(FragmentSlider fragmentSlider);
public void SliderEditField();
+ public void SliderBackToFieldsList();
+ public void SliderAddField();
}
\ No newline at end of file
From ee436c52bd170c38256bdbec59d5581ee7ef21b3 Mon Sep 17 00:00:00 2001
From: Samuel Noel
Date: Fri, 22 Nov 2013 00:48:43 -0500
Subject: [PATCH 07/10] ok
---
FieldNotebook/.classpath | 1 -
FieldNotebook/AndroidManifest.xml | 2 +-
FieldNotebook/project.properties | 4 +-
FieldNotebook/res/layout/activity_main.xml | 2 +-
FieldNotebook/res/layout/fragment_slider.xml | 19 +-
.../openatk/fieldnotebook/MainActivity.java | 38 +-
.../fieldlist/FragmentFieldList.java | 2 +-
.../sidebar/FragmentSidebar.java | 48 ++-
.../sidebar/SidebarListener.java | 7 +-
.../fieldnotebook/slider/FragmentSlider.java | 391 ------------------
.../fieldnotebook/slider/SliderListener.java | 23 --
11 files changed, 63 insertions(+), 474 deletions(-)
delete mode 100644 FieldNotebook/src/com/openatk/fieldnotebook/slider/FragmentSlider.java
delete mode 100644 FieldNotebook/src/com/openatk/fieldnotebook/slider/SliderListener.java
diff --git a/FieldNotebook/.classpath b/FieldNotebook/.classpath
index cd65889..572f4f5 100644
--- a/FieldNotebook/.classpath
+++ b/FieldNotebook/.classpath
@@ -5,6 +5,5 @@
-
diff --git a/FieldNotebook/AndroidManifest.xml b/FieldNotebook/AndroidManifest.xml
index 8caa8fd..cf5fa6e 100644
--- a/FieldNotebook/AndroidManifest.xml
+++ b/FieldNotebook/AndroidManifest.xml
@@ -45,7 +45,7 @@
+ android:value="AIzaSyBdeI8o1yoFSz6ckRB1_czLCiuXv7FPuzI" />
\ No newline at end of file
diff --git a/FieldNotebook/project.properties b/FieldNotebook/project.properties
index 44e5be1..ca7d21b 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=Google Inc.:Google APIs:18
-android.library.reference.1=../../android-maps-extensions-1.7.0 2/android-maps-extensions
+target=Google Inc.:Google APIs:19
+android.library.reference.1=../../android-maps-extensions/android-maps-extensions
diff --git a/FieldNotebook/res/layout/activity_main.xml b/FieldNotebook/res/layout/activity_main.xml
index bcbdbb6..7e97ec0 100644
--- a/FieldNotebook/res/layout/activity_main.xml
+++ b/FieldNotebook/res/layout/activity_main.xml
@@ -6,7 +6,7 @@
diff --git a/FieldNotebook/res/layout/fragment_slider.xml b/FieldNotebook/res/layout/fragment_slider.xml
index 4f0a3dc..d562efe 100644
--- a/FieldNotebook/res/layout/fragment_slider.xml
+++ b/FieldNotebook/res/layout/fragment_slider.xml
@@ -5,7 +5,7 @@
android:clickable="true"
android:background="#D1D1D1">
-
-
-
+ android:layout_below="@+id/sidebar_layMenuNotes"
+ android:visibility="gone"/>
-
\ No newline at end of file
+ android:layout_height="match_parent"
+ android:layout_below="@+id/sidebar_layMenuFields"/>
+
+
\ No newline at end of file
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java b/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java
index 6de80d5..52b277d 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/MainActivity.java
@@ -59,12 +59,10 @@
import com.openatk.fieldnotebook.notelist.NoteListListener;
import com.openatk.fieldnotebook.sidebar.FragmentSidebar;
import com.openatk.fieldnotebook.sidebar.SidebarListener;
-import com.openatk.fieldnotebook.slider.FragmentSlider;
-import com.openatk.fieldnotebook.slider.SliderListener;
public class MainActivity extends FragmentActivity implements OnClickListener,
OnMapClickListener, OnItemSelectedListener, OnMarkerClickListener, OnMarkerDragListener,
- AddFieldListener, SliderListener, SidebarListener, NoteListListener, FieldListListener, MyPolygonListener {
+ AddFieldListener, SidebarListener, NoteListListener, FieldListListener, MyPolygonListener {
private static String TAG = MainActivity.class.getName();
@@ -86,8 +84,6 @@ public class MainActivity extends FragmentActivity implements OnClickListener,
private int sliderIsShowing = 0;
private int addIsShowing = 0;
private int drawingIsShowing = 0;
- private int fieldListIsShowing = 0;
-
private Field currentField = null;
private MyPolygon currentPolygon = null;
@@ -97,7 +93,7 @@ public class MainActivity extends FragmentActivity implements OnClickListener,
String addingBoundary = "";
FragmentAddField fragmentAddField = null;
- FragmentSlider fragmentSlider = null;
+ FragmentSidebar fragmentSlider = null;
FragmentSidebar fragmentSidebar = null;
FragmentDrawing fragmentDrawing = null;
FragmentNoteList fragmentNoteList = null;
@@ -122,7 +118,7 @@ protected void onCreate(Bundle savedInstanceState) {
FragmentManager fm = getSupportFragmentManager();
fragmentMap = (SupportMapFragment) fm.findFragmentById(R.id.map);
- fragmentSlider = (FragmentSlider) fm.findFragmentByTag(FragmentSlider.class.getName());
+ fragmentSlider = (FragmentSidebar) fm.findFragmentByTag(FragmentSidebar.class.getName());
if(fragmentSlider != null){
sliderIsShowing = 1;
}
@@ -683,12 +679,12 @@ private Void showSlider(Boolean transition) {
params.height = RelativeLayout.LayoutParams.WRAP_CONTENT;
layout.setLayoutParams(params);
FragmentManager fm = getSupportFragmentManager();
- this.fragmentSlider = new FragmentSlider();
+ this.fragmentSlider = new FragmentSidebar();
FragmentTransaction ft = fm.beginTransaction();
if (transition) ft.setCustomAnimations(R.anim.slide_up, R.anim.slide_down);
- ft.add(R.id.fragment_container_slider, this.fragmentSlider, FragmentSlider.class.getName());
+ ft.add(R.id.fragment_container_slider, this.fragmentSlider, FragmentSidebar.class.getName());
ft.commit();
- Log.d("MainActivity", "Showing Slider:" + FragmentSlider.class.getName());
+ Log.d("MainActivity", "Showing Slider:" + FragmentSidebar.class.getName());
}
}
this.invalidateOptionsMenu();
@@ -704,7 +700,7 @@ private void hideSlider(Boolean transition) {
if(fragmentNoteList != null) fragmentNoteList.onClose();
FragmentManager fm = getSupportFragmentManager();
- FragmentSlider fragment = (FragmentSlider) fm.findFragmentByTag(FragmentSlider.class.getName());
+ FragmentSidebar fragment = (FragmentSidebar) fm.findFragmentByTag(FragmentSidebar.class.getName());
// Set height so transition works TODO 3 different heights?? Get from fragment, fragment.getMyHeight?
FrameLayout layout = (FrameLayout) findViewById(R.id.fragment_container_slider);
if(layout != null){
@@ -1053,9 +1049,9 @@ public void NoteListAddNote() {
// ----------------------------- FragmentSlider -------------------------------
- private FragmentSlider getFragmentSlider(){
+ private FragmentSidebar getFragmentSlider(){
FragmentManager fm = getSupportFragmentManager();
- return (FragmentSlider) fm.findFragmentByTag(FragmentSlider.class.getName());
+ return (FragmentSidebar) fm.findFragmentByTag(FragmentSidebar.class.getName());
}
@Override
@@ -1120,7 +1116,7 @@ public boolean willChangeBounds() {
}
@Override
- public void SliderRequestData(FragmentSlider requester) {
+ public void SliderRequestData(FragmentSidebar requester) {
if(requester != null) this.fragmentSlider = requester;
if(this.fragmentSlider == null){
this.fragmentSlider = this.getFragmentSlider();
@@ -1221,19 +1217,5 @@ public void FieldListSelectField(Field selectedField) {
this.SidebarRequestData(null);
this.NoteListRequestData(null); //Populate notes again
}
-
- @Override
- public void SliderBackToFieldsList() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void SliderAddField() {
- // TODO Auto-generated method stub
-
- }
-
-
}
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/fieldlist/FragmentFieldList.java b/FieldNotebook/src/com/openatk/fieldnotebook/fieldlist/FragmentFieldList.java
index 56d5596..e077386 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/fieldlist/FragmentFieldList.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/fieldlist/FragmentFieldList.java
@@ -22,7 +22,7 @@
import com.openatk.fieldnotebook.drawing.MyMarker;
import com.openatk.fieldnotebook.drawing.MyPolygon;
import com.openatk.fieldnotebook.drawing.MyPolyline;
-import com.openatk.fieldnotebook.slider.SliderListener;
+import com.openatk.fieldnotebook.sidebar.SidebarListener;
import android.app.Activity;
import android.app.AlertDialog;
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java b/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java
index a4449ab..149c573 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java
@@ -3,10 +3,10 @@
import com.openatk.fieldnotebook.R;
import com.openatk.fieldnotebook.MainActivity.DropDownAnim;
import com.openatk.fieldnotebook.db.Field;
-import com.openatk.fieldnotebook.fieldlist.FieldListListener;
import com.openatk.fieldnotebook.fieldlist.FragmentFieldList;
import com.openatk.fieldnotebook.notelist.FragmentNoteList;
-import com.openatk.fieldnotebook.notelist.NoteListListener;
+import com.openatk.fieldnotebook.sidebar.FragmentSidebar;
+import com.openatk.fieldnotebook.sidebar.SidebarListener;
import android.app.Activity;
import android.graphics.Point;
@@ -40,6 +40,8 @@ public class FragmentSidebar extends Fragment implements OnClickListener, OnTouc
private ImageButton butEditField;
private Button butAddNote;
private ImageButton butBackToFields;
+ private ViewGroup fieldMenu;
+ private ViewGroup noteMenu;
private SidebarListener listener;
private Field currentField = null;
@@ -49,9 +51,6 @@ public class FragmentSidebar extends Fragment implements OnClickListener, OnTouc
private Boolean initialCreate;
private ViewGroup noteListContainer;
private ViewGroup fieldListContainer;
- private ViewGroup fieldMenu;
- private ViewGroup noteMenu;
-
FragmentNoteList fragmentNoteList;
FragmentFieldList fragmentFieldList;
@@ -69,7 +68,7 @@ public void onCreate(Bundle savedInstanceState) {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.fragment_sidebar, container, false);
+ View view = inflater.inflate(R.layout.fragment_slider, container, false);
tvName = (TextView) view.findViewById(R.id.sidebar_tvName);
tvAcres = (TextView) view.findViewById(R.id.sidebar_tvAcres);
@@ -112,6 +111,25 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Commit the transaction
fragmentTransaction.commit();
}
+
+ // If this is the first creation of the fragment, add child fragments
+ if (initialCreate) {
+ initialCreate = false;
+ // Prepare a transaction to add fragments to this fragment
+ FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
+
+ // Add the list fragment to this fragment's layout
+ noteListContainer = (ViewGroup) view.findViewById(R.id.sidebar_fragment_listNotes_container);
+ if (noteListContainer != null) {
+ Log.i(TAG, "onCreate: adding FragmentNoteList to Fragmentsidebar");
+
+ // Add the fragment to the this fragment's container layout
+ fragmentNoteList = new FragmentNoteList();
+ fragmentTransaction.replace(noteListContainer.getId(), fragmentNoteList, FragmentNoteList.class.getName());
+ }
+ // Commit the transaction
+ fragmentTransaction.commit();
+ }
return view;
}
@@ -131,7 +149,7 @@ public void onAttach(Activity activity) {
throw new ClassCastException(activity.toString() + " must implement FragmentSlider.SliderListener");
}
Log.d("FragmentSlider", "Attached");
- }
+ }
@Override
public void onActivityCreated(Bundle savedInstanceState) {
@@ -214,7 +232,7 @@ public boolean onTouch(View v, MotionEvent event) {
private void SliderDragDown(int start) {
if(container != null){
int height = container.getHeight();
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
+ FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.sidebar_fragment_listFields_container);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
sliderStartDrag = height - start - params.height;
sliderHeightStart = params.height;
@@ -225,7 +243,7 @@ private void SliderDragDragging(int whereY) {
if(container != null){
int height = container.getHeight();
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
+ FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.sidebar_fragment_listFields_container);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
if((height - whereY - sliderStartDrag) > 0){
@@ -253,7 +271,7 @@ private void SliderDragUp(int whereY) {
Log.d("SliderDragUp", "closed");
}
//Find end height
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
+ FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.sidebar_fragment_listFields_container);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
if(params.height > sliderHeightStart){
//Make bigger
@@ -269,7 +287,7 @@ private void SliderDragUp(int whereY) {
private void SliderShrink(){
if(container != null){
int oneThirdHeight = container.getHeight() / 3;
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
+ FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.sidebar_fragment_listFields_container);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
if(sliderPosition == 2 || sliderPosition == 1){
//Middle -> Small
@@ -299,9 +317,9 @@ private void SliderShrink(){
private void SliderGrow(){
if(container != null){
int oneThirdHeight = container.getHeight() / 3;
- RelativeLayout relAdd = (RelativeLayout) this.getView().findViewById(R.id.slider_layMenu);
+ RelativeLayout relAdd = (RelativeLayout) this.getView().findViewById(R.id.sidebar_layMenuFields);
Log.d("layMenu:", Integer.toString(relAdd.getHeight()));
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
+ FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.sidebar_fragment_listFields_container);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
if(sliderPosition == 0 || sliderPosition == 1){
//Small -> Middle
@@ -321,9 +339,9 @@ private void SliderGrow(){
}
}
private void SliderOneNote(){
- RelativeLayout relAdd = (RelativeLayout) this.getView().findViewById(R.id.slider_layMenu);
+ RelativeLayout relAdd = (RelativeLayout) this.getView().findViewById(R.id.sidebar_layMenuFields);
Log.d("layMenu:", Integer.toString(relAdd.getHeight()));
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
+ FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.sidebar_fragment_listFields_container);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
DropDownAnim an = new DropDownAnim(layout, params.height, this.oneNoteHeight());
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/SidebarListener.java b/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/SidebarListener.java
index d6b2633..69d6d33 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/SidebarListener.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/SidebarListener.java
@@ -1,5 +1,7 @@
package com.openatk.fieldnotebook.sidebar;
+import com.openatk.fieldnotebook.sidebar.FragmentSidebar;
+
/**
* Interface to dispatch image selections.
*
@@ -14,8 +16,11 @@ public interface SidebarListener {
* @param position
*/
public void SidebarAddNote();
- public void SidebarRequestData(FragmentSidebar requester);
+ public void SidebarRequestData(FragmentSidebar fragmentSlider);
public void SidebarEditField();
public void SidebarBackToFieldsList();
public void SidebarAddField();
+ public void SliderAddNote();
+ public void SliderRequestData(FragmentSidebar requester);
+ public void SliderEditField();
}
\ No newline at end of file
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/slider/FragmentSlider.java b/FieldNotebook/src/com/openatk/fieldnotebook/slider/FragmentSlider.java
deleted file mode 100644
index 2bd470d..0000000
--- a/FieldNotebook/src/com/openatk/fieldnotebook/slider/FragmentSlider.java
+++ /dev/null
@@ -1,391 +0,0 @@
-package com.openatk.fieldnotebook.slider;
-
-import com.openatk.fieldnotebook.R;
-import com.openatk.fieldnotebook.MainActivity.DropDownAnim;
-import com.openatk.fieldnotebook.db.Field;
-import com.openatk.fieldnotebook.fieldlist.FragmentFieldList;
-import com.openatk.fieldnotebook.notelist.FragmentNoteList;
-import com.openatk.fieldnotebook.sidebar.FragmentSidebar;
-
-import android.app.Activity;
-import android.graphics.Point;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.util.Log;
-import android.view.Display;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnTouchListener;
-import android.view.animation.Animation;
-import android.view.animation.Transformation;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.FrameLayout;
-import android.widget.ImageButton;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-
-public class FragmentSlider extends Fragment implements OnClickListener, OnTouchListener {
- private static final String TAG = FragmentSlider.class.getSimpleName();
-
-
- private TextView tvName;
- private TextView tvAcres;
- private ImageButton butEditField;
- private Button butAddNote;
- private ImageButton butBackToFields;
- private ViewGroup fieldMenu;
- private ViewGroup noteMenu;
-
- private SliderListener listener;
- private Field currentField = null;
- private View container = null;
-
-
- private Boolean initialCreate;
- private ViewGroup noteListContainer;
- private ViewGroup fieldListContainer;
- FragmentNoteList fragmentNoteList;
- FragmentFieldList fragmentFieldList;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- if(savedInstanceState == null){
- initialCreate = true;
- } else {
- initialCreate = false;
- }
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.fragment_slider, container, false);
-
- tvName = (TextView) view.findViewById(R.id.sidebar_tvName);
- tvAcres = (TextView) view.findViewById(R.id.sidebar_tvAcres);
-
- //view.setOnTouchListener(this);
- //tvName.setOnTouchListener(this);
- //tvAcres.setOnTouchListener(this);
-
- butEditField = (ImageButton) view.findViewById(R.id.sidebar_butEditField);
- butAddNote = (Button) view.findViewById(R.id.sidebar_butAddNote);
- butBackToFields = (ImageButton) view.findViewById(R.id.sidebar_butBackToFields);
- fieldMenu = (ViewGroup) view.findViewById(R.id.sidebar_layMenuFields);
- noteMenu = (ViewGroup) view.findViewById(R.id.sidebar_layMenuNotes);
- fieldListContainer = (ViewGroup) view.findViewById(R.id.slider_fragment_listFields_container);
- noteListContainer = (ViewGroup) view.findViewById(R.id.slider_fragment_listNotes_container);
-
- butEditField.setOnClickListener(this);
- butAddNote.setOnClickListener(this);
- butBackToFields.setOnClickListener(this);
-
- // If this is the first creation of the fragment, add child fragments
- if (initialCreate) {
- initialCreate = false;
- // Prepare a transaction to add fragments to this fragment
- FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
-
- // Add the list fragment to this fragment's layout
- if (fieldListContainer != null) {
- Log.i(TAG, "onCreate: adding FragmentFieldList to FragmentSidebar");
- // Add the fragment to the this fragment's container layout
- fragmentFieldList = new FragmentFieldList();
- fragmentTransaction.replace(fieldListContainer.getId(), fragmentFieldList, FragmentFieldList.class.getName());
- }
- if (noteListContainer != null) {
- Log.i(TAG, "onCreate: adding FragmentNoteList to FragmentSidebar");
- // Add the fragment to the this fragment's container layout
- fragmentNoteList = new FragmentNoteList();
- fragmentTransaction.replace(noteListContainer.getId(), fragmentNoteList, FragmentNoteList.class.getName());
- }
- // Commit the transaction
- fragmentTransaction.commit();
- }
-
- // If this is the first creation of the fragment, add child fragments
- if (initialCreate) {
- initialCreate = false;
- // Prepare a transaction to add fragments to this fragment
- FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
-
- // Add the list fragment to this fragment's layout
- noteListContainer = (ViewGroup) view.findViewById(R.id.slider_fragment_listNotes_container);
- if (noteListContainer != null) {
- Log.i(TAG, "onCreate: adding FragmentNoteList to FragmentSlider");
-
- // Add the fragment to the this fragment's container layout
- fragmentNoteList = new FragmentNoteList();
- fragmentTransaction.replace(noteListContainer.getId(), fragmentNoteList, FragmentNoteList.class.getName());
- }
- // Commit the transaction
- fragmentTransaction.commit();
- }
-
- return view;
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
-
- Fragment parentFragment = getParentFragment();
- if (parentFragment != null && parentFragment instanceof SliderListener) {
- // Check if parent fragment (if there is one) is listener
- listener = (SliderListener) parentFragment;
- } else if (activity != null && activity instanceof SliderListener) {
- // Otherwise, check if parent activity is the listener
- listener = (SliderListener) activity;
- } else {
- throw new ClassCastException(activity.toString() + " must implement FragmentSlider.SliderListener");
- }
- Log.d("FragmentSlider", "Attached");
- }
-
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
- listener.SliderRequestData(this);
- }
-
- public void populateData(Field theField, View container) {
- Log.d("FragmentSidebar", "Populate Data");
- //Get current field
- currentField = theField;
- this.container = container;
- if (currentField != null) {
- tvName.setText(currentField.getName());
- tvAcres.setText(Integer.toString(currentField.getAcres()) + " ac");
- fieldListContainer.setVisibility(View.GONE);
- fieldMenu.setVisibility(View.GONE);
- noteListContainer.setVisibility(View.VISIBLE);
- noteMenu.setVisibility(View.VISIBLE);
- } else {
- tvName.setText("");
- tvAcres.setText("");
- fieldListContainer.setVisibility(View.VISIBLE);
- fieldMenu.setVisibility(View.VISIBLE);
- noteListContainer.setVisibility(View.GONE);
- noteMenu.setVisibility(View.GONE);
- }
- }
-
- public int getHeight() {
- // Method so close transition can work
- return getView().getHeight();
- }
-
- public int oneNoteHeight() {
- //TODO return get from FragmentNoteList
- return 0;
- }
-
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.sidebar_butEditField) {
- listener.SliderEditField();
- } else if (v.getId() == R.id.sidebar_butAddField) {
- listener.SliderAddField();
- } else if (v.getId() == R.id.sidebar_butBackToFields){
- listener.SliderBackToFieldsList();
- } else if (v.getId() == R.id.sidebar_butAddNote){
- listener.SliderAddNote();
- }
- }
-
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- float eventY = event.getRawY();
-
- switch (event.getAction())
- {
- case MotionEvent.ACTION_DOWN:
- {
- this.SliderDragDown((int)eventY);
- break;
- }
- case MotionEvent.ACTION_UP:
- {
- this.SliderDragUp((int)(eventY));
- break;
- }
- case MotionEvent.ACTION_MOVE:
- {
- this.SliderDragDragging((int)(eventY));
- break;
- }
- }
- return true;
- }
-
- private int sliderStartDrag = 0;
- private int sliderHeightStart = 0;
- private void SliderDragDown(int start) {
- if(container != null){
- int height = container.getHeight();
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
- sliderStartDrag = height - start - params.height;
- sliderHeightStart = params.height;
- }
- }
-
- private void SliderDragDragging(int whereY) {
- if(container != null){
- int height = container.getHeight();
-
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
-
- if((height - whereY - sliderStartDrag) > 0){
- params.height = height - whereY - sliderStartDrag;
- } else {
- params.height = 0;
- }
- layout.setLayoutParams(params);
- }
- }
-
- private void SliderDragUp(int whereY) {
- //Slider done dragging snap to 1 of 3 positions
- if(container != null){
- int oneThirdHeight = container.getHeight() / 3;
- if(whereY < oneThirdHeight){
- //Fullscreen
- Log.d("SliderDragUp", "fullscreen");
- } else if(whereY < oneThirdHeight * 2) {
- //Middle
- Log.d("SliderDragUp", "middle");
-
- } else {
- //Closed
- Log.d("SliderDragUp", "closed");
- }
- //Find end height
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
- if(params.height > sliderHeightStart){
- //Make bigger
- SliderGrow();
- } else {
- //Make smaller
- SliderShrink();
- }
- }
- }
-
- private int sliderPosition = 0;
- private void SliderShrink(){
- if(container != null){
- int oneThirdHeight = container.getHeight() / 3;
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
- if(sliderPosition == 2 || sliderPosition == 1){
- //Middle -> Small
- //OneNote -> Small
- DropDownAnim an = new DropDownAnim(layout, params.height, 0);
- an.setDuration(300);
- layout.startAnimation(an);
- sliderPosition = 0;
- } else if(sliderPosition == 3){
- //Fullscreen -> Middle if has notes
- //Fullscreen -> Small if no notes
- if(this.fragmentNoteList != null && this.fragmentNoteList.hasNotes()){
- DropDownAnim an = new DropDownAnim(layout, params.height, oneThirdHeight);
- an.setDuration(300);
- layout.startAnimation(an);
- sliderPosition = 2;
- } else {
- DropDownAnim an = new DropDownAnim(layout, params.height, 0);
- an.setDuration(300);
- layout.startAnimation(an);
- sliderPosition = 0;
- }
- }
- layout.setLayoutParams(params);
- }
- }
- private void SliderGrow(){
- if(container != null){
- int oneThirdHeight = container.getHeight() / 3;
- RelativeLayout relAdd = (RelativeLayout) this.getView().findViewById(R.id.slider_layMenu);
- Log.d("layMenu:", Integer.toString(relAdd.getHeight()));
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
- if(sliderPosition == 0 || sliderPosition == 1){
- //Small -> Middle
- //OneNote -> Middle
- DropDownAnim an = new DropDownAnim(layout, params.height, oneThirdHeight);
- an.setDuration(300);
- layout.startAnimation(an);
- sliderPosition = 2;
- } else if(sliderPosition == 2){
- //Middle -> Fullscreen
- DropDownAnim an = new DropDownAnim(layout, params.height, (container.getHeight() - relAdd.getHeight()));
- an.setDuration(300);
- layout.startAnimation(an);
- sliderPosition = 3;
- }
- layout.setLayoutParams(params);
- }
- }
- private void SliderOneNote(){
- RelativeLayout relAdd = (RelativeLayout) this.getView().findViewById(R.id.slider_layMenu);
- Log.d("layMenu:", Integer.toString(relAdd.getHeight()));
- FrameLayout layout = (FrameLayout) this.getView().findViewById(R.id.slider_fragment_listNotes_container);
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
-
- DropDownAnim an = new DropDownAnim(layout, params.height, this.oneNoteHeight());
- an.setDuration(300);
- layout.startAnimation(an);
- sliderPosition = 1;
-
- layout.setLayoutParams(params);
- }
- public void SliderSizeMiddle(){
- if(sliderPosition == 3){
- this.SliderShrink();
- } else if(sliderPosition == 0){
- this.SliderGrow();
- }
- }
-
- private class DropDownAnim extends Animation {
- int targetHeight;
- int startHeight;
- View view;
-
- public DropDownAnim(View view, int startHeight, int targetHeight) {
- this.view = view;
- this.startHeight = startHeight;
- this.targetHeight = targetHeight;
- }
-
- @Override
- protected void applyTransformation(float interpolatedTime, Transformation t) {
- int newHeight = (int) (startHeight - ((startHeight - targetHeight) * interpolatedTime));
- view.getLayoutParams().height = newHeight;
- view.requestLayout();
- }
-
- @Override
- public void initialize(int width, int height, int parentWidth,
- int parentHeight) {
- super.initialize(width, height, parentWidth, parentHeight);
- }
-
- @Override
- public boolean willChangeBounds() {
- return true;
- }
- }
-
-}
\ No newline at end of file
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/slider/SliderListener.java b/FieldNotebook/src/com/openatk/fieldnotebook/slider/SliderListener.java
deleted file mode 100644
index 8913314..0000000
--- a/FieldNotebook/src/com/openatk/fieldnotebook/slider/SliderListener.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.openatk.fieldnotebook.slider;
-
-import com.openatk.fieldnotebook.sidebar.FragmentSidebar;
-
-/**
- * Interface to dispatch image selections.
- *
- * @author Cyrus Bowman
- */
-public interface SliderListener {
-
- /**
- * Inform the listener that an image has been selected.
- *
- * @param imageItem
- * @param position
- */
- public void SliderAddNote();
- public void SliderRequestData(FragmentSlider fragmentSlider);
- public void SliderEditField();
- public void SliderBackToFieldsList();
- public void SliderAddField();
-}
\ No newline at end of file
From 7f62d221c71b719836c5c28732fd173c9d6e865e Mon Sep 17 00:00:00 2001
From: Samuel Noel
Date: Fri, 22 Nov 2013 00:58:12 -0500
Subject: [PATCH 08/10] k
---
FieldNotebook/AndroidManifest.xml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/FieldNotebook/AndroidManifest.xml b/FieldNotebook/AndroidManifest.xml
index cf5fa6e..0adf69a 100644
--- a/FieldNotebook/AndroidManifest.xml
+++ b/FieldNotebook/AndroidManifest.xml
@@ -46,6 +46,10 @@
+
+
\ No newline at end of file
From 305ba209966d5e9dc2e8f461b04f14f11a777de0 Mon Sep 17 00:00:00 2001
From: Samuel Noel
Date: Wed, 4 Dec 2013 01:14:52 -0500
Subject: [PATCH 09/10] demo ready
---
FieldNotebook/res/layout/note_open.xml | 2 +-
.../openatk/fieldnotebook/MainActivity.java | 382 +++++-----
.../com/openatk/fieldnotebook/db/Note.java | 54 ++
.../openatk/fieldnotebook/db/TableNotes.java | 4 +-
.../notelist/FragmentNoteList.java | 714 +++++++++---------
.../notelist/NoteListListener.java | 4 +-
.../sidebar/FragmentSidebar.java | 44 +-
7 files changed, 647 insertions(+), 557 deletions(-)
diff --git a/FieldNotebook/res/layout/note_open.xml b/FieldNotebook/res/layout/note_open.xml
index b633058..688fe45 100644
--- a/FieldNotebook/res/layout/note_open.xml
+++ b/FieldNotebook/res/layout/note_open.xml
@@ -10,7 +10,7 @@
android:id="@+id/note_open_note"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_alignParentTop="true"
+ android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true">
FieldsOnMap = null;
String addingBoundary = "";
-
+
FragmentAddField fragmentAddField = null;
FragmentSidebar fragmentSlider = null;
FragmentSidebar fragmentSidebar = null;
@@ -121,29 +121,29 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
FragmentFieldList fragmentFieldList = null;
ViewGroup vgSidebar = null;
-
-
+
+
private static final int STATE_DEFAULT = 0;
private static final int STATE_LIST_VIEW = 1;
-
+
//Trello
- //SyncController syncController;
- //TrelloController trelloController;
-
+ //SyncController syncController;
+ //TrelloController trelloController;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
-
+
dbHelper = new DatabaseHelper(this);
-
+
FragmentManager fm = getSupportFragmentManager();
fragmentMap = (SupportMapFragment) fm.findFragmentById(R.id.map);
fragmentSlider = (FragmentSidebar) fm.findFragmentByTag(FragmentSidebar.class.getName());
if(fragmentSlider != null){
sliderIsShowing = 1;
}
-
+
if (savedInstanceState == null) {
// First incarnation of this activity.
fragmentMap.setRetainInstance(true);
@@ -156,9 +156,9 @@ protected void onCreate(Bundle savedInstanceState) {
checkGPS();
//Trello
- //trelloController = new TrelloController(getApplicationContext());
- //syncController = new SyncController(getApplicationContext(), trelloController, this);
- //trelloController.setSyncController(syncController);
+ //trelloController = new TrelloController(getApplicationContext());
+ //syncController = new SyncController(getApplicationContext(), trelloController, this);
+ //trelloController.setSyncController(syncController);
// Get last selected operation
if (savedInstanceState != null) {
@@ -166,7 +166,7 @@ protected void onCreate(Bundle savedInstanceState) {
currentField = FindFieldById(savedInstanceState.getInt("currentField"));
this.addingBoundary = savedInstanceState.getString("drawingBoundary", "");
}
-
+
vgSidebar = (ViewGroup) findViewById(R.id.fragment_container_sidebar);
if (vgSidebar != null) {
Log.i(TAG, "onCreate: adding FragmentSidebar to MainActivity");
@@ -181,7 +181,7 @@ protected void onCreate(Bundle savedInstanceState) {
}
setUpMapIfNeeded();
-
+
Intent intent = this.getIntent();
String todo = intent.getStringExtra("todo");
if(todo != null){
@@ -189,7 +189,7 @@ protected void onCreate(Bundle savedInstanceState) {
//trelloController.sync();
}
}
-
+
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}
@@ -232,9 +232,9 @@ protected void onSaveInstanceState(Bundle outState) {
outState.putString("drawingBoundary", strNewBoundary);
}
}
-
+
if (currentField != null) outState.putInt("currentField", currentField.getId());
-
+
outState.putInt("mCurrentState", mCurrentState);
outState.putInt("sliderIsShowing",sliderIsShowing);
outState.putInt("addIsShowing",addIsShowing);
@@ -253,7 +253,7 @@ private void setUpMapIfNeeded() {
mapSettings.setZoomControlsEnabled(false);
mapSettings.setMyLocationButtonEnabled(false);
mapSettings.setTiltGesturesEnabled(false);
-
+
map.setOnMapClickListener(this);
map.setOnMarkerClickListener(this);
map.setOnMarkerDragListener(this);
@@ -261,22 +261,22 @@ private void setUpMapIfNeeded() {
map.setMyLocationEnabled(true);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
- Float startLat = prefs.getFloat("StartupLat", START_LAT);
- Float startLng = prefs.getFloat("StartupLng", START_LNG);
- Float startZoom = prefs.getFloat("StartupZoom", START_ZOOM);
- map.moveCamera( CameraUpdateFactory.newLatLngZoom(new LatLng(startLat,startLng) , startZoom));
+ Float startLat = prefs.getFloat("StartupLat", START_LAT);
+ Float startLng = prefs.getFloat("StartupLng", START_LNG);
+ Float startZoom = prefs.getFloat("StartupZoom", START_ZOOM);
+ map.moveCamera( CameraUpdateFactory.newLatLngZoom(new LatLng(startLat,startLng) , startZoom));
}
drawMap();
}
-
-
+
+
@Override
protected void onPause() {
super.onPause();
- //trelloController.stopAutoSync();
-
- CameraPosition myCam = map.getCameraPosition();
+ //trelloController.stopAutoSync();
+
+ CameraPosition myCam = map.getCameraPosition();
if(myCam != null){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = prefs.edit();
@@ -292,7 +292,7 @@ protected void onPause() {
protected void onResume() {
super.onResume();
checkGPS();
- //trelloController.startAutoSync();
+ //trelloController.startAutoSync();
}
@Override
@@ -306,13 +306,13 @@ protected void onNewIntent(Intent intent) {
}
}
-
+
@Override
public void onMapClick(LatLng position) {
if(this.fragmentNoteList == null){
this.fragmentNoteList = this.getFragmentNoteList();
}
-
+
if (addIsShowing == 1 || addingNotePolygon) {
Log.d("HERE", "Here1");
// Add points to polygon
@@ -330,7 +330,7 @@ public void onMapClick(LatLng position) {
if(fragmentSlider != null){
//fragmentSlider.flushChangesAndSave(false); //Save changes to all open notes
}
-
+
// Check if touched a field
Boolean touched = false;
for (int i = 0; i < FieldsOnMap.size(); i++) {
@@ -374,7 +374,7 @@ public void onMapClick(LatLng position) {
}
}
}
-
+
private void ExitField(){
if (this.currentPolygon != null) {
// Set back to unselected
@@ -384,7 +384,7 @@ private void ExitField(){
if(this.fragmentNoteList == null) this.fragmentNoteList = this.getFragmentNoteList();
if(this.fragmentSidebar == null) this.fragmentSidebar = this.getFragmentSidebar();
if(this.fragmentFieldList == null) this.fragmentFieldList = this.getFragmentFieldList();
-
+
if(this.fragmentNoteList != null) this.fragmentNoteList.onClose();
if(this.fragmentSidebar != null) this.fragmentSidebar.populateData(null, this.fragmentMap.getView());
if(this.fragmentFieldList != null) this.fragmentFieldList.populateData(null);
@@ -395,7 +395,7 @@ private void drawMap() {
drawFields();
}
-
+
private void drawFields() {
SQLiteDatabase database = dbHelper.getReadableDatabase();
String[] columns = { TableFields.COL_ID, TableFields.COL_BOUNDARY, TableFields.COL_NAME, TableFields.COL_DELETED };
@@ -405,9 +405,9 @@ private void drawFields() {
while (cursor.moveToNext()) {
String boundary = cursor.getString(cursor.getColumnIndex(TableFields.COL_BOUNDARY));
List points = Field.StringToBoundary(boundary);
-
+
if(points.size() == 0) points = null;
-
+
// Add to list so we can catch click events
Field newField = new Field();
newField.setId(cursor.getInt(cursor.getColumnIndex(TableFields.COL_ID)));
@@ -500,50 +500,50 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
} else if(item.getItemId() == R.id.main_menu_help){
AlertDialog.Builder alert = new AlertDialog.Builder(this);
- alert.setTitle("Help");
- WebView wv = new WebView(this);
- wv.loadUrl("file:///android_asset/Help.html");
- wv.getSettings().setSupportZoom(true);
- wv.getSettings().setBuiltInZoomControls(true);
- wv.setWebViewClient(new WebViewClient()
- {
- @Override
- public boolean shouldOverrideUrlLoading(WebView view, String url)
- {
- view.loadUrl(url);
- return true;
- }
- });
- alert.setView(wv);
- alert.setNegativeButton("Close", null);
- alert.show();
+ alert.setTitle("Help");
+ WebView wv = new WebView(this);
+ wv.loadUrl("file:///android_asset/Help.html");
+ wv.getSettings().setSupportZoom(true);
+ wv.getSettings().setBuiltInZoomControls(true);
+ wv.setWebViewClient(new WebViewClient()
+ {
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url)
+ {
+ view.loadUrl(url);
+ return true;
+ }
+ });
+ alert.setView(wv);
+ alert.setNegativeButton("Close", null);
+ alert.show();
} else if(item.getItemId() == R.id.main_menu_legal){
CharSequence licence= "The MIT License (MIT)\n" +
- "\n" +
- "Copyright (c) 2013 Purdue University\n" +
- "\n" +
- "Permission is hereby granted, free of charge, to any person obtaining a copy " +
- "of this software and associated documentation files (the \"Software\"), to deal " +
- "in the Software without restriction, including without limitation the rights " +
- "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell " +
- "copies of the Software, and to permit persons to whom the Software is " +
- "furnished to do so, subject to the following conditions:" +
- "\n" +
- "The above copyright notice and this permission notice shall be included in " +
- "all copies or substantial portions of the Software.\n" +
- "\n" +
- "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR " +
- "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, " +
- "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE " +
- "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER " +
- "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, " +
- "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " +
- "THE SOFTWARE.\n";
+ "\n" +
+ "Copyright (c) 2013 Purdue University\n" +
+ "\n" +
+ "Permission is hereby granted, free of charge, to any person obtaining a copy " +
+ "of this software and associated documentation files (the \"Software\"), to deal " +
+ "in the Software without restriction, including without limitation the rights " +
+ "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell " +
+ "copies of the Software, and to permit persons to whom the Software is " +
+ "furnished to do so, subject to the following conditions:" +
+ "\n" +
+ "The above copyright notice and this permission notice shall be included in " +
+ "all copies or substantial portions of the Software.\n" +
+ "\n" +
+ "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR " +
+ "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, " +
+ "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE " +
+ "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER " +
+ "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, " +
+ "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " +
+ "THE SOFTWARE.\n";
new AlertDialog.Builder(this)
- .setTitle("Legal")
- .setMessage(licence)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setPositiveButton("Close", null).show();
+ .setTitle("Legal")
+ .setMessage(licence)
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setPositiveButton("Close", null).show();
}
return true;
}
@@ -686,7 +686,7 @@ private void hideAdd(Boolean transition) {
this.invalidateOptionsMenu();
}
-
+
private Void showSlider(Boolean transition) {
if(addIsShowing == 1){
hideAdd(false);
@@ -695,31 +695,41 @@ private Void showSlider(Boolean transition) {
sliderIsShowing = 1;
// Set height back to wrap, in case add buttons or something
FrameLayout layout = (FrameLayout) findViewById(R.id.fragment_container_slider);
+
if(layout != null){
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
- params.height = RelativeLayout.LayoutParams.WRAP_CONTENT;
- layout.setLayoutParams(params);
- FragmentManager fm = getSupportFragmentManager();
- this.fragmentSlider = new FragmentSidebar();
- FragmentTransaction ft = fm.beginTransaction();
- if (transition) ft.setCustomAnimations(R.anim.slide_up, R.anim.slide_down);
- ft.add(R.id.fragment_container_slider, this.fragmentSlider, FragmentSidebar.class.getName());
- ft.commit();
- Log.d("MainActivity", "Showing Slider:" + FragmentSidebar.class.getName());
+ if (fragmentSlider == null) {
+ RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
+ params.height = RelativeLayout.LayoutParams.WRAP_CONTENT;
+ layout.setLayoutParams(params);
+ FragmentManager fm = getSupportFragmentManager();
+ this.fragmentSlider = new FragmentSidebar();
+ FragmentTransaction ft = fm.beginTransaction();
+ if (transition) ft.setCustomAnimations(R.anim.slide_up, R.anim.slide_down);
+ ft.add(R.id.fragment_container_slider, this.fragmentSlider, FragmentSidebar.class.getName());
+ ft.commit();
+ } else {
+ RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
+ params.height = RelativeLayout.LayoutParams.WRAP_CONTENT;
+ layout.setLayoutParams(params);
+ FragmentManager fm = getSupportFragmentManager();
+ FragmentTransaction ft = fm.beginTransaction();
+ if (transition) ft.setCustomAnimations(R.anim.slide_up, R.anim.slide_down);
+ ft.show(this.fragmentSlider);
+ ft.commit();
+ }
}
}
this.invalidateOptionsMenu();
return null;
}
- private void hideSlider(Boolean transition) {
+ void hideSlider(Boolean transition) {
if (sliderIsShowing == 1) {
sliderIsShowing = 0;
if(fragmentNoteList == null){
this.fragmentNoteList = this.getFragmentNoteList();
}
- if(fragmentNoteList != null) fragmentNoteList.onClose();
-
+ //if(fragmentNoteList != null) fragmentNoteList.onClose();
FragmentManager fm = getSupportFragmentManager();
FragmentSidebar fragment = (FragmentSidebar) fm.findFragmentByTag(FragmentSidebar.class.getName());
// Set height so transition works TODO 3 different heights?? Get from fragment, fragment.getMyHeight?
@@ -732,16 +742,16 @@ private void hideSlider(Boolean transition) {
// Do transition
FragmentTransaction ft = fm.beginTransaction();
if (transition) ft.setCustomAnimations(R.anim.slide_up, R.anim.slide_down);
- ft.remove(fragment);
+ ft.hide(fragment);
ft.commit();
}
- fragmentSlider = null;
+ // fragmentSlider = null;
}
this.invalidateOptionsMenu();
}
-
-
-
+
+
+
@Override
public Field AddFieldGetCurrentField() {
return this.currentField;
@@ -769,7 +779,7 @@ public void AddFieldDone(String name) {
this.currentPolygon.complete();
this.currentPolygon.setLabel(name, true);
this.currentPolygon.setFillColor(Field.FILL_COLOR_NOT_PLANNED);
-
+
List points = this.currentPolygon.getPoints();
Boolean wasAnEdit = false;
if (currentField == null) {
@@ -779,9 +789,9 @@ public void AddFieldDone(String name) {
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
@@ -803,7 +813,7 @@ public void AddFieldDone(String name) {
values.put(TableFields.COL_NAME, currentField.getName());
values.put(TableFields.COL_ACRES, currentField.getAcres());
values.put(TableFields.COL_BOUNDARY, strNewBoundary);
-
+
//TODO only update if something changed
values.put(TableFields.COL_HAS_CHANGED, 1);
values.put(TableFields.COL_DATE_CHANGED, DatabaseHelper.dateToStringUTC(new Date()));
@@ -818,7 +828,7 @@ public void AddFieldDone(String name) {
values,
TableFields.COL_ID + " = "
+ Integer.toString(currentField.getId()),
- null);
+ null);
}
dbHelper.close();
@@ -832,14 +842,14 @@ public void AddFieldDone(String name) {
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);
}
}
}
-
+
showSlider(true);
-
+
// add or update in list view
//if (this.fragmentListView != null) this.fragmentListView.getData();
//this.trelloController.syncDelayed();
@@ -859,7 +869,7 @@ public void AddFieldDelete() {
values.put(TableFields.COL_DATE_CHANGED, DatabaseHelper.dateToStringUTC(new Date()));
String where = TableFields.COL_ID + " = "+ Integer.toString(currentField.getId());
database.update(TableFields.TABLE_NAME, values, where, null);
-
+
dbHelper.close();
for(int i=0; i arg0, View arg1, int arg2,
@Override
public void onNothingSelected(AdapterView> arg0) {
-
+
}
-
+
// --------------------------------- FragmentNoteList ----------------------------------
private MyPolygon saveFieldPolygon = null;
private Boolean addingNotePolygon = false;
@@ -1005,6 +1015,18 @@ private FragmentNoteList getFragmentNoteList(){
return (FragmentNoteList) fm.findFragmentByTag(FragmentNoteList.class.getName());
}
+ @Override
+ public void NoteListUpdatePolygon(int fieldId, PolygonOptions polygonOptions){
+ for(int i=0; i polylines = null;
private String strMarkers = null;
+ private String strImageMarkers;
private List myMarkers = new ArrayList();
private List images = new ArrayList();
+ private List imageMarkers = new ArrayList();
//private List lines;
@@ -127,6 +130,9 @@ public void removePolyline(MyPolyline poly){
public void addMyMarker(MyMarker marker){
this.myMarkers.add(marker);
}
+ public void addImageMarker(Marker imageMarker) {
+ this.imageMarkers.add(imageMarker);
+ }
public void myMarkersToStringMarkers(){
StringBuilder build = new StringBuilder();
for(int i=0; i 0){
+ build.deleteCharAt(build.length() - 1);
+ }
+ this.strImageMarkers = build.toString();
+ }
+
+ public void removeImageMarkers(){
+ for(int i=0; i getMyPolylines() {
return this.myPolylines;
}
+ public String getStrImageMarkers() {
+ return this.strImageMarkers;
+ }
public String getStrMarkers() {
return this.strMarkers;
@@ -255,6 +289,22 @@ public List getMarkers() {
}
return markers;
}
+ public List getImageMarkers() {
+ //Convert strPolygons to polygons
+ List markers = new ArrayList();
+ String all = this.getStrImageMarkers();
+ if(all != null){
+ StringTokenizer tokensPoints = new StringTokenizer(all, ",");
+ while (tokensPoints.hasMoreTokens()) {
+ MarkerOptions options = new MarkerOptions();
+ String lat = tokensPoints.nextToken();
+ String lng = tokensPoints.nextToken();
+ options.position(new LatLng(Double.parseDouble(lat), Double.parseDouble(lng)));
+ markers.add(options);
+ }
+ }
+ return markers;
+ }
public List getMyMarkers() {
return this.myMarkers;
}
@@ -307,6 +357,9 @@ public void setPolylines(List polys) {
public void setStrMarkers(String str) {
this.strMarkers = str;
}
+ public void setStrImageMarkers(String str) {
+ this.strImageMarkers = str;
+ }
public void setColor(Integer color) {
for(int i=0; i notes = null;
@@ -102,6 +108,7 @@ public class FragmentNoteList extends Fragment implements OnClickListener, Drawi
private Note currentNote = null;
OpenNoteView currentOpenNoteView = null;
private RelativeLayout currentNoteView = null;
+ private Bitmap imageBitmap;
private Bitmap bitmap;
private File image;
@@ -112,13 +119,13 @@ public class FragmentNoteList extends Fragment implements OnClickListener, Drawi
private Boolean addingPoint = false;
private Boolean addingNote = false; //Or editing note
-
+
private MyPolyline currentPolyline = null;
private MyMarker currentPoint = null;
private String imagePath = null;
private Image currentImage = null; //Current image for imageviewer
-
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -126,10 +133,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
false);
me = this;
-
+
svNotes = (ScrollAutoView) view.findViewById(R.id.note_list_scrollView);
listNotes = (LinearLayout) view.findViewById(R.id.note_list_listNotes);
-
+
dbHelper = new DatabaseHelper(this.getActivity());
vi = (LayoutInflater) this.getActivity().getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
return view;
@@ -138,7 +145,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
-
+
Fragment parentFragment = getParentFragment();
if (parentFragment != null && parentFragment instanceof NoteListListener) {
// Check if parent fragment (if there is one) is listener
@@ -159,7 +166,7 @@ else if (listener == null) {
}
Log.d("FragmentNoteList", "Attached");
}
-
+
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
@@ -177,8 +184,7 @@ public void populateData(Integer currentFieldId, GoogleMap map) {
// Get current field
currentField = null;
if (currentFieldId != null) {
- currentField = Field.FindFieldById(dbHelper.getReadableDatabase(),
- currentFieldId);
+ currentField = Field.FindFieldById(dbHelper.getReadableDatabase(), currentFieldId);
dbHelper.close();
}
if (currentField != null) {
@@ -190,14 +196,22 @@ public void populateData(Integer currentFieldId, GoogleMap map) {
// Add note to list
listNotes.addView(inflateNote(notes.get(i)));
}
+ Log.w("currentNote", Boolean.toString(currentNote == null));
+ if (currentNote !=null) {
+ View newView = inflateOpenNote(currentNote);
+ currentOpenNoteView = (OpenNoteView) newView.getTag();
+
+ //Show drawing fragment
+ fragmentDrawing = listener.NoteListShowDrawing();
+ fragmentDrawing.setListener(me);
+ }
} else {
notes = null;
}
}
-
+
public void finishPolygon(MyPolygon newPolygon){
if(currentNote != null){
- //TODO handle edit finish? Maybe not, i think i removed on edit?
newPolygon.setStrokeColor(Field.STROKE_COLOR);
currentNote.addMyPolygon(newPolygon); // Adds a mypolygon
}
@@ -221,35 +235,35 @@ private View inflateNote(Note note) {
noteView.tvComment.setText(note.getComment());
-
+
noteView.tvComment.setTag(noteView);
noteView.butShowHide.setTag(noteView);
noteView.layNote.setTag(noteView);
-
+
noteView.tvComment.setOnClickListener(noteClickListener);
noteView.butShowHide.setOnClickListener(noteClickListener);
noteView.layNote.setOnClickListener(noteClickListener);
-
+
if(note.getVisible() == 1){
noteView.butShowHide.setImageResource(R.drawable.note_but_hide);
} else {
noteView.butShowHide.setImageResource(R.drawable.note_but_show);
}
-
+
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(Color.BLACK);
paint.setShadowLayer(2f, 0f, 2f, Color.LTGRAY);
paint.setTextAlign(Align.RIGHT);
paint.setTextSize(20);
paint.setStrokeWidth(20);
-
-
-
+
+
+
//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(), conf);
+
-
//Add polygons from note to map
List myPolygons = note.getMyPolygons();
if(myPolygons.isEmpty()){
@@ -267,7 +281,7 @@ private View inflateNote(Note note) {
List myPolylines = note.getMyPolylines();
if (myPolylines.isEmpty()) {
List polylines = note.getPolylines(); // Gets map
- // polygons
+ // polygons
for (int i = 0; i < polylines.size(); i++) {
note.addMyPolyline(new MyPolyline(map.addPolyline(polylines
.get(i)), map)); // Adds back my polygons
@@ -289,9 +303,30 @@ private View inflateNote(Note note) {
myMarkers.get(i).unselect();
}
}
+ //Add Images as Markers with icons
+ List images = note.getImages();
+ for (int i = 0; i < images.size(); i++) {
+ try {
+ ExifInterface exifInt = new ExifInterface(images.get(i).getPath());
+ imageBitmap = BitmapFactory.decodeByteArray(exifInt.getThumbnail(),0,exifInt.getThumbnail().length);
+ imageBitmap = Bitmap.createScaledBitmap(imageBitmap, imageBitmap.getWidth()/2,imageBitmap.getHeight()/2, false);
+ float[] ltlng = new float[2];
+ exifInt.getLatLong(ltlng);
+ LatLng picLoc = new LatLng(ltlng[0],ltlng[1]);
+ Log.w("bitmap null", Boolean.toString(imageBitmap == null));
+ Log.w("bitmap descriptor", Boolean.toString(BitmapDescriptorFactory.fromBitmap(imageBitmap) == null));
+// map.addMarker(new MarkerOptions().position(picLoc).icon(BitmapDescriptorFactory.fromBitmap(imageBitmap)));
+ note.addImageMarker(map.addMarker(new MarkerOptions().position(picLoc).icon(BitmapDescriptorFactory.fromBitmap(imageBitmap))));
+// note.addMyMarker(new MyMarker(marker, map));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
note.setColor(note.getColor());
noteView.imgColor.setBackgroundColor(note.getColor());
-
+
//Show icon and draw number on icon
Integer numberOfPolygons = note.getMyPolygons().size();
@@ -342,8 +377,6 @@ private View inflateNote(Note note) {
BitmapDrawable ob = new BitmapDrawable(getResources(), bitmap);
noteView.imgPoints.setBackgroundDrawable(ob);
}
-
-
noteView.me = view;
view.setTag(noteView);
return view;
@@ -356,7 +389,7 @@ private View inflateNote(Note note) {
public void onClick(View v) {
NoteView noteView = (NoteView) v.getTag();
if(v.getId() == R.id.note_butShowHide){
-
+
} else if(v.getId() == R.id.note_txtComment){
if(addingNote == false){
addingNote = true;
@@ -365,9 +398,9 @@ public void onClick(View v) {
newView.etComment.requestFocus();
//Show keyboard
InputMethodManager inputMethodManager = (InputMethodManager) me.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
- if (inputMethodManager != null) {
- inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
- }
+ if (inputMethodManager != null) {
+ inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
+ }
}
} else if(v.getId() == R.id.note){
if(addingNote == false){
@@ -380,7 +413,7 @@ public void onClick(View v) {
}
}
-
+
private OpenNoteView openNote(NoteView noteView){
svNotes.setScrollingEnabled(false);
svNotes.scrollToAfterAdd(noteView.me.getTop());
@@ -399,9 +432,9 @@ private OpenNoteView openNote(NoteView noteView){
}
};
-
+
static class NoteView
- {
+ {
ImageView imgColor;
ImageButton butShowHide;
TextView tvComment;
@@ -414,8 +447,8 @@ static class NoteView
Note note;
View me;
- }
-
+ }
+
private View inflateOpenNote(Note note){
View view = vi.inflate(R.layout.note_open, null);
@@ -430,11 +463,11 @@ private View inflateOpenNote(Note note){
noteView.svObjects = (HorizontalScrollView) view.findViewById(R.id.note_open_sv_objects);
noteView.etComment.setText(note.getComment());
-
+
List polygons = note.getMyPolygons();
List polylines = note.getMyPolylines();
List markers = note.getMyMarkers();
-
+
for(int i=0; i images = note.getImages();
if(images != null){
@@ -458,11 +491,10 @@ private View inflateOpenNote(Note note){
for(int i=0; i allNotes = Note.FindNotesByFieldName(dbHelper.getReadableDatabase(), note.getFieldName());
+ for (int z = 0; z < allNotes.size(); z++) {
+ Note aNote = allNotes.get(z);
+ if(aNote.getId() != note.getId()) {
+ // Get all the polygons, add their vertices to the bounding box
+ List listPolygons = aNote.getPolygons();
+ Log.w("ListPolygons is empty:", Boolean.toString(listPolygons.isEmpty()) + " " + note.getComment());
+ for (int i = 0; i < listPolygons.size(); i++) {
+ List points = listPolygons.get(i).getPoints();
+ for (int j = 0; j < points.size(); j++) {
+ builder.include(points.get(j));
+ }
+ }
+
+ // Do the same thing with the polylines
+ List listPolyline = aNote.getPolylines();
+ for (int p = 0; p < listPolyline.size(); p++) {
+ List points = listPolyline.get(p).getPoints();
+ for (int u = 0; u < points.size(); u++) {
+ builder.include(points.get(u));
+ }
+ }
+
+ // Do the same thing with the markers
+ List listMyMarker= aNote.getMarkers();
+ for (int p = 0; p < listMyMarker.size(); p++) {
+ builder.include(listMyMarker.get(p).getPosition());
+ }
+
+ List listImageMarker= note.getImageMarkers();
+ for (int p = 0; p < listImageMarker.size(); p++) {
+ builder.include(listImageMarker.get(p).getPosition());
+ }
+ }
+ }
+
// 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 < listPolygons.size(); i++) {
List points = listPolygons.get(i).getPoints();
for (int j = 0; j < points.size(); j++) {
@@ -625,41 +685,63 @@ private void SaveNote(Note note) {
}
}
- // TODO: there aren't markers or images yet, but add in the same test
- // for those
- // once they exist.
+ // Do the same thing with the markers
+ List listMyMarker= note.getMyMarkers();
+ for (int p = 0; p < listMyMarker.size(); p++) {
+ builder.include(listMyMarker.get(p).getPosition());
+ }
+
+ List listImageMarker= note.getImageMarkers();
+ for (int p = 0; p < listImageMarker.size(); p++) {
+ builder.include(listImageMarker.get(p).getPosition());
+ }
// Create the boundary, get the borders, convert to a string
- /*LatLngBounds bounds = builder.build();
- LatLng northeast = bounds.northeast;
- LatLng southwest = bounds.southwest;
- String newFieldBoundary = Double.toString(southwest.latitude) + ","
- + Double.toString(southwest.longitude) + ","
- + Double.toString(southwest.latitude) + ","
- + Double.toString(northeast.longitude) + ","
- + Double.toString(northeast.latitude) + ","
- + Double.toString(northeast.longitude) + ","
- + Double.toString(northeast.latitude) + ","
- + Double.toString(southwest.longitude);// and so on
-
- // Update the database with the new boundary value:
- ContentValues valuesField = new ContentValues();
- valuesField.put(TableFields.COL_BOUNDARY, newFieldBoundary);
- String whereField = TableFields.COL_NAME + "= '" + note.getFieldName()
- + "'";
- database.update(TableFields.TABLE_NAME, valuesField, whereField, null);*/
-
+ try {
+ LatLngBounds bounds = builder.build();
+ LatLng northeast = bounds.northeast;
+ LatLng southwest = bounds.southwest;
+ String newFieldBoundary = Double.toString(southwest.latitude) + ","
+ + Double.toString(southwest.longitude) + ","
+ + Double.toString(southwest.latitude) + ","
+ + Double.toString(northeast.longitude) + ","
+ + Double.toString(northeast.latitude) + ","
+ + Double.toString(northeast.longitude) + ","
+ + Double.toString(northeast.latitude) + ","
+ + Double.toString(southwest.longitude);// and so on
+
+ // Update the database with the new boundary value:
+ ContentValues valuesField = new ContentValues();
+ valuesField.put(TableFields.COL_BOUNDARY, newFieldBoundary);
+ String whereField = TableFields.COL_NAME + "= '" + note.getFieldName()
+ + "'";
+ database.update(TableFields.TABLE_NAME, valuesField, whereField, null);
+
+ // Now draw this field
+ // Create polygon
+
+ List points = Field.StringToBoundary(newFieldBoundary);
+
+ if(points != null && points.isEmpty() == false) {
+ PolygonOptions polygonOptions = new PolygonOptions();
+ polygonOptions.fillColor(Field.FILL_COLOR_NOT_PLANNED);
+ polygonOptions.strokeWidth(Field.STROKE_WIDTH);
+ polygonOptions.strokeColor(Field.STROKE_COLOR);
+ for (int i = 0; i < points.size(); i++) {
+ polygonOptions.add(points.get(i));
+ }
+ if (currentField == null) {
+ Log.w("currentfield", "sdf");
+ } else if (currentField.getPolygon() == null) {
+ Log.w("currentfield get poly", "ok");
+ }
+ this.listener.NoteListUpdatePolygon(currentField.getId(), polygonOptions);
+ }
+ }
+ catch (IllegalStateException e){
+ }
- // map.clear();
- // MainActivity.drawFields();
-
- // Done with case file boundary creation
-
- // TODO more stuff
- if (note.getId() == null) {
- // New note
- database.insert(TableNotes.TABLE_NAME, null, values);
-=======
+ //Save current my polygons to strpolygons
note.myPolygonsToStringPolygons();
//Save the polygons
values.put(TableNotes.COL_POLYGONS, note.getStrPolygons());
@@ -669,24 +751,27 @@ private void SaveNote(Note note) {
//Save the polylines
values.put(TableNotes.COL_LINES, note.getStrPolylines());
Log.d("SaveNote", "StrPolylines:" + note.getStrPolylines());
- //Save current my polylines to strpolylines
+ //Save current my mymarkers to strmarkers
note.myMarkersToStringMarkers();
- //Save the polylines
+ //Save the markers
values.put(TableNotes.COL_POINTS, note.getStrMarkers());
Log.d("SaveNote", "StrPoints:" + note.getStrMarkers());
+ //Save the imagemarkers
+ note.imageMarkersToStringImageMarkers();
+ values.put(TableNotes.COL_IMAGEPOINTS, note.getStrImageMarkers());
+ Log.d("SaveNote", "StrImagePoints:" + note.getStrImageMarkers());
//TODO more stuff
if(note.getId() == null){
//New note
Integer newId = (int) database.insert(TableNotes.TABLE_NAME, null, values);
note.setId(newId);
->>>>>>> e3bb026f0f4042bfd9f69ea2ba71dbd4f40a01dd
} else {
// Editing note
String where = TableNotes.COL_ID + " = " + note.getId();
database.update(TableNotes.TABLE_NAME, values, where, null);
}
-
+
List images = note.getImages();
if(images != null){
for(int i=0; i>>>>>> e3bb026f0f4042bfd9f69ea2ba71dbd4f40a01dd
-
- // Gets the layout params that will allow you to resize the layout
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) currentOpenNoteView.layImageView.getLayoutParams();
- // Changes the height and width to the specified *pixels*
- params.height = height;
- currentOpenNoteView.layImageView.setLayoutParams(params);
-
- // Prepare a transaction to add fragments to this fragment
- FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
- // Add the list fragment to this fragment's layout
- Log.i(TAG, "onCreate: adding FragmentNoteList to FragmentSidebar");
- // Add the fragment to the this fragment's container layout
- FragmentImageViewer fragmentImageViewer = new FragmentImageViewer();
- fragmentTransaction.replace(currentOpenNoteView.layImageView.getId(), fragmentImageViewer, FragmentImageViewer.class.getName());
- // Commit the transaction
- fragmentTransaction.commit();
- }
- };
- @Override
- public void ImageViewerRequestData(FragmentImageViewer requester) {
- if(this.currentNote != null){
- requester.populateData(this.currentNote.getImages(), currentImage);
+ //Get reference to the file
+ File newf = new File(this.getActivity().getFilesDir(), file);
+
+ Uri outputFileUri = Uri.fromFile(newf);
+ Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+ cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
+ this.getActivity().startActivityForResult(cameraIntent, 999);
+}
+public void ImageCaptured(){
+ if(imagePath != null){
+ Log.d(TAG, "ImageCaptured");
+ Bitmap fullImage = BitmapFactory.decodeFile(imagePath);
+ Bitmap thumb = ThumbnailUtils.extractThumbnail(fullImage, 100, 100);
+ ImageView img = new ImageView(this.getActivity());
+ img.setOnClickListener(imageClickListener);
+ img.setTag(new Image(thumb, imagePath));
+
+ float scale = getResources().getDisplayMetrics().density;
+ int dpAsPixels = (int) (7*scale + 0.5f); //Margin
+ LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
+ layoutParams.setMargins(dpAsPixels, 0, dpAsPixels, 0);
+
+ Drawable d = new BitmapDrawable(getResources(), thumb);
+ img.setBackgroundDrawable(d);
+ this.currentOpenNoteView.layObjects.addView(img, layoutParams);
+
+ //Save path and thumbnail in database
+ if(currentNote != null){
+ currentNote.addImage(thumb, imagePath);
}
}
+}
+private OnClickListener imageClickListener = new OnClickListener(){
@Override
- public void ImageViewerDone(Image image) {
- currentOpenNoteView.layFullNote.setVisibility(View.VISIBLE);
- currentOpenNoteView.layImageView.setVisibility(View.GONE);
- //currentOpenNoteView.me.setBackgroundResource(R.drawable.note);
+ public void onClick(View v) {
+ currentImage = (Image) v.getTag();
+ int height = currentOpenNoteView.layFullNote.getHeight();
+ currentOpenNoteView.layFullNote.setVisibility(View.GONE);
+ currentOpenNoteView.layImageView.setVisibility(View.VISIBLE);
+ //currentOpenNoteView.me.setBackgroundResource(R.drawable.note_image_viewer);
+ // Gets the layout params that will allow you to resize the layout
+ RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) currentOpenNoteView.layImageView.getLayoutParams();
+ // Changes the height and width to the specified *pixels*
+ params.height = height;
+ currentOpenNoteView.layImageView.setLayoutParams(params);
+
+ // Prepare a transaction to add fragments to this fragment
+ FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
+ // Add the list fragment to this fragment's layout
+ Log.i(TAG, "onCreate: adding FragmentNoteList to FragmentSidebar");
+ // Add the fragment to the this fragment's container layout
+ FragmentImageViewer fragmentImageViewer = new FragmentImageViewer();
+ fragmentTransaction.replace(currentOpenNoteView.layImageView.getId(), fragmentImageViewer, FragmentImageViewer.class.getName());
+ // Commit the transaction
+ fragmentTransaction.commit();
}
- public Boolean AddNote() {
- if(addingNote == false){
- Log.d("FragmentNoteList", "AddNote");
- this.addingNote = true;
- //Add a new note
- Note newNote = new Note(currentField.getName());
- notes.add(newNote);
- currentNote = newNote;
-
- View newView = inflateOpenNote(newNote);
- currentOpenNoteView = (OpenNoteView) newView.getTag();
- listNotes.addView(newView, 0);
- listener.NoteListAddNote();
-
- svNotes.scrollTo(0, 0);
- //InputMethodManager inputMethodManager = (InputMethodManager) this.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
- //inputMethodManager.showSoftInput(newOpenNote.etComment, 0);
-
- //Show drawing fragment
- fragmentDrawing = listener.NoteListShowDrawing();
- fragmentDrawing.setListener(me);
- return true;
- }
- return false;
+};
+@Override
+public void ImageViewerRequestData(FragmentImageViewer requester) {
+ if(this.currentNote != null){
+ requester.populateData(this.currentNote.getImages(), currentImage);
}
-
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public static Bitmap decodeMutableBitmapFromResourceId(final Context context, final int bitmapResId) {
- final Options bitmapOptions = new Options();
- if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB)
- bitmapOptions.inMutable = true;
- Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), bitmapResId, bitmapOptions);
- if (!bitmap.isMutable())
- bitmap = convertToMutable(context, bitmap);
- return bitmap;
+}
+@Override
+public void ImageViewerDone(Image image) {
+ currentOpenNoteView.layFullNote.setVisibility(View.VISIBLE);
+ currentOpenNoteView.layImageView.setVisibility(View.GONE);
+ //currentOpenNoteView.me.setBackgroundResource(R.drawable.note);
+}
+public Boolean AddNote() {
+ if(addingNote == false){
+ Log.d("FragmentNoteList", "AddNote");
+ this.addingNote = true;
+ //Add a new note
+ Note newNote = new Note(currentField.getName());
+ notes.add(newNote);
+ currentNote = newNote;
+
+ View newView = inflateOpenNote(newNote);
+ currentOpenNoteView = (OpenNoteView) newView.getTag();
+ listNotes.addView(newView, 0);
+ listener.NoteListAddNote();
+
+ svNotes.scrollTo(0, 0);
+ //InputMethodManager inputMethodManager = (InputMethodManager) this.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
+ //inputMethodManager.showSoftInput(newOpenNote.etComment, 0);
+
+ //Show drawing fragment
+ fragmentDrawing = listener.NoteListShowDrawing();
+ fragmentDrawing.setListener(me);
+ return true;
+ }
+ return false;
+}
+
+@TargetApi(Build.VERSION_CODES.HONEYCOMB)
+public static Bitmap decodeMutableBitmapFromResourceId(final Context context, final int bitmapResId) {
+ final Options bitmapOptions = new Options();
+ if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB)
+ bitmapOptions.inMutable = true;
+ Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), bitmapResId, bitmapOptions);
+ if (!bitmap.isMutable())
+ bitmap = convertToMutable(context, bitmap);
+ return bitmap;
+}
+
+@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+public static Bitmap convertToMutable(final Context context, final Bitmap imgIn) {
+ final int width = imgIn.getWidth(), height = imgIn.getHeight();
+ final Config type = imgIn.getConfig();
+ File outputFile = null;
+ final File outputDir = context.getCacheDir();
+ try {
+ outputFile = File.createTempFile(Long.toString(System.currentTimeMillis()), null, outputDir);
+ outputFile.deleteOnExit();
+ final RandomAccessFile randomAccessFile = new RandomAccessFile(outputFile, "rw");
+ final FileChannel channel = randomAccessFile.getChannel();
+ final MappedByteBuffer map = channel.map(MapMode.READ_WRITE, 0, imgIn.getRowBytes() * height);
+ imgIn.copyPixelsToBuffer(map);
+ imgIn.recycle();
+ final Bitmap result = Bitmap.createBitmap(width, height, type);
+ map.position(0);
+ result.copyPixelsFromBuffer(map);
+ channel.close();
+ randomAccessFile.close();
+ outputFile.delete();
+ return result;
+ } catch (final Exception e) {
+ } finally {
+ if (outputFile != null)
+ outputFile.delete();
}
+ return null;
+}
- @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
- public static Bitmap convertToMutable(final Context context, final Bitmap imgIn) {
- final int width = imgIn.getWidth(), height = imgIn.getHeight();
- final Config type = imgIn.getConfig();
- File outputFile = null;
- final File outputDir = context.getCacheDir();
- try {
- outputFile = File.createTempFile(Long.toString(System.currentTimeMillis()), null, outputDir);
- outputFile.deleteOnExit();
- final RandomAccessFile randomAccessFile = new RandomAccessFile(outputFile, "rw");
- final FileChannel channel = randomAccessFile.getChannel();
- final MappedByteBuffer map = channel.map(MapMode.READ_WRITE, 0, imgIn.getRowBytes() * height);
- imgIn.copyPixelsToBuffer(map);
- imgIn.recycle();
- final Bitmap result = Bitmap.createBitmap(width, height, type);
- map.position(0);
- result.copyPixelsFromBuffer(map);
- channel.close();
- randomAccessFile.close();
- outputFile.delete();
- return result;
- } catch (final Exception e) {
- } finally {
- if (outputFile != null)
- outputFile.delete();
- }
- return null;
- }
+@Override
+public void onClick(View arg0) {
+}
}
\ No newline at end of file
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/notelist/NoteListListener.java b/FieldNotebook/src/com/openatk/fieldnotebook/notelist/NoteListListener.java
index 525bb23..12f81cf 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/notelist/NoteListListener.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/notelist/NoteListListener.java
@@ -1,6 +1,8 @@
package com.openatk.fieldnotebook.notelist;
+import com.google.android.gms.maps.model.PolygonOptions;
import com.openatk.fieldnotebook.FragmentDrawing;
+import com.openatk.fieldnotebook.db.Field;
import com.openatk.fieldnotebook.drawing.MyPolygon;
/**
@@ -25,5 +27,5 @@ public interface NoteListListener {
public FragmentDrawing NoteListShowDrawing();
public void NoteListHideDrawing();
public void NoteListAddNote();
-
+ public void NoteListUpdatePolygon(int fieldId, PolygonOptions polygonOptions);
}
\ No newline at end of file
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java b/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java
index 149c573..c40d503 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java
@@ -47,7 +47,6 @@ public class FragmentSidebar extends Fragment implements OnClickListener, OnTouc
private Field currentField = null;
private View container = null;
-
private Boolean initialCreate;
private ViewGroup noteListContainer;
private ViewGroup fieldListContainer;
@@ -94,9 +93,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
initialCreate = false;
// Prepare a transaction to add fragments to this fragment
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
-
+ Log.w("fragtrans", fragmentTransaction.toString());
// Add the list fragment to this fragment's layout
+ Log.w("fieldListContainer", Boolean.toString(fieldListContainer == null));
+ Log.w("fragmentFieldList", Boolean.toString(fragmentFieldList == null));
+ Log.w("noteListContainer", Boolean.toString(noteListContainer == null));
+ Log.w("fragmentNoteList", Boolean.toString(fragmentNoteList == null));
+
if (fieldListContainer != null) {
+
Log.i(TAG, "onCreate: adding FragmentFieldList to FragmentSidebar");
// Add the fragment to the this fragment's container layout
fragmentFieldList = new FragmentFieldList();
@@ -108,28 +113,29 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
fragmentNoteList = new FragmentNoteList();
fragmentTransaction.replace(noteListContainer.getId(), fragmentNoteList, FragmentNoteList.class.getName());
}
+ Log.w("fragtrans", fragmentTransaction.toString());
// Commit the transaction
fragmentTransaction.commit();
}
// If this is the first creation of the fragment, add child fragments
- if (initialCreate) {
- initialCreate = false;
- // Prepare a transaction to add fragments to this fragment
- FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
-
- // Add the list fragment to this fragment's layout
- noteListContainer = (ViewGroup) view.findViewById(R.id.sidebar_fragment_listNotes_container);
- if (noteListContainer != null) {
- Log.i(TAG, "onCreate: adding FragmentNoteList to Fragmentsidebar");
-
- // Add the fragment to the this fragment's container layout
- fragmentNoteList = new FragmentNoteList();
- fragmentTransaction.replace(noteListContainer.getId(), fragmentNoteList, FragmentNoteList.class.getName());
- }
- // Commit the transaction
- fragmentTransaction.commit();
- }
+// if (initialCreate) {
+// initialCreate = false;
+// // Prepare a transaction to add fragments to this fragment
+// FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
+//
+// // Add the list fragment to this fragment's layout
+// noteListContainer = (ViewGroup) view.findViewById(R.id.sidebar_fragment_listNotes_container);
+// if (noteListContainer != null) {
+// Log.i(TAG, "onCreate: adding FragmentNoteList to Fragmentsidebar");
+//
+// // Add the fragment to the this fragment's container layout
+// fragmentNoteList = new FragmentNoteList();
+// fragmentTransaction.replace(noteListContainer.getId(), fragmentNoteList, FragmentNoteList.class.getName());
+// }
+// // Commit the transaction
+// fragmentTransaction.commit();
+// }
return view;
}
From 88404642de57b51dfacc74f5107f992c4c202cd8 Mon Sep 17 00:00:00 2001
From: Samuel Noel
Date: Wed, 4 Dec 2013 17:43:33 -0500
Subject: [PATCH 10/10] demo fixes
---
FieldNotebook/res/layout/field.xml | 13 -----
.../res/layout/fragment_add_field.xml | 17 ------
FieldNotebook/res/layout/fragment_drawing.xml | 7 ---
FieldNotebook/res/layout/fragment_sidebar.xml | 22 +------
FieldNotebook/res/layout/fragment_slider.xml | 20 -------
.../fieldnotebook/FragmentDrawing.java | 16 ++---
.../openatk/fieldnotebook/MainActivity.java | 2 +-
.../com/openatk/fieldnotebook/db/Field.java | 16 ++---
.../com/openatk/fieldnotebook/db/Note.java | 11 +++-
.../fieldlist/FragmentFieldList.java | 3 +-
.../notelist/FragmentNoteList.java | 58 +++++++++++--------
.../sidebar/FragmentSidebar.java | 4 --
12 files changed, 63 insertions(+), 126 deletions(-)
diff --git a/FieldNotebook/res/layout/field.xml b/FieldNotebook/res/layout/field.xml
index 050dc6d..4d33fc7 100644
--- a/FieldNotebook/res/layout/field.xml
+++ b/FieldNotebook/res/layout/field.xml
@@ -31,18 +31,5 @@
android:layout_below="@+id/field_row1"
android:layout_alignParentLeft="true"
android:layout_marginTop="5dp">
-
\ No newline at end of file
diff --git a/FieldNotebook/res/layout/fragment_add_field.xml b/FieldNotebook/res/layout/fragment_add_field.xml
index 779cf49..19f7b6f 100644
--- a/FieldNotebook/res/layout/fragment_add_field.xml
+++ b/FieldNotebook/res/layout/fragment_add_field.xml
@@ -75,22 +75,5 @@
android:layout_below="@+id/add_field_lay_row1"
android:gravity="center"
android:orientation="horizontal">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/FieldNotebook/res/layout/fragment_drawing.xml b/FieldNotebook/res/layout/fragment_drawing.xml
index 14ed1a1..ff4e239 100644
--- a/FieldNotebook/res/layout/fragment_drawing.xml
+++ b/FieldNotebook/res/layout/fragment_drawing.xml
@@ -62,13 +62,6 @@
android:layout_height="wrap_content"
android:layout_weight="1" >
-
-
-
-
-
-
boundary;
private LatLngBounds boundingBox = null;
private Integer deleted = 0;
@@ -125,9 +125,9 @@ public String getName() {
return name;
}
- public Integer getAcres() {
- return acres;
- }
+// public Integer getAcres() {
+// return acres;
+// }
public List getBoundary() {
return boundary;
@@ -161,9 +161,9 @@ public void setName(String name) {
this.name = name;
}
- public void setAcres(Integer acres) {
- this.acres = acres;
- }
+// public void setAcres(Integer acres) {
+// this.acres = acres;
+// }
public void setBoundary(List boundary) {
this.boundary = boundary;
@@ -201,7 +201,7 @@ public static Field cursorToField(Cursor cursor){
field.setDateChanged(cursor.getString(cursor.getColumnIndex(TableFields.COL_DATE_CHANGED)));
String boundary = cursor.getString(cursor.getColumnIndex(TableFields.COL_BOUNDARY));
field.setBoundary(Field.StringToBoundary(boundary));
- field.setAcres(cursor.getInt(cursor.getColumnIndex(TableFields.COL_ACRES)));
+// field.setAcres(cursor.getInt(cursor.getColumnIndex(TableFields.COL_ACRES)));
field.setName(cursor.getString(cursor.getColumnIndex(TableFields.COL_NAME)));
field.setDeleted(cursor.getInt(cursor.getColumnIndex(TableFields.COL_DELETED)));
return field;
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/db/Note.java b/FieldNotebook/src/com/openatk/fieldnotebook/db/Note.java
index d8435a5..80c1c71 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/db/Note.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/db/Note.java
@@ -8,6 +8,7 @@
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.Color;
+import android.util.Log;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
@@ -157,7 +158,8 @@ public void removeMarkers(){
}
public void imageMarkersToStringImageMarkers(){
- StringBuilder build = new StringBuilder();
+ StringBuilder build = new StringBuilder();
+ Log.w("imagemarkerstostringimagemarkers", imageMarkers.toString());
for(int i=0; i getMarkers() {
return markers;
}
public List getImageMarkers() {
- //Convert strPolygons to polygons
+ //Convert strImageMarkers to markers
List markers = new ArrayList();
String all = this.getStrImageMarkers();
+ if (all != null) {
+ Log.w("all", all);
+ } else {
+ Log.w("all", "all null");
+ }
if(all != null){
StringTokenizer tokensPoints = new StringTokenizer(all, ",");
while (tokensPoints.hasMoreTokens()) {
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/fieldlist/FragmentFieldList.java b/FieldNotebook/src/com/openatk/fieldnotebook/fieldlist/FragmentFieldList.java
index e077386..c7bb9ab 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/fieldlist/FragmentFieldList.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/fieldlist/FragmentFieldList.java
@@ -135,13 +135,12 @@ private View inflateField(Field field){
FieldView newView = new FieldView();
newView.layField = (RelativeLayout) view.findViewById(R.id.field);
newView.tvName = (TextView) view.findViewById(R.id.field_txtName);
- newView.tvAcres = (TextView) view.findViewById(R.id.field_txtAcres);
newView.row1 = (RelativeLayout) view.findViewById(R.id.field_row1);
newView.row2 = (RelativeLayout) view.findViewById(R.id.field_row2);
newView.field = field;
newView.tvName.setText(field.getName());
- newView.tvAcres.setText(Integer.toString(field.getAcres()) + " acres");
+// newView.tvAcres.setText(Integer.toString(field.getAcres()) + " acres");
newView.layField.setTag(newView);
newView.layField.setOnClickListener(fieldClickListener);
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/notelist/FragmentNoteList.java b/FieldNotebook/src/com/openatk/fieldnotebook/notelist/FragmentNoteList.java
index 1957224..61e151c 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/notelist/FragmentNoteList.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/notelist/FragmentNoteList.java
@@ -628,7 +628,27 @@ private void SaveNote(Note note) {
ContentValues values = new ContentValues();
values.put(TableNotes.COL_COMMENT,note.getComment());
values.put(TableNotes.COL_FIELD_NAME,note.getFieldName());
- values.put(TableNotes.COL_COLOR,note.getColor());
+ values.put(TableNotes.COL_COLOR,note.getColor());
+
+ //Save current my polygons to strpolygons
+ 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());
+ //Save current my mymarkers to strmarkers
+ note.myMarkersToStringMarkers();
+ //Save the markers
+ values.put(TableNotes.COL_POINTS, note.getStrMarkers());
+ Log.d("SaveNote", "StrPoints:" + note.getStrMarkers());
+ //Save the imagemarkers
+ note.imageMarkersToStringImageMarkers();
+ values.put(TableNotes.COL_IMAGEPOINTS, note.getStrImageMarkers());
+ Log.d("SaveNote", "StrImagePoints:" + note.getStrImageMarkers());
LatLngBounds.Builder builder = new LatLngBounds.Builder();
List allNotes = Note.FindNotesByFieldName(dbHelper.getReadableDatabase(), note.getFieldName());
@@ -660,7 +680,8 @@ private void SaveNote(Note note) {
builder.include(listMyMarker.get(p).getPosition());
}
- List listImageMarker= note.getImageMarkers();
+ List listImageMarker = aNote.getImageMarkers();
+ Log.w("imagemarkers A", listImageMarker.toString());
for (int p = 0; p < listImageMarker.size(); p++) {
builder.include(listImageMarker.get(p).getPosition());
}
@@ -691,7 +712,8 @@ private void SaveNote(Note note) {
builder.include(listMyMarker.get(p).getPosition());
}
- List listImageMarker= note.getImageMarkers();
+ List listImageMarker = note.getImageMarkers();
+ Log.w("imagemarkers B", listImageMarker.toString());
for (int p = 0; p < listImageMarker.size(); p++) {
builder.include(listImageMarker.get(p).getPosition());
}
@@ -741,26 +763,6 @@ private void SaveNote(Note note) {
catch (IllegalStateException e){
}
- //Save current my polygons to strpolygons
- 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());
- //Save current my mymarkers to strmarkers
- note.myMarkersToStringMarkers();
- //Save the markers
- values.put(TableNotes.COL_POINTS, note.getStrMarkers());
- Log.d("SaveNote", "StrPoints:" + note.getStrMarkers());
- //Save the imagemarkers
- note.imageMarkersToStringImageMarkers();
- values.put(TableNotes.COL_IMAGEPOINTS, note.getStrImageMarkers());
- Log.d("SaveNote", "StrImagePoints:" + note.getStrImageMarkers());
-
//TODO more stuff
if(note.getId() == null){
//New note
@@ -1035,6 +1037,16 @@ public void ImageCaptured(){
if(currentNote != null){
currentNote.addImage(thumb, imagePath);
}
+ try {
+ ExifInterface exifInt = new ExifInterface(imagePath);
+ imageBitmap = Bitmap.createScaledBitmap(thumb, thumb.getWidth()/2,thumb.getHeight()/2, false);
+ float[] ltlng = new float[2];
+ exifInt.getLatLong(ltlng);
+ LatLng picLoc = new LatLng(ltlng[0],ltlng[1]);
+ currentNote.addImageMarker(map.addMarker(new MarkerOptions().position(picLoc).icon(BitmapDescriptorFactory.fromBitmap(imageBitmap))));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
}
private OnClickListener imageClickListener = new OnClickListener(){
diff --git a/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java b/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java
index c40d503..3af6c7f 100644
--- a/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java
+++ b/FieldNotebook/src/com/openatk/fieldnotebook/sidebar/FragmentSidebar.java
@@ -36,7 +36,6 @@ public class FragmentSidebar extends Fragment implements OnClickListener, OnTouc
private TextView tvName;
- private TextView tvAcres;
private ImageButton butEditField;
private Button butAddNote;
private ImageButton butBackToFields;
@@ -70,7 +69,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
View view = inflater.inflate(R.layout.fragment_slider, container, false);
tvName = (TextView) view.findViewById(R.id.sidebar_tvName);
- tvAcres = (TextView) view.findViewById(R.id.sidebar_tvAcres);
//view.setOnTouchListener(this);
//tvName.setOnTouchListener(this);
@@ -170,14 +168,12 @@ public void populateData(Field theField, View container) {
this.container = container;
if (currentField != null) {
tvName.setText(currentField.getName());
- tvAcres.setText(Integer.toString(currentField.getAcres()) + " ac");
fieldListContainer.setVisibility(View.GONE);
fieldMenu.setVisibility(View.GONE);
noteListContainer.setVisibility(View.VISIBLE);
noteMenu.setVisibility(View.VISIBLE);
} else {
tvName.setText("");
- tvAcres.setText("");
fieldListContainer.setVisibility(View.VISIBLE);
fieldMenu.setVisibility(View.VISIBLE);
noteListContainer.setVisibility(View.GONE);