@25.01.15 Dennis Thießen: TBugs und Verbesserungsvorschläge überwiegend implementiert.
This commit is contained in:
@@ -127,6 +127,15 @@
|
|||||||
|
|
||||||
<service android:name=".helper.NotificationService"
|
<service android:name=".helper.NotificationService"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
|
<receiver android:name=".helper.RABroadcastReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED">
|
||||||
|
</action>
|
||||||
|
<category android:name="android.intent.category.HOME">
|
||||||
|
</category>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.content.Intent;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@@ -70,6 +71,9 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
}else if(msg_intent.equals(AppConfig.INTENT_REGISTER)){
|
}else if(msg_intent.equals(AppConfig.INTENT_REGISTER)){
|
||||||
initRegisterView();
|
initRegisterView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextView policyandterms = (TextView) findViewById(R.id.lbl_login_policy);
|
||||||
|
policyandterms.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initProgressDialog() {
|
private void initProgressDialog() {
|
||||||
@@ -166,16 +170,16 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr
|
|||||||
btn_login.setOnClickListener(new View.OnClickListener() {
|
btn_login.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String email = input_email.getText().toString();
|
String email = input_email.getText().toString();
|
||||||
String password = input_password.getText().toString();
|
String password = input_password.getText().toString();
|
||||||
|
|
||||||
String name = input_username.getText().toString();
|
String name = input_username.getText().toString();
|
||||||
if (input_password.getError() != null || input_email.getError() != null || input_username.getError() != null) {
|
if (input_password.getError() != null || input_email.getError() != null || input_username.getError() != null) {
|
||||||
showMessage(getString(R.string.error_validation));
|
showMessage(getString(R.string.error_validation));
|
||||||
} else {
|
} else {
|
||||||
showDialog();
|
showDialog();
|
||||||
performRegistration(name, email, password);
|
performRegistration(name, email, password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.os.Handler;
|
|||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -37,9 +38,12 @@ public class MainActivity extends BaseActivity{
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
userHasToBeLoggedIn();
|
|
||||||
registerBroadcastReceiver();
|
|
||||||
|
|
||||||
|
userHasToBeLoggedIn();
|
||||||
|
|
||||||
|
showDialog();
|
||||||
|
|
||||||
|
registerBroadcastReceiver();
|
||||||
initButtons();
|
initButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,6 +101,7 @@ public class MainActivity extends BaseActivity{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
|
hideDialog();
|
||||||
Log.d(TAG, "Incident count: " + response);
|
Log.d(TAG, "Incident count: " + response);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -4,10 +4,14 @@ import android.app.SearchManager;
|
|||||||
import android.app.SearchableInfo;
|
import android.app.SearchableInfo;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.content.CursorLoader;
|
import android.support.v4.content.CursorLoader;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v7.widget.SearchView;
|
import android.support.v7.widget.SearchView;
|
||||||
@@ -39,6 +43,8 @@ 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;
|
||||||
import com.google.maps.android.heatmaps.WeightedLatLng;
|
import com.google.maps.android.heatmaps.WeightedLatLng;
|
||||||
|
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
||||||
|
import com.mikepenz.iconics.IconicsDrawable;
|
||||||
|
|
||||||
import org.deke.risk.riskahead.helper.IncidentReport;
|
import org.deke.risk.riskahead.helper.IncidentReport;
|
||||||
import org.deke.risk.riskahead.helper.AppConfig;
|
import org.deke.risk.riskahead.helper.AppConfig;
|
||||||
@@ -56,16 +62,16 @@ import java.util.HashMap;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCallbacks<Cursor>,
|
public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCallbacks<Cursor>,
|
||||||
ClusterManager.OnClusterItemInfoWindowClickListener<IncidentReport>, ClusterManager.OnClusterClickListener<IncidentReport>, ClusterManager.OnClusterItemClickListener<IncidentReport>, OnMapReadyCallback {
|
ClusterManager.OnClusterItemInfoWindowClickListener<IncidentReport>, ClusterManager.OnClusterClickListener<IncidentReport>, ClusterManager.OnClusterItemClickListener<IncidentReport>, OnMapReadyCallback {
|
||||||
|
|
||||||
private final static String mActivityTitle = "Risk Map";
|
private final static String mActivityTitle = "Risk Map";
|
||||||
private static final String TAG = MapsActivity.class.getSimpleName();
|
private static final String TAG = MapsActivity.class.getSimpleName();
|
||||||
|
|
||||||
private Double PRELOAD_PERCENTAGE = 0.3;
|
|
||||||
private static final int DEFAULT_ZOOM_LEVEL = 14;
|
private static final int DEFAULT_ZOOM_LEVEL = 14;
|
||||||
private static final int THRESHOLD_ZOOM_LEVEL = 10;
|
private static final int THRESHOLD_ZOOM_LEVEL = 10;
|
||||||
|
|
||||||
|
private Double PRELOAD_PERCENTAGE = 0.3;
|
||||||
private int MIN_ZOOM_LEVEL = 9;
|
private int MIN_ZOOM_LEVEL = 9;
|
||||||
|
|
||||||
private float current_zoom_level;
|
private float current_zoom_level;
|
||||||
@@ -77,6 +83,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
private HeatmapTileProvider mProvider;
|
private HeatmapTileProvider mProvider;
|
||||||
|
|
||||||
private Marker mMarker;
|
private Marker mMarker;
|
||||||
|
private FloatingActionButton addButton;
|
||||||
private Marker markerShowingInfoWindow;
|
private Marker markerShowingInfoWindow;
|
||||||
private IncidentReport clickedClusterItem;
|
private IncidentReport clickedClusterItem;
|
||||||
|
|
||||||
@@ -135,33 +142,55 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
if (mMarker != null) {
|
if (mMarker != null) {
|
||||||
mMarker.remove();
|
mMarker.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
markedLocation = point;
|
markedLocation = point;
|
||||||
mMarker = mMap.addMarker(new MarkerOptions().position(point));
|
mMarker = mMap.addMarker(new MarkerOptions().position(point));
|
||||||
if(current_zoom_level > DEFAULT_ZOOM_LEVEL){
|
|
||||||
|
if (current_zoom_level > DEFAULT_ZOOM_LEVEL) {
|
||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, current_zoom_level));
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, current_zoom_level));
|
||||||
}else{
|
} else {
|
||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_ZOOM_LEVEL));
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_ZOOM_LEVEL));
|
||||||
}
|
}
|
||||||
|
|
||||||
findViewById(R.id.fab_reportwf_map).setVisibility(View.VISIBLE);
|
addButton = (FloatingActionButton) findViewById(R.id.fab_reportwf_map);
|
||||||
|
addButton.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if(session.getNotificationPositionRequest()){
|
if (getIntent().hasExtra(AppConfig.EXTRA_MAP_TYPE)) {
|
||||||
findViewById(R.id.fab_reportwf_map).setOnClickListener(new View.OnClickListener() {
|
if (getIntent().getStringExtra(AppConfig.EXTRA_MAP_TYPE).equals(AppConfig.INTENT_MAP_GETINCLOC)) {
|
||||||
@Override
|
addButton.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(getApplicationContext(), R.color.md_green_400)));
|
||||||
public void onClick(View v) {
|
|
||||||
session.setLocation(Double.doubleToRawLongBits(markedLocation.latitude), Double.doubleToRawLongBits(markedLocation.longitude));
|
Drawable identityIcon = new IconicsDrawable(getApplicationContext())
|
||||||
Log.d(TAG, "MARKED LOCATION: " + markedLocation.latitude + " " + markedLocation.longitude);
|
.icon(GoogleMaterial.Icon.gmd_done)
|
||||||
session.setNotificationPositionRequest(false);
|
.color(ContextCompat.getColor(getApplicationContext(), R.color.white))
|
||||||
gotoSettingsActivity();
|
.sizeDp(24);
|
||||||
}
|
|
||||||
});
|
addButton.setImageDrawable(identityIcon);
|
||||||
}else{
|
|
||||||
findViewById(R.id.fab_reportwf_map).setOnClickListener(new View.OnClickListener() {
|
addButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
gotoReportActivity(markedLocation.latitude + ":" + markedLocation.longitude);
|
gotoReportActivity(markedLocation.latitude + ":" + markedLocation.longitude);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (getIntent().getStringExtra(AppConfig.EXTRA_MAP_TYPE).equals(AppConfig.INTENT_MAP_GETNOTIFY)) {
|
||||||
|
addButton.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(getApplicationContext(), R.color.md_green_400)));
|
||||||
|
|
||||||
|
Drawable identityIcon = new IconicsDrawable(getApplicationContext())
|
||||||
|
.icon(GoogleMaterial.Icon.gmd_done)
|
||||||
|
.color(ContextCompat.getColor(getApplicationContext(), R.color.white))
|
||||||
|
.sizeDp(24);
|
||||||
|
|
||||||
|
addButton.setImageDrawable(identityIcon);
|
||||||
|
|
||||||
|
addButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
session.setLocation(Double.doubleToRawLongBits(markedLocation.latitude), Double.doubleToRawLongBits(markedLocation.longitude));
|
||||||
|
Log.d(TAG, "MARKED LOCATION: " + markedLocation.latitude + " " + markedLocation.longitude);
|
||||||
|
gotoSettingsActivity();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -178,6 +207,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
|
|
||||||
if(position.zoom < MIN_ZOOM_LEVEL) {
|
if(position.zoom < MIN_ZOOM_LEVEL) {
|
||||||
mMap.animateCamera(CameraUpdateFactory.zoomTo(MIN_ZOOM_LEVEL));
|
mMap.animateCamera(CameraUpdateFactory.zoomTo(MIN_ZOOM_LEVEL));
|
||||||
|
showMessage("Get Premiuim to view the Full Map!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +279,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
refreshIncidentHeatMap(curNortheastBounds, curSouthwestBounds);
|
refreshIncidentHeatMap(curNortheastBounds, curSouthwestBounds);
|
||||||
markersShown = false;
|
markersShown = false;
|
||||||
}
|
}
|
||||||
} else if((isOutOfBounds == false) && ((position.zoom >= THRESHOLD_ZOOM_LEVEL) && (markersShown == false))){
|
} else if((position.zoom >= THRESHOLD_ZOOM_LEVEL) && !markersShown){
|
||||||
curNortheastBounds = new LatLng(northeastLat, northeastLng);
|
curNortheastBounds = new LatLng(northeastLat, northeastLng);
|
||||||
curSouthwestBounds = new LatLng(southwestLat, southwestLng);
|
curSouthwestBounds = new LatLng(southwestLat, southwestLng);
|
||||||
|
|
||||||
@@ -258,7 +288,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
refreshIncidentHeatMap(curNortheastBounds, curSouthwestBounds);
|
refreshIncidentHeatMap(curNortheastBounds, curSouthwestBounds);
|
||||||
refreshIncidentMarkers(curNortheastBounds, curSouthwestBounds);
|
refreshIncidentMarkers(curNortheastBounds, curSouthwestBounds);
|
||||||
markersShown = true;
|
markersShown = true;
|
||||||
} else if((isOutOfBounds == false) && ((position.zoom < THRESHOLD_ZOOM_LEVEL) && (markersShown == true))){
|
} else if((position.zoom < THRESHOLD_ZOOM_LEVEL) && !markersShown){
|
||||||
mClusterManager.clearItems();
|
mClusterManager.clearItems();
|
||||||
markersShown = false;
|
markersShown = false;
|
||||||
}
|
}
|
||||||
@@ -297,7 +327,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
|
|
||||||
for(int i = 0; i < incidents.length();i++){
|
for(int i = 0; i < incidents.length();i++){
|
||||||
try {
|
try {
|
||||||
heatMapPositions.add(new WeightedLatLng(new LatLng(incidents.getJSONObject(i).getDouble("latitude"), incidents.getJSONObject(i).getDouble("longitude")),1.0));
|
heatMapPositions.add(new WeightedLatLng(new LatLng(incidents.getJSONObject(i).getDouble("latitude"), incidents.getJSONObject(i).getDouble("longitude")), 1.0));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -562,13 +592,13 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
|
|
||||||
LatLng point = new LatLng(Double.parseDouble(latitude),Double.parseDouble(longitude));
|
LatLng point = new LatLng(Double.parseDouble(latitude),Double.parseDouble(longitude));
|
||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_ZOOM_LEVEL));
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_ZOOM_LEVEL));
|
||||||
|
if(getIntent().hasExtra(AppConfig.EXTRA_MAP_TYPE)) mMarker = mMap.addMarker(new MarkerOptions().position(point));
|
||||||
} else {
|
} else {
|
||||||
myPosition = session.getLocation();
|
myPosition = session.getLocation();
|
||||||
|
|
||||||
if ((myPosition != null) && (myPosition.latitude != 0.0) && (myPosition.longitude != 0.0))
|
if ((myPosition != null) && (myPosition.latitude != 0.0) && (myPosition.longitude != 0.0))
|
||||||
{
|
{
|
||||||
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
|
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(myPosition.latitude, myPosition.longitude), DEFAULT_ZOOM_LEVEL));
|
||||||
new LatLng(myPosition.latitude, myPosition.longitude), DEFAULT_ZOOM_LEVEL));
|
|
||||||
}else{
|
}else{
|
||||||
String sDefSystemLanguage = Locale.getDefault().getLanguage();
|
String sDefSystemLanguage = Locale.getDefault().getLanguage();
|
||||||
|
|
||||||
@@ -627,7 +657,6 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
private void showLocations(Cursor c){
|
private void showLocations(Cursor c){
|
||||||
MarkerOptions markerOptions;
|
MarkerOptions markerOptions;
|
||||||
LatLng position = null;
|
LatLng position = null;
|
||||||
//mMap.clear();
|
|
||||||
|
|
||||||
while(c.moveToNext()){
|
while(c.moveToNext()){
|
||||||
markerOptions = new MarkerOptions();
|
markerOptions = new MarkerOptions();
|
||||||
@@ -686,6 +715,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
@Override
|
@Override
|
||||||
protected void onPause(){
|
protected void onPause(){
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
||||||
showAd();
|
showAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -700,7 +730,6 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onBackPressed(){
|
public void onBackPressed(){
|
||||||
session.setNotificationPositionRequest(false);
|
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.os.Bundle;
|
|||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
import android.support.v4.view.PagerAdapter;
|
import android.support.v4.view.PagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import org.deke.risk.riskahead.helper.AppConfig;
|
import org.deke.risk.riskahead.helper.AppConfig;
|
||||||
import org.deke.risk.riskahead.helper.BaseActivity;
|
import org.deke.risk.riskahead.helper.BaseActivity;
|
||||||
@@ -22,7 +23,6 @@ public class ProfileActivity extends BaseActivity{
|
|||||||
userHasToBeLoggedIn();
|
userHasToBeLoggedIn();
|
||||||
registerBroadcastReceiver();
|
registerBroadcastReceiver();
|
||||||
|
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
String msg_intent = intent.getStringExtra(AppConfig.EXTRA_MESSAGE);
|
String msg_intent = intent.getStringExtra(AppConfig.EXTRA_MESSAGE);
|
||||||
|
|
||||||
@@ -31,6 +31,8 @@ public class ProfileActivity extends BaseActivity{
|
|||||||
}else{
|
}else{
|
||||||
initOwnProfileView();
|
initOwnProfileView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.d(TAG,"ProfileActivity created");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initProfileFromUserID(String msg_intent) {
|
private void initProfileFromUserID(String msg_intent) {
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package org.deke.risk.riskahead;
|
package org.deke.risk.riskahead;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.support.v4.app.Fragment;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.provider.MediaStore;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -135,9 +138,9 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
incident = fragList.get(currentState).getCurrentInput();
|
incident = fragList.get(currentState).getCurrentInput();
|
||||||
if (incident != null && incident.getPosition() != null) {
|
if (incident != null && incident.getPosition() != null) {
|
||||||
gotoMapActivity(incident.getPosition().latitude + ":" + incident.getPosition().longitude);
|
getIncidentLocationFromMapActivity(incident.getPosition().latitude + ":" + incident.getPosition().longitude);
|
||||||
} else {
|
} else {
|
||||||
gotoMapActivity();
|
getIncidentLocationFromMapActivity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -152,7 +155,11 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
|||||||
transaction.replace(R.id.fragment_reportwf, fragList.get(state));
|
transaction.replace(R.id.fragment_reportwf, fragList.get(state));
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
|
|
||||||
if(state > 1) btnReportNow.setVisibility(View.VISIBLE);
|
if(state > 0){
|
||||||
|
btnReportNow.setVisibility(View.VISIBLE);
|
||||||
|
btnMap.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
if(state == (fragList.size()-1)){
|
if(state == (fragList.size()-1)){
|
||||||
btnContinue.setVisibility(View.INVISIBLE);
|
btnContinue.setVisibility(View.INVISIBLE);
|
||||||
btnReportNow.setVisibility(View.INVISIBLE);
|
btnReportNow.setVisibility(View.INVISIBLE);
|
||||||
@@ -179,6 +186,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
|||||||
String[] position = pos.split(":");
|
String[] position = pos.split(":");
|
||||||
Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
|
Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
|
||||||
LatLng latlngpos = new LatLng(Double.parseDouble(position[0]), Double.parseDouble(position[1]));
|
LatLng latlngpos = new LatLng(Double.parseDouble(position[0]), Double.parseDouble(position[1]));
|
||||||
|
incident.setPosition(latlngpos);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<Address> addressList = geocoder.getFromLocation(latlngpos.latitude,latlngpos.longitude,1);
|
List<Address> addressList = geocoder.getFromLocation(latlngpos.latitude,latlngpos.longitude,1);
|
||||||
@@ -194,9 +202,10 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
|||||||
if(address.getCountryName() != null) sb.append(address.getCountryName());
|
if(address.getCountryName() != null) sb.append(address.getCountryName());
|
||||||
incident.setIncidentPositionDescription(sb.toString());
|
incident.setIncidentPositionDescription(sb.toString());
|
||||||
}
|
}
|
||||||
incident.setPosition(latlngpos);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
incident.setIncidentPositionDescription("Latitude: " + latlngpos.latitude + "\nLongitude: " + latlngpos.longitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,8 +261,11 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
|||||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
resetStateAndIncident();
|
resetStateAndIncident();
|
||||||
|
|
||||||
initFragment(0);
|
initFragment(0);
|
||||||
|
|
||||||
|
if(currentState == 0){
|
||||||
|
gotoReportActivity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
||||||
@@ -292,7 +304,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
Log.d(TAG, "Report response: " + response);
|
Log.d(TAG, "Report response: " + response);
|
||||||
hideDialog();
|
|
||||||
try {
|
try {
|
||||||
JSONObject jObj = new JSONObject(response);
|
JSONObject jObj = new JSONObject(response);
|
||||||
boolean error = jObj.getBoolean("error");
|
boolean error = jObj.getBoolean("error");
|
||||||
@@ -300,12 +312,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
|||||||
if (!error) {
|
if (!error) {
|
||||||
showMessage(getString(R.string.txt_success_addreport));
|
showMessage(getString(R.string.txt_success_addreport));
|
||||||
|
|
||||||
LatLng gotoPosition = new LatLng(incident.getPosition().latitude,incident.getPosition().longitude);
|
showDialogWhenReportAdded(incident);
|
||||||
resetStateAndIncident();
|
|
||||||
|
|
||||||
showAd();
|
|
||||||
|
|
||||||
gotoMapActivity(gotoPosition.latitude+":"+gotoPosition.longitude);
|
|
||||||
} else {
|
} else {
|
||||||
String errorMsg = jObj.getString("error_msg");
|
String errorMsg = jObj.getString("error_msg");
|
||||||
Log.e(TAG, "Error adding incident (Server returned error): " + errorMsg);
|
Log.e(TAG, "Error adding incident (Server returned error): " + errorMsg);
|
||||||
@@ -314,6 +321,8 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
|||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideDialog();
|
||||||
}
|
}
|
||||||
}, new Response.ErrorListener() {
|
}, new Response.ErrorListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -364,6 +373,53 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showDialogWhenReportAdded(final IncidentReport incident) {
|
||||||
|
new AlertDialog.Builder(ReportWFActivity.this)
|
||||||
|
.setTitle(R.string.txt_share_title)
|
||||||
|
.setMessage(R.string.txt_share_message)
|
||||||
|
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
|
||||||
|
Bitmap icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
|
||||||
|
R.drawable.logo_riskahead);
|
||||||
|
|
||||||
|
String text = getString(R.string.txt_share_hint)
|
||||||
|
+getString(R.string.txt_share_hint2)+": "+ incident.getIncidentCategoryName(getApplicationContext())
|
||||||
|
+" - "+incident.getIncidentSubCategoryName(getApplicationContext())+"\n"
|
||||||
|
+getString(R.string.txt_share_hint3)+": "+ incident.getIncidentPositionDescription().split("\\n")[0] + " - " + incident.getIncidentPositionDescription().split("\\n")[1] + "\n"
|
||||||
|
+getString(R.string.txt_share_page);
|
||||||
|
|
||||||
|
sharingIntent.putExtra(Intent.EXTRA_TEXT, text);
|
||||||
|
sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(MediaStore.Images.Media.insertImage(getApplicationContext().getContentResolver(), icon, "Share incident", null)));
|
||||||
|
|
||||||
|
sharingIntent.setType("image/*");
|
||||||
|
|
||||||
|
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
startActivity(Intent.createChooser(sharingIntent, getString(R.string.txt_share_acttitle)));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
finishReportAndGotoMap(incident);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
|
.show();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finishReportAndGotoMap(IncidentReport incident) {
|
||||||
|
resetStateAndIncident();
|
||||||
|
showAd();
|
||||||
|
gotoMapActivity(incident.getPosition().latitude+":"+incident.getPosition().longitude);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume(){
|
public void onResume(){
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.deke.risk.riskahead;
|
package org.deke.risk.riskahead;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import org.deke.risk.riskahead.fragment.SettingsFragment;
|
import org.deke.risk.riskahead.fragment.SettingsFragment;
|
||||||
import org.deke.risk.riskahead.helper.BaseActivity;
|
import org.deke.risk.riskahead.helper.BaseActivity;
|
||||||
@@ -18,6 +19,7 @@ public class SettingsActivity extends BaseActivity {
|
|||||||
registerBroadcastReceiver();
|
registerBroadcastReceiver();
|
||||||
|
|
||||||
getFragmentManager().beginTransaction().replace(R.id.fragment_content, new SettingsFragment()).commit();
|
getFragmentManager().beginTransaction().replace(R.id.fragment_content, new SettingsFragment()).commit();
|
||||||
|
Log.d(TAG, "SettingsActivity created");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class SubscriptionsActivity extends BaseActivity{
|
public class SubscriptionsActivity extends BaseActivity{
|
||||||
|
|
||||||
private final static String mActivityTitle = "Subscriptions";
|
private final static String mActivityTitle = "Subscriptions";
|
||||||
@@ -139,7 +138,7 @@ public class SubscriptionsActivity extends BaseActivity{
|
|||||||
itemFound = itemFound || sku.equals(sub);
|
itemFound = itemFound || sku.equals(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(itemFound == false){
|
if(!itemFound){
|
||||||
Log.d(TAG, "found sub in database which is active but sub already expired: "+sub);
|
Log.d(TAG, "found sub in database which is active but sub already expired: "+sub);
|
||||||
deactivateSubscriptionInDB(dbItems.get(sub));
|
deactivateSubscriptionInDB(dbItems.get(sub));
|
||||||
}
|
}
|
||||||
@@ -151,6 +150,7 @@ public class SubscriptionsActivity extends BaseActivity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initBillingOptions() {
|
private void initBillingOptions() {
|
||||||
|
showDialog();
|
||||||
try {
|
try {
|
||||||
Bundle skuDetails = mService.getSkuDetails(3, getPackageName(), "subs", querySkus);
|
Bundle skuDetails = mService.getSkuDetails(3, getPackageName(), "subs", querySkus);
|
||||||
int response = skuDetails.getInt("RESPONSE_CODE");
|
int response = skuDetails.getInt("RESPONSE_CODE");
|
||||||
@@ -217,6 +217,7 @@ public class SubscriptionsActivity extends BaseActivity{
|
|||||||
|
|
||||||
Log.d(TAG,"Product: "+sku+" Price: "+price);
|
Log.d(TAG,"Product: "+sku+" Price: "+price);
|
||||||
}
|
}
|
||||||
|
hideDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buyProduct(String sku) {
|
private void buyProduct(String sku) {
|
||||||
@@ -260,8 +261,9 @@ public class SubscriptionsActivity extends BaseActivity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addSubscription(String productId, String type, String price, String currency) {
|
private void addSubscription(String productId, String type, String price, String currency) {
|
||||||
|
showDialog();
|
||||||
String tag_string_req = "requestaddsubscription";
|
String tag_string_req = "requestaddsubscription";
|
||||||
StringRequest strReq = getStringAddSubscription(productId, type, price, price);
|
StringRequest strReq = getStringAddSubscription(productId, type, price, currency);
|
||||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,6 +288,8 @@ public class SubscriptionsActivity extends BaseActivity{
|
|||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideDialog();
|
||||||
}
|
}
|
||||||
}, new Response.ErrorListener() {
|
}, new Response.ErrorListener() {
|
||||||
|
|
||||||
@@ -293,6 +297,7 @@ public class SubscriptionsActivity extends BaseActivity{
|
|||||||
public void onErrorResponse(VolleyError error) {
|
public void onErrorResponse(VolleyError error) {
|
||||||
Log.e(TAG, "Error adding subscription: " + error.getMessage());
|
Log.e(TAG, "Error adding subscription: " + error.getMessage());
|
||||||
showMessage(getResources().getString(R.string.txt_errormsg_subs));
|
showMessage(getResources().getString(R.string.txt_errormsg_subs));
|
||||||
|
hideDialog();
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.android.volley.Request;
|
|||||||
import com.android.volley.Response;
|
import com.android.volley.Response;
|
||||||
import com.android.volley.VolleyError;
|
import com.android.volley.VolleyError;
|
||||||
import com.android.volley.toolbox.StringRequest;
|
import com.android.volley.toolbox.StringRequest;
|
||||||
|
import com.beardedhen.androidbootstrap.AwesomeTextView;
|
||||||
import com.beardedhen.androidbootstrap.BootstrapLabel;
|
import com.beardedhen.androidbootstrap.BootstrapLabel;
|
||||||
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
||||||
import com.mikepenz.iconics.IconicsDrawable;
|
import com.mikepenz.iconics.IconicsDrawable;
|
||||||
@@ -59,12 +60,17 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
private BootstrapLabel scorelabel;
|
private BootstrapLabel scorelabel;
|
||||||
private IncidentReport incident;
|
private IncidentReport incident;
|
||||||
|
|
||||||
|
private AwesomeTextView btnUpvote;
|
||||||
|
private AwesomeTextView btnDownvote;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
userHasToBeLoggedIn();
|
userHasToBeLoggedIn();
|
||||||
registerBroadcastReceiver();
|
registerBroadcastReceiver();
|
||||||
|
|
||||||
|
showDialog();
|
||||||
|
|
||||||
txtIncidentCategory = (EditText) findViewById(R.id.txt_viewreport_incidentcategory);
|
txtIncidentCategory = (EditText) findViewById(R.id.txt_viewreport_incidentcategory);
|
||||||
txtIncidentSubCategory = (EditText) findViewById(R.id.txt_viewreport_incidentsubcategory);
|
txtIncidentSubCategory = (EditText) findViewById(R.id.txt_viewreport_incidentsubcategory);
|
||||||
txtPosition = (EditText) findViewById(R.id.txt_viewreport_position);
|
txtPosition = (EditText) findViewById(R.id.txt_viewreport_position);
|
||||||
@@ -80,19 +86,22 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
txtSuspectRecognition = (EditText) findViewById(R.id.txt_viewreport_suspectrecon);
|
txtSuspectRecognition = (EditText) findViewById(R.id.txt_viewreport_suspectrecon);
|
||||||
txtEtcEtc = (EditText) findViewById(R.id.txt_viewreport_etcetc);
|
txtEtcEtc = (EditText) findViewById(R.id.txt_viewreport_etcetc);
|
||||||
txtReportedFrom = (EditText) findViewById(R.id.txt_viewreport_reportedfrom);
|
txtReportedFrom = (EditText) findViewById(R.id.txt_viewreport_reportedfrom);
|
||||||
|
btnUpvote = (AwesomeTextView) findViewById(R.id.btn_viewreport_upvote);
|
||||||
|
btnDownvote = (AwesomeTextView) findViewById(R.id.btn_viewreport_downvote);
|
||||||
|
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
final Integer id = intent.getIntExtra(BaseActivity.EXTRA_MESSAGE, 0);
|
final Integer id = intent.getIntExtra(BaseActivity.EXTRA_MESSAGE, 0);
|
||||||
getIncident(id);
|
getIncident(id);
|
||||||
|
|
||||||
findViewById(R.id.btn_viewreport_upvote).setOnClickListener(new View.OnClickListener() {
|
btnUpvote.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
makeUpvote(id);
|
makeUpvote(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
findViewById(R.id.btn_viewreport_downvote).setOnClickListener(new View.OnClickListener() {
|
btnDownvote.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
makeDownvote(id);
|
makeDownvote(id);
|
||||||
@@ -120,6 +129,13 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Drawable identityIcon = new IconicsDrawable(this)
|
||||||
|
.icon(GoogleMaterial.Icon.gmd_account_circle)
|
||||||
|
.color(ContextCompat.getColor(getApplicationContext(), R.color.white))
|
||||||
|
.sizeDp(24);
|
||||||
|
|
||||||
|
((FloatingActionButton)findViewById(R.id.btn_viewreport_user)).setImageDrawable(identityIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteReport(Integer uid) {
|
private void deleteReport(Integer uid) {
|
||||||
@@ -185,7 +201,6 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> getParams() {
|
protected Map<String, String> getParams() {
|
||||||
// Posting parameters to login url
|
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("tag", AppConfig.REST_DEACTIVATE_INCIDENT);
|
params.put("tag", AppConfig.REST_DEACTIVATE_INCIDENT);
|
||||||
params.put("uid", user.get(SessionManager.KEY_UID));
|
params.put("uid", user.get(SessionManager.KEY_UID));
|
||||||
@@ -213,6 +228,8 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
JSONObject jIncident = jObj.getJSONObject("msg");
|
JSONObject jIncident = jObj.getJSONObject("msg");
|
||||||
|
|
||||||
|
checkVotetypeAndSetVoteButtons(jIncident);
|
||||||
initReport(new IncidentReport(jIncident));
|
initReport(new IncidentReport(jIncident));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -250,8 +267,92 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkVotetypeAndSetVoteButtons(final JSONObject jIncident) throws JSONException {
|
||||||
|
if(jIncident.has("hasvoted")){
|
||||||
|
if(jIncident.get("hasvoted") instanceof JSONObject){
|
||||||
|
JSONObject hasvoted = jIncident.getJSONObject("hasvoted");
|
||||||
|
|
||||||
|
Log.d(TAG, "hasvote is instance of JSONObject. GO FOR IT");
|
||||||
|
|
||||||
|
if(hasvoted.has("fid_votetype")){
|
||||||
|
if(hasvoted.getInt("fid_votetype") == AppConfig.VOTETYPE_UPVOTE){
|
||||||
|
btnUpvote.startFlashing(true, AwesomeTextView.AnimationSpeed.MEDIUM);
|
||||||
|
btnDownvote.startFlashing(false, AwesomeTextView.AnimationSpeed.MEDIUM);
|
||||||
|
|
||||||
|
btnUpvote.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
deleteVote(incident.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btnDownvote.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
deleteVote(incident.getId());
|
||||||
|
makeDownvote(incident.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else if(hasvoted.getInt("fid_votetype") == AppConfig.VOTETYPE_DOWNVOTE){
|
||||||
|
btnUpvote.startFlashing(false, AwesomeTextView.AnimationSpeed.MEDIUM);
|
||||||
|
btnDownvote.startFlashing(true, AwesomeTextView.AnimationSpeed.MEDIUM);
|
||||||
|
|
||||||
|
btnUpvote.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
deleteVote(incident.getId());
|
||||||
|
makeUpvote(incident.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btnDownvote.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
deleteVote(incident.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
btnUpvote.startFlashing(false, AwesomeTextView.AnimationSpeed.MEDIUM);
|
||||||
|
btnDownvote.startFlashing(false, AwesomeTextView.AnimationSpeed.MEDIUM);
|
||||||
|
|
||||||
|
btnUpvote.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
makeUpvote(incident.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btnDownvote.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
makeDownvote(incident.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
btnUpvote.startFlashing(false, AwesomeTextView.AnimationSpeed.MEDIUM);
|
||||||
|
btnDownvote.startFlashing(false, AwesomeTextView.AnimationSpeed.MEDIUM);
|
||||||
|
|
||||||
|
btnUpvote.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
makeUpvote(incident.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btnDownvote.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
makeDownvote(incident.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String checkIfTextEmptyAndReturnString(String input){
|
private String checkIfTextEmptyAndReturnString(String input){
|
||||||
String formattedString = "Keine Angaben";
|
String formattedString = getString(R.string.txt_viewreport_noinput);
|
||||||
|
|
||||||
if(input.trim().length() > 0){
|
if(input.trim().length() > 0){
|
||||||
formattedString = input;
|
formattedString = input;
|
||||||
@@ -263,6 +364,8 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
private void initReport(IncidentReport incident) {
|
private void initReport(IncidentReport incident) {
|
||||||
Context tmpContext = getApplicationContext();
|
Context tmpContext = getApplicationContext();
|
||||||
|
|
||||||
|
hideDialog();
|
||||||
|
|
||||||
scorelabel.setText(Integer.toString(incident.getVotedScore()));
|
scorelabel.setText(Integer.toString(incident.getVotedScore()));
|
||||||
txtIncidentCategory.setText(incident.getIncidentCategoryName(tmpContext));
|
txtIncidentCategory.setText(incident.getIncidentCategoryName(tmpContext));
|
||||||
txtIncidentSubCategory.setText(checkIfTextEmptyAndReturnString(incident.getIncidentSubCategoryName(tmpContext)));
|
txtIncidentSubCategory.setText(checkIfTextEmptyAndReturnString(incident.getIncidentSubCategoryName(tmpContext)));
|
||||||
@@ -304,13 +407,6 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
final String longitude = Double.toString(incident.getPosition().longitude);
|
final String longitude = Double.toString(incident.getPosition().longitude);
|
||||||
final String fromUid = Integer.toString(incident.getFidFromUser());
|
final String fromUid = Integer.toString(incident.getFidFromUser());
|
||||||
|
|
||||||
Drawable identityIcon = new IconicsDrawable(this)
|
|
||||||
.icon(GoogleMaterial.Icon.gmd_account_circle)
|
|
||||||
.color(ContextCompat.getColor(getApplicationContext(), R.color.white))
|
|
||||||
.sizeDp(24);
|
|
||||||
|
|
||||||
((FloatingActionButton)findViewById(R.id.btn_viewreport_user)).setImageDrawable(identityIcon);
|
|
||||||
|
|
||||||
findViewById(R.id.btn_viewreport_user).setOnClickListener(new View.OnClickListener() {
|
findViewById(R.id.btn_viewreport_user).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -367,8 +463,8 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
showMessage(getString(R.string.txt_success_voted));
|
showMessage(getString(R.string.txt_success_voted));
|
||||||
JSONObject jPoints = jObj.getJSONObject("points");
|
JSONObject jPoints = jObj.getJSONObject("points");
|
||||||
|
|
||||||
scorelabel.setText(Integer.toString(jPoints.getInt("upvoted")-jPoints.getInt("downvoted")));
|
scorelabel.setText(Integer.toString(jPoints.getInt("upvoted") - jPoints.getInt("downvoted")));
|
||||||
showAd();
|
checkVotetypeAndSetVoteButtons(jPoints);
|
||||||
} else {
|
} else {
|
||||||
String errorMsg = jObj.getString("error_msg");
|
String errorMsg = jObj.getString("error_msg");
|
||||||
Log.e(TAG, "Error voting incident (Server returned error): " + errorMsg);
|
Log.e(TAG, "Error voting incident (Server returned error): " + errorMsg);
|
||||||
@@ -402,4 +498,59 @@ public class ViewReportActivity extends BaseActivity {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteVote(Integer incidentid) {
|
||||||
|
String tag_string_req = "deletevote";
|
||||||
|
StringRequest strReq = getStringRequestDeleteVote(incidentid);
|
||||||
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private StringRequest getStringRequestDeleteVote(final Integer incidentid) {
|
||||||
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(String response) {
|
||||||
|
Log.d(TAG, "Delete Vote: " + response);
|
||||||
|
hideDialog();
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject jObj = new JSONObject(response);
|
||||||
|
boolean error = jObj.getBoolean("error");
|
||||||
|
|
||||||
|
if (!error) {
|
||||||
|
JSONObject jPoints = jObj.getJSONObject("points");
|
||||||
|
|
||||||
|
scorelabel.setText(Integer.toString(jPoints.getInt("upvoted") - jPoints.getInt("downvoted")));
|
||||||
|
checkVotetypeAndSetVoteButtons(jPoints);
|
||||||
|
} else {
|
||||||
|
String errorMsg = jObj.getString("error_msg");
|
||||||
|
Log.e(TAG, "Error deleting voting incident (Server returned error): " + errorMsg);
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Response.ErrorListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onErrorResponse(VolleyError error) {
|
||||||
|
Log.e(TAG, "Error deleting voting incident: " + error.getMessage());
|
||||||
|
showMessage(getString(R.string.errormsg_couldnotretrieve));
|
||||||
|
hideDialog();
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getParams() {
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("tag", AppConfig.REST_DELETE_VOTE);
|
||||||
|
params.put("uid", user.get(SessionManager.KEY_UID));
|
||||||
|
params.put("token", user.get(SessionManager.TOKEN));
|
||||||
|
params.put("incidentid", incidentid.toString());
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import android.os.Bundle;
|
|||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.deke.risk.riskahead.fragment.ProfileStatisticsFragment;
|
import org.deke.risk.riskahead.fragment.ProfileStatisticsFragment;
|
||||||
import org.deke.risk.riskahead.fragment.ReportListFragment;
|
import org.deke.risk.riskahead.fragment.ReportListFragment;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -14,7 +13,6 @@ 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;
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package org.deke.risk.riskahead.adapter;
|
package org.deke.risk.riskahead.adapter;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Dennis on 06.12.2015.
|
|
||||||
*/
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -25,14 +22,6 @@ public class SpinnerHintAdapter implements SpinnerAdapter, ListAdapter {
|
|||||||
protected LayoutInflater layoutInflater;
|
protected LayoutInflater layoutInflater;
|
||||||
private boolean isInInitialState = false;
|
private boolean isInInitialState = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this constructor to have NO 'Select One...' item, instead use
|
|
||||||
* the standard prompt or nothing at all.
|
|
||||||
* @param spinnerAdapter wrapped Adapter.
|
|
||||||
* @param nothingSelectedLayout layout for nothing selected, perhaps
|
|
||||||
* you want text grayed out like a prompt...
|
|
||||||
* @param context
|
|
||||||
*/
|
|
||||||
public SpinnerHintAdapter(
|
public SpinnerHintAdapter(
|
||||||
SpinnerAdapter spinnerAdapter,
|
SpinnerAdapter spinnerAdapter,
|
||||||
int nothingSelectedLayout, Context context) {
|
int nothingSelectedLayout, Context context) {
|
||||||
@@ -40,18 +29,6 @@ public class SpinnerHintAdapter implements SpinnerAdapter, ListAdapter {
|
|||||||
this(spinnerAdapter, nothingSelectedLayout, -1, context);
|
this(spinnerAdapter, nothingSelectedLayout, -1, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this constructor to Define your 'Select One...' layout as the first
|
|
||||||
* row in the returned choices.
|
|
||||||
* If you do this, you probably don't want a prompt on your spinner or it'll
|
|
||||||
* have two 'Select' rows.
|
|
||||||
* @param spinnerAdapter wrapped Adapter. Should probably return false for isEnabled(0)
|
|
||||||
* @param nothingSelectedLayout layout for nothing selected, perhaps you want
|
|
||||||
* text grayed out like a prompt...
|
|
||||||
* @param nothingSelectedDropdownLayout layout for your 'Select an Item...' in
|
|
||||||
* the dropdown.
|
|
||||||
* @param context
|
|
||||||
*/
|
|
||||||
public SpinnerHintAdapter(SpinnerAdapter spinnerAdapter, int nothingSelectedLayout, int nothingSelectedDropdownLayout, Context context) {
|
public SpinnerHintAdapter(SpinnerAdapter spinnerAdapter, int nothingSelectedLayout, int nothingSelectedDropdownLayout, Context context) {
|
||||||
this.adapter = spinnerAdapter;
|
this.adapter = spinnerAdapter;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@@ -62,47 +39,30 @@ public class SpinnerHintAdapter implements SpinnerAdapter, ListAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final View getView(int position, View convertView, ViewGroup parent) {
|
public final View getView(int position, View convertView, ViewGroup parent) {
|
||||||
// This provides the View for the Selected Item in the Spinner, not
|
|
||||||
// the dropdown (unless dropdownView is not set).
|
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
isInInitialState = true;
|
isInInitialState = true;
|
||||||
return getNothingSelectedView(parent);
|
return getNothingSelectedView(parent);
|
||||||
}
|
}
|
||||||
isInInitialState = false;
|
isInInitialState = false;
|
||||||
return adapter.getView(position - EXTRA, null, parent); // Could re-use
|
return adapter.getView(position - EXTRA, null, parent); // Could re-use
|
||||||
// the convertView if possible.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* View to show in Spinner with Nothing Selected
|
|
||||||
* Override this to do something dynamic... e.g. "37 Options Found"
|
|
||||||
* @param parent
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected View getNothingSelectedView(ViewGroup parent) {
|
protected View getNothingSelectedView(ViewGroup parent) {
|
||||||
return layoutInflater.inflate(nothingSelectedLayout, parent, false);
|
return layoutInflater.inflate(nothingSelectedLayout, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||||
// Android BUG! http://code.google.com/p/android/issues/detail?id=17128 -
|
|
||||||
// Spinner does not support multiple view types
|
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
return nothingSelectedDropdownLayout == -1 ?
|
return nothingSelectedDropdownLayout == -1 ?
|
||||||
new View(context) :
|
new View(context) :
|
||||||
getNothingSelectedDropdownView(parent);
|
getNothingSelectedDropdownView(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Could re-use the convertView if possible, use setTag...
|
|
||||||
return adapter.getDropDownView(position - EXTRA, null, parent);
|
return adapter.getDropDownView(position - EXTRA, null, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Override this to do something dynamic... For example, "Pick your favorite
|
|
||||||
* of these 37".
|
|
||||||
* @param parent
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
protected View getNothingSelectedDropdownView(ViewGroup parent) {
|
protected View getNothingSelectedDropdownView(ViewGroup parent) {
|
||||||
return layoutInflater.inflate(nothingSelectedDropdownLayout, parent, false);
|
return layoutInflater.inflate(nothingSelectedDropdownLayout, parent, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.deke.risk.riskahead.fragment;
|
package org.deke.risk.riskahead.fragment;
|
||||||
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -8,7 +7,6 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.deke.risk.riskahead.R;
|
|
||||||
import org.deke.risk.riskahead.helper.IncidentReport;
|
import org.deke.risk.riskahead.helper.IncidentReport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,11 +21,9 @@ public abstract class BaseReportWFFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
||||||
Bundle savedInstanceState) {
|
|
||||||
TextView textView = new TextView(getActivity());
|
|
||||||
|
|
||||||
return textView;
|
return new TextView(getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract IncidentReport getCurrentInput();
|
public abstract IncidentReport getCurrentInput();
|
||||||
|
|||||||
@@ -28,21 +28,15 @@ import org.deke.risk.riskahead.R;
|
|||||||
public class GooglePlusButtonFragment extends Fragment implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{
|
public class GooglePlusButtonFragment extends Fragment implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{
|
||||||
|
|
||||||
public static final int RC_SIGN_IN = 0;
|
public static final int RC_SIGN_IN = 0;
|
||||||
|
|
||||||
private static final String TAG = "MainActivity";
|
private static final String TAG = "MainActivity";
|
||||||
|
|
||||||
private static final int PROFILE_PIC_SIZE = 800;
|
|
||||||
|
|
||||||
private GoogleApiClient mGoogleApiClient;
|
private GoogleApiClient mGoogleApiClient;
|
||||||
|
|
||||||
private boolean mIntentInProgress;
|
private boolean mIntentInProgress;
|
||||||
|
|
||||||
private boolean mSignInClicked;
|
private boolean mSignInClicked;
|
||||||
|
|
||||||
private ConnectionResult mConnectionResult;
|
private ConnectionResult mConnectionResult;
|
||||||
|
|
||||||
private BootstrapButton btnSignIn;
|
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private Activity mActivity;
|
private Activity mActivity;
|
||||||
|
|
||||||
@@ -59,7 +53,7 @@ public class GooglePlusButtonFragment extends Fragment implements GoogleApiClien
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.fragment_googleplus_button,container, false);
|
View view = inflater.inflate(R.layout.fragment_googleplus_button,container, false);
|
||||||
|
|
||||||
btnSignIn = (BootstrapButton) view.findViewById(R.id.btn_login_gp);
|
BootstrapButton btnSignIn = (BootstrapButton) view.findViewById(R.id.btn_login_gp);
|
||||||
|
|
||||||
mGoogleApiClient = new GoogleApiClient.Builder(view.getContext())
|
mGoogleApiClient = new GoogleApiClient.Builder(view.getContext())
|
||||||
.addConnectionCallbacks(this)
|
.addConnectionCallbacks(this)
|
||||||
@@ -78,7 +72,6 @@ public class GooglePlusButtonFragment extends Fragment implements GoogleApiClien
|
|||||||
|
|
||||||
private void performClickAction() {
|
private void performClickAction() {
|
||||||
if(mGoogleApiClient.isConnected()){
|
if(mGoogleApiClient.isConnected()){
|
||||||
//signOutFromGplus();
|
|
||||||
Person currentPerson = getProfileInformation();
|
Person currentPerson = getProfileInformation();
|
||||||
((LoginActivity) getActivity()).handleSocialMediaLogin(currentPerson.getId(),"google",currentPerson.getDisplayName(),Plus.AccountApi.getAccountName(mGoogleApiClient));
|
((LoginActivity) getActivity()).handleSocialMediaLogin(currentPerson.getId(),"google",currentPerson.getDisplayName(),Plus.AccountApi.getAccountName(mGoogleApiClient));
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import com.android.volley.Response;
|
|||||||
import com.android.volley.VolleyError;
|
import com.android.volley.VolleyError;
|
||||||
import com.android.volley.toolbox.StringRequest;
|
import com.android.volley.toolbox.StringRequest;
|
||||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||||
import com.beardedhen.androidbootstrap.api.attributes.BootstrapBrand;
|
|
||||||
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
|
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
|
||||||
|
|
||||||
import org.deke.risk.riskahead.ProfileActivity;
|
import org.deke.risk.riskahead.ProfileActivity;
|
||||||
@@ -30,29 +29,26 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class ProfileStatisticsFragment extends Fragment {
|
public class ProfileStatisticsFragment extends Fragment {
|
||||||
|
|
||||||
private final static String mActivityTitle = "User Statistics";
|
|
||||||
private final static String TAG = ProfileStatisticsFragment.class.getSimpleName();
|
private final static String TAG = ProfileStatisticsFragment.class.getSimpleName();
|
||||||
|
|
||||||
private View view;
|
|
||||||
private ProfileActivity parent;
|
private ProfileActivity parent;
|
||||||
|
|
||||||
private String uid = "";
|
private String uid = "";
|
||||||
|
|
||||||
TextView points ;
|
private TextView points ;
|
||||||
TextView ranking ;
|
private TextView ranking ;
|
||||||
TextView posts ;
|
private TextView posts ;
|
||||||
TextView txtMemberSince ;
|
private TextView txtMemberSince ;
|
||||||
|
|
||||||
TextView lblPoints;
|
private TextView lblPoints;
|
||||||
TextView lblPosts;
|
private TextView lblPosts;
|
||||||
TextView lblRanking;
|
private TextView lblRanking;
|
||||||
TextView lblMemberSince;
|
private TextView lblMemberSince;
|
||||||
|
|
||||||
BootstrapButton btnMembershipType;
|
private BootstrapButton btnMembershipType;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
view = inflater.inflate(R.layout.fragment_profile_stats, container, false);
|
View view = inflater.inflate(R.layout.fragment_profile_stats, container, false);
|
||||||
parent = (ProfileActivity)getActivity();
|
parent = (ProfileActivity)getActivity();
|
||||||
|
|
||||||
points = (TextView) view.findViewById(R.id.txt_profile_points);
|
points = (TextView) view.findViewById(R.id.txt_profile_points);
|
||||||
@@ -75,6 +71,8 @@ public class ProfileStatisticsFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void getProfileStatsForList() {
|
private void getProfileStatsForList() {
|
||||||
|
((ProfileActivity)getActivity()).showDialog();
|
||||||
|
|
||||||
StringRequest strReq = getStringRequestProfileStats();
|
StringRequest strReq = getStringRequestProfileStats();
|
||||||
String tag_string_req = "req_profilestats";
|
String tag_string_req = "req_profilestats";
|
||||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
@@ -98,33 +96,31 @@ public class ProfileStatisticsFragment extends Fragment {
|
|||||||
txtMemberSince.setText(jObj.getString("created_at"));
|
txtMemberSince.setText(jObj.getString("created_at"));
|
||||||
|
|
||||||
JSONArray jSubs = jObj.getJSONArray("subs");
|
JSONArray jSubs = jObj.getJSONArray("subs");
|
||||||
boolean isPremium = false;
|
|
||||||
boolean isAdFree = false;
|
|
||||||
|
|
||||||
if(jSubs.length() == 0){
|
if(jSubs.length() == 0){
|
||||||
btnMembershipType.setBootstrapBrand(DefaultBootstrapBrand.SUCCESS);
|
btnMembershipType.setBootstrapBrand(DefaultBootstrapBrand.SUCCESS);
|
||||||
btnMembershipType.setText(getResources().getString(R.string.lbl_membershiptype_free));
|
btnMembershipType.setText(getResources().getString(R.string.lbl_membershiptype_free));
|
||||||
}else{
|
}else{
|
||||||
for(int i = 0; i < jSubs.length();i++) {
|
for(int i = 0; i < jSubs.length();i++) {
|
||||||
if(jSubs.getJSONObject(i).getString("productId").contains("extra_functions")){
|
|
||||||
isPremium = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(jSubs.getJSONObject(i).getString("productId").contains("no_ads")){
|
if(jSubs.getJSONObject(i).getString("productId").contains("no_ads")){
|
||||||
isAdFree = true;
|
btnMembershipType.setBootstrapBrand(DefaultBootstrapBrand.PRIMARY);
|
||||||
|
btnMembershipType.setText(getResources().getString(R.string.lbl_membershiptype_addfree));
|
||||||
|
((ProfileActivity) getActivity()).session.setSubsPremium(true);
|
||||||
|
}else{
|
||||||
|
((ProfileActivity) getActivity()).session.setSubsPremium(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(jSubs.getJSONObject(i).getString("productId").contains("extra_functions")){
|
||||||
|
btnMembershipType.setBootstrapBrand(DefaultBootstrapBrand.WARNING);
|
||||||
|
btnMembershipType.setText(getResources().getString(R.string.lbl_membershiptype_premium));
|
||||||
|
((ProfileActivity) getActivity()).session.setSubsNoAds(true);
|
||||||
|
}else{
|
||||||
|
((ProfileActivity) getActivity()).session.setSubsNoAds(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isPremium){
|
|
||||||
btnMembershipType.setBootstrapBrand(DefaultBootstrapBrand.WARNING);
|
|
||||||
btnMembershipType.setText(getResources().getString(R.string.lbl_membershiptype_premium));
|
|
||||||
}else if(isAdFree){
|
|
||||||
btnMembershipType.setBootstrapBrand(DefaultBootstrapBrand.PRIMARY);
|
|
||||||
btnMembershipType.setText(getResources().getString(R.string.lbl_membershiptype_addfree));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uid != parent.user.get(SessionManager.KEY_UID) ){
|
if(!parent.user.get(SessionManager.KEY_UID).equals(uid) ){
|
||||||
lblPoints.setText(jObj.getString("username")+" "+getResources().getString(R.string.lbl_profile_points_someone));
|
lblPoints.setText(jObj.getString("username")+" "+getResources().getString(R.string.lbl_profile_points_someone));
|
||||||
lblPosts.setText(getResources().getString(R.string.lbl_profile_numofposts_me));
|
lblPosts.setText(getResources().getString(R.string.lbl_profile_numofposts_me));
|
||||||
lblRanking.setText(getResources().getString(R.string.lbl_profile_ranking_someone));
|
lblRanking.setText(getResources().getString(R.string.lbl_profile_ranking_someone));
|
||||||
@@ -136,6 +132,8 @@ public class ProfileStatisticsFragment extends Fragment {
|
|||||||
|
|
||||||
parent.showMessage(getResources().getString(R.string.txt_errormsg_retrievestats));
|
parent.showMessage(getResources().getString(R.string.txt_errormsg_retrievestats));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((ProfileActivity)getActivity()).hideDialog();
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -145,6 +143,7 @@ public class ProfileStatisticsFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onErrorResponse(VolleyError error) {
|
public void onErrorResponse(VolleyError error) {
|
||||||
Log.e(TAG, "Error getting user stats: " + error.getMessage());
|
Log.e(TAG, "Error getting user stats: " + error.getMessage());
|
||||||
|
((ProfileActivity)getActivity()).hideDialog();
|
||||||
parent.showMessage(getString(R.string.errormsg_couldnotretrieve));
|
parent.showMessage(getString(R.string.errormsg_couldnotretrieve));
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -31,21 +31,20 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ReportListFragment extends Fragment{
|
public class ReportListFragment extends Fragment{
|
||||||
private final static String mActivityTitle = "ReportList";
|
|
||||||
private final static String TAG = ReportListFragment.class.getSimpleName();
|
private final static String TAG = ReportListFragment.class.getSimpleName();
|
||||||
|
|
||||||
private View view;
|
|
||||||
private ProfileActivity parent;
|
private ProfileActivity parent;
|
||||||
|
|
||||||
ListView myListView;
|
private ListView myListView;
|
||||||
ListAdapter myListAdapter;
|
private ListAdapter myListAdapter;
|
||||||
List<JSONObject> resultList;
|
private List<JSONObject> resultList;
|
||||||
|
|
||||||
private String uid = "";
|
private String uid = "";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
view = inflater.inflate(R.layout.fragment_reportlist, container, false);
|
View view = inflater.inflate(R.layout.fragment_reportlist, container, false);
|
||||||
parent = (ProfileActivity)getActivity();
|
parent = (ProfileActivity)getActivity();
|
||||||
|
|
||||||
uid = getArguments().getString("uid",parent.user.get(SessionManager.KEY_UID));
|
uid = getArguments().getString("uid",parent.user.get(SessionManager.KEY_UID));
|
||||||
@@ -69,6 +68,8 @@ public class ReportListFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void getIncidentsForList() {
|
private void getIncidentsForList() {
|
||||||
|
((ProfileActivity)getActivity()).showDialog();
|
||||||
|
|
||||||
String tag_string_req = "getincidentswithpositionfromid";
|
String tag_string_req = "getincidentswithpositionfromid";
|
||||||
StringRequest strReq = getStringRequestGetIncidentsWithPositionFromUserID();
|
StringRequest strReq = getStringRequestGetIncidentsWithPositionFromUserID();
|
||||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
@@ -104,6 +105,8 @@ public class ReportListFragment extends Fragment{
|
|||||||
String errorMsg = jObj.getString("error_msg");
|
String errorMsg = jObj.getString("error_msg");
|
||||||
Log.e(TAG, "Error getting incident list (Server returned error): " + errorMsg);
|
Log.e(TAG, "Error getting incident list (Server returned error): " + errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((ProfileActivity)getActivity()).hideDialog();
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -114,6 +117,7 @@ public class ReportListFragment extends Fragment{
|
|||||||
@Override
|
@Override
|
||||||
public void onErrorResponse(VolleyError error) {
|
public void onErrorResponse(VolleyError error) {
|
||||||
Log.e(TAG, "Error getting incident list: " + error.getMessage());
|
Log.e(TAG, "Error getting incident list: " + error.getMessage());
|
||||||
|
((ProfileActivity)getActivity()).hideDialog();
|
||||||
parent.showMessage(getString(R.string.errormsg_couldnotretrieve));
|
parent.showMessage(getString(R.string.errormsg_couldnotretrieve));
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import android.widget.RelativeLayout;
|
|||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.google.android.gms.maps.model.LatLng;
|
|
||||||
|
|
||||||
import org.deke.risk.riskahead.R;
|
import org.deke.risk.riskahead.R;
|
||||||
import org.deke.risk.riskahead.ReportWFActivity;
|
import org.deke.risk.riskahead.ReportWFActivity;
|
||||||
import org.deke.risk.riskahead.helper.IncidentReport;
|
import org.deke.risk.riskahead.helper.IncidentReport;
|
||||||
@@ -38,7 +36,6 @@ public class ReportWF_1_Fragment extends BaseReportWFFragment{
|
|||||||
|
|
||||||
private RelativeLayout timeLayout;
|
private RelativeLayout timeLayout;
|
||||||
private TextView txtPositionInformation;
|
private TextView txtPositionInformation;
|
||||||
private LatLng position;
|
|
||||||
|
|
||||||
private IncidentReport incident;
|
private IncidentReport incident;
|
||||||
|
|
||||||
@@ -132,40 +129,12 @@ public class ReportWF_1_Fragment extends BaseReportWFFragment{
|
|||||||
crimeSubCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
crimeSubCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
int i = 99;
|
|
||||||
|
|
||||||
switch (((Spinner) viewFragment.findViewById(R.id.dd_reportwf_1_cat_main)).getSelectedItemPosition()) {
|
|
||||||
case VIOLANCE_GENERAL:
|
|
||||||
i = 7;
|
|
||||||
break;
|
|
||||||
case VIOLANCE_VERBAL:
|
|
||||||
i = 5;
|
|
||||||
break;
|
|
||||||
case VIOLANCE_LIGHT:
|
|
||||||
i = 6;
|
|
||||||
break;
|
|
||||||
case VIOLANCE_HARD:
|
|
||||||
i = 7;
|
|
||||||
break;
|
|
||||||
case VIOLANCE_NATURE:
|
|
||||||
i = 7;
|
|
||||||
break;
|
|
||||||
case VIOLANCE_INFRASTRUCTURE:
|
|
||||||
i = 8;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((SpinnerHintAdapter) parent.getAdapter()).isInInitialState()) {
|
if (((SpinnerHintAdapter) parent.getAdapter()).isInInitialState()) {
|
||||||
crimeSubOther.setVisibility(View.INVISIBLE);
|
crimeSubOther.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
timeLayout.setVisibility(View.VISIBLE);
|
timeLayout.setVisibility(View.VISIBLE);
|
||||||
|
crimeSubOther.setVisibility(View.VISIBLE);
|
||||||
if (position == i) {
|
|
||||||
crimeSubOther.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
crimeSubOther.setVisibility(View.INVISIBLE);
|
|
||||||
crimeSubOther.setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
((ReportWFActivity) getActivity()).setMapButtonVisibility(true);
|
((ReportWFActivity) getActivity()).setMapButtonVisibility(true);
|
||||||
checkIfFinished();
|
checkIfFinished();
|
||||||
|
|||||||
@@ -241,13 +241,7 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||||
try {
|
tmpInput.setText(String.format("%02d:%02d",hourOfDay,minute));
|
||||||
SimpleDateFormat df = new SimpleDateFormat("hh:mm");
|
|
||||||
Date tmpTime = df.parse(hourOfDay + ":" + minute);
|
|
||||||
tmpInput.setText(df.format(tmpTime));
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
checkIfFinished();
|
checkIfFinished();
|
||||||
}
|
}
|
||||||
@@ -286,13 +280,7 @@ public class ReportWF_2_Fragment extends BaseReportWFFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onDateSet(DatePicker view, int year, int month, int day) {
|
public void onDateSet(DatePicker view, int year, int month, int day) {
|
||||||
try {
|
tmpInput.setText(String.format("%04d-%02d-%02d",year,month + 1,day));
|
||||||
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();
|
checkIfFinished();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ package org.deke.risk.riskahead.fragment;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ package org.deke.risk.riskahead.fragment;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package org.deke.risk.riskahead.fragment;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ package org.deke.risk.riskahead.fragment;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ package org.deke.risk.riskahead.fragment;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|||||||
@@ -18,15 +18,13 @@ import org.deke.risk.riskahead.helper.IncidentReport;
|
|||||||
*/
|
*/
|
||||||
public class ReportWF_Finish_Fragment extends BaseReportWFFragment {
|
public class ReportWF_Finish_Fragment extends BaseReportWFFragment {
|
||||||
|
|
||||||
private View viewFragment;
|
|
||||||
private SendReportListener mCallback;
|
private SendReportListener mCallback;
|
||||||
private Button btnSendReport;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
|
||||||
viewFragment = inflater.inflate(R.layout.fragment_reportwf_finish, container, false);
|
View viewFragment = inflater.inflate(R.layout.fragment_reportwf_finish, container, false);
|
||||||
|
|
||||||
btnSendReport = (Button) viewFragment.findViewById(R.id.btn_reportwf_finish_send);
|
Button btnSendReport = (Button) viewFragment.findViewById(R.id.btn_reportwf_finish_send);
|
||||||
btnSendReport.setOnClickListener(new View.OnClickListener() {
|
btnSendReport.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
private EditTextPreference prefSurname;
|
private EditTextPreference prefSurname;
|
||||||
private EditTextPreference prefName;
|
private EditTextPreference prefName;
|
||||||
private ValidatedEditTextPreference prefEmail;
|
private ValidatedEditTextPreference prefEmail;
|
||||||
private Preference btnRequestPW;
|
|
||||||
|
|
||||||
private SwitchPreference prefNotifications;
|
private SwitchPreference prefNotifications;
|
||||||
private ListPreference prefRadius;
|
private ListPreference prefRadius;
|
||||||
@@ -63,7 +62,6 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
initNotificationPrefs();
|
initNotificationPrefs();
|
||||||
|
|
||||||
|
|
||||||
updatePrefs();
|
updatePrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +86,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
String newStringValue = newValue.toString();
|
String newStringValue = newValue.toString();
|
||||||
session.setNotificationRadius(Integer.valueOf(newStringValue));
|
session.setNotificationRadius(Integer.valueOf(newStringValue));
|
||||||
((ListPreference)preference).setValue(newValue.toString());
|
((ListPreference) preference).setValue(newValue.toString());
|
||||||
preference.setSummary(prefRadius.getEntry());
|
preference.setSummary(prefRadius.getEntry());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -99,13 +97,13 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
String newStringValue = newValue.toString();
|
String newStringValue = newValue.toString();
|
||||||
session.setNotificationPollFreq(Integer.valueOf(newStringValue));
|
session.setNotificationPollFreq(Integer.valueOf(newStringValue));
|
||||||
((ListPreference)preference).setValue(newValue.toString());
|
((ListPreference) preference).setValue(newValue.toString());
|
||||||
preference.setSummary(prefFrequency.getEntry());
|
preference.setSummary(prefFrequency.getEntry());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
prefGPSENabled.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
|
prefGPSENabled.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
String newStringValue = newValue.toString();
|
String newStringValue = newValue.toString();
|
||||||
@@ -118,8 +116,12 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
prefLocation.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
prefLocation.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
session.setNotificationPositionRequest(true);
|
if (session.getLocation().longitude != 0.0 && session.getLocation().latitude != 0.0) {
|
||||||
((SettingsActivity)getActivity()).gotoMapActivity();
|
((SettingsActivity) getActivity()).getNotifyLocationFromMapActivity(Double.toString(session.getLocation().latitude) + " : " + Double.toString(session.getLocation().longitude));
|
||||||
|
} else {
|
||||||
|
((SettingsActivity) getActivity()).getNotifyLocationFromMapActivity();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -138,7 +140,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
prefSurname = (EditTextPreference) getPreferenceManager().findPreference("surnamePref");
|
prefSurname = (EditTextPreference) getPreferenceManager().findPreference("surnamePref");
|
||||||
prefName = (EditTextPreference) getPreferenceManager().findPreference("namePref");
|
prefName = (EditTextPreference) getPreferenceManager().findPreference("namePref");
|
||||||
prefEmail = (ValidatedEditTextPreference) getPreferenceManager().findPreference("emailPref");
|
prefEmail = (ValidatedEditTextPreference) getPreferenceManager().findPreference("emailPref");
|
||||||
btnRequestPW = getPreferenceManager().findPreference("resetPassword");
|
Preference btnRequestPW = getPreferenceManager().findPreference("resetPassword");
|
||||||
|
|
||||||
Preference.OnPreferenceChangeListener changeListener = new Preference.OnPreferenceChangeListener() {
|
Preference.OnPreferenceChangeListener changeListener = new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -204,19 +206,21 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
prefGPSENabled.setChecked(session.isGPSForNotificationsEnabled());
|
prefGPSENabled.setChecked(session.isGPSForNotificationsEnabled());
|
||||||
prefLocation.setSummary(getResources().getString(R.string.txt_settings_gps_loca_sum)+":\n"+Double.toString(session.getLocation().latitude)+" : "+Double.toString(session.getLocation().longitude));
|
prefLocation.setSummary(getResources().getString(R.string.txt_settings_gps_loca_sum)+":\n"+Double.toString(session.getLocation().latitude)+" : "+Double.toString(session.getLocation().longitude));
|
||||||
|
|
||||||
if(session.isGPSForNotificationsEnabled()){
|
if(session.getSubsPremium()){
|
||||||
prefLocation.setEnabled(false);
|
if(session.isGPSForNotificationsEnabled()){
|
||||||
}else{
|
prefLocation.setEnabled(false);
|
||||||
prefLocation.setEnabled(true);
|
}else{
|
||||||
|
prefLocation.setEnabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void requestPasswordReset() {
|
private void requestPasswordReset() {
|
||||||
|
((SettingsActivity)getActivity()).showDialog();
|
||||||
|
|
||||||
String tag_string_req = "requestpwreset";
|
String tag_string_req = "requestpwreset";
|
||||||
StringRequest strReq = getStringRequestResetPW(user.get(SessionManager.KEY_EMAIL));
|
StringRequest strReq = getStringRequestResetPW(user.get(SessionManager.KEY_EMAIL));
|
||||||
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
|
|
||||||
((SettingsActivity) getActivity()).showMessage(getString(R.string.alert_passwordreset_confirmation));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringRequestResetPW(final String email) {
|
private StringRequest getStringRequestResetPW(final String email) {
|
||||||
@@ -231,9 +235,10 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
try {
|
try {
|
||||||
JSONObject jObj = new JSONObject(response);
|
JSONObject jObj = new JSONObject(response);
|
||||||
boolean error = jObj.getBoolean("error");
|
boolean error = jObj.getBoolean("error");
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
//do nothing
|
((SettingsActivity) getActivity()).showMessage(getString(R.string.alert_passwordreset_confirmation));
|
||||||
} else {
|
}else{
|
||||||
String errorMsg = jObj.getString("error_msg");
|
String errorMsg = jObj.getString("error_msg");
|
||||||
Log.e(TAG, "Error request email reset (Server returned error): " + errorMsg);
|
Log.e(TAG, "Error request email reset (Server returned error): " + errorMsg);
|
||||||
((SettingsActivity) getActivity()).showMessage(getResources().getString(R.string.txt_errormsg_resetpw));
|
((SettingsActivity) getActivity()).showMessage(getResources().getString(R.string.txt_errormsg_resetpw));
|
||||||
@@ -265,6 +270,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void requestUpdateUserSettings(Preference pref, String newValue) {
|
private void requestUpdateUserSettings(Preference pref, String newValue) {
|
||||||
|
((SettingsActivity) getActivity()).showDialog();
|
||||||
String username = prefUsername.getText(),name = prefName.getText(),surname = prefSurname.getText(),email = prefEmail.getText();
|
String username = prefUsername.getText(),name = prefName.getText(),surname = prefSurname.getText(),email = prefEmail.getText();
|
||||||
|
|
||||||
if(pref.getKey().equals("usernamePref")){
|
if(pref.getKey().equals("usernamePref")){
|
||||||
@@ -284,13 +290,11 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private StringRequest getStringChangeUserSettings(final String username, final String name, final String surname, final String email) {
|
private StringRequest getStringChangeUserSettings(final String username, final String name, final String surname, final String email) {
|
||||||
((SettingsActivity) getActivity()).showDialog();
|
|
||||||
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response) {
|
public void onResponse(String response) {
|
||||||
Log.d(TAG, "Change user settings: " + response);
|
Log.d(TAG, "Change user settings: " + response);
|
||||||
((SettingsActivity) getActivity()).hideDialog();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JSONObject jObj = new JSONObject(response);
|
JSONObject jObj = new JSONObject(response);
|
||||||
@@ -322,12 +326,14 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
Log.e(TAG, "Error getting user settings (Server returned error): " + errorMsg);
|
Log.e(TAG, "Error getting user settings (Server returned error): " + errorMsg);
|
||||||
((SettingsActivity) getActivity()).showMessage(getResources().getString(R.string.txt_errormsg_changesettings));
|
((SettingsActivity) getActivity()).showMessage(getResources().getString(R.string.txt_errormsg_changesettings));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
updatePrefs();
|
updatePrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((SettingsActivity) getActivity()).hideDialog();
|
||||||
|
|
||||||
}
|
}
|
||||||
}, new Response.ErrorListener() {
|
}, new Response.ErrorListener() {
|
||||||
@@ -343,7 +349,6 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> getParams() {
|
protected Map<String, String> getParams() {
|
||||||
// Posting params to register url
|
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
params.put("tag", AppConfig.REST_UPDATE_USER);
|
params.put("tag", AppConfig.REST_UPDATE_USER);
|
||||||
params.put("uid", user.get(SessionManager.KEY_UID));
|
params.put("uid", user.get(SessionManager.KEY_UID));
|
||||||
|
|||||||
@@ -30,15 +30,9 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Dennis on 13.12.2015.
|
|
||||||
*/
|
|
||||||
public class Top10Fragment extends Fragment {
|
public class Top10Fragment extends Fragment {
|
||||||
|
|
||||||
private final static String mActivityTitle = "Top10";
|
|
||||||
private final static String TAG = ProfileStatisticsFragment.class.getSimpleName();
|
private final static String TAG = ProfileStatisticsFragment.class.getSimpleName();
|
||||||
|
|
||||||
private View view;
|
|
||||||
private ProfileActivity parent;
|
private ProfileActivity parent;
|
||||||
|
|
||||||
ListView myListView;
|
ListView myListView;
|
||||||
@@ -47,7 +41,7 @@ public class Top10Fragment extends Fragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
view = inflater.inflate(R.layout.fragment_top10list, container, false);
|
View view = inflater.inflate(R.layout.fragment_top10list, container, false);
|
||||||
parent = (ProfileActivity)getActivity();
|
parent = (ProfileActivity)getActivity();
|
||||||
|
|
||||||
myListView = (ListView) view.findViewById(R.id.lv_top10list);
|
myListView = (ListView) view.findViewById(R.id.lv_top10list);
|
||||||
@@ -69,6 +63,8 @@ public class Top10Fragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void getTop10ForList() {
|
private void getTop10ForList() {
|
||||||
|
((ProfileActivity)getActivity()).showDialog();
|
||||||
|
|
||||||
StringRequest strReq2 = getStringRequestTop10();
|
StringRequest strReq2 = getStringRequestTop10();
|
||||||
String tag_string_req2 = "req_top10";
|
String tag_string_req2 = "req_top10";
|
||||||
AppController.getInstance().addToRequestQueue(strReq2, tag_string_req2);
|
AppController.getInstance().addToRequestQueue(strReq2, tag_string_req2);
|
||||||
@@ -105,6 +101,8 @@ public class Top10Fragment extends Fragment {
|
|||||||
Log.e(TAG, "Error getting top 10 stats (Server returned error): " + errorMsg);
|
Log.e(TAG, "Error getting top 10 stats (Server returned error): " + errorMsg);
|
||||||
parent.showMessage(getResources().getString(R.string.txt_errormsg_gettop10));
|
parent.showMessage(getResources().getString(R.string.txt_errormsg_gettop10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((ProfileActivity)getActivity()).hideDialog();
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -115,6 +113,7 @@ public class Top10Fragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onErrorResponse(VolleyError error) {
|
public void onErrorResponse(VolleyError error) {
|
||||||
Log.e(TAG, "Error getting top 10 stats: " + error.getMessage());
|
Log.e(TAG, "Error getting top 10 stats: " + error.getMessage());
|
||||||
|
((ProfileActivity)getActivity()).hideDialog();
|
||||||
parent.showMessage(getString(R.string.errormsg_couldnotretrieve));
|
parent.showMessage(getString(R.string.errormsg_couldnotretrieve));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ public class TwitterButtonFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//TO-DO
|
|
||||||
if(isAuthed()){
|
if(isAuthed()){
|
||||||
// log out
|
// log out
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ package org.deke.risk.riskahead.helper;
|
|||||||
* Created by Dennis on 09.08.2015.
|
* Created by Dennis on 09.08.2015.
|
||||||
*/
|
*/
|
||||||
public class AppConfig {
|
public class AppConfig {
|
||||||
|
/** GENERAL **/
|
||||||
|
public final static String APP_PNAME = "org.deke.risk.riskahead";
|
||||||
|
|
||||||
|
|
||||||
/** URLs **/
|
/** URLs **/
|
||||||
public final static String URL_ENCRYPTED = "https://www.riskahead.de/helper/rest/";
|
public final static String URL_ENCRYPTED = "https://www.riskahead.de/helper/rest/";
|
||||||
public final static String URL_DEFAULT = "http://www.riskahead.de/helper/rest/";
|
public final static String URL_DEFAULT = "http://www.riskahead.de/helper/rest/";
|
||||||
@@ -13,6 +17,11 @@ public class AppConfig {
|
|||||||
|
|
||||||
/** INTENT MESSAGES **/
|
/** INTENT MESSAGES **/
|
||||||
public final static String EXTRA_MESSAGE = "org.deke.risk.riskahead.MESSAGE";
|
public final static String EXTRA_MESSAGE = "org.deke.risk.riskahead.MESSAGE";
|
||||||
|
public final static String EXTRA_MAP_TYPE = "org.deke.risk.riskahead.MESSAGE_MAP_TYPE";
|
||||||
|
|
||||||
|
public final static String INTENT_MAP_GETNOTIFY = "notifyloc";
|
||||||
|
public final static String INTENT_MAP_GETINCLOC = "incidentloc";
|
||||||
|
|
||||||
public final static String INTENT_LOGIN = "login";
|
public final static String INTENT_LOGIN = "login";
|
||||||
public final static String INTENT_REGISTER = "register";
|
public final static String INTENT_REGISTER = "register";
|
||||||
public final static String INTENT_NORMALLOGIN = "normallogin";
|
public final static String INTENT_NORMALLOGIN = "normallogin";
|
||||||
@@ -22,6 +31,10 @@ public class AppConfig {
|
|||||||
/** HANDLER INTERVALS **/
|
/** HANDLER INTERVALS **/
|
||||||
public final static int UPDATE_COUNT_INTERVAL = 1000 * 30; //30 seconds
|
public final static int UPDATE_COUNT_INTERVAL = 1000 * 30; //30 seconds
|
||||||
|
|
||||||
|
/** VOTETYPE **/
|
||||||
|
public final static int VOTETYPE_UPVOTE = 1;
|
||||||
|
public final static int VOTETYPE_DOWNVOTE = 2;
|
||||||
|
|
||||||
/** REST WEBSERVICE **/
|
/** REST WEBSERVICE **/
|
||||||
public final static String REST_LOGIN = "login";
|
public final static String REST_LOGIN = "login";
|
||||||
public final static String REST_LOGIN_SOCIAL = "sociallogin";
|
public final static String REST_LOGIN_SOCIAL = "sociallogin";
|
||||||
@@ -43,6 +56,8 @@ public class AppConfig {
|
|||||||
public final static String REST_GET_TOP10 = "gettop10";
|
public final static String REST_GET_TOP10 = "gettop10";
|
||||||
public final static String REST_GET_VOTETYPES = "getvotetypes";
|
public final static String REST_GET_VOTETYPES = "getvotetypes";
|
||||||
public final static String REST_ADD_VOTE = "addvote";
|
public final static String REST_ADD_VOTE = "addvote";
|
||||||
|
public final static String REST_DELETE_VOTE = "deletevote";
|
||||||
|
public final static String REST_SEND_FEEDBACK = "sendfeedback";
|
||||||
public final static String REST_DEACTIVATE_INCIDENT = "deactivateincident";
|
public final static String REST_DEACTIVATE_INCIDENT = "deactivateincident";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import org.deke.risk.riskahead.R;
|
||||||
|
|
||||||
|
|
||||||
|
public class AppRater {
|
||||||
|
|
||||||
|
|
||||||
|
private final static int DAYS_UNTIL_PROMPT = 1;
|
||||||
|
private final static int LAUNCHES_UNTIL_PROMPT = 10;
|
||||||
|
|
||||||
|
public static boolean app_launched(Context mContext) {
|
||||||
|
SharedPreferences prefs = mContext.getSharedPreferences("apprater", 0);
|
||||||
|
if (prefs.getBoolean("dontshowagain", false)) { return false ; }
|
||||||
|
|
||||||
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
|
||||||
|
// Increment launch counter
|
||||||
|
long launch_count = prefs.getLong("launch_count", 0) + 1;
|
||||||
|
editor.putLong("launch_count", launch_count);
|
||||||
|
|
||||||
|
// Get date of first launch
|
||||||
|
Long date_firstLaunch = prefs.getLong("date_firstlaunch", 0);
|
||||||
|
if (date_firstLaunch == 0) {
|
||||||
|
date_firstLaunch = System.currentTimeMillis();
|
||||||
|
editor.putLong("date_firstlaunch", date_firstLaunch);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait at least n days before opening
|
||||||
|
if (launch_count >= LAUNCHES_UNTIL_PROMPT) {
|
||||||
|
if (System.currentTimeMillis() >= date_firstLaunch +
|
||||||
|
(DAYS_UNTIL_PROMPT * 24 * 60 * 60 * 1000)) {
|
||||||
|
showRateDialog(mContext, editor);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.commit();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showRateDialog(final Context mContext, final SharedPreferences.Editor editor) {
|
||||||
|
AlertDialog.Builder alert = new AlertDialog.Builder(mContext);
|
||||||
|
alert.setTitle(R.string.txt_rate_title);
|
||||||
|
alert.setMessage(R.string.txt_rate_message);
|
||||||
|
|
||||||
|
alert.setIcon(R.drawable.logo_512w);
|
||||||
|
alert.setCancelable(true);
|
||||||
|
alert.setPositiveButton(R.string.txt_rate_retenowbtn,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + AppConfig.APP_PNAME)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
alert.setNeutralButton(R.string.txt_rate_laterbtn,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
SharedPreferences prefs = mContext.getSharedPreferences("apprater", 0);
|
||||||
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
|
||||||
|
Long date_firstLaunch = System.currentTimeMillis();
|
||||||
|
editor.putLong("date_firstlaunch", date_firstLaunch);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
alert.setNegativeButton(R.string.txt_rate_neverbtn,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
if (editor != null) {
|
||||||
|
editor.putBoolean("dontshowagain", true);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog ad = alert.create();
|
||||||
|
ad.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,18 @@
|
|||||||
package org.deke.risk.riskahead.helper;
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
|
import android.app.ActionBar;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
|
import android.app.AlarmManager;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.PendingIntent;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.location.LocationListener;
|
import android.location.LocationListener;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
@@ -15,19 +20,28 @@ import android.net.ConnectivityManager;
|
|||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.view.LayoutInflaterCompat;
|
import android.support.v4.view.LayoutInflaterCompat;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.text.format.DateUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.android.volley.Request;
|
||||||
|
import com.android.volley.Response;
|
||||||
|
import com.android.volley.VolleyError;
|
||||||
|
import com.android.volley.toolbox.StringRequest;
|
||||||
import com.google.android.gms.ads.AdListener;
|
import com.google.android.gms.ads.AdListener;
|
||||||
import com.google.android.gms.ads.AdRequest;
|
import com.google.android.gms.ads.AdRequest;
|
||||||
import com.google.android.gms.ads.InterstitialAd;
|
import com.google.android.gms.ads.InterstitialAd;
|
||||||
import com.google.android.gms.common.api.GoogleApiClient;
|
|
||||||
import com.google.android.gms.maps.model.LatLng;
|
import com.google.android.gms.maps.model.LatLng;
|
||||||
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
|
||||||
import com.mikepenz.iconics.context.IconicsLayoutInflater;
|
import com.mikepenz.iconics.context.IconicsLayoutInflater;
|
||||||
@@ -49,8 +63,11 @@ import org.deke.risk.riskahead.ReportWFActivity;
|
|||||||
import org.deke.risk.riskahead.SettingsActivity;
|
import org.deke.risk.riskahead.SettingsActivity;
|
||||||
import org.deke.risk.riskahead.SubscriptionsActivity;
|
import org.deke.risk.riskahead.SubscriptionsActivity;
|
||||||
import org.deke.risk.riskahead.ViewReportActivity;
|
import org.deke.risk.riskahead.ViewReportActivity;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class BaseActivity extends AppCompatActivity {
|
public abstract class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@@ -67,19 +84,18 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public SessionManager session;
|
public SessionManager session;
|
||||||
public HashMap<String, String> user;
|
public HashMap<String, String> user;
|
||||||
public ProgressDialog pDialog;
|
public Dialog pDialog;
|
||||||
|
|
||||||
GoogleApiClient mGoogleApiClient;
|
public InterstitialAd mInterstitialAd;
|
||||||
private final static int INTERVAL = 1000 * 300; //300 seconds
|
|
||||||
InterstitialAd mInterstitialAd;
|
|
||||||
|
|
||||||
private AccountHeader headerResult = null;
|
|
||||||
public Drawer navDrawer = null;
|
public Drawer navDrawer = null;
|
||||||
public Toolbar mToolbar;
|
public Toolbar mToolbar;
|
||||||
|
|
||||||
public LocationManager locationManager;
|
public LocationManager locationManager;
|
||||||
public LatLng myPosition;
|
public LatLng myPosition;
|
||||||
|
|
||||||
|
private static final int TIME_INTERVAL = 2000; // # milliseconds, desired time passed between two back presses.
|
||||||
|
private long mBackPressed;
|
||||||
|
|
||||||
public void userHasToBeLoggedIn(){
|
public void userHasToBeLoggedIn(){
|
||||||
if (!session.isLoggedIn()) {
|
if (!session.isLoggedIn()) {
|
||||||
@@ -118,11 +134,26 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if(!isMyNotificationServiceRunning()){
|
if(!isMyNotificationServiceRunning()){
|
||||||
Log.d(TAG,"onCreate: NotificationService not running. Starting service...");
|
Log.d(TAG,"onCreate: NotificationService not running. Starting service...");
|
||||||
|
|
||||||
|
Intent wtdSServiceIntent = new Intent(this, NotificationService.class);
|
||||||
|
PendingIntent wtdSServicePendingIntent = PendingIntent.getService(this, 0, wtdSServiceIntent, 0);
|
||||||
|
|
||||||
|
long interval = DateUtils.MINUTE_IN_MILLIS * 3;
|
||||||
|
long firstStart = System.currentTimeMillis();
|
||||||
|
|
||||||
|
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||||
|
|
||||||
|
am.setInexactRepeating(AlarmManager.RTC, firstStart, interval,
|
||||||
|
wtdSServicePendingIntent);
|
||||||
|
|
||||||
|
Log.d(TAG, "AlarmManager set");
|
||||||
|
|
||||||
startService(new Intent(this, NotificationService.class));
|
startService(new Intent(this, NotificationService.class));
|
||||||
}else{
|
}else{
|
||||||
Log.d(TAG,"onCreate: NotificationService already running. Not starting more services.");
|
Log.d(TAG,"onCreate: NotificationService already running. Not starting more services.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppRater.app_launched(BaseActivity.this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,10 +197,17 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initProgressDialog() {
|
private void initProgressDialog() {
|
||||||
|
/*
|
||||||
|
pDialog = new ProgressDialog(this);
|
||||||
pDialog = new ProgressDialog(this);
|
pDialog = new ProgressDialog(this);
|
||||||
pDialog.setCancelable(false);
|
pDialog.setCancelable(false);
|
||||||
pDialog.setTitle(getString(R.string.progress_getdata_title));
|
pDialog.setTitle(getString(R.string.progress_getdata_title));
|
||||||
pDialog.setMessage(getString(R.string.progress_getdata_text));
|
pDialog.setMessage(getString(R.string.progress_getdata_text));*/
|
||||||
|
|
||||||
|
pDialog = new Dialog(this);
|
||||||
|
pDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
pDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
|
||||||
|
pDialog.setContentView(R.layout.progress_circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initAds() {
|
private void initAds() {
|
||||||
@@ -222,11 +260,11 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
.withIdentifier(logoutAvtivityID)
|
.withIdentifier(logoutAvtivityID)
|
||||||
.withIcon(GoogleMaterial.Icon.gmd_remove_circle);
|
.withIcon(GoogleMaterial.Icon.gmd_remove_circle);
|
||||||
|
|
||||||
headerResult = new AccountHeaderBuilder()
|
AccountHeader headerResult = new AccountHeaderBuilder()
|
||||||
.withActivity(this)
|
.withActivity(this)
|
||||||
.withHeaderBackground(R.drawable.header2)
|
.withHeaderBackground(R.drawable.header)
|
||||||
.addProfiles(
|
.addProfiles(
|
||||||
new ProfileDrawerItem().withName(user.get("username")).withEmail(user.get("email")).withIcon(getResources().getDrawable(R.drawable.logo_riskahead_header))
|
new ProfileDrawerItem().withName(user.get("username")).withEmail(user.get("email")).withIcon(ContextCompat.getDrawable(getApplicationContext(), R.drawable.logo_riskahead))
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -243,7 +281,8 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDrawerClosed(View drawerView) {
|
public void onDrawerClosed(View drawerView) {
|
||||||
getSupportActionBar().setTitle(getActivityName());
|
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
|
||||||
|
if(actionBar != null) actionBar.setTitle(getActivityName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -265,26 +304,27 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
item7).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
|
item7).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
|
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
|
||||||
Intent intent = null;
|
|
||||||
|
|
||||||
switch (drawerItem.getIdentifier()) {
|
switch (drawerItem.getIdentifier()) {
|
||||||
case 1:
|
case 1:
|
||||||
intent = new Intent(BaseActivity.this, MainActivity.class);
|
gotoMainActivity();
|
||||||
break;
|
return false;
|
||||||
case 2:
|
case 2:
|
||||||
intent = new Intent(BaseActivity.this, ReportWFActivity.class);
|
gotoReportActivity();
|
||||||
break;
|
return false;
|
||||||
case 3:
|
case 3:
|
||||||
intent = new Intent(BaseActivity.this, MapsActivity.class);
|
gotoMapActivity();
|
||||||
break;
|
return false;
|
||||||
case 4:
|
case 4:
|
||||||
intent = new Intent(BaseActivity.this, ProfileActivity.class);
|
gotoProfileActivity();
|
||||||
break;
|
return false;
|
||||||
case 5:
|
case 5:
|
||||||
intent = new Intent(BaseActivity.this, SettingsActivity.class);
|
gotoSettingsActivity();
|
||||||
break;
|
return false;
|
||||||
case 6:
|
case 6:
|
||||||
intent = new Intent(BaseActivity.this, SubscriptionsActivity.class);
|
gotoSubscriptionsActivity();
|
||||||
break;
|
return false;
|
||||||
case 7:
|
case 7:
|
||||||
logoutUser();
|
logoutUser();
|
||||||
break;
|
break;
|
||||||
@@ -292,8 +332,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
Log.d("Unknown switch page: ", Integer.toString(position));
|
Log.d("Unknown switch page: ", Integer.toString(position));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
session.setNotificationPositionRequest(false);
|
|
||||||
if(intent != null) BaseActivity.this.startActivity(intent);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).build();
|
}).build();
|
||||||
@@ -392,6 +431,36 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getNotifyLocationFromMapActivity(){
|
||||||
|
Intent intent;
|
||||||
|
intent = new Intent(getApplicationContext(), MapsActivity.class);
|
||||||
|
intent.putExtra(AppConfig.EXTRA_MAP_TYPE, AppConfig.INTENT_MAP_GETNOTIFY);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getIncidentLocationFromMapActivity(){
|
||||||
|
Intent intent;
|
||||||
|
intent = new Intent(getApplicationContext(), MapsActivity.class);
|
||||||
|
intent.putExtra(AppConfig.EXTRA_MAP_TYPE, AppConfig.INTENT_MAP_GETINCLOC);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getNotifyLocationFromMapActivity(String position){
|
||||||
|
Intent intent;
|
||||||
|
intent = new Intent(getApplicationContext(), MapsActivity.class);
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, position);
|
||||||
|
intent.putExtra(AppConfig.EXTRA_MAP_TYPE, AppConfig.INTENT_MAP_GETNOTIFY);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getIncidentLocationFromMapActivity(String position){
|
||||||
|
Intent intent;
|
||||||
|
intent = new Intent(getApplicationContext(), MapsActivity.class);
|
||||||
|
intent.putExtra(EXTRA_MESSAGE, position);
|
||||||
|
intent.putExtra(AppConfig.EXTRA_MAP_TYPE, AppConfig.INTENT_MAP_GETINCLOC);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
public void gotoProfileActivity(){
|
public void gotoProfileActivity(){
|
||||||
Intent intent;
|
Intent intent;
|
||||||
intent = new Intent(getApplicationContext(), ProfileActivity.class);
|
intent = new Intent(getApplicationContext(), ProfileActivity.class);
|
||||||
@@ -439,11 +508,111 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
}else if((id == R.id.menu_action_help)){
|
}else if((id == R.id.menu_action_help)){
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.riskahead.net/contact/"));
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.riskahead.net/contact/"));
|
||||||
startActivity(browserIntent);
|
startActivity(browserIntent);
|
||||||
|
}else if((id == R.id.menu_action_feedback)){
|
||||||
|
showFeedbackDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showFeedbackDialog() {
|
||||||
|
AlertDialog.Builder alert=new AlertDialog.Builder(this);
|
||||||
|
alert.setTitle(R.string.txt_feedback_title);
|
||||||
|
alert.setMessage(R.string.txt_feedback_message);
|
||||||
|
|
||||||
|
final EditText input = new EditText(BaseActivity.this);
|
||||||
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT);
|
||||||
|
|
||||||
|
|
||||||
|
input.setLayoutParams(lp);
|
||||||
|
input.setLines(4);
|
||||||
|
input.setBackgroundColor(ContextCompat.getColor(getApplicationContext(),R.color.bootstrap_gray_lightest));
|
||||||
|
input.setGravity(Gravity.TOP);
|
||||||
|
input.setHint(R.string.txt_feedback_hint);
|
||||||
|
|
||||||
|
alert.setIcon(R.drawable.logo_512w);
|
||||||
|
alert.setCancelable(true);
|
||||||
|
alert.setPositiveButton(R.string.txt_feedback_sendbtn,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
sendFeedback(input.getText().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
alert.setNegativeButton(R.string.txt_feedback_cancelbtn,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog ad = alert.create();
|
||||||
|
ad.setView(input,0,50,0,20);
|
||||||
|
ad.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendFeedback(String feedback) {
|
||||||
|
String sysprop = "";
|
||||||
|
java.util.Properties props = System.getProperties();
|
||||||
|
java.util.Enumeration e = props.propertyNames();
|
||||||
|
while (e.hasMoreElements()) {
|
||||||
|
String k = (String) e.nextElement();
|
||||||
|
String v = props.getProperty(k);
|
||||||
|
sysprop += k+": "+v+"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
StringRequest strReq = getStringRequestSendFeedback(feedback,sysprop);
|
||||||
|
String tag_string_req = "reqsendfeedback";
|
||||||
|
AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
|
||||||
|
}
|
||||||
|
|
||||||
|
private StringRequest getStringRequestSendFeedback(final String feedback, final String sysprop) {
|
||||||
|
return new StringRequest(Request.Method.POST, AppConfig.URL_DEFAULT, new Response.Listener<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(String response) {
|
||||||
|
Log.d(TAG, "Send Feedback: " + response);
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject jObj = new JSONObject(response);
|
||||||
|
boolean error = jObj.getBoolean("error");
|
||||||
|
|
||||||
|
if (!error) {
|
||||||
|
showMessage(getString(R.string.txt_feedback_response));
|
||||||
|
} else {
|
||||||
|
String errorMsg = jObj.getString("error_msg");
|
||||||
|
Log.e(TAG, "Error sending feedback (server returned error): " + errorMsg);
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}, new Response.ErrorListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onErrorResponse(VolleyError error) {
|
||||||
|
Log.e(TAG, "Error sending feedback: " + error.getMessage());
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<String, String> getParams() {
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("tag", AppConfig.REST_SEND_FEEDBACK);
|
||||||
|
params.put("uid", user.get(SessionManager.KEY_UID));
|
||||||
|
params.put("token", user.get(SessionManager.TOKEN));
|
||||||
|
params.put("feedback", feedback);
|
||||||
|
params.put("systemprop", sysprop);
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public void showMessage(String statusText){
|
public void showMessage(String statusText){
|
||||||
Toast.makeText(this, statusText, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, statusText, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
@@ -471,4 +640,20 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (mBackPressed + TIME_INTERVAL > System.currentTimeMillis())
|
||||||
|
{
|
||||||
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
|
intent.addCategory(Intent.CATEGORY_HOME);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Toast.makeText(getBaseContext(), R.string.txt_backpressed_msg, Toast.LENGTH_SHORT).show(); }
|
||||||
|
|
||||||
|
mBackPressed = System.currentTimeMillis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,6 @@ import java.text.ParseException;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Dennis on 12.11.2015.
|
|
||||||
*/
|
|
||||||
public class IncidentReport implements ClusterItem {
|
public class IncidentReport implements ClusterItem {
|
||||||
|
|
||||||
private int id = 0;
|
private int id = 0;
|
||||||
@@ -344,10 +341,11 @@ public class IncidentReport implements ClusterItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(stringArray != null && (stringArray.length == this.fidIncidentSubCategory)){
|
if((stringArray != null) && (this.fidIncidentSubCategory > 0) && (this.fidIncidentSubCategory <= stringArray.length)){
|
||||||
returnValue = getEtcIncidentCategory();
|
|
||||||
}else if((stringArray != null) && (this.fidIncidentSubCategory > 0) && (this.fidIncidentSubCategory <= stringArray.length)){
|
|
||||||
returnValue = stringArray[this.fidIncidentSubCategory-1];
|
returnValue = stringArray[this.fidIncidentSubCategory-1];
|
||||||
|
if(this.etcIncidentCategory.trim().length() > 0){
|
||||||
|
returnValue += " ("+this.etcIncidentCategory+")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.deke.risk.riskahead.helper;
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
|
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
|
||||||
@@ -29,9 +28,6 @@ import java.util.Calendar;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by denni on 06.01.2016.
|
|
||||||
*/
|
|
||||||
public class NotificationService extends Service {
|
public class NotificationService extends Service {
|
||||||
|
|
||||||
private final static String TAG = NotificationService.class.getSimpleName();
|
private final static String TAG = NotificationService.class.getSimpleName();
|
||||||
@@ -40,11 +36,6 @@ public class NotificationService extends Service {
|
|||||||
Handler mNotifyHandler = new Handler();
|
Handler mNotifyHandler = new Handler();
|
||||||
NotificationManager mNotificationManager;
|
NotificationManager mNotificationManager;
|
||||||
|
|
||||||
private LatLng myPosition;
|
|
||||||
private boolean notifyEnabled = true;
|
|
||||||
private int radius = 15;
|
|
||||||
private int pollFrequency = 10;
|
|
||||||
|
|
||||||
public SessionManager session;
|
public SessionManager session;
|
||||||
public HashMap<String, String> user;
|
public HashMap<String, String> user;
|
||||||
|
|
||||||
@@ -73,16 +64,16 @@ public class NotificationService extends Service {
|
|||||||
public void run() {
|
public void run() {
|
||||||
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
|
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
|
||||||
|
|
||||||
myPosition = session.getLocation();
|
LatLng myPosition = session.getLocation();
|
||||||
radius = session.getNotificationRadius();
|
int radius = session.getNotificationRadius();
|
||||||
pollFrequency = session.getNotificationPollFreq() * 1000 * 60;
|
int pollFrequency = session.getNotificationPollFreq() * 1000 * 60;
|
||||||
notifyEnabled = session.getNotificationEnabled();
|
boolean notifyEnabled = session.getNotificationEnabled();
|
||||||
|
|
||||||
Log.d(this.toString(), "Run Notification Task. Notifications enabled = "+notifyEnabled);
|
Log.d(this.toString(), "Run Notification Task. Notifications enabled = "+ notifyEnabled);
|
||||||
|
|
||||||
if ((myPosition != null) && (myPosition.latitude != 0.0) && (myPosition.longitude != 0.0)) {
|
if ((myPosition != null) && (myPosition.latitude != 0.0) && (myPosition.longitude != 0.0)) {
|
||||||
|
|
||||||
String lastNotificationTime = "";
|
String lastNotificationTime;
|
||||||
|
|
||||||
if (session.getLastNotification().equals("")) {
|
if (session.getLastNotification().equals("")) {
|
||||||
lastNotificationTime = user.get(SessionManager.KEY_LASTLOGIN_AT);
|
lastNotificationTime = user.get(SessionManager.KEY_LASTLOGIN_AT);
|
||||||
@@ -90,7 +81,7 @@ public class NotificationService extends Service {
|
|||||||
lastNotificationTime = session.getLastNotification();
|
lastNotificationTime = session.getLastNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(this.toString(), "Lookup location with position: " + myPosition + " Radius: "+radius+" PollFrequency: "+pollFrequency+" lastNotifyTime: " + lastNotificationTime);
|
Log.d(this.toString(), "Lookup location with position: " + myPosition + " Radius: "+ radius +" PollFrequency: "+ pollFrequency +" lastNotifyTime: " + lastNotificationTime);
|
||||||
|
|
||||||
StringRequest strReq = getStringRequestIncidentsFromAreaAndTime(myPosition.latitude, myPosition.longitude, radius, lastNotificationTime);
|
StringRequest strReq = getStringRequestIncidentsFromAreaAndTime(myPosition.latitude, myPosition.longitude, radius, lastNotificationTime);
|
||||||
String tag_string_req = "req_incidents";
|
String tag_string_req = "req_incidents";
|
||||||
@@ -149,8 +140,8 @@ public class NotificationService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sentNotification(JSONArray notification) {
|
private void sentNotification(JSONArray notification) {
|
||||||
String title = "";
|
String title;
|
||||||
String context = "";
|
String context;
|
||||||
|
|
||||||
if(notification.length() == 1){
|
if(notification.length() == 1){
|
||||||
title = getString(R.string.txt_notification_title);
|
title = getString(R.string.txt_notification_title);
|
||||||
@@ -161,7 +152,7 @@ public class NotificationService extends Service {
|
|||||||
}
|
}
|
||||||
NotificationCompat.Builder mBuilder =
|
NotificationCompat.Builder mBuilder =
|
||||||
new NotificationCompat.Builder(getApplicationContext())
|
new NotificationCompat.Builder(getApplicationContext())
|
||||||
.setSmallIcon(R.drawable.logo_riskahead_header)
|
.setSmallIcon(R.drawable.logo_riskahead)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.setContentTitle(title)
|
.setContentTitle(title)
|
||||||
.setContentText(context);
|
.setContentText(context);
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ 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;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Dennis on 12.11.2015.
|
|
||||||
*/
|
|
||||||
public class OwnIconRendered extends DefaultClusterRenderer<IncidentReport> {
|
public class OwnIconRendered extends DefaultClusterRenderer<IncidentReport> {
|
||||||
|
|
||||||
Context context;
|
Context context;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package org.deke.risk.riskahead.helper;
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public class PlaceJSONParser {
|
public class PlaceJSONParser {
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ public class PlaceJSONParser {
|
|||||||
private List<HashMap<String, String>> getPlaces(JSONArray jPlaces){
|
private List<HashMap<String, String>> getPlaces(JSONArray jPlaces){
|
||||||
int placesCount = jPlaces.length();
|
int placesCount = jPlaces.length();
|
||||||
List<HashMap<String, String>> placesList = new ArrayList<>();
|
List<HashMap<String, String>> placesList = new ArrayList<>();
|
||||||
HashMap<String, String> place = null;
|
HashMap<String, String> place;
|
||||||
|
|
||||||
/** Taking each place, parses and adds to list object */
|
/** Taking each place, parses and adds to list object */
|
||||||
for(int i=0; i<placesCount;i++){
|
for(int i=0; i<placesCount;i++){
|
||||||
@@ -51,9 +51,9 @@ public class PlaceJSONParser {
|
|||||||
|
|
||||||
HashMap<String, String> place = new HashMap<>();
|
HashMap<String, String> place = new HashMap<>();
|
||||||
|
|
||||||
String id="";
|
String id;
|
||||||
String reference="";
|
String reference;
|
||||||
String description="";
|
String description;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ public class PlaceJSONParserDetail {
|
|||||||
/** Receives a JSONObject and returns a list */
|
/** Receives a JSONObject and returns a list */
|
||||||
public List<HashMap<String,String>> parse(JSONObject jObject){
|
public List<HashMap<String,String>> parse(JSONObject jObject){
|
||||||
|
|
||||||
Double lat = Double.valueOf(0);
|
Double lat = 0.0;
|
||||||
Double lng = Double.valueOf(0);
|
Double lng = 0.0;
|
||||||
String formattedAddress = "";
|
String formattedAddress = "";
|
||||||
|
|
||||||
HashMap<String, String> hm = new HashMap<>();
|
HashMap<String, String> hm = new HashMap<>();
|
||||||
@@ -26,8 +26,6 @@ public class PlaceJSONParserDetail {
|
|||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hm.put("lat", Double.toString(lat));
|
hm.put("lat", Double.toString(lat));
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
|
import android.app.AlarmManager;
|
||||||
|
import android.app.PendingIntent;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.text.format.DateUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
|
||||||
|
public class RABroadcastReceiver extends BroadcastReceiver {
|
||||||
|
private final static String TAG = RABroadcastReceiver.class.getSimpleName();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
|
||||||
|
Log.d(TAG, "BroadcastReceiver received intent");
|
||||||
|
|
||||||
|
Intent wtdSServiceIntent = new Intent(context, NotificationService.class);
|
||||||
|
PendingIntent wtdSServicePendingIntent = PendingIntent.
|
||||||
|
getService(context, 0, wtdSServiceIntent, 0);
|
||||||
|
|
||||||
|
long interval = DateUtils.MINUTE_IN_MILLIS * 2;
|
||||||
|
long firstStart = System.currentTimeMillis() + interval;
|
||||||
|
|
||||||
|
AlarmManager am = (AlarmManager) context
|
||||||
|
.getSystemService(Context.ALARM_SERVICE);
|
||||||
|
am.setInexactRepeating(AlarmManager.RTC, firstStart,
|
||||||
|
interval, wtdSServicePendingIntent);
|
||||||
|
|
||||||
|
Log.v("WhatTheDroidService", "AlarmManager gesetzt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
package org.deke.risk.riskahead.helper;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import android.content.ContentValues;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.database.Cursor;
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class SQLiteHandler extends SQLiteOpenHelper {
|
|
||||||
|
|
||||||
private static final String TAG = SQLiteHandler.class.getSimpleName();
|
|
||||||
|
|
||||||
// All Static variables
|
|
||||||
// Database Version
|
|
||||||
private static final int DATABASE_VERSION = 1;
|
|
||||||
|
|
||||||
// Database Name
|
|
||||||
private static final String DATABASE_NAME = "android_api";
|
|
||||||
|
|
||||||
// Login table name
|
|
||||||
private static final String TABLE_LOGIN = "login";
|
|
||||||
|
|
||||||
// Login Table Columns names
|
|
||||||
private static final String KEY_UID = "uid";
|
|
||||||
private static final String KEY_USERNAME = "username";
|
|
||||||
private static final String KEY_NAME = "name";
|
|
||||||
private static final String KEY_SURNAME = "surname";
|
|
||||||
private static final String KEY_EMAIL = "email";
|
|
||||||
private static final String KEY_STATUS = "status";
|
|
||||||
private static final String PROVIDER_TYPE = "providerType";
|
|
||||||
private static final String KEY_CREATED_AT = "created_at";
|
|
||||||
private static final String KEY_UPDATED_AT = "updated_at";
|
|
||||||
private static final String TOKEN = "token";
|
|
||||||
|
|
||||||
public SQLiteHandler(Context context) {
|
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creating Tables
|
|
||||||
@Override
|
|
||||||
public void onCreate(SQLiteDatabase db) {
|
|
||||||
String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_LOGIN + "("
|
|
||||||
+ KEY_UID + " INTEGER PRIMARY KEY,"
|
|
||||||
+ KEY_USERNAME + " TEXT,"
|
|
||||||
+ KEY_NAME + " TEXT,"
|
|
||||||
+ KEY_SURNAME + " TEXT,"
|
|
||||||
+ KEY_EMAIL + " TEXT UNIQUE,"
|
|
||||||
+ KEY_STATUS + " TEXT,"
|
|
||||||
+ PROVIDER_TYPE + " TEXT,"
|
|
||||||
+ KEY_UPDATED_AT + " TEXT,"
|
|
||||||
+ KEY_CREATED_AT + " TEXT,"
|
|
||||||
+ TOKEN + " TEXT"+ ")";
|
|
||||||
db.execSQL(CREATE_LOGIN_TABLE);
|
|
||||||
|
|
||||||
Log.d(TAG, "Database tables created");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Upgrading database
|
|
||||||
@Override
|
|
||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
|
||||||
db.execSQL("DROP TABLE IF EXISTS " + TABLE_LOGIN);
|
|
||||||
onCreate(db);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Storing user details in database
|
|
||||||
* *//*
|
|
||||||
public void addUser(String uid, String username, String name, String surname, String email, String status, String provider_type, String created_at, String updated_at, String token) {
|
|
||||||
SQLiteDatabase db = this.getWritableDatabase();
|
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
|
||||||
values.put(KEY_UID, uid); //UID
|
|
||||||
values.put(KEY_USERNAME, username); // Username
|
|
||||||
values.put(KEY_NAME, name); // Name
|
|
||||||
values.put(KEY_SURNAME, surname); // Surame
|
|
||||||
values.put(KEY_EMAIL, email); // Email
|
|
||||||
values.put(KEY_STATUS, status); // Status
|
|
||||||
values.put(PROVIDER_TYPE, provider_type); // ProviderType
|
|
||||||
values.put(KEY_CREATED_AT, created_at); // Created At
|
|
||||||
values.put(KEY_UPDATED_AT, updated_at); // Updated At
|
|
||||||
values.put(TOKEN, token); // TOKEN
|
|
||||||
|
|
||||||
// Inserting Row
|
|
||||||
long id = db.insert(TABLE_LOGIN, null, values);
|
|
||||||
db.close(); // Closing database connection
|
|
||||||
|
|
||||||
Log.d(TAG, "New user inserted into sqlite: " + id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateUser(String uid, String username, String name, String surname, String email, String status, String provider_type, String created_at, String updated_at, String token) {
|
|
||||||
deleteUsers();
|
|
||||||
addUser(uid,username,name,surname,email,status,provider_type,created_at,updated_at,token);
|
|
||||||
}
|
|
||||||
|
|
||||||
*//**
|
|
||||||
* Getting user data from database
|
|
||||||
* *//*
|
|
||||||
public HashMap<String, String> getUserDetails() {
|
|
||||||
HashMap<String, String> user = new HashMap<String, String>();
|
|
||||||
String selectQuery = "SELECT * FROM " + TABLE_LOGIN;
|
|
||||||
|
|
||||||
SQLiteDatabase db = this.getReadableDatabase();
|
|
||||||
Cursor cursor = db.rawQuery(selectQuery, null);
|
|
||||||
// Move to first row
|
|
||||||
cursor.moveToFirst();
|
|
||||||
if (cursor.getCount() > 0) {
|
|
||||||
user.put("uid", cursor.getString(0));
|
|
||||||
user.put("username", cursor.getString(1));
|
|
||||||
user.put("name", cursor.getString(2));
|
|
||||||
user.put("surname", cursor.getString(3));
|
|
||||||
user.put("email", cursor.getString(4));
|
|
||||||
user.put("status", cursor.getString(5));
|
|
||||||
user.put("providerType", cursor.getString(6));
|
|
||||||
user.put("created_at", cursor.getString(7));
|
|
||||||
user.put("updated_at", cursor.getString(8));
|
|
||||||
user.put("token", cursor.getString(9));
|
|
||||||
}
|
|
||||||
cursor.close();
|
|
||||||
db.close();
|
|
||||||
// return user
|
|
||||||
Log.d(TAG, "Fetching user from Sqlite: " + user.toString());
|
|
||||||
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
*//**
|
|
||||||
* Getting user login status return true if rows are there in table
|
|
||||||
* *//*
|
|
||||||
public int getRowCount() {
|
|
||||||
String countQuery = "SELECT * FROM " + TABLE_LOGIN;
|
|
||||||
SQLiteDatabase db = this.getReadableDatabase();
|
|
||||||
Cursor cursor = db.rawQuery(countQuery, null);
|
|
||||||
int rowCount = cursor.getCount();
|
|
||||||
db.close();
|
|
||||||
cursor.close();
|
|
||||||
|
|
||||||
// return row count
|
|
||||||
return rowCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
*//**
|
|
||||||
* Re crate database Delete all tables and create them again
|
|
||||||
* *//*
|
|
||||||
public void deleteUsers() {
|
|
||||||
SQLiteDatabase db = this.getWritableDatabase();
|
|
||||||
// Delete All Rows
|
|
||||||
db.delete(TABLE_LOGIN, null, null);
|
|
||||||
db.close();
|
|
||||||
|
|
||||||
Log.d(TAG, "Deleted all user info from sqlite");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -47,7 +47,6 @@ public class SessionManager {
|
|||||||
public static final String KEY_NOTIFY_RADIUS = "notifyRadius";
|
public static final String KEY_NOTIFY_RADIUS = "notifyRadius";
|
||||||
public static final String KEY_NOTIFY_POLLINGFREQ = "notifyPollingfreq";
|
public static final String KEY_NOTIFY_POLLINGFREQ = "notifyPollingfreq";
|
||||||
public static final String KEY_NOTIFY_GPS = "notifyGPSEnabled";
|
public static final String KEY_NOTIFY_GPS = "notifyGPSEnabled";
|
||||||
public static final String KEY_NOTIFY_REQUEST_POS = "notifyGPSPositionRequest";
|
|
||||||
|
|
||||||
public static final String KEY_SUBS_NOADS = "subs_noads";
|
public static final String KEY_SUBS_NOADS = "subs_noads";
|
||||||
public static final String KEY_SUBS_PREMIUM = "subs_premium";
|
public static final String KEY_SUBS_PREMIUM = "subs_premium";
|
||||||
@@ -99,8 +98,6 @@ public class SessionManager {
|
|||||||
return status.getString(KEY_LAST_NOTIFICATION, "");
|
return status.getString(KEY_LAST_NOTIFICATION, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setNotificationRadius(int radius){
|
public void setNotificationRadius(int radius){
|
||||||
statusEditor.putInt(KEY_NOTIFY_RADIUS, radius);
|
statusEditor.putInt(KEY_NOTIFY_RADIUS, radius);
|
||||||
statusEditor.apply();
|
statusEditor.apply();
|
||||||
@@ -120,15 +117,6 @@ public class SessionManager {
|
|||||||
return status.getBoolean(KEY_NOTIFY_ENABLED, true);
|
return status.getBoolean(KEY_NOTIFY_ENABLED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotificationPositionRequest(boolean isEnabled){
|
|
||||||
statusEditor.putBoolean(KEY_NOTIFY_REQUEST_POS, isEnabled);
|
|
||||||
statusEditor.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getNotificationPositionRequest(){
|
|
||||||
return status.getBoolean(KEY_NOTIFY_REQUEST_POS, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubsNoAds(boolean isEnabled){
|
public void setSubsNoAds(boolean isEnabled){
|
||||||
statusEditor.putBoolean(KEY_SUBS_NOADS, isEnabled);
|
statusEditor.putBoolean(KEY_SUBS_NOADS, isEnabled);
|
||||||
statusEditor.apply();
|
statusEditor.apply();
|
||||||
@@ -169,8 +157,8 @@ public class SessionManager {
|
|||||||
userDataEditor.putString(KEY_LASTLOGIN_AT, lastlogin_at); // Last Login
|
userDataEditor.putString(KEY_LASTLOGIN_AT, lastlogin_at); // Last Login
|
||||||
userDataEditor.putString(TOKEN, token); // TOKEN
|
userDataEditor.putString(TOKEN, token); // TOKEN
|
||||||
|
|
||||||
setSubsNoAds(true);
|
setSubsNoAds(addfree);
|
||||||
setSubsPremium(true);
|
setSubsPremium(premium);
|
||||||
|
|
||||||
userDataEditor.apply();
|
userDataEditor.apply();
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,15 @@
|
|||||||
package org.deke.risk.riskahead.helper;
|
package org.deke.risk.riskahead.helper;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.deke.risk.riskahead.R;
|
|
||||||
|
|
||||||
import static android.provider.Settings.Global.getString;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Dennis on 17.11.2015.
|
|
||||||
*/
|
|
||||||
public abstract class TextValidator implements TextWatcher {
|
public abstract class TextValidator implements TextWatcher {
|
||||||
private final TextView textView;
|
private final TextView textView;
|
||||||
|
|
||||||
public TextValidator(TextView textView, Context context) {
|
public TextValidator(TextView textView, Context context) {
|
||||||
this.textView = textView;
|
this.textView = textView;
|
||||||
//if(this.textView.getText().length() == 0) this.textView.setError(context.getResources().getString(R.string.error_enter_value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void validate(TextView textView, String text);
|
public abstract void validate(TextView textView, String text);
|
||||||
|
|||||||
@@ -81,10 +81,10 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/lbl_login_policy"
|
android:id="@+id/lbl_login_policy"
|
||||||
android:ellipsize="end"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
|
android:ellipsize="end"
|
||||||
android:layout_weight=".45"
|
android:layout_weight=".45"
|
||||||
android:text="@string/lbl_login_policy"
|
android:text="@string/lbl_login_policy"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|||||||
@@ -16,6 +16,17 @@
|
|||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_centerHorizontal="true" />
|
android:layout_centerHorizontal="true" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:src="@drawable/bg_main_map"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:alpha="0.9" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/layoutContent"
|
android:id="@+id/layoutContent"
|
||||||
android:layout_below="@+id/toolbar"
|
android:layout_below="@+id/toolbar"
|
||||||
@@ -23,13 +34,14 @@
|
|||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_marginTop="30dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_marginTop="79dp"
|
android:padding="5dp"
|
||||||
android:layout_centerInParent="true">
|
android:background="@color/main_button"
|
||||||
|
android:id="@+id/linearLayout">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/lbl_profile_points"
|
android:id="@+id/lbl_profile_points"
|
||||||
@@ -37,12 +49,12 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:layout_marginTop="52dp"
|
android:textColor="@color/white"/>
|
||||||
android:textColor="@color/text_light_grey"/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txt_main_incidents"
|
android:id="@+id/txt_main_incidents"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
|
android:textColor="@color/white"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="38dp"
|
android:layout_marginTop="38dp"
|
||||||
@@ -55,15 +67,24 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:layout_marginTop="34dp"
|
android:layout_marginTop="34dp"
|
||||||
android:textColor="@color/text_light_grey"/>
|
android:textColor="@color/white"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:id="@+id/imageView3"
|
||||||
|
android:src="@drawable/logo_512w"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_below="@+id/linearLayout"
|
||||||
|
android:alpha="0.8" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/layoutFooter"
|
android:id="@+id/layoutFooter"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="#7fbfbfbf"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
@@ -72,12 +93,12 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_main_report"
|
android:id="@+id/btn_main_report"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@color/bg_common_trans"
|
android:background="@drawable/activity_main_button"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:layout_marginRight="1dp"
|
android:layout_marginRight="1dp"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="80dp"
|
||||||
style="?android:attr/borderlessButtonStyle"
|
style="?android:attr/borderlessButtonStyle"
|
||||||
android:text="@string/btn_main_reportinc" />
|
android:text="@string/btn_main_reportinc" />
|
||||||
|
|
||||||
@@ -87,13 +108,15 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:paddingRight="10dp"
|
android:paddingRight="10dp"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:background="@color/bg_common_trans"
|
android:background="@drawable/activity_main_button"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="80dp"
|
||||||
android:text="@string/btn_main_showmap" />
|
android:text="@string/btn_main_showmap" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:tint="@color/white"
|
android:tint="@color/white"
|
||||||
android:src="@android:drawable/ic_input_add"
|
android:src="@android:drawable/ic_input_add"
|
||||||
|
app:borderWidth="0dp"
|
||||||
app:layout_anchor="@+id/frag_maps_map"
|
app:layout_anchor="@+id/frag_maps_map"
|
||||||
android:layout_marginLeft="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:layout_marginBottom="50dp"
|
android:layout_marginBottom="50dp"
|
||||||
|
|||||||
@@ -63,31 +63,38 @@
|
|||||||
android:textColor="@color/input_register"
|
android:textColor="@color/input_register"
|
||||||
android:textColorHint="@color/input_register_hint" />
|
android:textColorHint="@color/input_register_hint" />
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@+id/btn_register"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_below="@+id/input_register_password"
|
android:layout_below="@+id/input_register_password"
|
||||||
android:layout_marginBottom="20dp"
|
android:orientation="horizontal"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_height="wrap_content">
|
||||||
android:background="#ffea7f8a"
|
|
||||||
android:minWidth="120dp"
|
<Button
|
||||||
android:text="@string/btn_start_register"
|
android:id="@+id/btn_register"
|
||||||
android:textColor="@color/white" />
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_weight=".4"
|
||||||
|
android:background="#ffea7f8a"
|
||||||
|
android:minWidth="120dp"
|
||||||
|
android:text="@string/btn_start_register"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lbl_login_policy"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight=".4"
|
||||||
|
android:gravity="end"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:text="@string/lbl_login_policy"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@color/input_register" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/lbl_login_policy"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignTop="@+id/btn_register"
|
|
||||||
android:gravity="right"
|
|
||||||
android:text="@string/lbl_login_policy"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:textColor="@color/input_register" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/lbl_login_usesocialnet"
|
android:id="@+id/lbl_login_usesocialnet"
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
android:text="@string/btn_start_login"
|
android:text="@string/btn_start_login"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:backgroundTint="@color/bg_common_trans"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:onClick="gotoLogin" />
|
android:onClick="gotoLogin" />
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
android:text="@string/btn_start_register"
|
android:text="@string/btn_start_register"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:backgroundTint="@color/bg_common_trans"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:onClick="gotoRegister" />
|
android:onClick="gotoRegister" />
|
||||||
|
|
||||||
|
|||||||
@@ -310,8 +310,7 @@
|
|||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:clickable="true"
|
android:clickable="true" />
|
||||||
android:src="@android:drawable/ic_menu_search" />
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
android:theme="@style/MyRiskAheadToolbar"
|
android:theme="@style/MyRiskAheadToolbar"
|
||||||
app:popupTheme="@style/Theme.AppCompat.Light.NoActionBar"
|
app:popupTheme="@style/Theme.AppCompat.Light.NoActionBar"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto" />
|
xmlns:app="http://schemas.android.com/apk/res-auto" />
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
12
app/src/main/res/layout/progress_circle.xml
Normal file
12
app/src/main/res/layout/progress_circle.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical" android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
style="?android:attr/progressBarStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
android:orderInCategory="100" app:showAsAction="never" />
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
<item android:id="@+id/menu_action_help" android:title="@string/menu_action_help"
|
<item android:id="@+id/menu_action_help" android:title="@string/menu_action_help"
|
||||||
android:orderInCategory="100" app:showAsAction="never" />
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
|
<item android:id="@+id/menu_action_feedback" android:title="@string/menu_action_feedback"
|
||||||
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
<item android:id="@+id/menu_action_exit" android:title="@string/menu_action_exit"
|
<item android:id="@+id/menu_action_exit" android:title="@string/menu_action_exit"
|
||||||
android:orderInCategory="100" app:showAsAction="never" />
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
<string name="menu_action_about">Info</string>
|
<string name="menu_action_about">Info</string>
|
||||||
<string name="menu_action_help">Hilfe & Kontakt</string>
|
<string name="menu_action_help">Hilfe & Kontakt</string>
|
||||||
<string name="menu_action_exit">Beenden</string>
|
<string name="menu_action_exit">Beenden</string>
|
||||||
<string name="menu_action_refresh">Karte aktualisieren</string>
|
|
||||||
|
|
||||||
<string name="lbl_main_txt1">Wir haben aktuell …</string>
|
<string name="lbl_main_txt1">Wir haben aktuell …</string>
|
||||||
<string name="lbl_main_txt2">… gemeldete Vorfälle</string>
|
<string name="lbl_main_txt2">… gemeldete Vorfälle</string>
|
||||||
@@ -148,8 +147,6 @@
|
|||||||
<string name="btn_reportwf_reportnow">Jetzt melden!</string>
|
<string name="btn_reportwf_reportnow">Jetzt melden!</string>
|
||||||
<string name="btn_reportwf_next">Weiter</string>
|
<string name="btn_reportwf_next">Weiter</string>
|
||||||
|
|
||||||
<string name="menu_send_feedback">Feedback senden</string>
|
|
||||||
|
|
||||||
<string name="txt_reportwf_newincidenttitle">Neuen Vorfall anlegen?</string>
|
<string name="txt_reportwf_newincidenttitle">Neuen Vorfall anlegen?</string>
|
||||||
<string name="txt_reportwf_newincidenttext">Willst du alle gemachten Eingaben zurücksetzen und einen neuen Vorfall erstellen?</string>
|
<string name="txt_reportwf_newincidenttext">Willst du alle gemachten Eingaben zurücksetzen und einen neuen Vorfall erstellen?</string>
|
||||||
<string name="txt_subs_youbought">Du hast gekauft</string>
|
<string name="txt_subs_youbought">Du hast gekauft</string>
|
||||||
@@ -206,6 +203,29 @@
|
|||||||
<string name="txt_top10_reportedinc">gemeldete Vorfälle</string>
|
<string name="txt_top10_reportedinc">gemeldete Vorfälle</string>
|
||||||
<string name="txt_top10_membersince">Mitglied seit</string>
|
<string name="txt_top10_membersince">Mitglied seit</string>
|
||||||
|
|
||||||
|
<string name="menu_action_feedback">Feedback</string>
|
||||||
|
<string name="txt_feedback_title">Feedback</string>
|
||||||
|
<string name="txt_feedback_message">Sende uns Verbesserungsvorschläge, Lob und Kritik um uns dabei zu helfen RiskAhead zu verbessern.</string>
|
||||||
|
<string name="txt_feedback_hint">Trage dein Feedback hier ein</string>
|
||||||
|
<string name="txt_feedback_sendbtn">Senden</string>
|
||||||
|
<string name="txt_feedback_cancelbtn">Abbrechen</string>
|
||||||
|
<string name="txt_feedback_response">Danke für dein Feedback!</string>
|
||||||
|
|
||||||
|
<string name="txt_rate_title">Bewerte RiskAhead</string>
|
||||||
|
<string name="txt_rate_message">Wenn dir diese App gefällt, nimm doch bitte einen Moment Zeit diese App zu bewerten. Danke für deine Unterstützung!</string>
|
||||||
|
<string name="txt_rate_retenowbtn">Jetzt bewerten!</string>
|
||||||
|
<string name="txt_rate_laterbtn">Später</string>
|
||||||
|
<string name="txt_rate_neverbtn">Niemals</string>
|
||||||
|
<string name="txt_share_title">Teilen?</string>
|
||||||
|
<string name="txt_share_message">Danke für deinen Eintrag. Möchtest du diesen Vorfall außerhalb von RiskAhead mit anderen Menschen teilen?</string>
|
||||||
|
<string name="txt_share_hint">Vorsicht, neuer Vorfall!\n</string>
|
||||||
|
<string name="txt_share_hint2">Was</string>
|
||||||
|
<string name="txt_share_hint3">Wo</string>
|
||||||
|
<string name="txt_share_page">Für mehr Details: www.riskahead.de</string>
|
||||||
|
<string name="txt_share_acttitle">Vorfall teilen…</string>
|
||||||
|
<string name="txt_viewreport_noinput">Keine Angaben</string>
|
||||||
|
<string name="txt_backpressed_msg">Drücke erneut Zurück um die RiskAhead zu schließen</string>
|
||||||
|
|
||||||
<string-array name="cat_situation_main">
|
<string-array name="cat_situation_main">
|
||||||
<item>Allgemeiner Vorfall/Situation</item>
|
<item>Allgemeiner Vorfall/Situation</item>
|
||||||
<item>Mündliche Gewalt</item>
|
<item>Mündliche Gewalt</item>
|
||||||
|
|||||||
@@ -6,13 +6,22 @@
|
|||||||
|
|
||||||
<color name="bg_common">#1175b7</color>
|
<color name="bg_common">#1175b7</color>
|
||||||
<color name="bg_common_trans">#9e1175b7</color>
|
<color name="bg_common_trans">#9e1175b7</color>
|
||||||
|
|
||||||
|
<color name="main_button">#50626262</color>
|
||||||
|
<color name="main_button_pressed">#e4474747</color>
|
||||||
|
|
||||||
<color name="bg_common_2">#0461a8</color>
|
<color name="bg_common_2">#0461a8</color>
|
||||||
<color name="common_text">#333333</color>
|
<color name="common_text">#333333</color>
|
||||||
<color name="actionbar_text">#fdfdfd</color>
|
<color name="actionbar_text">#fdfdfd</color>
|
||||||
|
|
||||||
<color name="text_light_grey">#aa4b4b4b</color>
|
<color name="text_light_grey">#aa4b4b4b</color>
|
||||||
|
|
||||||
<color name="white">#ffffff</color>
|
<color name="txt_main">#b3d1e6</color>
|
||||||
|
|
||||||
|
<color name="black">#000000</color>
|
||||||
|
<color name="white">#f5f5f5</color>
|
||||||
|
|
||||||
|
|
||||||
<color name="input_login">#222222</color>
|
<color name="input_login">#222222</color>
|
||||||
<color name="input_login_hint">#999999</color>
|
<color name="input_login_hint">#999999</color>
|
||||||
<color name="input_register">#888888</color>
|
<color name="input_register">#888888</color>
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
<string name="menu_action_about">About</string>
|
<string name="menu_action_about">About</string>
|
||||||
<string name="menu_action_help">Help & Contact</string>
|
<string name="menu_action_help">Help & Contact</string>
|
||||||
<string name="menu_action_exit">Exit</string>
|
<string name="menu_action_exit">Exit</string>
|
||||||
<string name="menu_action_refresh">Refresh Map</string>
|
|
||||||
|
|
||||||
<string name="lbl_main_txt1">We have currently …</string>
|
<string name="lbl_main_txt1">We have currently …</string>
|
||||||
<string name="lbl_main_txt2">… reported incidents</string>
|
<string name="lbl_main_txt2">… reported incidents</string>
|
||||||
@@ -151,7 +150,6 @@
|
|||||||
|
|
||||||
<string name="btn_reportwf_reportnow">Report NOW!</string>
|
<string name="btn_reportwf_reportnow">Report NOW!</string>
|
||||||
<string name="btn_reportwf_next">Next</string>
|
<string name="btn_reportwf_next">Next</string>
|
||||||
<string name="menu_send_feedback">Send Feedback</string>
|
|
||||||
|
|
||||||
<string name="txt_reportwf_newincidenttitle">Create new incident?</string>
|
<string name="txt_reportwf_newincidenttitle">Create new incident?</string>
|
||||||
<string name="txt_reportwf_newincidenttext">Do you want to reset all values and create a new incident?</string>
|
<string name="txt_reportwf_newincidenttext">Do you want to reset all values and create a new incident?</string>
|
||||||
@@ -209,6 +207,28 @@
|
|||||||
<string name="txt_top10_reportedinc">reported incidents</string>
|
<string name="txt_top10_reportedinc">reported incidents</string>
|
||||||
<string name="txt_top10_membersince">Member since</string>
|
<string name="txt_top10_membersince">Member since</string>
|
||||||
|
|
||||||
|
<string name="menu_action_feedback">Feedback</string>
|
||||||
|
<string name="txt_feedback_title">FeedBack</string>
|
||||||
|
<string name="txt_feedback_message">Give us your feedback to help us improve RiskAhead</string>
|
||||||
|
<string name="txt_feedback_hint">Enter Feedback here</string>
|
||||||
|
<string name="txt_feedback_sendbtn">Send</string>
|
||||||
|
<string name="txt_feedback_cancelbtn">Cancel</string>
|
||||||
|
<string name="txt_feedback_response">Thank you for your feedback!</string>
|
||||||
|
<string name="txt_rate_title">Rate RiskAhead</string>
|
||||||
|
<string name="txt_rate_message">If you enjoy using RiskAhead, please take a moment to rate it. Thanks for your support!</string>
|
||||||
|
<string name="txt_rate_retenowbtn">Rate Now!</string>
|
||||||
|
<string name="txt_rate_laterbtn">Later</string>
|
||||||
|
<string name="txt_rate_neverbtn">Never</string>
|
||||||
|
<string name="txt_share_title">Share?</string>
|
||||||
|
<string name="txt_share_message">Thank you for your entry. Do you want to share this incident?</string>
|
||||||
|
<string name="txt_share_hint">Attention, new incident!\n</string>
|
||||||
|
<string name="txt_share_hint2">What</string>
|
||||||
|
<string name="txt_share_hint3">Where</string>
|
||||||
|
<string name="txt_share_page">For more Details: www.riskahead.net</string>
|
||||||
|
<string name="txt_share_acttitle">Share incident…</string>
|
||||||
|
<string name="txt_viewreport_noinput">No Value</string>
|
||||||
|
<string name="txt_backpressed_msg">Tap back button again in order to exit RiskAhead</string>
|
||||||
|
|
||||||
<string-array name="cat_situation_main">
|
<string-array name="cat_situation_main">
|
||||||
<item>Allgemeiner Vorfall/Situation</item>
|
<item>Allgemeiner Vorfall/Situation</item>
|
||||||
<item>Mündliche Gewalt</item>
|
<item>Mündliche Gewalt</item>
|
||||||
|
|||||||
@@ -8,18 +8,21 @@
|
|||||||
<org.deke.risk.riskahead.helper.ValidatedEditTextPreference
|
<org.deke.risk.riskahead.helper.ValidatedEditTextPreference
|
||||||
android:key="usernamePref"
|
android:key="usernamePref"
|
||||||
android:title="@string/txt_settings_username"
|
android:title="@string/txt_settings_username"
|
||||||
|
android:inputType="textCapSentences"
|
||||||
android:summary="@string/txt_settings_username_sum"
|
android:summary="@string/txt_settings_username_sum"
|
||||||
android:dialogTitle="@string/txt_settings_username_sum" />
|
android:dialogTitle="@string/txt_settings_username_sum" />
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:key="namePref"
|
android:key="namePref"
|
||||||
android:title="@string/txt_settings_name_title"
|
android:title="@string/txt_settings_name_title"
|
||||||
|
android:inputType="textCapSentences"
|
||||||
android:summary="@string/txt_settings_name_sum"
|
android:summary="@string/txt_settings_name_sum"
|
||||||
android:dialogTitle="@string/txt_settings_name_sum" />
|
android:dialogTitle="@string/txt_settings_name_sum" />
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:key="surnamePref"
|
android:key="surnamePref"
|
||||||
android:title="@string/txt_settings_surname_title"
|
android:title="@string/txt_settings_surname_title"
|
||||||
|
android:inputType="textCapSentences"
|
||||||
android:summary="@string/txt_settings_surname_sum"
|
android:summary="@string/txt_settings_surname_sum"
|
||||||
android:dialogTitle="@string/txt_settings_surname_sum" />
|
android:dialogTitle="@string/txt_settings_surname_sum" />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user