@06.03.16 Dennis Thießen: 2.1

This commit is contained in:
Dennis Thießen
2016-03-06 17:16:52 +01:00
parent a14fa0d549
commit effb54e824
12 changed files with 97 additions and 40 deletions

Binary file not shown.

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="RiskAhead" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> <module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="riskAhead" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager"> <component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle"> <facet type="android-gradle" name="Android-Gradle">
<configuration> <configuration>

View File

@@ -19,8 +19,8 @@ android {
applicationId "org.deke.risk.riskahead" applicationId "org.deke.risk.riskahead"
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 23 targetSdkVersion 23
versionCode 33 versionCode 34
versionName "2.0.4" versionName "2.1"
} }
buildTypes { buildTypes {
release { release {

View File

@@ -41,8 +41,6 @@ import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.TileOverlay; import com.google.android.gms.maps.model.TileOverlay;
import com.google.android.gms.maps.model.TileOverlayOptions; import com.google.android.gms.maps.model.TileOverlayOptions;
import com.google.android.gms.plus.Plus;
import com.google.android.gms.plus.model.people.Person;
import com.google.maps.android.clustering.Cluster; import com.google.maps.android.clustering.Cluster;
import com.google.maps.android.clustering.ClusterManager; import com.google.maps.android.clustering.ClusterManager;
import com.google.maps.android.heatmaps.HeatmapTileProvider; import com.google.maps.android.heatmaps.HeatmapTileProvider;
@@ -142,8 +140,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
String permissions[], int[] grantResults) {
switch (requestCode) { switch (requestCode) {
case MY_PERMISSIONS_REQUEST_LOCATION: { case MY_PERMISSIONS_REQUEST_LOCATION: {
// If request is cancelled, the result arrays are empty. // If request is cancelled, the result arrays are empty.
@@ -152,14 +149,9 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
try{ try{
mMap.setMyLocationEnabled(true); mMap.setMyLocationEnabled(true);
}catch(SecurityException e){ }catch(SecurityException e){
Log.e(TAG,"Security Exception: "+e.toString());
} }
} else {
} }
return;
} }
// other 'case' lines to check for other // other 'case' lines to check for other

View File

@@ -1,8 +1,10 @@
package org.deke.risk.riskahead.adapter; package org.deke.risk.riskahead.adapter;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Build; import android.os.Build;
import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@@ -13,6 +15,7 @@ import android.widget.TextView;
import org.deke.risk.riskahead.R; import org.deke.risk.riskahead.R;
import org.deke.risk.riskahead.helper.IncidentReport; import org.deke.risk.riskahead.helper.IncidentReport;
import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.util.List; import java.util.List;
@@ -63,22 +66,49 @@ public class ReportListAdapter extends BaseAdapter {
TextView categoryText = (TextView) vi.findViewById(R.id.txt_reportlist_lvrow_category); TextView categoryText = (TextView) vi.findViewById(R.id.txt_reportlist_lvrow_category);
LinearLayout ll = (LinearLayout) vi.findViewById(R.id.lay_reportlist_color); LinearLayout ll = (LinearLayout) vi.findViewById(R.id.lay_reportlist_color);
ImageView iv = (ImageView) vi.findViewById(R.id.ic_reportlist_row); ImageView iv = (ImageView) vi.findViewById(R.id.ic_reportlist_row);
LinearLayout bglayout = (LinearLayout) vi.findViewById(R.id.lay_reportlist_bgcolor);
IncidentReport item = new IncidentReport(data.get(position)); boolean status = true;
titleText.setText(item.getIncidentCategoryName(vi.getContext())); try {
itemText.setText(item.getIncidentSubCategoryName(vi.getContext())); if(data.get(position).getInt("status") == 0){
categoryText.setText(item.getTimeString(vi.getContext())); status = false;
}
titleText.setTypeface(null, Typeface.BOLD); } catch (JSONException e) {
ll.setBackgroundColor(item.getCategoryColor()); e.printStackTrace();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
iv.setBackground(parent.getContext().getDrawable(item.getIconDrawable()));
} else {
iv.setBackgroundDrawable(parent.getResources().getDrawable(item.getIconDrawable()));
} }
if(!status){
bglayout.setBackgroundColor(Color.argb(120, 255, 0, 0));
titleText.setText("");
itemText.setText(R.string.txt_reportlist_deleted);
itemText.setGravity(Gravity.CENTER);
itemText.setPadding(10,0,0,0);
categoryText.setText("");
ll.setBackgroundColor(Color.argb(150, 255, 0, 0));
iv.setVisibility(View.GONE);
}else {
bglayout.setBackgroundColor(Color.argb(0, 0, 0, 0));
IncidentReport item = new IncidentReport(data.get(position));
titleText.setText(item.getIncidentCategoryName(vi.getContext()));
itemText.setText(item.getIncidentSubCategoryName(vi.getContext()));
itemText.setGravity(Gravity.LEFT);
itemText.setPadding(0,0,0,0);
categoryText.setText(item.getTimeString(vi.getContext()));
titleText.setTypeface(null, Typeface.BOLD);
ll.setBackgroundColor(item.getCategoryColor());
iv.setVisibility(View.VISIBLE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
iv.setBackground(parent.getContext().getDrawable(item.getIconDrawable()));
} else {
iv.setBackgroundDrawable(parent.getResources().getDrawable(item.getIconDrawable()));
}
}
return vi; return vi;
} }
} }

