diff --git a/app/app-release.apk b/app/app-release.apk index af798d3..3ff4e7f 100644 Binary files a/app/app-release.apk and b/app/app-release.apk differ diff --git a/app/src/main/java/org/deke/risk/riskahead/LoginActivity.java b/app/src/main/java/org/deke/risk/riskahead/LoginActivity.java index 88359d7..0b5cb26 100644 --- a/app/src/main/java/org/deke/risk/riskahead/LoginActivity.java +++ b/app/src/main/java/org/deke/risk/riskahead/LoginActivity.java @@ -304,7 +304,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr } else { String errorMsg = jObj.getString("error_msg"); Log.e(TAG, "Error at social media login (Server returned error): " + errorMsg); - Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_sociallogin), Toast.LENGTH_LONG).show(); + Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_login)+getResources().getString(R.string.txt_errormsg_suffix), Toast.LENGTH_LONG).show(); } } catch (JSONException e) { e.printStackTrace(); @@ -316,7 +316,7 @@ public class LoginActivity extends AppCompatActivity implements FacebookButtonFr @Override public void onErrorResponse(VolleyError error) { Log.e(TAG, "Social Media Login Error: " + error.getMessage()); - Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_sociallogin), Toast.LENGTH_LONG).show(); + Toast.makeText(getApplicationContext(), getResources().getString(R.string.txt_errormsg_login)+getResources().getString(R.string.txt_errormsg_suffix), Toast.LENGTH_LONG).show(); hideDialog(); } }) { diff --git a/app/src/main/java/org/deke/risk/riskahead/ReportWFActivity.java b/app/src/main/java/org/deke/risk/riskahead/ReportWFActivity.java index 226367e..5e12eea 100644 --- a/app/src/main/java/org/deke/risk/riskahead/ReportWFActivity.java +++ b/app/src/main/java/org/deke/risk/riskahead/ReportWFActivity.java @@ -24,6 +24,7 @@ import com.beardedhen.androidbootstrap.BootstrapButton; import com.google.android.gms.maps.model.LatLng; import com.google.gson.Gson; +import org.deke.risk.riskahead.fragment.BaseReportWFFragment; import org.deke.risk.riskahead.fragment.ReportWF_1_Fragment; import org.deke.risk.riskahead.fragment.ReportWF_2_Fragment; import org.deke.risk.riskahead.fragment.ReportWF_3_Fragment; @@ -55,17 +56,17 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen private final static String mActivityTitle = "Report Incident"; private final static String TAG = ReportWFActivity.class.getSimpleName(); - private List fragList = new ArrayList<>(); + private List fragList = new ArrayList<>(); - private Fragment frag_report_1 = new ReportWF_1_Fragment(); - private Fragment frag_report_2 = new ReportWF_2_Fragment(); - private Fragment frag_report_3 = new ReportWF_3_Fragment(); - private Fragment frag_report_4 = new ReportWF_4_Fragment(); - private Fragment frag_report_5 = new ReportWF_5_Fragment(); - private Fragment frag_report_6 = new ReportWF_6_Fragment(); - private Fragment frag_report_7 = new ReportWF_7_Fragment(); - private Fragment frag_report_8 = new ReportWF_8_Fragment(); - private Fragment frag_report_finish = new ReportWF_Finish_Fragment(); + private BaseReportWFFragment frag_report_1 = new ReportWF_1_Fragment(); + private BaseReportWFFragment frag_report_2 = new ReportWF_2_Fragment(); + private BaseReportWFFragment frag_report_3 = new ReportWF_3_Fragment(); + private BaseReportWFFragment frag_report_4 = new ReportWF_4_Fragment(); + private BaseReportWFFragment frag_report_5 = new ReportWF_5_Fragment(); + private BaseReportWFFragment frag_report_6 = new ReportWF_6_Fragment(); + private BaseReportWFFragment frag_report_7 = new ReportWF_7_Fragment(); + private BaseReportWFFragment frag_report_8 = new ReportWF_8_Fragment(); + private BaseReportWFFragment frag_report_finish = new ReportWF_Finish_Fragment(); private BootstrapButton btnContinue; private BootstrapButton btnReportNow; @@ -111,6 +112,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen btnContinue.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + incident = fragList.get(currentState).getCurrentInput(); initFragment(currentState + 1); } }); @@ -120,6 +122,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen btnReportNow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + incident = fragList.get(currentState).getCurrentInput(); sendReport(); } }); @@ -130,6 +133,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen btnMap.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + incident = fragList.get(currentState).getCurrentInput(); if (incident != null && incident.getPosition() != null) { gotoMapActivity(incident.getPosition().latitude + ":" + incident.getPosition().longitude); } else { @@ -157,7 +161,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen siteIndicator.setVisibility(View.VISIBLE); } - String currentSite = (currentState+1)+"/"+(fragList.size()-1); + String currentSite = (currentState+1) + "/" + (fragList.size()-1); siteIndicator.setText(currentSite); } @@ -198,11 +202,14 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen @Override public void sendReport() { + incident = fragList.get(currentState).getCurrentInput(); + String tag_string_req = "addincidentwithposition"; StringRequest strReq = getStringRequestAddIncidentWithPosition(incident); AppController.getInstance().addToRequestQueue(strReq, tag_string_req); } + public void setIncident(IncidentReport newIncident){ if(!resetSignal){ incident = newIncident; @@ -291,7 +298,7 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen boolean error = jObj.getBoolean("error"); if (!error) { - showMessage("Report added!"); + showMessage(getString(R.string.txt_success_addreport)); LatLng gotoPosition = new LatLng(incident.getPosition().latitude,incident.getPosition().longitude); resetStateAndIncident(); diff --git a/app/src/main/java/org/deke/risk/riskahead/SubscriptionsActivity.java b/app/src/main/java/org/deke/risk/riskahead/SubscriptionsActivity.java index dde4a77..7a70a33 100644 --- a/app/src/main/java/org/deke/risk/riskahead/SubscriptionsActivity.java +++ b/app/src/main/java/org/deke/risk/riskahead/SubscriptionsActivity.java @@ -50,8 +50,8 @@ public class SubscriptionsActivity extends BaseActivity{ Bundle querySkus; HashMap purchaseMap = new HashMap<>(); - HashMap dbItems = new HashMap<>(); + ArrayList ownedSkus = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { @@ -60,7 +60,6 @@ public class SubscriptionsActivity extends BaseActivity{ registerBroadcastReceiver(); tblBillings = (TableLayout) findViewById(R.id.tbl_billing); - getSubscriptions(user.get(SessionManager.KEY_UID)); ServiceConnection mServiceConn = new ServiceConnection() { @Override @@ -92,7 +91,6 @@ public class SubscriptionsActivity extends BaseActivity{ querySkus = new Bundle(); querySkus.putStringArrayList("ITEM_ID_LIST", skuList); - } private void getAlreadyPurchasedItems() { @@ -101,7 +99,7 @@ public class SubscriptionsActivity extends BaseActivity{ int response = activeSubs.getInt("RESPONSE_CODE"); if (response == 0) { - ArrayList ownedSkus = activeSubs.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); + ownedSkus = activeSubs.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); ArrayList purchaseDataList = activeSubs.getStringArrayList("INAPP_PURCHASE_DATA_LIST"); ArrayList signatureList = activeSubs.getStringArrayList("INAPP_DATA_SIGNATURE_LIST"); String continuationToken = activeSubs.getString("INAPP_CONTINUATION_TOKEN"); @@ -114,7 +112,7 @@ public class SubscriptionsActivity extends BaseActivity{ Log.d(TAG, "Already purchased: " + sku + " : " + purchaseData + " : " + signature); } - syncWithDatabase(ownedSkus); + getSubscriptionsAndSync(user.get(SessionManager.KEY_UID)); } } catch (RemoteException e) { @@ -123,7 +121,8 @@ public class SubscriptionsActivity extends BaseActivity{ } private void syncWithDatabase(ArrayList ownedSkus) { - Log.d(TAG, "sync subs with database..."); + Log.d(TAG, "Sync subs with database..."); + Log.d(TAG, "Database shows following active subs: "+dbItems.toString()); ArrayList subs = new ArrayList<>(); subs.add("extra_functions_01"); @@ -132,15 +131,17 @@ public class SubscriptionsActivity extends BaseActivity{ subs.add("no_ads_02"); for(String sub : subs){ + boolean itemFound = false; - if(dbItems.containsKey("extra_functions_01")){ + + if(dbItems.containsKey(sub)){ for(String sku : ownedSkus){ itemFound = itemFound || sku.equals(sub); } if(itemFound == false){ Log.d(TAG, "found sub in database which is active but sub already expired: "+sub); - deactivateSubscriptions(dbItems.get(sub)); + deactivateSubscriptionInDB(dbItems.get(sub)); } } } @@ -246,8 +247,8 @@ public class SubscriptionsActivity extends BaseActivity{ JSONObject jo = new JSONObject(purchaseData); String sku = jo.getString("productId"); String title = jo.getString("title"); - //TODO: Dont show sku but product title - showMessage(getResources().getString(R.string.txt_subs_youbought) + sku + ". "+getResources().getString(R.string.txt_subs_thankyou)); + + showMessage(getResources().getString(R.string.txt_subs_youbought) +" "+ title + ". "+getResources().getString(R.string.txt_subs_thankyou)); addSubscription(purchaseMap.get(sku).getString("productId"),purchaseMap.get(sku).getString("type"),purchaseMap.get(sku).getString("price_amount_micros"),purchaseMap.get(sku).getString("price_currency_code")); } catch (JSONException e) { @@ -279,7 +280,7 @@ public class SubscriptionsActivity extends BaseActivity{ Log.e(TAG, "Error adding subscription (Server returned error): " + errorMsg); showMessage(getResources().getString(R.string.txt_errormsg_subs)); } else { - getSubscriptions(user.get(SessionManager.KEY_UID)); + getSubscriptionsAndSync(user.get(SessionManager.KEY_UID)); } } catch (JSONException e) { @@ -311,7 +312,7 @@ public class SubscriptionsActivity extends BaseActivity{ }; } - private void getSubscriptions(String userId) { + private void getSubscriptionsAndSync(String userId) { String tag_string_req = "requestgetsubscription"; StringRequest strReq = getStringGetSubscriptions(userId); AppController.getInstance().addToRequestQueue(strReq, tag_string_req); @@ -333,10 +334,13 @@ public class SubscriptionsActivity extends BaseActivity{ dbItems = null; }else{ JSONArray subs = jObj.getJSONArray("msg"); + Log.d(TAG,"SUB FROM DB RECEIVED"); for(int i = 0;i < subs.length();i++){ dbItems.put(subs.getJSONObject(i).getString("productId"),subs.getJSONObject(i).getString("id")); } + + syncWithDatabase(ownedSkus); } } catch (JSONException e) { @@ -364,7 +368,9 @@ public class SubscriptionsActivity extends BaseActivity{ }; } - private void deactivateSubscriptions(String subscriptionId) { + private void deactivateSubscriptionInDB(String subscriptionId) { + Log.d(TAG,"Deactivate sub with uid: "+subscriptionId); + String tag_string_req = "requestdeactivatesubscription"; StringRequest strReq = getStringDeactivateSubscriptions(subscriptionId); AppController.getInstance().addToRequestQueue(strReq, tag_string_req); @@ -383,6 +389,8 @@ public class SubscriptionsActivity extends BaseActivity{ if (error) { String errorMsg = jObj.getString("error_msg"); Log.e(TAG, "Error deactivating subscription (Server returned error): " + errorMsg); + }else{ + Log.d(TAG,"Sub with uid: "+subscriptionId+" deactivated in DB"); } } catch (JSONException e) { diff --git a/app/src/main/java/org/deke/risk/riskahead/ViewReportActivity.java b/app/src/main/java/org/deke/risk/riskahead/ViewReportActivity.java index 41e9b48..b8968ae 100644 --- a/app/src/main/java/org/deke/risk/riskahead/ViewReportActivity.java +++ b/app/src/main/java/org/deke/risk/riskahead/ViewReportActivity.java @@ -162,7 +162,7 @@ public class ViewReportActivity extends BaseActivity { boolean error = jObj.getBoolean("error"); if (!error) { - showMessage("Incident deleted"); + showMessage(getString(R.string.txt_success_incidentdel)); gotoProfileActivity(); } else { String errorMsg = jObj.getString("error_msg"); @@ -364,7 +364,7 @@ public class ViewReportActivity extends BaseActivity { boolean error = jObj.getBoolean("error"); if (!error) { - showMessage("Voted! Score updated."); + showMessage(getString(R.string.txt_success_voted)); JSONObject jPoints = jObj.getJSONObject("points"); scorelabel.setText(Integer.toString(jPoints.getInt("upvoted")-jPoints.getInt("downvoted"))); diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/BaseReportWFFragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/BaseReportWFFragment.java new file mode 100644 index 0000000..546a62b --- /dev/null +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/BaseReportWFFragment.java @@ -0,0 +1,35 @@ +package org.deke.risk.riskahead.fragment; + + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import org.deke.risk.riskahead.R; +import org.deke.risk.riskahead.helper.IncidentReport; + +/** + * A simple {@link Fragment} subclass. + */ +public abstract class BaseReportWFFragment extends Fragment { + + + public BaseReportWFFragment() { + // Required empty public constructor + } + + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + TextView textView = new TextView(getActivity()); + + return textView; + } + + public abstract IncidentReport getCurrentInput(); + +} diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/ProfileStatisticsFragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/ProfileStatisticsFragment.java index 219df97..307a107 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/ProfileStatisticsFragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/ProfileStatisticsFragment.java @@ -133,8 +133,8 @@ public class ProfileStatisticsFragment extends Fragment { } else { String errorMsg = jObj.getString("error_msg"); Log.e(TAG, "Error getting user stats (server returned error): " + errorMsg); - //TODO: CONTINUE HERE WITH STRINGS - parent.showMessage(errorMsg); + + parent.showMessage(getResources().getString(R.string.txt_errormsg_retrievestats)); } } catch (JSONException e) { e.printStackTrace(); diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_1_Fragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_1_Fragment.java index 764e1e5..2f8d4bf 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_1_Fragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_1_Fragment.java @@ -1,6 +1,5 @@ package org.deke.risk.riskahead.fragment; -import android.support.v4.app.Fragment; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; @@ -13,6 +12,8 @@ import android.widget.RelativeLayout; import android.widget.Spinner; import android.widget.TextView; +import com.google.android.gms.maps.model.LatLng; + import org.deke.risk.riskahead.R; import org.deke.risk.riskahead.ReportWFActivity; import org.deke.risk.riskahead.helper.IncidentReport; @@ -21,8 +22,7 @@ import org.deke.risk.riskahead.adapter.SpinnerHintAdapter; /** * @author Dennis Thießen */ -public class ReportWF_1_Fragment extends Fragment{ - +public class ReportWF_1_Fragment extends BaseReportWFFragment{ private final static int VIOLANCE_GENERAL = 1; private final static int VIOLANCE_VERBAL = 2; private final static int VIOLANCE_LIGHT = 3; @@ -38,6 +38,7 @@ public class ReportWF_1_Fragment extends Fragment{ private RelativeLayout timeLayout; private TextView txtPositionInformation; + private LatLng position; private IncidentReport incident; @@ -62,6 +63,12 @@ public class ReportWF_1_Fragment extends Fragment{ return viewFragment; } + @Override + public IncidentReport getCurrentInput() { + saveInput(); + return incident; + } + private void initInputElements() { crimeCategory = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_1_cat_main); crimeSubCategory = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_1_cat_sub); @@ -107,11 +114,12 @@ public class ReportWF_1_Fragment extends Fragment{ crimeSubCategory.setVisibility(View.INVISIBLE); } else { crimeSubCategory.setVisibility(View.VISIBLE); - incident.setFidIncidentCategory(position); setSubSpinnerValues(stringId); + + checkIfFinished(); } - checkIfFinished(); + } @Override @@ -120,6 +128,7 @@ public class ReportWF_1_Fragment extends Fragment{ } }); + crimeSubCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { @@ -151,18 +160,16 @@ public class ReportWF_1_Fragment extends Fragment{ } else { timeLayout.setVisibility(View.VISIBLE); - if (position == i){ + if (position == i) { crimeSubOther.setVisibility(View.VISIBLE); - }else{ + } else { crimeSubOther.setVisibility(View.INVISIBLE); crimeSubOther.setText(""); } - ((ReportWFActivity)getActivity()).setMapButtonVisibility(true); - incident.setFidIncidentSubCategory(position); + ((ReportWFActivity) getActivity()).setMapButtonVisibility(true); + checkIfFinished(); } - - checkIfFinished(); } @Override @@ -170,8 +177,10 @@ public class ReportWF_1_Fragment extends Fragment{ // do nothing } }); + } + private void setMainSpinnerValues(int stringId) { ArrayAdapter adapter_main_1 = ArrayAdapter.createFromResource(getActivity(),stringId, android.R.layout.simple_spinner_dropdown_item); crimeCategory.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity())); @@ -190,15 +199,16 @@ public class ReportWF_1_Fragment extends Fragment{ boolean positionIsFilled = false; if(incident != null){ - mainCategoryIsFilled = (crimeCategory.getSelectedItemPosition() > 0) && (incident.getFidIncidentCategory() > 0); + mainCategoryIsFilled = (crimeCategory.getSelectedItemPosition() > 0); - subCategoryIsFilled = (crimeSubCategory.isShown()) && (crimeSubCategory.getSelectedItemPosition() > 0) && (incident.getFidIncidentSubCategory() > 0); + subCategoryIsFilled = (crimeSubCategory.isShown()) && (crimeSubCategory.getSelectedItemPosition() > 0); - positionIsFilled = (timeLayout.isShown()) && (incident.getPosition() != null); + positionIsFilled = (timeLayout.isShown() && incident.getPosition() != null); } boolean isFinished = mainCategoryIsFilled && subCategoryIsFilled && positionIsFilled; + //saveInput(); mCallbackFinished.onInputFinished(isFinished); } @@ -211,11 +221,10 @@ public class ReportWF_1_Fragment extends Fragment{ if(incident != null){ if(incident.getFidIncidentCategory() > 0){ crimeCategory.setSelection(incident.getFidIncidentCategory()); - // The IncidentSubCategory gets automatically initialized } - if (!incident.getEtcIncidentCategory().equals("")){ - crimeSubOther.setText(incident.getEtcIncidentCategory()); + if(incident.getFidIncidentSubCategory() > 0){ + crimeSubCategory.setSelection(incident.getFidIncidentSubCategory()); } if(incident.getPosition() != null){ @@ -223,6 +232,10 @@ public class ReportWF_1_Fragment extends Fragment{ txtPositionInformation.setText(incident.getIncidentPositionDescription()); ((ReportWFActivity)getActivity()).setMapButtonVisibility(true); } + + if (!incident.getEtcIncidentCategory().equals("")){ + crimeSubOther.setText(incident.getEtcIncidentCategory()); + } } checkIfFinished(); @@ -232,11 +245,15 @@ public class ReportWF_1_Fragment extends Fragment{ public void onPause() { super.onPause(); + saveInput(); + } + + public void saveInput() { incident.setFidIncidentCategory(crimeCategory.getSelectedItemPosition()); incident.setFidIncidentSubCategory(crimeSubCategory.getSelectedItemPosition()); incident.setEtcIncidentCategory(crimeSubOther.getText().toString()); - ((ReportWFActivity)getActivity()).setIncident(incident); + ((ReportWFActivity) getActivity()).setIncident(incident); } @Override diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_2_Fragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_2_Fragment.java index 41d3f1a..217f0d5 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_2_Fragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_2_Fragment.java @@ -3,7 +3,6 @@ package org.deke.risk.riskahead.fragment; import android.app.DatePickerDialog; import android.app.Dialog; import android.support.v4.app.DialogFragment; -import android.support.v4.app.Fragment; import android.app.TimePickerDialog; import android.content.Context; import android.os.Bundle; @@ -32,13 +31,11 @@ import java.util.Date; /** * @author Dennis Thießen */ -public class ReportWF_2_Fragment extends Fragment { - +public class ReportWF_2_Fragment extends BaseReportWFFragment { private final static int NOW = 1; private final static int PERIODIC = 2; private final static int DATETIME = 3; private final static int DATETIMEAREA = 4; - private final static int DONTKNOW = 5; private View viewFragment; @@ -56,6 +53,9 @@ public class ReportWF_2_Fragment extends Fragment { private OnInputFinishedListener mCallback; + private boolean tmpIsToDate = false; + private boolean tmpIsToTime = false; + public interface OnInputFinishedListener { void onInputFinished(boolean finished); } @@ -75,6 +75,12 @@ public class ReportWF_2_Fragment extends Fragment { return viewFragment; } + @Override + public IncidentReport getCurrentInput() { + saveInput(); + return incident; + } + private void initInputElements() { initLayoutFromDateTime(); initLayoutToDateTime(); @@ -88,7 +94,6 @@ public class ReportWF_2_Fragment extends Fragment { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { int stringId = 0; - resetDates(); switch (position) { case NOW: @@ -97,7 +102,7 @@ public class ReportWF_2_Fragment extends Fragment { viewFragment.findViewById(R.id.dd_reportwf_2_time_sub).setVisibility(View.INVISIBLE); inputDateFrom.setText(new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime())); - inputTimeFrom.setText(new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime())); + inputTimeFrom.setText(new SimpleDateFormat("HH:mm").format(Calendar.getInstance().getTime())); break; case PERIODIC: viewFragment.findViewById(R.id.ll_report_from_time).setVisibility(View.INVISIBLE); @@ -115,25 +120,28 @@ public class ReportWF_2_Fragment extends Fragment { viewFragment.findViewById(R.id.ll_report_to_time).setVisibility(View.VISIBLE); viewFragment.findViewById(R.id.dd_reportwf_2_time_sub).setVisibility(View.INVISIBLE); break; - case DONTKNOW: + default: viewFragment.findViewById(R.id.ll_report_from_time).setVisibility(View.INVISIBLE); viewFragment.findViewById(R.id.ll_report_to_time).setVisibility(View.INVISIBLE); viewFragment.findViewById(R.id.dd_reportwf_2_time_sub).setVisibility(View.INVISIBLE); + + inputDateFrom.setText(new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime())); + inputTimeFrom.setText(new SimpleDateFormat("HH:mm").format(Calendar.getInstance().getTime())); break; } if (((SpinnerHintAdapter) timeCategory.getAdapter()).isInInitialState()) { timeSubCategory.setVisibility(View.INVISIBLE); } else { - incident.setFidTimeCategory(position); - if (stringId != 0) { timeSubCategory.setVisibility(View.VISIBLE); setSubSpinnerValues(stringId); } + + checkIfFinished(); } - checkIfFinished(); + } @Override @@ -145,11 +153,11 @@ public class ReportWF_2_Fragment extends Fragment { timeSubCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { - if ((position < 1) && (incident.getFidTimeSubCategory() != 0)) - timeSubCategory.setSelection(incident.getFidTimeSubCategory()); + if (((SpinnerHintAdapter) timeSubCategory.getAdapter()).isInInitialState()) { - incident.setFidTimeSubCategory(position); - checkIfFinished(); + } else { + checkIfFinished(); + } } @Override @@ -206,6 +214,7 @@ public class ReportWF_2_Fragment extends Fragment { @Override public void onClick(View v) { tmpInput = inputDateTo; + tmpIsToDate = true; showDatePickerDialog(); } }); @@ -214,6 +223,7 @@ public class ReportWF_2_Fragment extends Fragment { @Override public void onClick(View v) { tmpInput = inputTimeTo; + tmpIsToTime = true; showTimePickerDialog(); } }); @@ -245,6 +255,7 @@ public class ReportWF_2_Fragment extends Fragment { public void showTimePickerDialog() { DialogFragment newFragment = new TimePickerFragment(); + newFragment.show(getActivity().getSupportFragmentManager(), "Pick Time"); } @@ -257,6 +268,20 @@ public class ReportWF_2_Fragment extends Fragment { int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); + if(tmpIsToDate && inputDateFrom.getText().length() > 0){ + try { + DatePickerDialog tmpDialog = new DatePickerDialog(getActivity(), this, year, month, day); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Date tmpFromDate = simpleDateFormat.parse(inputDateFrom.getText().toString()); + tmpDialog.getDatePicker().setMinDate(tmpFromDate.getTime()); + tmpIsToDate = false; + return tmpDialog; + } catch (ParseException e) { + e.printStackTrace(); + } + + } + return new DatePickerDialog(getActivity(), this, year, month, day); } @@ -268,6 +293,7 @@ public class ReportWF_2_Fragment extends Fragment { } catch (ParseException e) { e.printStackTrace(); } + checkIfFinished(); } } @@ -290,7 +316,7 @@ public class ReportWF_2_Fragment extends Fragment { } if(timeSubCategory.isShown()){ - isSubCategoryFilled = (timeSubCategory.getSelectedItemPosition() > 0) && (incident.getFidTimeSubCategory() > 0); + isSubCategoryFilled = (timeSubCategory.getSelectedItemPosition() > 0); }else{ isSubCategoryFilled = true; } @@ -306,22 +332,12 @@ public class ReportWF_2_Fragment extends Fragment { }else{ isToDateFilled = true; } + } - saveInput(); - ((ReportWFActivity)getActivity()).setIncident(incident); mCallback.onInputFinished(isTimeCategoryFilled && isSubCategoryFilled && isFromDateFilled && isToDateFilled); } - private void resetDates() { - incident.resetDatetime(); - - inputDateFrom.setText(""); - inputTimeFrom.setText(""); - inputDateTo.setText(""); - inputDateFrom.setText(""); - } - @Override public void onResume() { super.onResume(); @@ -331,7 +347,6 @@ public class ReportWF_2_Fragment extends Fragment { if(incident != null){ if(incident.getFidTimeCategory() != 0){ timeCategory.setSelection(incident.getFidTimeCategory()); - //SubCategory is automatically initialized } if(incident.getFromDate() != null && !incident.getFromDate().equals("")){ @@ -359,17 +374,18 @@ public class ReportWF_2_Fragment extends Fragment { super.onPause(); saveInput(); - - ((ReportWFActivity)getActivity()).setIncident(incident); } - private void saveInput() { + public void saveInput() { + incident.setFidTimeCategory(timeCategory.getSelectedItemPosition()); incident.setFidTimeSubCategory(timeSubCategory.getSelectedItemPosition()); incident.setFromDate(inputDateFrom.getText().toString()); incident.setFromTime(inputTimeFrom.getText().toString()); incident.setToDate(inputDateTo.getText().toString()); incident.setToTime(inputTimeTo.getText().toString()); + + ((ReportWFActivity)getActivity()).setIncident(incident); } @Override diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_3_Fragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_3_Fragment.java index 14a6dc0..c1e2edf 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_3_Fragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_3_Fragment.java @@ -1,6 +1,5 @@ package org.deke.risk.riskahead.fragment; -import android.support.v4.app.Fragment; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; @@ -19,8 +18,7 @@ import org.deke.risk.riskahead.adapter.SpinnerHintAdapter; /** * @author Dennis Thießen */ -public class ReportWF_3_Fragment extends Fragment { - +public class ReportWF_3_Fragment extends BaseReportWFFragment { private final static int GANGS = 1; private final static int POLICE = 2; private final static int MOB = 3; @@ -30,7 +28,6 @@ public class ReportWF_3_Fragment extends Fragment { private final static int DONTKNOW = 7; private final static int ETC = 8; - private View viewFragment; private Spinner suspectCategory; @@ -60,6 +57,12 @@ public class ReportWF_3_Fragment extends Fragment { return viewFragment; } + @Override + public IncidentReport getCurrentInput() { + saveInput(); + return incident; + } + private void initInputElements() { suspectCategory = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_3_suspect); suspectSubCategory = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_3_suspect_sub); @@ -99,16 +102,14 @@ public class ReportWF_3_Fragment extends Fragment { if (((SpinnerHintAdapter) suspectCategory.getAdapter()).isInInitialState()) { suspectSubCategory.setVisibility(View.INVISIBLE); } else { - incident.setFidSuspectCategory(position); - if (stringId != 0) { suspectSubCategory.setVisibility(View.VISIBLE); setSubSpinnerValues(stringId); - }else{ + } else { suspectSubCategory.setVisibility(View.INVISIBLE); } - if (position != ETC){ + if (position != ETC) { suspectEtcInput.setVisibility(View.INVISIBLE); } } @@ -125,10 +126,8 @@ public class ReportWF_3_Fragment extends Fragment { suspectSubCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { - if ((position < 1) && (incident.getFidSuspectSubCategory() != 0)) - suspectSubCategory.setSelection(incident.getFidSuspectSubCategory()); + if ((position < 1) && (incident.getFidSuspectSubCategory() != 0)) suspectSubCategory.setSelection(incident.getFidSuspectSubCategory()); - incident.setFidSuspectSubCategory(position); checkIfFinished(); } @@ -139,6 +138,7 @@ public class ReportWF_3_Fragment extends Fragment { }); } + private void setMainSpinnerValues(int stringId) { ArrayAdapter adapter_main_1 = ArrayAdapter.createFromResource(getActivity(),stringId, android.R.layout.simple_spinner_dropdown_item); suspectCategory.setAdapter(new SpinnerHintAdapter(adapter_main_1, R.layout.contact_spinner_row_nothing_selected, getActivity())); @@ -184,6 +184,10 @@ public class ReportWF_3_Fragment extends Fragment { public void onPause() { super.onPause(); + saveInput(); + } + + private void saveInput() { incident.setFidSuspectCategory(suspectCategory.getSelectedItemPosition()); incident.setFidSuspectSubCategory(suspectSubCategory.getSelectedItemPosition()); incident.setEtcSuspectCategory(suspectEtcInput.getText().toString()); diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_4_Fragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_4_Fragment.java index 83f0fd7..9601ddf 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_4_Fragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_4_Fragment.java @@ -3,6 +3,8 @@ package org.deke.risk.riskahead.fragment; import android.content.Context; 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.View; import android.view.ViewGroup; @@ -19,8 +21,7 @@ import org.deke.risk.riskahead.helper.IncidentReport; /** * @author Dennis Thießen */ -public class ReportWF_4_Fragment extends Fragment { - +public class ReportWF_4_Fragment extends BaseReportWFFragment { private final static int COMMON_OBJECTS = 1; private final static int FIREARM = 2; private final static int EXPLOSIONS = 3; @@ -56,6 +57,13 @@ public class ReportWF_4_Fragment extends Fragment { return viewFragment; } + @Override + public IncidentReport getCurrentInput() { + saveInput(); + return incident; + } + + private void initInputElements() { suspectWeapon = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_4_weapon); suspectWeaponEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_4_weapon_etc); @@ -87,10 +95,6 @@ public class ReportWF_4_Fragment extends Fragment { break; } - if (position > 0) { - incident.setFidSuspectWeaponCategory(position); - } - checkIfFinished(); } @@ -99,6 +103,7 @@ public class ReportWF_4_Fragment extends Fragment { // do nothing } }); + } private void setMainSpinnerValues(int stringId){ @@ -111,9 +116,10 @@ public class ReportWF_4_Fragment extends Fragment { boolean isMainCategoryFilled = false; if(incident != null){ - isMainCategoryFilled = (suspectWeapon.getSelectedItemPosition() > 0) && (incident.getFidSuspectWeaponCategory() > 0); + isMainCategoryFilled = (suspectWeapon.getSelectedItemPosition() > 0); } + saveInput(); mCallback.onInputFinished(isMainCategoryFilled); } @@ -135,6 +141,10 @@ public class ReportWF_4_Fragment extends Fragment { public void onPause() { super.onPause(); + saveInput(); + } + + private void saveInput(){ incident.setFidSuspectWeaponCategory(suspectWeapon.getSelectedItemPosition()); incident.setEtcSuspectWeaponCategory(suspectWeaponEtcInput.getText().toString()); diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_5_Fragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_5_Fragment.java index e6c140a..b2420c2 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_5_Fragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_5_Fragment.java @@ -3,6 +3,8 @@ package org.deke.risk.riskahead.fragment; import android.content.Context; 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.View; import android.view.ViewGroup; @@ -19,7 +21,7 @@ import org.deke.risk.riskahead.helper.IncidentReport; /** * @author Dennis Thießen */ -public class ReportWF_5_Fragment extends Fragment { +public class ReportWF_5_Fragment extends BaseReportWFFragment { private final static int SINGLE_PERSON = 1; @@ -56,6 +58,12 @@ public class ReportWF_5_Fragment extends Fragment { return viewFragment; } + @Override + public IncidentReport getCurrentInput() { + saveInput(); + return incident; + } + private void initInputElements() { suspectCount = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_5_count); suspectCountEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_5_count_etc); @@ -84,10 +92,6 @@ public class ReportWF_5_Fragment extends Fragment { break; } - if (position > 0) { - incident.setFidSuspectCountCategory(position); - } - checkIfFinished(); } @@ -96,6 +100,7 @@ public class ReportWF_5_Fragment extends Fragment { // do nothing } }); + } private void setMainSpinnerValues(int stringId){ @@ -108,7 +113,7 @@ public class ReportWF_5_Fragment extends Fragment { boolean isMainCategoryFilled = false; if(incident != null){ - isMainCategoryFilled = (suspectCount.getSelectedItemPosition() > 0) && (incident.getFidSuspectCountCategory() > 0); + isMainCategoryFilled = (suspectCount.getSelectedItemPosition() > 0); } mCallback.onInputFinished(isMainCategoryFilled); @@ -132,6 +137,10 @@ public class ReportWF_5_Fragment extends Fragment { public void onPause() { super.onPause(); + saveInput(); + } + + private void saveInput(){ incident.setFidSuspectCountCategory(suspectCount.getSelectedItemPosition()); incident.setEtcSuspectCountCategory(suspectCountEtcInput.getText().toString()); diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_6_Fragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_6_Fragment.java index c5a8332..a8ebd9e 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_6_Fragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_6_Fragment.java @@ -18,7 +18,7 @@ import org.deke.risk.riskahead.helper.IncidentReport; /** * @author Dennis Thießen */ -public class ReportWF_6_Fragment extends Fragment { +public class ReportWF_6_Fragment extends BaseReportWFFragment { private final static int WOMEN = 1; private final static int CHILDREN = 2; @@ -53,6 +53,12 @@ public class ReportWF_6_Fragment extends Fragment { return viewFragment; } + @Override + public IncidentReport getCurrentInput() { + saveInput(); + return incident; + } + private void initInputElements() { victimType = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_6_victim); @@ -73,16 +79,12 @@ public class ReportWF_6_Fragment extends Fragment { break; } - if (position > 0) { - incident.setFidVictimCategory(position); - } - checkIfFinished(); } @Override public void onNothingSelected(AdapterView parentView) { - // do nothing + } }); } @@ -97,7 +99,7 @@ public class ReportWF_6_Fragment extends Fragment { boolean isMainCategoryFilled = false; if(incident != null){ - isMainCategoryFilled = (victimType.getSelectedItemPosition() > 0) && (incident.getFidVictimCategory() > 0); + isMainCategoryFilled = (victimType.getSelectedItemPosition() > 0); } mCallback.onInputFinished(isMainCategoryFilled); @@ -120,6 +122,10 @@ public class ReportWF_6_Fragment extends Fragment { public void onPause() { super.onPause(); + saveInput(); + } + + private void saveInput(){ incident.setFidVictimCategory(victimType.getSelectedItemPosition()); ((ReportWFActivity)getActivity()).setIncident(incident); diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_7_Fragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_7_Fragment.java index aed56fd..e1c1571 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_7_Fragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_7_Fragment.java @@ -3,6 +3,8 @@ package org.deke.risk.riskahead.fragment; import android.content.Context; 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.View; import android.view.ViewGroup; @@ -19,7 +21,7 @@ import org.deke.risk.riskahead.helper.IncidentReport; /** * @author Dennis Thießen */ -public class ReportWF_7_Fragment extends Fragment { +public class ReportWF_7_Fragment extends BaseReportWFFragment { private final static int LOCAL = 1; @@ -56,6 +58,12 @@ public class ReportWF_7_Fragment extends Fragment { return viewFragment; } + @Override + public IncidentReport getCurrentInput() { + saveInput(); + return incident; + } + private void initInputElements() { victimOrigin = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_7_victimorigin); victimOriginEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_7_victimorigin_etc); @@ -84,10 +92,6 @@ public class ReportWF_7_Fragment extends Fragment { break; } - if (position > 0) { - incident.setFidVictimOriginCategory(position); - } - checkIfFinished(); } @@ -96,6 +100,7 @@ public class ReportWF_7_Fragment extends Fragment { // do nothing } }); + } private void setMainSpinnerValues(int stringId){ @@ -108,7 +113,7 @@ public class ReportWF_7_Fragment extends Fragment { boolean isMainCategoryFilled = false; if(incident != null){ - isMainCategoryFilled = (victimOrigin.getSelectedItemPosition() > 0) && (incident.getFidVictimOriginCategory() > 0); + isMainCategoryFilled = (victimOrigin.getSelectedItemPosition() > 0); } mCallback.onInputFinished(isMainCategoryFilled); @@ -132,6 +137,10 @@ public class ReportWF_7_Fragment extends Fragment { public void onPause() { super.onPause(); + saveInput(); + } + + private void saveInput(){ incident.setFidVictimOriginCategory(victimOrigin.getSelectedItemPosition()); incident.setEtcVictimOriginCategory(victimOriginEtcInput.getText().toString()); diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_8_Fragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_8_Fragment.java index 3db4a18..053f3bd 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_8_Fragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_8_Fragment.java @@ -3,6 +3,8 @@ package org.deke.risk.riskahead.fragment; import android.content.Context; 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.View; import android.view.ViewGroup; @@ -19,7 +21,7 @@ import org.deke.risk.riskahead.helper.IncidentReport; /** * @author Dennis Thießen */ -public class ReportWF_8_Fragment extends Fragment { +public class ReportWF_8_Fragment extends BaseReportWFFragment { private final static int FEET = 1; @@ -88,6 +90,12 @@ public class ReportWF_8_Fragment extends Fragment { return viewFragment; } + @Override + public IncidentReport getCurrentInput() { + saveInput(); + return incident; + } + private void initSuspectVehicleInputElements() { suspectVehicle = (Spinner) viewFragment.findViewById(R.id.dd_reportwf_8_suspectvehicle); suspectVehicleEtcInput = (EditText) viewFragment.findViewById(R.id.txt_reportwf_8_suspectvehicle); @@ -122,10 +130,6 @@ public class ReportWF_8_Fragment extends Fragment { break; } - if (position > 0) { - incident.setFidSuspectTransportationCategory(position); - } - checkIfFinished(); } @@ -134,6 +138,7 @@ public class ReportWF_8_Fragment extends Fragment { // do nothing } }); + } private void setSuspectVehicleMainSpinnerValues(int stringId){ @@ -175,10 +180,6 @@ public class ReportWF_8_Fragment extends Fragment { break; } - if (position > 0) { - incident.setFidVictimBelongingCategory(position); - } - checkIfFinished(); } @@ -187,6 +188,7 @@ public class ReportWF_8_Fragment extends Fragment { // do nothing } }); + } private void setVictimAffiliationMainSpinnerValues(int stringId){ @@ -222,10 +224,6 @@ public class ReportWF_8_Fragment extends Fragment { break; } - if (position > 0) { - incident.setFidSuspectCharacteristicsCategory(position); - } - checkIfFinished(); } @@ -234,6 +232,7 @@ public class ReportWF_8_Fragment extends Fragment { // do nothing } }); + } private void setSuspectRecognitionMainSpinnerValues(int stringId){ @@ -247,9 +246,9 @@ public class ReportWF_8_Fragment extends Fragment { boolean isSuspectRecoginitionFilled = false; if(incident != null){ - isSuspectVehicleFilled = (suspectVehicle.getSelectedItemPosition() > 0) && (incident.getFidSuspectTransportationCategory() > 0); - isVictimAffiliationFilled = (victimAffiliation.getSelectedItemPosition() > 0) && (incident.getFidVictimBelongingCategory() > 0); - isSuspectRecoginitionFilled = (suspectRecongnition.getSelectedItemPosition() > 0) && (incident.getFidSuspectCharacteristicsCategory() > 0); + isSuspectVehicleFilled = (suspectVehicle.getSelectedItemPosition() > 0); + isVictimAffiliationFilled = (victimAffiliation.getSelectedItemPosition() > 0); + isSuspectRecoginitionFilled = (suspectRecongnition.getSelectedItemPosition() > 0); } mCallback.onInputFinished(isSuspectVehicleFilled && isVictimAffiliationFilled && isSuspectRecoginitionFilled); @@ -281,6 +280,10 @@ public class ReportWF_8_Fragment extends Fragment { public void onPause() { super.onPause(); + saveInput(); + } + + private void saveInput(){ incident.setFidSuspectTransportationCategory(suspectVehicle.getSelectedItemPosition()); incident.setEtcSuspectTransportationCategory(suspectVehicleEtcInput.getText().toString()); diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_Finish_Fragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_Finish_Fragment.java index 7b857e7..416869c 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_Finish_Fragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/ReportWF_Finish_Fragment.java @@ -10,11 +10,13 @@ import android.view.ViewGroup; import android.widget.Button; import org.deke.risk.riskahead.R; +import org.deke.risk.riskahead.ReportWFActivity; +import org.deke.risk.riskahead.helper.IncidentReport; /** * A simple {@link Fragment} subclass. */ -public class ReportWF_Finish_Fragment extends Fragment { +public class ReportWF_Finish_Fragment extends BaseReportWFFragment { private View viewFragment; private SendReportListener mCallback; @@ -35,6 +37,11 @@ public class ReportWF_Finish_Fragment extends Fragment { return viewFragment; } + @Override + public IncidentReport getCurrentInput() { + return ((ReportWFActivity)getActivity()).getIncident(); + } + public interface SendReportListener { void sendReport(); } diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/SettingsFragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/SettingsFragment.java index 9acbb19..67f32df 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/SettingsFragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/SettingsFragment.java @@ -128,8 +128,8 @@ public class SettingsFragment extends PreferenceFragment { prefGPSENabled.setEnabled(false); prefLocation.setEnabled(false); - prefGPSENabled.setTitle(prefGPSENabled.getTitle()+" (Only Premium)"); - prefLocation.setTitle(prefLocation.getTitle()+" (Only Premium)"); + prefGPSENabled.setTitle(prefGPSENabled.getTitle() + " " + getResources().getString(R.string.txt_premium_only)); + prefLocation.setTitle(prefLocation.getTitle() + " " + getResources().getString(R.string.txt_premium_only)); } } @@ -157,8 +157,8 @@ public class SettingsFragment extends PreferenceFragment { @Override public boolean onPreferenceClick(Preference preference) { new AlertDialog.Builder(getActivity()) - .setTitle("Send password reset E-Mail") - .setMessage("Do you really want to reset your password? An E-Mail will be send to your address. Please follow the instructions to reset your password.") + .setTitle(getResources().getString(R.string.txt_settings_resetpwtitle)) + .setMessage(getResources().getString(R.string.txt_settings_resetpwtext)) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { requestPasswordReset(); @@ -202,7 +202,7 @@ public class SettingsFragment extends PreferenceFragment { prefRadius.setValue(Integer.toString(session.getNotificationRadius())); prefRadius.setSummary(prefRadius.getEntry()); prefGPSENabled.setChecked(session.isGPSForNotificationsEnabled()); - prefLocation.setSummary("Your Location (Latitude/Longitude):\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()){ prefLocation.setEnabled(false); @@ -216,7 +216,7 @@ public class SettingsFragment extends PreferenceFragment { StringRequest strReq = getStringRequestResetPW(user.get(SessionManager.KEY_EMAIL)); AppController.getInstance().addToRequestQueue(strReq, tag_string_req); - ((SettingsActivity) getActivity()).showMessage("E-Mail was sent to your address"); + ((SettingsActivity) getActivity()).showMessage(getString(R.string.alert_passwordreset_confirmation)); } private StringRequest getStringRequestResetPW(final String email) { @@ -236,7 +236,7 @@ public class SettingsFragment extends PreferenceFragment { } else { String errorMsg = jObj.getString("error_msg"); Log.e(TAG, "Error request email reset (Server returned error): " + errorMsg); - ((SettingsActivity) getActivity()).showMessage(errorMsg); + ((SettingsActivity) getActivity()).showMessage(getResources().getString(R.string.txt_errormsg_resetpw)); } } catch (JSONException e) { e.printStackTrace(); @@ -256,7 +256,7 @@ public class SettingsFragment extends PreferenceFragment { @Override protected Map getParams() { Map params = new HashMap<>(); - params.put("tag", "requestpwreset"); + params.put("tag", AppConfig.REST_REQUESTPWRESET); params.put("email", email); return params; @@ -296,7 +296,7 @@ public class SettingsFragment extends PreferenceFragment { JSONObject jObj = new JSONObject(response); boolean error = jObj.getBoolean("error"); if (!error) { - ((SettingsActivity) getActivity()).showMessage(jObj.getString("msg")); + ((SettingsActivity) getActivity()).showMessage(getResources().getString(R.string.txt_success_changesett)); JSONObject tmpuser = jObj.getJSONObject("user"); JSONArray jSubs = tmpuser.getJSONArray("subs"); @@ -320,7 +320,7 @@ public class SettingsFragment extends PreferenceFragment { } else { String errorMsg = jObj.getString("error_msg"); Log.e(TAG, "Error getting user settings (Server returned error): " + errorMsg); - ((SettingsActivity) getActivity()).showMessage(errorMsg); + ((SettingsActivity) getActivity()).showMessage(getResources().getString(R.string.txt_errormsg_changesettings)); } } catch (JSONException e) { e.printStackTrace(); @@ -345,7 +345,7 @@ public class SettingsFragment extends PreferenceFragment { protected Map getParams() { // Posting params to register url Map params = new HashMap<>(); - params.put("tag", "updateuser"); + params.put("tag", AppConfig.REST_UPDATE_USER); params.put("uid", user.get(SessionManager.KEY_UID)); params.put("token", user.get(SessionManager.TOKEN)); params.put("username", username); diff --git a/app/src/main/java/org/deke/risk/riskahead/fragment/Top10Fragment.java b/app/src/main/java/org/deke/risk/riskahead/fragment/Top10Fragment.java index 76595da..0d71167 100644 --- a/app/src/main/java/org/deke/risk/riskahead/fragment/Top10Fragment.java +++ b/app/src/main/java/org/deke/risk/riskahead/fragment/Top10Fragment.java @@ -103,7 +103,7 @@ public class Top10Fragment extends Fragment { } else { String errorMsg = jObj.getString("error_msg"); Log.e(TAG, "Error getting top 10 stats (Server returned error): " + errorMsg); - parent.showMessage(errorMsg); + parent.showMessage(getResources().getString(R.string.txt_errormsg_gettop10)); } } catch (JSONException e) { e.printStackTrace(); @@ -123,7 +123,7 @@ public class Top10Fragment extends Fragment { @Override protected Map getParams() { Map params = new HashMap<>(); - params.put("tag", "gettop10"); + params.put("tag", AppConfig.REST_GET_TOP10); params.put("uid", parent.user.get(SessionManager.KEY_UID)); params.put("token", parent.user.get(SessionManager.TOKEN)); diff --git a/app/src/main/java/org/deke/risk/riskahead/helper/IncidentReport.java b/app/src/main/java/org/deke/risk/riskahead/helper/IncidentReport.java index 4b08b57..53c8688 100644 --- a/app/src/main/java/org/deke/risk/riskahead/helper/IncidentReport.java +++ b/app/src/main/java/org/deke/risk/riskahead/helper/IncidentReport.java @@ -142,14 +142,14 @@ public class IncidentReport implements ClusterItem { int mIcon; Date tmpFromDate = null; - SimpleDateFormat simpleDateFormat = null; + SimpleDateFormat simpleDateFormat; Date today = new Date(System.currentTimeMillis()-1*60*60*1000); try { - if(this.fromTime != null){ + if(this.fromDate != null && this.fromTime != null){ simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); tmpFromDate = simpleDateFormat.parse(this.fromDate+" "+this.fromTime); - }else{ + }else if(this.fromDate != null){ simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); tmpFromDate = simpleDateFormat.parse(this.fromDate); } @@ -282,15 +282,6 @@ public class IncidentReport implements ClusterItem { } } - public void resetDatetime() { - toTime = ""; - toDate = ""; - fromTime = ""; - fromDate = ""; - } - - - public int getId() { return id; } @@ -300,11 +291,18 @@ public class IncidentReport implements ClusterItem { } public String getIncidentCategoryName(Context context){ - return context.getResources().getStringArray(R.array.cat_situation_main)[this.fidIncidentCategory-1]; + String returnValue = ""; + String[] stringArray = context.getResources().getStringArray(R.array.cat_situation_main); + + if((this.fidIncidentCategory > 0) && (this.fidIncidentCategory <= stringArray.length)){ + returnValue = stringArray[this.fidIncidentCategory-1]; + } + + return returnValue; } public String getIncidentSubCategoryName(Context context){ - String returnValue = ""; + String returnValue; String[] stringArray; switch(this.fidIncidentCategory){ @@ -348,7 +346,7 @@ public class IncidentReport implements ClusterItem { if(stringArray != null && (stringArray.length == this.fidIncidentSubCategory)){ returnValue = getEtcIncidentCategory(); - }else if(stringArray != null){ + }else if((stringArray != null) && (this.fidIncidentSubCategory > 0) && (this.fidIncidentSubCategory <= stringArray.length)){ returnValue = stringArray[this.fidIncidentSubCategory-1]; } @@ -357,24 +355,31 @@ public class IncidentReport implements ClusterItem { public String getTimeString(Context context){ String returnString = ""; + String[] returnTimeArray = context.getResources().getStringArray(R.array.cat_time_main); + String[] returnSubTimeArray = context.getResources().getStringArray(R.array.cat_time_sub_periodical); + switch (this.fidTimeCategory){ case 1: - if((this.fromDate != null) && !(this.fromDate.equals("0000-00-00"))){ + if((this.fromDate != null) && !(this.fromDate.equals("0000-00-00")) && (this.fromTime != null) && (this.fromTime.length() > 4)){ returnString = this.fromDate+" "+this.fromTime.substring(0,5); - }else if(this.fromDate.equals("0000-00-00")){ + }else if((this.fromDate != null) && (this.fromDate.equals("0000-00-00")) && (this.createdAt.length() > 15)){ returnString = this.createdAt.substring(0,16); - }else{ - returnString = context.getResources().getStringArray(R.array.cat_time_main)[this.fidTimeCategory-1]; + }else if((this.fidTimeCategory > 0) && (this.fidTimeCategory <= returnTimeArray.length)){ + returnString = returnTimeArray[this.fidTimeCategory-1]; } break; case 2: - returnString = context.getResources().getStringArray(R.array.cat_time_sub_periodical)[this.fidTimeSubCategory-1]; + if(this.fidTimeSubCategory > 0 && this.fidTimeSubCategory <= returnSubTimeArray.length){ + returnString = returnSubTimeArray[this.fidTimeSubCategory-1]; + } break; case 3: - if((this.fromTime != null) && !(this.fromTime.equals("00:00:00"))){ + if((this.fromDate != null) && !(this.fromDate.equals("0000-00-00")) && (this.fromTime != null) && (this.fromTime.length() > 4)){ returnString = this.fromDate+" "+this.fromTime.substring(0,5); - }else{ - returnString = this.fromDate; + }else if((this.fromDate != null) && (this.fromDate.equals("0000-00-00")) && (this.createdAt.length() > 15)){ + returnString = this.createdAt.substring(0,16); + }else if((this.fidTimeCategory > 0) && (this.fidTimeCategory <= returnTimeArray.length)){ + returnString = returnTimeArray[this.fidTimeCategory-1]; } break; case 4: @@ -384,47 +389,50 @@ public class IncidentReport implements ClusterItem { returnString = this.fromDate+" -> "+this.toDate; } break; - case 5: - returnString = context.getResources().getStringArray(R.array.cat_time_main)[this.fidTimeCategory-1]; + default: + if((this.createdAt != null) && (this.createdAt.length() > 15)) { + returnString = this.createdAt.substring(0, 16); + }else{ + returnString = ""; + } break; } return returnString; } public String getSuspectString(Context context){ - String returnValue = ""; - String[] stringArray; + String returnValue; + String[] stringArray = context.getResources().getStringArray(R.array.cat_suspect_main); - if(this.fidSuspectCategory > 0){ - stringArray = context.getResources().getStringArray(R.array.cat_suspect_main); - returnValue = stringArray[this.fidSuspectCategory-1]; + if(this.fidSuspectCategory > 0 && this.fidSuspectCategory <= stringArray.length){ + if(stringArray.length == this.fidSuspectCategory){ + returnValue = getEtcSuspectCategory(); + }else{ + returnValue = stringArray[this.fidSuspectCategory-1]; + + + if((this.fidSuspectCategory == 4) || (this.fidSuspectCategory == 5) || (this.fidSuspectCategory == 6)) { + + String[] stringSubArray = context.getResources().getStringArray(R.array.cat_suspect_sub_location); + if(this.fidSuspectSubCategory > 0 && this.fidSuspectSubCategory <= stringSubArray.length){ + returnValue += " ("+stringSubArray[this.fidSuspectSubCategory-1]+")"; + } + } + } }else{ - stringArray = null; returnValue = ""; } - if(stringArray != null && (stringArray.length == this.fidSuspectCategory)){ - returnValue = getEtcSuspectCategory(); - }else if(stringArray != null){ - returnValue = stringArray[this.fidSuspectCategory-1]; - } - - if(this.fidSuspectCategory == 4 || this.fidSuspectCategory == 5 || this.fidSuspectCategory == 6) { - returnValue += " ("+context.getResources().getStringArray(R.array.cat_suspect_sub_location)[this.fidSuspectSubCategory-1]+")"; - } - return returnValue; } public String getVictimString(Context context){ - String returnValue = ""; - String[] stringArray; + String returnValue; + String[] stringArray = context.getResources().getStringArray(R.array.cat_victim); - if(this.fidVictimCategory > 0){ - stringArray = context.getResources().getStringArray(R.array.cat_victim); + if(this.fidVictimCategory > 0 && this.fidVictimCategory <= stringArray.length){ returnValue = stringArray[this.fidVictimCategory-1]; }else{ - stringArray = null; returnValue = ""; } @@ -457,132 +465,108 @@ public class IncidentReport implements ClusterItem { } public String getSuspectWeaponsString(Context context) { - String returnValue = ""; - String[] stringArray; + String returnValue; + String[] stringArray = context.getResources().getStringArray(R.array.cat_suspect_weapons); - if(this.fidSuspectWeaponCategory > 0){ - stringArray = context.getResources().getStringArray(R.array.cat_suspect_weapons); - returnValue = stringArray[this.fidSuspectWeaponCategory-1]; + if(this.fidSuspectWeaponCategory > 0 && this.fidSuspectWeaponCategory <= stringArray.length){ + if(stringArray.length == this.fidSuspectWeaponCategory){ + returnValue = etcSuspectWeaponCategory; + }else{ + returnValue = stringArray[this.fidSuspectWeaponCategory-1]; + + if(this.fidSuspectWeaponCategory < 5 && this.etcSuspectWeaponCategory.trim().length() > 0) { + returnValue += " ( "+this.etcSuspectWeaponCategory+" )"; + } + } }else{ - stringArray = null; returnValue = ""; } - if(stringArray != null && (stringArray.length == this.fidSuspectWeaponCategory)){ - returnValue = etcSuspectWeaponCategory; - }else if(stringArray != null){ - returnValue = stringArray[this.fidSuspectWeaponCategory-1]; - } - - if(this.fidSuspectWeaponCategory < 5 && this.etcSuspectWeaponCategory.length() > 0) { - returnValue += " ( "+this.etcSuspectWeaponCategory+" )"; - } - return returnValue; } public String getSuspectNoOfString(Context context) { - String returnValue = ""; - String[] stringArray; + String returnValue; + String[] stringArray = context.getResources().getStringArray(R.array.cat_suspect_count); - if(this.fidSuspectCountCategory > 0){ - stringArray = context.getResources().getStringArray(R.array.cat_suspect_count); - returnValue = stringArray[this.fidSuspectCountCategory-1]; + if(this.fidSuspectCountCategory > 0 && this.fidSuspectCountCategory <= stringArray.length){ + if(stringArray.length == this.fidSuspectCountCategory){ + returnValue = etcSuspectCountCategory; + }else{ + returnValue = stringArray[this.fidSuspectCountCategory-1]; + } }else{ - stringArray = null; returnValue = ""; } - if(stringArray != null && (stringArray.length == this.fidSuspectCountCategory)){ - returnValue = etcSuspectCountCategory; - }else if(stringArray != null){ - returnValue = stringArray[this.fidSuspectCountCategory-1]; - } - return returnValue; } public String getVictimOriginString(Context context) { - String returnValue = ""; - String[] stringArray; + String returnValue; + String[] stringArray = context.getResources().getStringArray(R.array.cat_victim_origin); - if(this.fidVictimOriginCategory > 0){ - stringArray = context.getResources().getStringArray(R.array.cat_victim_origin); - returnValue = stringArray[this.fidVictimOriginCategory-1]; + if(this.fidVictimOriginCategory > 0 && this.fidVictimOriginCategory <= stringArray.length){ + if(stringArray.length == this.fidVictimOriginCategory){ + returnValue = etcVictimOriginCategory; + }else{ + returnValue = stringArray[this.fidVictimOriginCategory-1]; + } }else{ - stringArray = null; returnValue = ""; } - if(stringArray != null && (stringArray.length == this.fidVictimOriginCategory)){ - returnValue = etcVictimOriginCategory; - }else if(stringArray != null){ - returnValue = stringArray[this.fidVictimOriginCategory-1]; - } - return returnValue; } public String getSuspectTransportString(Context context) { - String returnValue = ""; - String[] stringArray; + String returnValue; + String[] stringArray = context.getResources().getStringArray(R.array.cat_details_vehicle); - if(this.fidSuspectTransportationCategory > 0){ - stringArray = context.getResources().getStringArray(R.array.cat_details_vehicle); - returnValue = stringArray[this.fidSuspectTransportationCategory-1]; + if(this.fidSuspectTransportationCategory > 0 && this.fidSuspectTransportationCategory <= stringArray.length){ + if(stringArray.length == this.fidSuspectTransportationCategory){ + returnValue = etcSuspectTransportationCategory; + }else{ + returnValue = stringArray[this.fidSuspectTransportationCategory-1]; + } }else{ - stringArray = null; returnValue = ""; } - if(stringArray != null && (stringArray.length == this.fidSuspectTransportationCategory)){ - returnValue = etcSuspectTransportationCategory; - }else if(stringArray != null){ - returnValue = stringArray[this.fidSuspectTransportationCategory-1]; - } - return returnValue; } public String getVictimAffiliationString(Context context) { - String returnValue = ""; - String[] stringArray; + String returnValue; + String[] stringArray = context.getResources().getStringArray(R.array.cat_details_victimaff); - if(this.fidVictimBelongingCategory > 0){ - stringArray = context.getResources().getStringArray(R.array.cat_details_victimaff); - returnValue = stringArray[this.fidVictimBelongingCategory-1]; + if(this.fidVictimBelongingCategory > 0 && this.fidVictimBelongingCategory <= stringArray.length){ + if(stringArray.length == this.fidVictimBelongingCategory){ + returnValue = etcVictimBelongingCategory; + }else{ + returnValue = stringArray[this.fidVictimBelongingCategory-1]; + } }else{ - stringArray = null; returnValue = ""; } - if(stringArray != null && (stringArray.length == this.fidVictimBelongingCategory)){ - returnValue = etcVictimBelongingCategory; - }else if(stringArray != null){ - returnValue = stringArray[this.fidVictimBelongingCategory-1]; - } - return returnValue; } public String getSuspectRecognitionString(Context context) { - String returnValue = ""; - String[] stringArray; + String returnValue; + String[] stringArray = context.getResources().getStringArray(R.array.cat_details_suspect_recon); if(this.fidSuspectCharacteristicsCategory > 0){ - stringArray = context.getResources().getStringArray(R.array.cat_details_suspect_recon); - returnValue = stringArray[this.fidSuspectCharacteristicsCategory-1]; + if(stringArray.length == this.fidSuspectCharacteristicsCategory){ + returnValue = etcSuspectCharacteristicsCategory; + }else{ + returnValue = stringArray[this.fidSuspectCharacteristicsCategory-1]; + } }else{ - stringArray = null; returnValue = ""; } - if(stringArray != null && (stringArray.length == this.fidSuspectCharacteristicsCategory)){ - returnValue = etcSuspectCharacteristicsCategory; - }else if(stringArray != null){ - returnValue = stringArray[this.fidSuspectCharacteristicsCategory-1]; - } - return returnValue; } @@ -590,7 +574,7 @@ public class IncidentReport implements ClusterItem { /* Simple Getters and Setter below - */ + */ public void setPosition(LatLng position) { this.incidentPosition = position; diff --git a/app/src/main/java/org/deke/risk/riskahead/helper/ValidatedEditTextPreference.java b/app/src/main/java/org/deke/risk/riskahead/helper/ValidatedEditTextPreference.java index 24543ce..bf4d4cb 100644 --- a/app/src/main/java/org/deke/risk/riskahead/helper/ValidatedEditTextPreference.java +++ b/app/src/main/java/org/deke/risk/riskahead/helper/ValidatedEditTextPreference.java @@ -13,6 +13,8 @@ import android.util.Log; import android.util.Patterns; import android.widget.Button; +import org.deke.risk.riskahead.R; + /** * Copyright 2015 RiskAhead Dennis Thiessen *

@@ -58,14 +60,12 @@ public class ValidatedEditTextPreference extends EditTextPreference if((getEditText().getInputType() & InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) != 0){ if (!Patterns.EMAIL_ADDRESS.matcher(value).matches()) { - getEditText().setError("Please enter a valid email address\n" + - "e.g.: text@abc.de"); + getEditText().setError(getEditText().getContext().getResources().getString(R.string.error_email)); enable = false; } }else{ if (value.length() < 5) { - getEditText().setError("Your username must be at least\n" + - "5 characters in length."); + getEditText().setError(getEditText().getContext().getResources().getString(R.string.error_anytext)); enable = false; } } diff --git a/app/src/main/res/layout/activity_view_report.xml b/app/src/main/res/layout/activity_view_report.xml index 8845aa8..41cf9cb 100644 --- a/app/src/main/res/layout/activity_view_report.xml +++ b/app/src/main/res/layout/activity_view_report.xml @@ -38,7 +38,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:padding="10dp" - android:layout_marginRight="45dp" + android:layout_marginRight="55dp" android:layout_weight="1"> Jetzt melden! Weiter + Feedback senden - Could not log-in. Please try again later or contact RiskAhead support. - Sorry, could not log-in. Please try again later or contact RiskAhead support. - Sorry, could not registrate. Please try again later or contact RiskAhead support. - Sorry, could not send E-Mail. Please try again later or contact RiskAhead support. - Sorry, we could not send you an activation link. Please try again later or contact RiskAhead support. - Sorry, could not load info window values. Please try again later or contact RiskAhead support. - Create new incident? - Do you want to reset all values and create a new incident? - You have bought - Thank you for your support! - There was an error parsing your purchase data. Please try again or contact RiskAhead support. - Delete incident? - Do you really want to delete this incident? A deleted incident can not be restored. - Sorry, we could not delete this incident. Please try again later or contact RiskAhead support. - Sorry, we could not retrieve incident details. Please try again later or contact RiskAhead support. - You can not vote your own incident. - Sorry, we could not save your vote. Please try again later or contact RiskAhead support. + + Neuen Vorfall anlegen? + Willst du alle gemachten Eingaben zurücksetzen und einen neuen Vorfall erstellen? + Du hast gekauft + Vielen Dank für deine Unterstützung! + Vorfall löschen? + Willst du wirklich diesen Vorfall löschen? Ein gelöschter Vorfall kann nicht wiederhergestellt werden. + + Bitte versuche es später erneut oder schreibe dem RiskAhead Support. + Anmeldung ist fehlgeschlagen. + Registrierung ist fehlgeschlagen. + Konnte keine E-Mail versenden. + Aktivierungslink konnte nicht versendet werden. + Vorfall konnte nicht geladen werden. + Es gab einen Fehler bei der Verarbeitung Ihrer Bestellung. + Vorfall konnte nicht gelöscht werden. + Vorfall konnte nicht geladen werden. + Du kannst nicht für deinen eigenen Vorfall stimmen. + Stimme konnte nicht gespeichert werden. + Konnte Profil nicht abrufen. + Passwort zurücksetzen? + Willst du wirklich dein Passwort zurücksetzen? Eine E-Mail wird dazu an deine Adresse versendet. Bitte folge dem Link um dein Passwort zurückzusetzen. + Versenden der Passwort-Zurücksetzen E-Mail fehlgeschlagen. + Benutzerinstellungen konnten nicht gespeichert werden. + Top10 Liste konnte nicht geladen werden. + + Stimme erfasst. Wertung aktualisiert! + Vorfall wurde gelöscht + Vorfall erfolgreich hinzugefügt! + Benutzereinstellungen erfolgreich geändert + (Nur Premium) + Benutzereinstellungen + Benutzername + Bitte gebe deinen Benutzernamen ein + Name + Bitte gebe deinen Namen ein + Nachname + Bitte gebe deinen Nachnamen ein + E-Mail + Bitte gebe deine E-Mail Adresse ein + Passwort zurücksetzen + Fordere ein neues Passwort an + Benachrichtigungen + Zeige Benachrichtigungen + Aktiviere Benachrichtigungen in deiner Umgebung + Radius + Wähle den Radius um deine letzte bekannte Position von wo du aus Benachrichtungen erhalten möchtest + Abrufhäufigkeit + Wähle wie häufig deine Umgebung nach neuen Vorfällen untersucht werden soll + Aktiviere GPS + Deine letzte bekannte Position wird automatisch durch GPS bestimmt (GPS muss in den Geräteeinstellungen aktiviert sein) + Wähle deine Position + Deine Position (Latitude/Longitude): Allgemeiner Vorfall/Situation @@ -238,7 +275,6 @@ Regelmäßig Bestimmter Zeitpunkt Bestimmter Zeitraum - Weiß ich nicht diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d34c7a5..2656010 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -152,24 +152,60 @@ Report NOW! Next Send Feedback - Could not log-in. Please try again later or contact RiskAhead support. - Sorry, could not log-in. Please try again later or contact RiskAhead support. - Sorry, could not registrate. Please try again later or contact RiskAhead support. - Sorry, could not send E-Mail. Please try again later or contact RiskAhead support. - Sorry, we could not send you an activation link. Please try again later or contact RiskAhead support. - Sorry, could not load info window values. Please try again later or contact RiskAhead support. + Create new incident? Do you want to reset all values and create a new incident? - Sorry, we could not save your incident. Please try again later or contact RiskAhead support. You have bought Thank you for your support! - There was an error parsing your purchase data. Please try again or contact RiskAhead support. Delete incident? Do you really want to delete this incident? A deleted incident can not be restored. - Sorry, we could not delete this incident. Please try again later or contact RiskAhead support. - Sorry, we could not retrieve incident details. Please try again later or contact RiskAhead support. + + Please try again later or contact RiskAhead support. + Could not log-in. . + Could not registrate. + Could not send E-Mail. + Could not send you an activation link. + Could not load info window values. + Could not save your incident. + There was an error parsing your purchase data. + Could not delete this incident. + Could not retrieve incident details. You can not vote your own incident. - Sorry, we could not save your vote. Please try again later or contact RiskAhead support. + Could not save your vote. + Could not retrieve profile stats. + Reset password? + Do you really want to reset your password? An E-Mail will be send to your address. Please follow the given link to reset your password. + Could not send you an password reset E-Mail. + Could not change your user settings. + Could not get the Top10 list. + + Voted! Score updated. + Incident deleted + Report added! + User settings changed successfully + (Only Premium) + Account Settings + Username + Please enter your username + Name + Please enter your name + Surname + Please enter your surname + E-Mail + Please enter your email + Reset Password + Request a new password + Notifications + Show Notifications + Enable notifications in your area + Radius + Choose the radius from your last known location in which notifications will be displayed + Poll Frequency + Decide how often notification updates should be received from server + Enable GPS + Get your last know location with GPS (GPS has to be activated in your device settings) + Choose your location + Your Location (Latitude/Longitude): Allgemeiner Vorfall/Situation @@ -243,7 +279,6 @@ Regelmäßig Bestimmter Zeitpunkt Bestimmter Zeitraum - Weiß ich nicht @@ -361,5 +396,4 @@ 60 - diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml index b7a0680..e04ccd5 100644 --- a/app/src/main/res/xml/settings.xml +++ b/app/src/main/res/xml/settings.xml @@ -3,74 +3,74 @@ xmlns:android="http://schemas.android.com/apk/res/android"> + android:title="@string/txt_settings_acc_headline"> + android:title="@string/txt_settings_username" + android:summary="@string/txt_settings_username_sum" + android:dialogTitle="@string/txt_settings_username_sum" /> + android:title="@string/txt_settings_name_title" + android:summary="@string/txt_settings_name_sum" + android:dialogTitle="@string/txt_settings_name_sum" /> + android:title="@string/txt_settings_surname_title" + android:summary="@string/txt_settings_surname_sum" + android:dialogTitle="@string/txt_settings_surname_sum" /> + android:title="@string/txt_settings_email_title" + android:summary="@string/txt_settings_email_sum" + android:dialogTitle="@string/txt_settings_email_sum" /> + android:title="@string/txt_settings_resetpw_title" + android:summary="@string/txt_settings_resetpw_sum" /> + android:title="@string/txt_settings_notify_head"> + android:title="@string/txt_settings_showno_title" + android:summary="@string/txt_settings_showno_sum" /> + android:summary="@string/txt_settings_notify_showradius_sum" + android:dialogTitle="@string/txt_settings_notify_showradius" /> + android:summary="@string/txt_settings_notify_pollfreq_sum" + android:dialogTitle="@string/txt_settings_notify_pollfreq" /> + android:title="@string/txt_settings_gps_enable_title" + android:summary="@string/txt_settings_gps_enable_sum" /> + android:title="@string/txt_settings_gps_loca_title" + android:summary="@string/txt_settings_gps_loca_sum" />