DT @1.11.2015: IncidentCategories final implementiert. Farben zu den einzelnen Kategorien hinzugefügt. Bugfixes in der ListenDarstellung.

This commit is contained in:
Dennis Thießen
2015-11-01 20:11:49 +01:00
parent cfc99d216c
commit c050980797
11 changed files with 54 additions and 30 deletions

View File

@@ -24,6 +24,7 @@ import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.Circle;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
@@ -229,14 +230,30 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
JSONObject incident = incidents.getJSONObject(i);
LatLng pos = new LatLng(Double.parseDouble(incident.getString("latitude")),Double.parseDouble(incident.getString("longitude")));
Log.d(TAG, "Adding marker with position: " + pos.latitude +" : "+ pos.longitude);
mMarker = mMap.addMarker(new MarkerOptions().position(pos).title(incident.getString("text_short")).snippet("Crime Category:" + incident.getString("fid_category")));
markerIDs.put(mMarker.getId(),incident.getString("uid"));
mMarker = mMap.addMarker(new MarkerOptions()
.position(pos)
.title(incident.getString("text_short"))
.snippet("Crime Category:" + incident.getString("cat_name")));
switch (incident.getInt("fid_category")) {
case 1:
mMarker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
break;
case 2:
mMarker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
break;
case 3:
mMarker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
break;
}
markerIDs.put(mMarker.getId(), incident.getString("uid"));
CircleOptions circleOptions = new CircleOptions()
.center(pos)
.strokeColor(Color.BLACK)
.strokeWidth(2)
.fillColor(Color.argb(50, 255, 0, 0))
.fillColor(Color.parseColor("#"+incident.getString("color")))
.radius(incident.getInt("radius")); // In meters
Circle circle = mMap.addCircle(circleOptions);

View File

@@ -35,7 +35,7 @@ public class ViewReportActivity extends BaseActivity {
private EditText txtTitle;
private EditText txtDescription;
private Spinner txtCrimeCategory;
private EditText txtCrimeCategory;
private EditText txtPosition;
private EditText txtDate;
private EditText txtTime;
@@ -48,7 +48,7 @@ public class ViewReportActivity extends BaseActivity {
txtTitle = (EditText) findViewById(R.id.input_viewreport_short);
txtDescription = (EditText) findViewById(R.id.input_viewreport_long);
txtCrimeCategory = (Spinner) findViewById(R.id.dd_viewreport_category);
txtCrimeCategory = (EditText) findViewById(R.id.input_viewreport_category);
txtDate = (EditText) findViewById(R.id.input_viewreport_date);
txtTime = (EditText) findViewById(R.id.input_viewreport_time);
txtPosition = (EditText) findViewById(R.id.input_viewreport_position);
@@ -99,7 +99,7 @@ public class ViewReportActivity extends BaseActivity {
txtTitle.setText(incident.getString("text_short"));
txtDescription.setText(incident.getString("text_long"));
txtCrimeCategory.setSelection(incident.getInt("fid_category"));
txtCrimeCategory.setText(incident.getString("cat_name"));
String[] happened_at = incident.getString("happened_at").split(" ");
txtDate.setText(happened_at[0]);
@@ -118,8 +118,8 @@ public class ViewReportActivity extends BaseActivity {
}
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
}
}
}, new Response.ErrorListener() {

View File

@@ -57,7 +57,7 @@
<LinearLayout
android:id="@+id/ll_01"
android:gravity="center"
android:background="#33FF0000"
android:background="#c5a7a7a7"
android:layout_height="50dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
@@ -93,7 +93,7 @@
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffeeee"/>
android:background="#ffffff"/>
</android.support.v4.widget.DrawerLayout>

View File

@@ -38,6 +38,6 @@
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffeeee"/>
android:background="#ffffff"/>
</android.support.v4.widget.DrawerLayout>

View File

@@ -178,7 +178,7 @@
<LinearLayout
android:id="@+id/ll_01"
android:gravity="center"
android:background="#33FF0000"
android:background="#c55ed9ff"
android:layout_height="50dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
@@ -203,6 +203,6 @@
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffeeee"/>
android:background="#ffffff"/>
</android.support.v4.widget.DrawerLayout>

View File

@@ -2,7 +2,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
xmlns:fontawesometext="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:background="#8ae6e6e6"
android:layout_width="match_parent"
@@ -188,6 +187,6 @@
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffeeee"/>
android:background="#ffffff"/>
</android.support.v4.widget.DrawerLayout>

View File

@@ -1,7 +1,6 @@
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:background="#8ae6e6e6"
android:layout_width="match_parent"
@@ -13,7 +12,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_margin="20dp"
android:orientation="vertical" >
<ListView
@@ -28,6 +26,6 @@
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffeeee"/>
android:background="#ffffff"/>
</android.support.v4.widget.DrawerLayout>

View File

@@ -2,21 +2,34 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:orientation="vertical"
android:padding="5dp"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#a6000000"
android:id="@+id/txt_reportlist_lvrow_title"
android:text="Header"/>
android:text="Header"
android:textSize="16dp"
android:typeface="serif" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#b9000000"
android:text="Long Text"
android:id="@+id/txt_reportlist_lvrow_text"/>
android:id="@+id/txt_reportlist_lvrow_text"
android:typeface="serif" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#b9000000"
android:text="Category"
android:id="@+id/txt_reportlist_lvrow_category"
android:typeface="serif" />
</LinearLayout>

View File

@@ -160,6 +160,6 @@
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffeeee"/>
android:background="#ffffff"/>
</android.support.v4.widget.DrawerLayout>

View File

@@ -22,6 +22,6 @@
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffeeee"/>
android:background="#ffffff"/>
</android.support.v4.widget.DrawerLayout>

View File

@@ -81,8 +81,8 @@
android:layout_marginTop="10dp"
android:layout_below="@+id/input_viewreport_long" />
<Spinner
android:id="@+id/dd_viewreport_category"
<EditText
android:id="@+id/input_viewreport_category"
android:enabled="false"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -94,7 +94,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_below="@+id/dd_viewreport_category" />
android:layout_below="@+id/input_viewreport_category" />
<TextView
android:id="@+id/lbl_viewreport_time"
@@ -226,9 +226,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
@@ -238,6 +235,6 @@
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#ffeeee"/>
android:background="#ffffff"/>
</android.support.v4.widget.DrawerLayout>