View File

@@ -64,7 +64,10 @@ public class ReportListFragment extends Fragment{
@Override @Override
public void onItemClick(AdapterView<?> parentview, View view, int position, long id) { public void onItemClick(AdapterView<?> parentview, View view, int position, long id) {
try { try {
parent.gotoViewReportActivity(resultList.get(position).getInt("id")); if(resultList.get(position).getInt("status") == 1){
parent.gotoViewReportActivity(resultList.get(position).getInt("id"));
}
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -100,9 +103,7 @@ public class ReportListFragment extends Fragment{
for(int i=0;i<incidents.length();i++){ for(int i=0;i<incidents.length();i++){
JSONObject incident = incidents.getJSONObject(i); JSONObject incident = incidents.getJSONObject(i);
if(incident.getInt("status") == 1){ resultList.add(incident);
resultList.add(incident);
}
} }
myListAdapter = new ReportListAdapter( myListAdapter = new ReportListAdapter(

View File

@@ -572,7 +572,7 @@ public abstract class BaseActivity extends AppCompatActivity {
private void showLanguageDialog(){ private void showLanguageDialog(){
AlertDialog.Builder b = new AlertDialog.Builder(this); AlertDialog.Builder b = new AlertDialog.Builder(this);
b.setTitle(R.string.txt_language_title); b.setTitle(R.string.txt_language_title);
String[] types = {"ar - العربية", "de - Deutsch", "en - English", "es - Español", "et - Eesti keel", "fr - Français", "lv - Latviešu valoda", "mn - Монгол хэл", "nl - Nederlands", "pl - Polszczyzna", "pt - Português do Brasil", "ru - Pусский", "tr - Türkçe"}; String[] types = {"ar - العربية", "de - Deutsch", "en - English", "es - Español", "et - Eesti keel", "fi - Suomi", "fr - Français", "lv - Latviešu valoda", "mn - Монгол хэл", "nl - Nederlands", "pl - Polszczyzna", "pt - Português do Brasil", "ru - Pусский", "tr - Türkçe"};
b.setItems(types, new DialogInterface.OnClickListener() { b.setItems(types, new DialogInterface.OnClickListener() {
@Override @Override
@@ -596,27 +596,30 @@ public abstract class BaseActivity extends AppCompatActivity {
setLocale("et"); setLocale("et");
break; break;
case 5: case 5:
setLocale("fr"); setLocale("fi");
break; break;
case 6: case 6:
setLocale("lv"); setLocale("fr");
break; break;
case 7: case 7:
setLocale("mn"); setLocale("lv");
break; break;
case 8: case 8:
setLocale("nl"); setLocale("mn");
break; break;
case 9: case 9:
setLocale("pl"); setLocale("nl");
break; break;
case 10: case 10:
setLocale("pt"); setLocale("pl");
break; break;
case 11: case 11:
setLocale("ru"); setLocale("pt");
break; break;
case 12: case 12:
setLocale("ru");
break;
case 13:
setLocale("tr"); setLocale("tr");
break; break;
} }

View File

@@ -139,7 +139,9 @@ public class IncidentReport implements ClusterItem {
} }
public BitmapDescriptor getIcon() { public BitmapDescriptor getIcon() {
return BitmapDescriptorFactory.fromResource(getIconDrawable()); BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(getIconDrawable());
return icon;
} }
public int getIconDrawable() { public int getIconDrawable() {
@@ -257,6 +259,8 @@ public class IncidentReport implements ClusterItem {
break; break;
} }
return mIcon; return mIcon;
} }

View File

@@ -1,12 +1,17 @@
package org.deke.risk.riskahead.helper; package org.deke.risk.riskahead.helper;
import android.content.Context; import android.content.Context;
import android.util.Log;
import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.MarkerOptions;
import com.google.maps.android.clustering.ClusterManager; import com.google.maps.android.clustering.ClusterManager;
import com.google.maps.android.clustering.view.DefaultClusterRenderer; import com.google.maps.android.clustering.view.DefaultClusterRenderer;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/** /**
* *
* (C) Copyright 2016 RiskAhead (http://www.riskahead.net) * (C) Copyright 2016 RiskAhead (http://www.riskahead.net)
@@ -26,6 +31,26 @@ public class OwnIconRendered extends DefaultClusterRenderer<IncidentReport> {
@Override @Override
protected void onBeforeClusterItemRendered(IncidentReport item, MarkerOptions markerOptions) { protected void onBeforeClusterItemRendered(IncidentReport item, MarkerOptions markerOptions) {
markerOptions.icon(item.getIcon()); markerOptions.icon(item.getIcon());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date dateToCheck = null;
try {
if(item.getToDate() != null && !item.getToDate().equals("0000-00-00")){
dateToCheck = simpleDateFormat.parse(item.getToDate());
}else if(item.getFromDate() != null){
dateToCheck = simpleDateFormat.parse(item.getFromDate());
}
} catch (ParseException e) {
e.printStackTrace();
}
if(dateToCheck != null && !dateToCheck.after(new Date(System.currentTimeMillis()-14*24*60*60*1000))){
markerOptions.alpha(0.5f);
}
markerOptions.snippet(item.getIncidentSubCategoryName(context)); markerOptions.snippet(item.getIncidentSubCategoryName(context));
markerOptions.title(item.getIncidentCategoryName(context)); markerOptions.title(item.getIncidentCategoryName(context));
super.onBeforeClusterItemRendered(item, markerOptions); super.onBeforeClusterItemRendered(item, markerOptions);

View File

@@ -4,7 +4,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingRight="5dp"
android:weightSum="1"> android:weightSum="1">
<LinearLayout <LinearLayout
@@ -24,6 +23,7 @@
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:id="@+id/lay_reportlist_bgcolor"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@@ -37,7 +37,7 @@
android:typeface="serif" /> android:typeface="serif" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/text_light_grey" android:textColor="@color/text_light_grey"
android:text="Long Text" android:text="Long Text"

View File

@@ -443,6 +443,7 @@
<string name="alert_notsupported_title">Bitte jetzt aktualisieren!</string> <string name="alert_notsupported_title">Bitte jetzt aktualisieren!</string>
<string name="exit">Exit</string> <string name="exit">Exit</string>
<string name="later">Später</string> <string name="later">Später</string>
<string name="txt_reportlist_deleted">Gelöscht</string>
</resources> </resources>

View File

@@ -255,6 +255,7 @@
<string name="alert_notrecommended_text">There is a new version available in your marketplace. We still support your version but it is recommended to perform an update. The support of your version will end soon.</string> <string name="alert_notrecommended_text">There is a new version available in your marketplace. We still support your version but it is recommended to perform an update. The support of your version will end soon.</string>
<string name="txt_about_dt" translatable="false">Dennis Thießen</string> <string name="txt_about_dt" translatable="false">Dennis Thießen</string>
<string name="txt_about_kg" translatable="false">Kevin-Chris Gründel</string> <string name="txt_about_kg" translatable="false">Kevin-Chris Gründel</string>
<string name="txt_reportlist_deleted">Deleted</string>
<string-array name="cat_situation_main"> <string-array name="cat_situation_main">
<item>A Threatening Incident or Situation</item> <item>A Threatening Incident or Situation</item>