DT @11.01.2016: Bugfixes
This commit is contained in:
Binary file not shown.
@@ -19,8 +19,8 @@ android {
|
||||
applicationId "org.deke.risk.riskahead"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 22
|
||||
versionCode 4
|
||||
versionName "1.3"
|
||||
versionCode 5
|
||||
versionName "1.4"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
||||
@@ -38,6 +38,7 @@ public class MainActivity extends BaseActivity{
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
userHasToBeLoggedIn();
|
||||
registerBroadcastReceiver();
|
||||
|
||||
initButtons();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
private final static String mActivityTitle = "Risk Map";
|
||||
private static final String TAG = MapsActivity.class.getSimpleName();
|
||||
|
||||
private static final Double PRELOAD_PERCENTAGE = 0.3;
|
||||
private Double PRELOAD_PERCENTAGE = 0.3;
|
||||
private static final int DEFAULT_ZOOM_LEVEL = 14;
|
||||
private static final int THRESHOLD_ZOOM_LEVEL = 10;
|
||||
private int MIN_ZOOM_LEVEL = 9;
|
||||
@@ -89,6 +89,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
userHasToBeLoggedIn();
|
||||
registerBroadcastReceiver();
|
||||
|
||||
navDrawer.setSelection(mapAvtivityID, false);
|
||||
|
||||
@@ -173,6 +174,12 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
return;
|
||||
}
|
||||
|
||||
if(position.zoom > 13) {
|
||||
PRELOAD_PERCENTAGE = 0.7;
|
||||
}else{
|
||||
PRELOAD_PERCENTAGE = 0.3;
|
||||
}
|
||||
|
||||
LatLngBounds bounds = mMap.getProjection().getVisibleRegion().latLngBounds;
|
||||
|
||||
Log.d("OnCameraChangeListener", "Position: "+bounds.getCenter()+" Zoom: "+position.zoom + " Bounds: NE:" + bounds.northeast + " SW: " + bounds.southwest);
|
||||
@@ -673,16 +680,6 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
||||
showAd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (mMap != null) {
|
||||
getSupportFragmentManager().beginTransaction().remove(getSupportFragmentManager().findFragmentById(R.id.frag_maps_map)).commitAllowingStateLoss();
|
||||
mMap = null;
|
||||
}
|
||||
session.setNotificationPositionRequest(false);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutResourceId() {
|
||||
return R.layout.activity_maps;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ProfileActivity extends BaseActivity{
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
userHasToBeLoggedIn();
|
||||
|
||||
registerBroadcastReceiver();
|
||||
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
||||
@@ -84,6 +84,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
registerBroadcastReceiver();
|
||||
|
||||
initFragments();
|
||||
initButtonsAndElements();
|
||||
|
||||
@@ -15,6 +15,7 @@ public class SettingsActivity extends BaseActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
userHasToBeLoggedIn();
|
||||
registerBroadcastReceiver();
|
||||
|
||||
getFragmentManager().beginTransaction().replace(R.id.fragment_content, new SettingsFragment()).commit();
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public class SubscriptionsActivity extends BaseActivity{
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
userHasToBeLoggedIn();
|
||||
registerBroadcastReceiver();
|
||||
|
||||
tblBillings = (TableLayout) findViewById(R.id.tbl_billing);
|
||||
getSubscriptions(user.get(SessionManager.KEY_UID));
|
||||
|
||||
@@ -63,7 +63,8 @@ public class ViewReportActivity extends BaseActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
userHasToBeLoggedIn();
|
||||
|
||||
registerBroadcastReceiver();
|
||||
|
||||
txtIncidentCategory = (EditText) findViewById(R.id.txt_viewreport_incidentcategory);
|
||||
txtIncidentSubCategory = (EditText) findViewById(R.id.txt_viewreport_incidentsubcategory);
|
||||
txtPosition = (EditText) findViewById(R.id.txt_viewreport_position);
|
||||
|
||||
@@ -24,8 +24,10 @@ import org.deke.risk.riskahead.ReportWFActivity;
|
||||
import org.deke.risk.riskahead.helper.IncidentReport;
|
||||
import org.deke.risk.riskahead.adapter.SpinnerHintAdapter;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Dennis Thießen
|
||||
@@ -229,8 +231,13 @@ public class ReportWF_2_Fragment extends Fragment {
|
||||
}
|
||||
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
tmpInput.setText(new StringBuilder().append(hourOfDay)
|
||||
.append(":").append(minute).append(" "));
|
||||
try {
|
||||
SimpleDateFormat df = new SimpleDateFormat("hh:mm");
|
||||
Date tmpTime = df.parse(hourOfDay + ":" + minute);
|
||||
tmpInput.setText(df.format(tmpTime));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
checkIfFinished();
|
||||
}
|
||||
@@ -254,10 +261,13 @@ public class ReportWF_2_Fragment extends Fragment {
|
||||
}
|
||||
|
||||
public void onDateSet(DatePicker view, int year, int month, int day) {
|
||||
tmpInput.setText(new StringBuilder()
|
||||
.append(year).append("-").append(month + 1).append("-")
|
||||
.append(day).append(" "));
|
||||
|
||||
try {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date tmpTime = df.parse(year + "-" + month + 1 + "-" + day);
|
||||
tmpInput.setText(df.format(tmpTime));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
checkIfFinished();
|
||||
}
|
||||
}
|
||||
@@ -298,6 +308,8 @@ public class ReportWF_2_Fragment extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
saveInput();
|
||||
((ReportWFActivity)getActivity()).setIncident(incident);
|
||||
mCallback.onInputFinished(isTimeCategoryFilled && isSubCategoryFilled && isFromDateFilled && isToDateFilled);
|
||||
}
|
||||
|
||||
@@ -346,14 +358,18 @@ public class ReportWF_2_Fragment extends Fragment {
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
saveInput();
|
||||
|
||||
((ReportWFActivity)getActivity()).setIncident(incident);
|
||||
}
|
||||
|
||||
private void saveInput() {
|
||||
incident.setFidTimeCategory(timeCategory.getSelectedItemPosition());
|
||||
incident.setFidTimeSubCategory(timeSubCategory.getSelectedItemPosition());
|
||||
incident.setFromDate(inputDateFrom.getText().toString());
|
||||
incident.setFromTime(inputTimeFrom.getText().toString());
|
||||
incident.setToDate(inputDateTo.getText().toString());
|
||||
incident.setToTime(inputTimeTo.getText().toString());
|
||||
|
||||
((ReportWFActivity)getActivity()).setIncident(incident);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@ public class AppConfig {
|
||||
public final static String INTENT_REGISTER = "register";
|
||||
public final static String INTENT_NORMALLOGIN = "normallogin";
|
||||
public final static String INTENT_SOCIALMEDIALOGIN = "socialmedialogin";
|
||||
public final static String INTENT_LOGOUT = "org.deke.risk.riskahead.ACTION_LOGOUT";
|
||||
|
||||
/** HANDLER INTERVALS **/
|
||||
public final static int UPDATE_COUNT_INTERVAL = 1000 * 30; //30 seconds
|
||||
|
||||
@@ -3,9 +3,11 @@ package org.deke.risk.riskahead.helper;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
@@ -120,6 +122,20 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
}else{
|
||||
Log.d(TAG,"onCreate: NotificationService already running. Not starting more services.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void registerBroadcastReceiver(){
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(AppConfig.INTENT_LOGOUT);
|
||||
registerReceiver(new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d("onReceive", "Logout in progress");
|
||||
finish();
|
||||
}
|
||||
}, intentFilter);
|
||||
}
|
||||
|
||||
private class MyLocationListener implements LocationListener {
|
||||
@@ -328,8 +344,12 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
session.setLogin(false);
|
||||
|
||||
Intent intent = new Intent(BaseActivity.this, LoginActivity.class);
|
||||
intent.putExtra(EXTRA_MESSAGE, "login");
|
||||
intent.putExtra(EXTRA_MESSAGE, AppConfig.INTENT_LOGIN);
|
||||
BaseActivity.this.startActivity(intent);
|
||||
|
||||
Intent broadcastIntent = new Intent();
|
||||
broadcastIntent.setAction(AppConfig.INTENT_LOGOUT);
|
||||
sendBroadcast(broadcastIntent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -142,11 +142,17 @@ public class IncidentReport implements ClusterItem {
|
||||
int mIcon;
|
||||
|
||||
Date tmpFromDate = null;
|
||||
Date today = new Date();
|
||||
SimpleDateFormat simpleDateFormat = null;
|
||||
Date today = new Date(System.currentTimeMillis()-1*60*60*1000);
|
||||
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
tmpFromDate = simpleDateFormat.parse(this.fromDate);
|
||||
if(this.fromTime != null){
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
tmpFromDate = simpleDateFormat.parse(this.fromDate+" "+this.fromTime);
|
||||
}else{
|
||||
simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
tmpFromDate = simpleDateFormat.parse(this.fromDate);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -149,13 +149,22 @@ public class NotificationService extends Service {
|
||||
}
|
||||
|
||||
private void sentNotification(JSONArray notification) {
|
||||
String title = "";
|
||||
String context = "";
|
||||
|
||||
if(notification.length() == 1){
|
||||
title = getString(R.string.txt_notification_title);
|
||||
context = notification.length() + " " + getString(R.string.txt_notification_context);
|
||||
}else{
|
||||
title = getString(R.string.txt_notification_title_multi);
|
||||
context = notification.length() + " " + getString(R.string.txt_notification_context_multi);
|
||||
}
|
||||
NotificationCompat.Builder mBuilder =
|
||||
new NotificationCompat.Builder(getApplicationContext())
|
||||
.setSmallIcon(R.drawable.logo_riskahead_header)
|
||||
.setContentTitle("New incidents reported in your area!")
|
||||
.setContentText(notification.length() + " new incidents near your last location. Watch out!");
|
||||
|
||||
|
||||
.setAutoCancel(true)
|
||||
.setContentTitle(title)
|
||||
.setContentText(context);
|
||||
|
||||
|
||||
Intent resultIntent = new Intent(this, MapsActivity.class);
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
android:repeatCount="0" />
|
||||
</set>-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="@android:integer/config_mediumAnimTime" />
|
||||
<translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="@android:integer/config_shortAnimTime"/>
|
||||
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="@android:integer/config_shortAnimTime" />
|
||||
</set>
|
||||
@@ -8,6 +8,6 @@
|
||||
android:repeatCount="0" />
|
||||
</set>-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="0" android:toXDelta="-100%p" android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="@android:integer/config_mediumAnimTime" />
|
||||
<translate android:fromXDelta="0" android:toXDelta="-100%p" android:duration="@android:integer/config_shortAnimTime"/>
|
||||
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="@android:integer/config_shortAnimTime" />
|
||||
</set>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 87 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 64 KiB |
@@ -3,9 +3,6 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="org.deke.risk.riskahead.MapsActivity">
|
||||
|
||||
<item android:id="@+id/menu_action_refresh" android:title="@string/menu_action_refresh"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
|
||||
<item android:id="@+id/location_search"
|
||||
android:title="@string/lbl_map_search"
|
||||
android:icon="@android:drawable/ic_menu_search"
|
||||
|
||||
@@ -136,7 +136,10 @@
|
||||
|
||||
<string name="lbl_map_search">Suche</string>
|
||||
<string name="lbl_dropdown_pleaseselect">Bitte wählen …</string>
|
||||
|
||||
<string name="txt_notification_title">Neuer Vorfall in deiner Nähe gemeldet!</string>
|
||||
<string name="txt_notification_title_multi">Neue Vorfälle in deiner Nähe gemeldet!</string>
|
||||
<string name="txt_notification_context"> neuer Vorfall. Pass auf!</string>
|
||||
<string name="txt_notification_context_multi"> neue Vorfälle. Pass auf!</string>
|
||||
|
||||
<string-array name="cat_situation_main">
|
||||
<item>Allgemeiner Vorfall/Situation</item>
|
||||
|
||||
@@ -140,6 +140,10 @@
|
||||
<string name="lbl_subs_helpus">Help us by purchasing subscriptions. This allows us to maintain and enhance RiskAhead in the future.</string>
|
||||
|
||||
<string name="lbl_dropdown_pleaseselect">Please select …</string>
|
||||
<string name="txt_notification_title">New incident reported in your area!</string>
|
||||
<string name="txt_notification_title_multi">New incidents reported in your area!</string>
|
||||
<string name="txt_notification_context"> new incident near your last location. Watch out!</string>
|
||||
<string name="txt_notification_context_multi"> new incidents near your last location. Watch out!</string>
|
||||
|
||||
<string-array name="cat_situation_main">
|
||||
<item>Allgemeiner Vorfall/Situation</item>
|
||||
|
||||
Reference in New Issue
Block a user