@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"?>
<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">
<facet type="android-gradle" name="Android-Gradle">
<configuration>

View File

@@ -19,8 +19,8 @@ android {
applicationId "org.deke.risk.riskahead"
minSdkVersion 15
targetSdkVersion 23
versionCode 33
versionName "2.0.4"
versionCode 34
versionName "2.1"
}
buildTypes {
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.TileOverlay;
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.ClusterManager;
import com.google.maps.android.heatmaps.HeatmapTileProvider;
@@ -142,8 +140,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
}
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_LOCATION: {
// If request is cancelled, the result arrays are empty.
@@ -152,14 +149,9 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
try{
mMap.setMyLocationEnabled(true);
}catch(SecurityException e){
Log.e(TAG,"Security Exception: "+e.toString());
}
} else {
}
return;
}
// other 'case' lines to check for other

View File

@@ -1,8 +1,10 @@
package org.deke.risk.riskahead.adapter;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -13,6 +15,7 @@ import android.widget.TextView;
import org.deke.risk.riskahead.R;
import org.deke.risk.riskahead.helper.IncidentReport;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.List;
@@ -63,22 +66,49 @@ public class ReportListAdapter extends BaseAdapter {
TextView categoryText = (TextView) vi.findViewById(R.id.txt_reportlist_lvrow_category);
LinearLayout ll = (LinearLayout) vi.findViewById(R.id.lay_reportlist_color);
ImageView iv = (ImageView) vi.findViewById(R.id.ic_reportlist_row);
LinearLayout bglayout = (LinearLayout) vi.findViewById(R.id.lay_reportlist_bgcolor);
boolean status = true;
try {
if(data.get(position).getInt("status") == 0){
status = false;
}
} catch (JSONException e) {
e.printStackTrace();
}
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;
}
}

View File

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

View File

@@ -572,7 +572,7 @@ public abstract class BaseActivity extends AppCompatActivity {
private void showLanguageDialog(){
AlertDialog.Builder b = new AlertDialog.Builder(this);
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() {
@Override
@@ -596,27 +596,30 @@ public abstract class BaseActivity extends AppCompatActivity {
setLocale("et");
break;
case 5:
setLocale("fr");
setLocale("fi");
break;
case 6:
setLocale("lv");
setLocale("fr");
break;
case 7:
setLocale("mn");
setLocale("lv");
break;
case 8:
setLocale("nl");
setLocale("mn");
break;
case 9:
setLocale("pl");
setLocale("nl");
break;
case 10:
setLocale("pt");
setLocale("pl");
break;
case 11:
setLocale("ru");
setLocale("pt");
break;
case 12:
setLocale("ru");
break;
case 13:
setLocale("tr");
break;
}

View File

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

View File

@@ -1,12 +1,17 @@
package org.deke.risk.riskahead.helper;
import android.content.Context;
import android.util.Log;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.maps.android.clustering.ClusterManager;
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)
@@ -26,6 +31,26 @@ public class OwnIconRendered extends DefaultClusterRenderer<IncidentReport> {
@Override
protected void onBeforeClusterItemRendered(IncidentReport item, MarkerOptions markerOptions) {
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.title(item.getIncidentCategoryName(context));
super.onBeforeClusterItemRendered(item, markerOptions);

View File

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

View File

@@ -443,6 +443,7 @@
<string name="alert_notsupported_title">Bitte jetzt aktualisieren!</string>
<string name="exit">Exit</string>
<string name="later">Später</string>
<string name="txt_reportlist_deleted">Gelöscht</string>
</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="txt_about_dt" translatable="false">Dennis Thießen</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">
<item>A Threatening Incident or Situation</item>