DT @11.12.2015: Report-Workflow weiterentwickelt (noch nicht fertig), Map-Icons hinzugefügt, Performance auf der Map verbessert, Theme angepasst

This commit is contained in:
Dennis Thießen
2015-12-11 15:22:01 +01:00
parent 6b6f3a8340
commit 69a4493dc4
22 changed files with 767 additions and 303 deletions

View File

@@ -134,7 +134,6 @@
<orderEntry type="library" exported="" name="twitter-core-1.4.1" level="project" /> <orderEntry type="library" exported="" name="twitter-core-1.4.1" level="project" />
<orderEntry type="library" exported="" name="play-services-analytics-7.5.0" level="project" /> <orderEntry type="library" exported="" name="play-services-analytics-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-7.5.0" level="project" /> <orderEntry type="library" exported="" name="play-services-7.5.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.2.4" level="project" />
<orderEntry type="library" exported="" name="mediarouter-v7-22.0.0" level="project" /> <orderEntry type="library" exported="" name="mediarouter-v7-22.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-wallet-7.5.0" level="project" /> <orderEntry type="library" exported="" name="play-services-wallet-7.5.0" level="project" />
<orderEntry type="library" exported="" name="bolts-android-1.2.0" level="project" /> <orderEntry type="library" exported="" name="bolts-android-1.2.0" level="project" />
@@ -147,6 +146,7 @@
<orderEntry type="library" exported="" name="android-maps-utils-0.3.4" level="project" /> <orderEntry type="library" exported="" name="android-maps-utils-0.3.4" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-7.5.0" level="project" /> <orderEntry type="library" exported="" name="play-services-ads-7.5.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.4" level="project" />
<orderEntry type="library" exported="" name="play-services-location-7.5.0" level="project" /> <orderEntry type="library" exported="" name="play-services-location-7.5.0" level="project" />
</component> </component>
</module> </module>

View File

@@ -42,6 +42,7 @@ dependencies {
compile 'com.facebook.android:facebook-android-sdk:4.1.0' compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.beardedhen:androidbootstrap:2.0.1' compile 'com.beardedhen:androidbootstrap:2.0.1'
compile 'com.mcxiaoke.volley:library:1.0.+' compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.google.code.gson:gson:2.4'
compile('com.twitter.sdk.android:twitter-core:1.4.1@aar') { compile('com.twitter.sdk.android:twitter-core:1.4.1@aar') {
transitive = true; transitive = true;
} }

View File

@@ -18,7 +18,7 @@
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/CustomActionBarTheme"> android:theme="@style/MyRiskAheadTheme">
<!-- Google Maps Android API V2 requires OpenGL ES version 2 --> <!-- Google Maps Android API V2 requires OpenGL ES version 2 -->
<uses-feature <uses-feature

View File

@@ -29,6 +29,7 @@ import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.TileOverlay; import com.google.android.gms.maps.model.TileOverlay;
@@ -53,26 +54,27 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCallbacks<Cursor>, ClusterManager.OnClusterItemInfoWindowClickListener<AppClusterItem>, ClusterManager.OnClusterClickListener<AppClusterItem>, ClusterManager.OnClusterItemClickListener<AppClusterItem>{ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCallbacks<Cursor>,
ClusterManager.OnClusterItemInfoWindowClickListener<AppClusterItem>, ClusterManager.OnClusterClickListener<AppClusterItem>, ClusterManager.OnClusterItemClickListener<AppClusterItem>{
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 static GoogleMap mMap; private static GoogleMap mMap;
Marker mMarker; private Marker mMarker;
ArrayList<AppClusterItem> myMarkers = new ArrayList<AppClusterItem>();
private float previousZoomLevel = -1.0f; private AppClusterItem clickedClusterItem;
private boolean isZooming = false; private ArrayList<AppClusterItem> myMarkers = new ArrayList<AppClusterItem>();
private HashMap<Integer, AppClusterItem> visibleMarkers = new HashMap<Integer, AppClusterItem>();
private List<LatLng> mHeatMapPositionList = new ArrayList<>();
private ClusterManager<AppClusterItem> mClusterManager;
private boolean isMarkerShown = false;
private LatLng myLocation; private LatLng myLocation;
private LatLng markedLocation; private LatLng markedLocation;
private AppClusterItem clickedClusterItem;
private List<LatLng> mPositionList = new ArrayList<>();
ClusterManager<AppClusterItem> mClusterManager;
private static final int DEFAULT_ZOOM_LEVEL = 14; private static final int DEFAULT_ZOOM_LEVEL = 14;
private static final int THRESHOLD_ZOOM_LEVEL = 7; private static final int THRESHOLD_ZOOM_LEVEL = 7;
@@ -122,24 +124,61 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
mClusterManager.onCameraChange(position); mClusterManager.onCameraChange(position);
Log.d("Zoom", "Zoom: " + position.zoom); Log.d("Zoom", "Zoom: " + position.zoom);
if(previousZoomLevel != position.zoom) if(position.zoom >= THRESHOLD_ZOOM_LEVEL)
{ {
if(previousZoomLevel < THRESHOLD_ZOOM_LEVEL && position.zoom >= THRESHOLD_ZOOM_LEVEL){ //mClusterManager.addItems(myMarkers);
mClusterManager.addItems(myMarkers); addMarkersToMap();
}else if(previousZoomLevel > THRESHOLD_ZOOM_LEVEL && position.zoom <= THRESHOLD_ZOOM_LEVEL){ isMarkerShown = true;
mClusterManager.clearItems(); } else if (position.zoom < THRESHOLD_ZOOM_LEVEL && (isMarkerShown == true)){
} mClusterManager.clearItems();
visibleMarkers.clear();
isMarkerShown = false;
} }
previousZoomLevel = position.zoom;
} }
}; };
} }
private void addMarkersToMap(){
LatLngBounds bounds = mMap.getProjection().getVisibleRegion().latLngBounds;
//Loop through all the items that are available to be placed on the map
for(AppClusterItem item : myMarkers)
{
//If the item is within the the bounds of the screen
if(bounds.contains(item.getPosition()))
{
//If the item isn't already being displayed
if(!visibleMarkers.containsKey(item.getID()))
{
Log.d(TAG,"Should add now marker!");
mClusterManager.addItem(item);
mClusterManager.cluster();
visibleMarkers.put(item.getID(),item);
}
} else {
/*
//If the course was previously on screen
if(courseMarkers.containsKey(item.getId()))
{
//1. Remove the Marker from the GoogleMap
courseMarkers.get(item.getId()).remove();
//2. Remove the reference to the Marker from the HashMap
courseMarkers.remove(item.getId());
}
*/
}
}
}
private void setUpClustering() { private void setUpClustering() {
mClusterManager = new ClusterManager<AppClusterItem>(this, mMap); mClusterManager = new ClusterManager<AppClusterItem>(this, mMap);
mMap.setOnCameraChangeListener(getCameraChangeListener()); mMap.setOnCameraChangeListener(getCameraChangeListener());
mClusterManager.setRenderer(new OwnIconRendered(MapsActivity.this,mMap,mClusterManager)); mClusterManager.setRenderer(new OwnIconRendered(MapsActivity.this,mMap,mClusterManager));
@@ -230,7 +269,7 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
private void addHeatMap() { private void addHeatMap() {
HeatmapTileProvider mProvider = new HeatmapTileProvider.Builder() HeatmapTileProvider mProvider = new HeatmapTileProvider.Builder()
.data(mPositionList) .data(mHeatMapPositionList)
.radius(50) .radius(50)
.build(); .build();
@@ -380,10 +419,8 @@ public class MapsActivity extends BaseActivity implements LoaderManager.LoaderCa
LatLng pos = new LatLng(Double.parseDouble(incident.getString("latitude")),Double.parseDouble(incident.getString("longitude"))); LatLng pos = new LatLng(Double.parseDouble(incident.getString("latitude")),Double.parseDouble(incident.getString("longitude")));
Log.d(TAG, "Adding marker with position: " + pos.latitude + " : " + pos.longitude); Log.d(TAG, "Adding marker with position: " + pos.latitude + " : " + pos.longitude);
AppClusterItem offsetItem = new AppClusterItem(incident,pos); myMarkers.add(new AppClusterItem(incident,pos));
myMarkers.add(offsetItem); mHeatMapPositionList.add(pos);
mPositionList.add(pos);
} }
addHeatMap(); addHeatMap();

View File

@@ -2,38 +2,48 @@ package org.deke.risk.riskahead;
import android.app.Fragment; import android.app.Fragment;
import android.app.FragmentTransaction; import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu; import android.view.Menu;
import android.view.View; import android.view.View;
import com.beardedhen.androidbootstrap.BootstrapButton; import com.beardedhen.androidbootstrap.BootstrapButton;
import com.google.android.gms.maps.model.LatLng;
import com.google.gson.Gson;
import org.deke.risk.riskahead.fragments.ReportWF_1_Fragment; import org.deke.risk.riskahead.fragments.ReportWF_1_Fragment;
import org.deke.risk.riskahead.fragments.ReportWF_2_Fragment; import org.deke.risk.riskahead.fragments.ReportWF_2_Fragment;
import org.deke.risk.riskahead.helper.AppClusterItem;
import org.deke.risk.riskahead.helper.BaseActivity; import org.deke.risk.riskahead.helper.BaseActivity;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragment.OnInputFinishedListener, ReportWF_2_Fragment.OnInputFinishedListener { public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragment.OnInputFinishedListener, ReportWF_1_Fragment.OnCallMapListener, ReportWF_2_Fragment.OnInputFinishedListener {
private final static String mActivityTitle = "Report NEW"; private final static String mActivityTitle = "Report NEW";
private final static String TAG = ReportWFActivity.class.getSimpleName(); private final static String TAG = ReportWFActivity.class.getSimpleName();
List<Fragment> fragList = new ArrayList<Fragment>(); private List<Fragment> fragList = new ArrayList<Fragment>();
Fragment frag_report_1 = new ReportWF_1_Fragment(); private Fragment frag_report_1 = new ReportWF_1_Fragment();
Fragment frag_report_2 = new ReportWF_2_Fragment(); private Fragment frag_report_2 = new ReportWF_2_Fragment();
BootstrapButton btnContinue; private BootstrapButton btnContinue;
BootstrapButton btnReportNow; private BootstrapButton btnReportNow;
private AppClusterItem incident = new AppClusterItem();
private int currentState = 0; private int currentState = 0;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_report_wf);
fragList.add(frag_report_1); fragList.add(frag_report_1);
fragList.add(frag_report_2); fragList.add(frag_report_2);
@@ -49,17 +59,48 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
} }
}); });
btnReportNow = (BootstrapButton) findViewById(R.id.btn_reportwf_reportnow); btnReportNow = (BootstrapButton) findViewById(R.id.btn_reportwf_reportnow);
btnReportNow.setVisibility(View.INVISIBLE); btnReportNow.setVisibility(View.INVISIBLE);
} }
private void modifiyPos(String pos){
String[] position = pos.split(":");
Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
LatLng latlngpos = new LatLng(Double.parseDouble(position[0]), Double.parseDouble(position[1]));
try {
List<Address> addressList = geocoder.getFromLocation(latlngpos.latitude,latlngpos.longitude,1);
if (addressList != null && addressList.size() > 0) {
Address address = addressList.get(0);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < address.getMaxAddressLineIndex(); i++) {
if(address.getAddressLine(i) != null) sb.append(address.getAddressLine(i)).append("\n");
}
if(address.getCountryName() != null) sb.append(address.getCountryName());
incident.setmPosDescription(sb.toString());
}
incident.setPosition(latlngpos);
} catch (IOException e) {
e.printStackTrace();
}
}
public AppClusterItem getIncident(){
return incident;
}
public void setIncident(AppClusterItem newIncident){
incident = newIncident;
}
private void initFragment(int state) { private void initFragment(int state) {
FragmentTransaction transaction = getFragmentManager().beginTransaction(); FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_reportwf, fragList.get(state)); transaction.replace(R.id.fragment_reportwf, fragList.get(state));
transaction.addToBackStack(null); transaction.addToBackStack(null);
transaction.commit(); transaction.commit();
if(state > 1) btnReportNow.setVisibility(View.VISIBLE); if(state > 1) btnReportNow.setVisibility(View.VISIBLE);
@@ -99,4 +140,38 @@ public class ReportWFActivity extends BaseActivity implements ReportWF_1_Fragmen
btnReportNow.setVisibility(View.INVISIBLE); btnReportNow.setVisibility(View.INVISIBLE);
} }
} }
@Override
public void onStop(){
super.onStop();
SharedPreferences mPrefs = getPreferences(MODE_PRIVATE);
Gson gson = new Gson();
SharedPreferences.Editor prefsEditor = mPrefs.edit();
prefsEditor.putString("incident",gson.toJson(incident));
prefsEditor.commit();
}
@Override
public void onResume(){
super.onResume();
SharedPreferences mPrefs = getPreferences(MODE_PRIVATE);
Gson gson = new Gson();
if(!mPrefs.getString("incident", "").equals("")) incident = gson.fromJson(mPrefs.getString("incident", ""), AppClusterItem.class);
Intent intent = getIntent();
String pos = intent.getStringExtra(EXTRA_MESSAGE);
if(pos != null) modifiyPos(pos);
}
@Override
public void onCallMap() {
gotoMapActivity();
}
} }

View File

@@ -52,7 +52,7 @@ public class ReportlistActivity extends BaseActivity {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
try { try {
gotoViewReportActivity(resultList.get(position).getString("uid")); gotoViewReportActivity(resultList.get(position).getInt("uid"));
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@@ -49,7 +49,7 @@ public class ViewReportActivity extends BaseActivity {
userHasToBeLoggedIn(); userHasToBeLoggedIn();
Intent intent = getIntent(); Intent intent = getIntent();
final String uid = intent.getStringExtra(BaseActivity.EXTRA_MESSAGE); final Integer uid = intent.getIntExtra(BaseActivity.EXTRA_MESSAGE, 0);
txtTitle = (EditText) findViewById(R.id.input_viewreport_short); txtTitle = (EditText) findViewById(R.id.input_viewreport_short);
txtDescription = (EditText) findViewById(R.id.input_viewreport_long); txtDescription = (EditText) findViewById(R.id.input_viewreport_long);
@@ -99,7 +99,7 @@ public class ViewReportActivity extends BaseActivity {
}); });
} }
private void deleteReport(String uid) { private void deleteReport(Integer uid) {
deleteIncident(uid); deleteIncident(uid);
} }
@@ -113,19 +113,19 @@ public class ViewReportActivity extends BaseActivity {
return mActivityTitle; return mActivityTitle;
} }
public void getIncident(String uid) { public void getIncident(Integer uid) {
String tag_string_req = "getincidentwithpositionfromid"; String tag_string_req = "getincidentwithpositionfromid";
StringRequest strReq = getStringRequestGetIncidentWithPositionFromID(uid); StringRequest strReq = getStringRequestGetIncidentWithPositionFromID(uid);
AppController.getInstance().addToRequestQueue(strReq, tag_string_req); AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
} }
public void deleteIncident(String uid) { public void deleteIncident(Integer uid) {
String tag_string_req = "deactivateIncident"; String tag_string_req = "deactivateIncident";
StringRequest strReq = getStringRequestDeleteIncident(uid); StringRequest strReq = getStringRequestDeleteIncident(uid);
AppController.getInstance().addToRequestQueue(strReq, tag_string_req); AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
} }
private StringRequest getStringRequestDeleteIncident(final String incidentid) { private StringRequest getStringRequestDeleteIncident(final Integer incidentid) {
showDialog(); showDialog();
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() { return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
@@ -167,7 +167,7 @@ public class ViewReportActivity extends BaseActivity {
params.put("tag", "deactivateincident"); params.put("tag", "deactivateincident");
params.put("uid", user.get("uid")); params.put("uid", user.get("uid"));
params.put("token", user.get("token")); params.put("token", user.get("token"));
params.put("incidentid", incidentid); params.put("incidentid", incidentid.toString());
return params; return params;
@@ -176,7 +176,7 @@ public class ViewReportActivity extends BaseActivity {
} }
private StringRequest getStringRequestGetIncidentWithPositionFromID(final String incidentid) { private StringRequest getStringRequestGetIncidentWithPositionFromID(final Integer incidentid) {
showDialog(); showDialog();
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() { return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
@@ -263,7 +263,7 @@ public class ViewReportActivity extends BaseActivity {
params.put("tag", "getincidentfromid"); params.put("tag", "getincidentfromid");
params.put("uid", user.get("uid")); params.put("uid", user.get("uid"));
params.put("token", user.get("token")); params.put("token", user.get("token"));
params.put("incidentid", incidentid); params.put("incidentid", incidentid.toString());
return params; return params;
@@ -272,13 +272,13 @@ public class ViewReportActivity extends BaseActivity {
}; };
} }
public void getIncidentVoteScore(String uid) { public void getIncidentVoteScore(Integer uid) {
String tag_string_req = "getincidentvotescore"; String tag_string_req = "getincidentvotescore";
StringRequest strReq = getStringRequestGetIncidentVoteScore(uid); StringRequest strReq = getStringRequestGetIncidentVoteScore(uid);
AppController.getInstance().addToRequestQueue(strReq, tag_string_req); AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
} }
private StringRequest getStringRequestGetIncidentVoteScore(final String incidentid) { private StringRequest getStringRequestGetIncidentVoteScore(final Integer incidentid) {
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() { return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
@Override @Override
@@ -318,26 +318,26 @@ public class ViewReportActivity extends BaseActivity {
params.put("tag", "getincidentvotescore"); params.put("tag", "getincidentvotescore");
params.put("uid", user.get("uid")); params.put("uid", user.get("uid"));
params.put("token", user.get("token")); params.put("token", user.get("token"));
params.put("incidentid", incidentid); params.put("incidentid", incidentid.toString());
return params; return params;
} }
}; };
} }
public void makeUpvote(String uid) { public void makeUpvote(Integer uid) {
String tag_string_req = "addvote"; String tag_string_req = "addvote";
StringRequest strReq = getStringRequestAddVote(uid, "1"); StringRequest strReq = getStringRequestAddVote(uid, "1");
AppController.getInstance().addToRequestQueue(strReq, tag_string_req); AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
} }
public void makeDownvote(String uid) { public void makeDownvote(Integer uid) {
String tag_string_req = "addvote"; String tag_string_req = "addvote";
StringRequest strReq = getStringRequestAddVote(uid, "2"); StringRequest strReq = getStringRequestAddVote(uid, "2");
AppController.getInstance().addToRequestQueue(strReq, tag_string_req); AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
} }
private StringRequest getStringRequestAddVote(final String incidentid, final String votetype) { private StringRequest getStringRequestAddVote(final Integer incidentid, final String votetype) {
return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() { return new StringRequest(Request.Method.POST, AppConfig.URL_REGISTER, new Response.Listener<String>() {
@Override @Override
@@ -380,7 +380,7 @@ public class ViewReportActivity extends BaseActivity {
params.put("tag", "addvote"); params.put("tag", "addvote");
params.put("uid", user.get("uid")); params.put("uid", user.get("uid"));
params.put("token", user.get("token")); params.put("token", user.get("token"));
params.put("incidentid", incidentid); params.put("incidentid", incidentid.toString());
params.put("votetype", votetype); params.put("votetype", votetype);
return params; return params;

View File

@@ -9,11 +9,17 @@ import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView;
import com.beardedhen.androidbootstrap.AwesomeTextView; import com.beardedhen.androidbootstrap.BootstrapButton;
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.helper.AppClusterItem;
import org.deke.risk.riskahead.helper.BaseActivity;
import org.deke.risk.riskahead.helper.HintAdapter; import org.deke.risk.riskahead.helper.HintAdapter;
/** /**
@@ -23,16 +29,27 @@ public class ReportWF_1_Fragment extends Fragment{
private View mainview; private View mainview;
Spinner spinner_main_1; private Spinner spinner_main_1;
Spinner spinner_sub_1; private Spinner spinner_sub_1;
private EditText sub_1_etc;
private RelativeLayout rl_pos;
private BootstrapButton btnPos;
private TextView txtPosDetail;
OnInputFinishedListener mCallback; private boolean isCatFinished;
AppClusterItem tmpIncident = new AppClusterItem();
OnInputFinishedListener mCallbackFinished;
OnCallMapListener mCallbackMapListener;
public interface OnCallMapListener {
void onCallMap();
}
public interface OnInputFinishedListener { public interface OnInputFinishedListener {
void onInputFinished(boolean finished); void onInputFinished(boolean finished);
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@@ -44,18 +61,23 @@ public class ReportWF_1_Fragment extends Fragment{
initSpinnerOneMain(); initSpinnerOneMain();
initSpinnerOneSub(); initSpinnerOneSub();
initLayerPosition();
return mainview; return mainview;
} }
private void isFinished(boolean isFinished){ private void checkIfFinished(){
if(isFinished){ boolean isFinished = isCatFinished && (tmpIncident != null) && (tmpIncident.getPosition() != null);
if(isCatFinished) mainview.findViewById(R.id.ll_pos).setVisibility(View.VISIBLE);
if(isFinished ){
mainview.findViewById(R.id.atv_reportwf_1_finish).setVisibility(View.VISIBLE); mainview.findViewById(R.id.atv_reportwf_1_finish).setVisibility(View.VISIBLE);
}else{ }else{
mainview.findViewById(R.id.atv_reportwf_1_finish).setVisibility(View.INVISIBLE); mainview.findViewById(R.id.atv_reportwf_1_finish).setVisibility(View.INVISIBLE);
} }
mCallback.onInputFinished(isFinished); mCallbackFinished.onInputFinished(isFinished);
} }
private void initSpinnerOneMain() { private void initSpinnerOneMain() {
@@ -101,13 +123,14 @@ public class ReportWF_1_Fragment extends Fragment{
adapter_sub_1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter_sub_1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner_sub_1.setAdapter(new HintAdapter(adapter_sub_1, R.layout.contact_spinner_row_nothing_selected, getActivity())); spinner_sub_1.setAdapter(new HintAdapter(adapter_sub_1, R.layout.contact_spinner_row_nothing_selected, getActivity()));
if (((HintAdapter) spinner_main_1.getAdapter()).isInInitialState()){ if (((HintAdapter) spinner_main_1.getAdapter()).isInInitialState()) {
spinner_sub_1.setVisibility(View.INVISIBLE); spinner_sub_1.setVisibility(View.INVISIBLE);
}else{ } else {
spinner_sub_1.setVisibility(View.VISIBLE); spinner_sub_1.setVisibility(View.VISIBLE);
} }
isFinished(false); isCatFinished = false;
checkIfFinished();
} }
@Override @Override
@@ -118,6 +141,7 @@ public class ReportWF_1_Fragment extends Fragment{
} }
private void initSpinnerOneSub() { private void initSpinnerOneSub() {
sub_1_etc = (EditText) mainview.findViewById(R.id.txt_reportwf_1_cat_etc);
spinner_sub_1 = (Spinner) mainview.findViewById(R.id.dd_reportwf_1_cat_sub); spinner_sub_1 = (Spinner) mainview.findViewById(R.id.dd_reportwf_1_cat_sub);
spinner_sub_1.setVisibility(View.INVISIBLE); spinner_sub_1.setVisibility(View.INVISIBLE);
spinner_sub_1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { spinner_sub_1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@@ -153,11 +177,15 @@ public class ReportWF_1_Fragment extends Fragment{
mainview.findViewById(R.id.txt_reportwf_1_cat_etc).setVisibility(View.INVISIBLE); mainview.findViewById(R.id.txt_reportwf_1_cat_etc).setVisibility(View.INVISIBLE);
} }
if (((HintAdapter) spinner_sub_1.getAdapter()).isInInitialState()){ if (((HintAdapter) spinner_sub_1.getAdapter()).isInInitialState()) {
isFinished(false); isCatFinished = false;
}else{ checkIfFinished();
isFinished(true); } else {
isCatFinished = true;
checkIfFinished();
} }
if((position == 0) && (tmpIncident.getmFidCat1_Sub() != 0)) spinner_sub_1.setSelection(tmpIncident.getmFidCat1_Sub());
} }
@Override @Override
@@ -166,15 +194,71 @@ public class ReportWF_1_Fragment extends Fragment{
}); });
} }
private void initLayerPosition(){
rl_pos = (RelativeLayout) mainview.findViewById(R.id.ll_pos);
rl_pos.setVisibility(View.INVISIBLE);
btnPos = (BootstrapButton) mainview.findViewById(R.id.btn_reportwf_position);
txtPosDetail = (TextView) mainview.findViewById(R.id.lbl_reportwf_position_detail);
btnPos.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCallbackMapListener.onCallMap();
}
});
}
@Override
public void onResume() {
super.onResume();
tmpIncident = ((ReportWFActivity)getActivity()).getIncident();
if(tmpIncident != null){
if(tmpIncident.getPosition() != null){
rl_pos.setVisibility(View.VISIBLE);
txtPosDetail.setText(tmpIncident.getmPosDescription());
}
if(tmpIncident.getmFidCat1_Main() != 0){
spinner_main_1.setSelection(tmpIncident.getmFidCat1_Main());
}
if(tmpIncident.getmFidCat1_Sub() != 0){
spinner_sub_1.setSelection(tmpIncident.getmFidCat1_Sub());
}
if(tmpIncident.getmCat1_Sub_etc() != null){
sub_1_etc.setText(tmpIncident.getmCat1_Sub_etc());
}
}
checkIfFinished();
}
@Override
public void onPause() {
super.onPause();
tmpIncident.setmFidCat1_Main(spinner_main_1.getSelectedItemPosition());
tmpIncident.setmFidCat1_Sub(spinner_sub_1.getSelectedItemPosition());
tmpIncident.setmCat1_Sub_etc(sub_1_etc.getText().toString());
((ReportWFActivity)getActivity()).setIncident(tmpIncident);
}
@Override @Override
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
super.onAttach(activity); super.onAttach(activity);
try { try {
mCallback = (OnInputFinishedListener) activity; mCallbackFinished = (OnInputFinishedListener) activity;
mCallbackMapListener = (OnCallMapListener) activity;
} catch (ClassCastException e) { } catch (ClassCastException e) {
throw new ClassCastException(activity.toString() throw new ClassCastException(activity.toString()
+ " must implement OnInputFinishedListener"); + " must implement all Listeners");
} }
} }

View File

@@ -1,33 +1,46 @@
package org.deke.risk.riskahead.fragments; package org.deke.risk.riskahead.fragments;
import android.app.Activity; import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.Fragment; import android.app.Fragment;
import android.app.TimePickerDialog;
import android.os.Bundle; import android.os.Bundle;
import android.text.format.DateFormat;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.DatePicker;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TimePicker;
import com.beardedhen.androidbootstrap.AwesomeTextView;
import org.deke.risk.riskahead.R; import org.deke.risk.riskahead.R;
import org.deke.risk.riskahead.helper.HintAdapter; import org.deke.risk.riskahead.helper.HintAdapter;
import java.util.Calendar;
/** /**
* Created by Dennis on 08.12.2015. * Created by Dennis on 08.12.2015.
*/ */
public class ReportWF_2_Fragment extends Fragment{ public class ReportWF_2_Fragment extends Fragment {
View mainview; View mainview;
Spinner spinner_main_1; Spinner spinner_main_1;
Spinner spinner_sub_1; Spinner spinner_sub_1;
EditText input_time_from;
EditText input_date_from;
EditText input_time_to;
EditText input_date_to;
EditText tmpInput;
OnInputFinishedListener mCallback; OnInputFinishedListener mCallback;
public interface OnInputFinishedListener { public interface OnInputFinishedListener {
@@ -60,6 +73,43 @@ public class ReportWF_2_Fragment extends Fragment{
initLayoutFromTime(); initLayoutFromTime();
initLayoutToTime(); initLayoutToTime();
input_time_from = ((EditText) mainview.findViewById(R.id.input_report_from_time));
input_time_to = ((EditText) mainview.findViewById(R.id.input_report_to_time));
input_date_from = ((EditText) mainview.findViewById(R.id.input_report_from_date));
input_date_to = ((EditText) mainview.findViewById(R.id.input_report_to_date));
input_time_from.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tmpInput = input_time_from;
showTimePickerDialog(v);
}
});
input_time_to.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tmpInput = input_time_to;
showTimePickerDialog(v);
}
});
input_date_to.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tmpInput = input_date_to;
showDatePickerDialog(v);
}
});
input_date_from.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tmpInput = input_date_from;
showDatePickerDialog(v);
}
});
return mainview; return mainview;
} }
@@ -122,11 +172,13 @@ public class ReportWF_2_Fragment extends Fragment{
mainview.findViewById(R.id.ll_report_from_time).setVisibility(View.VISIBLE); mainview.findViewById(R.id.ll_report_from_time).setVisibility(View.VISIBLE);
mainview.findViewById(R.id.ll_report_to_time).setVisibility(View.INVISIBLE); mainview.findViewById(R.id.ll_report_to_time).setVisibility(View.INVISIBLE);
mainview.findViewById(R.id.dd_reportwf_2_time_sub).setVisibility(View.INVISIBLE); mainview.findViewById(R.id.dd_reportwf_2_time_sub).setVisibility(View.INVISIBLE);
checkIfDateTimeFinished();
break; break;
case 4: case 4:
mainview.findViewById(R.id.ll_report_from_time).setVisibility(View.VISIBLE); mainview.findViewById(R.id.ll_report_from_time).setVisibility(View.VISIBLE);
mainview.findViewById(R.id.ll_report_to_time).setVisibility(View.VISIBLE); mainview.findViewById(R.id.ll_report_to_time).setVisibility(View.VISIBLE);
mainview.findViewById(R.id.dd_reportwf_2_time_sub).setVisibility(View.INVISIBLE); mainview.findViewById(R.id.dd_reportwf_2_time_sub).setVisibility(View.INVISIBLE);
checkIfDateTimeFinished();
break; break;
case 5: case 5:
mainview.findViewById(R.id.ll_report_from_time).setVisibility(View.INVISIBLE); mainview.findViewById(R.id.ll_report_from_time).setVisibility(View.INVISIBLE);
@@ -177,9 +229,73 @@ public class ReportWF_2_Fragment extends Fragment{
} }
} }
public class TimePickerFragment extends DialogFragment
implements TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
tmpInput.setText(new StringBuilder().append(hourOfDay)
.append(":").append(minute).append(" "));
checkIfDateTimeFinished();
}
}
public void showTimePickerDialog(View v) {
DialogFragment newFragment = new TimePickerFragment();
newFragment.show(getFragmentManager(),"Pick Time");
}
public class DatePickerFragment extends DialogFragment
implements DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
return new DatePickerDialog(getActivity(), this, year, month, day);
}
public void onDateSet(DatePicker view, int year, int month, int day) {
tmpInput.setText(new StringBuilder()
.append(year).append("-").append(month + 1).append("-")
.append(day).append(" "));
checkIfDateTimeFinished();
}
}
public void showDatePickerDialog(View v) {
DialogFragment newFragment = new DatePickerFragment();
newFragment.show(getFragmentManager(), "Pick Date");
}
private void checkIfDateTimeFinished(){
if( mainview.findViewById(R.id.ll_report_from_time).getVisibility() == View.VISIBLE) {
isFinished(!input_date_from.getText().toString().matches(""));
}
if (mainview.findViewById(R.id.ll_report_to_time).getVisibility() == View.VISIBLE){
isFinished(!input_date_to.getText().toString().matches(""));
}
}
@Override @Override
public void onDetach() { public void onDetach() {
super.onDetach(); super.onDetach();
} }
} }

View File

@@ -5,6 +5,7 @@ import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLng;
import com.google.maps.android.clustering.ClusterItem; import com.google.maps.android.clustering.ClusterItem;
import org.deke.risk.riskahead.R;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@@ -14,7 +15,7 @@ import org.json.JSONObject;
public class AppClusterItem implements ClusterItem { public class AppClusterItem implements ClusterItem {
private LatLng mPosition; private LatLng mPosition;
private String mID; private Integer mID;
private String mTitle; private String mTitle;
private String mDescription; private String mDescription;
private String mFidUser; private String mFidUser;
@@ -28,13 +29,21 @@ public class AppClusterItem implements ClusterItem {
private String mColor; private String mColor;
private String mUsername; private String mUsername;
private int mScore; private int mScore;
private int mFidCat1_Main;
private int mFidCat1_Sub;
private String mCat1_Sub_etc;
private String mPosDescription;
private BitmapDescriptor icon; private BitmapDescriptor icon;
public AppClusterItem(JSONObject mIncident, LatLng pos) { public AppClusterItem(JSONObject mIncident, LatLng pos) {
try { try {
this.mID = mIncident.getString("uid"); this.mID = mIncident.getInt("uid");
this.mTitle = mIncident.getString("text_short"); this.mTitle = mIncident.getString("text_short");
this.mDescription = mIncident.getString("text_long"); this.mDescription = mIncident.getString("text_long");
this.mFidUser = mIncident.getString("fid_user"); this.mFidUser = mIncident.getString("fid_user");
@@ -54,26 +63,43 @@ public class AppClusterItem implements ClusterItem {
} }
} }
public AppClusterItem(){
}
@Override @Override
public LatLng getPosition() { public LatLng getPosition() {
return mPosition; return mPosition;
} }
public void setPosition(LatLng pos) {
mPosition = pos;
}
public BitmapDescriptor getIcon() { public BitmapDescriptor getIcon() {
BitmapDescriptor mIcon; BitmapDescriptor mIcon;
switch (Integer.valueOf(this.mFidCategory)) { switch (Integer.valueOf(this.mFidCategory)) {
case 1: case 1:
mIcon = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED); mIcon = BitmapDescriptorFactory.fromResource(R.drawable.icon_general);
break; break;
case 2: case 2:
mIcon = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN); mIcon = BitmapDescriptorFactory.fromResource(R.drawable.icon_verbal);
break; break;
case 3: case 3:
mIcon = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE); mIcon = BitmapDescriptorFactory.fromResource(R.drawable.icon_middle_violance);
break;
case 4:
mIcon = BitmapDescriptorFactory.fromResource(R.drawable.icon_high_violance);
break;
case 5:
mIcon = BitmapDescriptorFactory.fromResource(R.drawable.icon_nature);
break;
case 6:
mIcon = BitmapDescriptorFactory.fromResource(R.drawable.icon_infra_v2);
break; break;
default: default:
mIcon = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW); mIcon = BitmapDescriptorFactory.fromResource(R.drawable.icon_general);
break; break;
} }
@@ -126,7 +152,41 @@ public class AppClusterItem implements ClusterItem {
return this.mColor; return this.mColor;
} }
public String getID() { public Integer getID() {
return mID; return mID;
} }
public String getmPosDescription() {
return mPosDescription;
}
public void setmPosDescription(String mLocDetail) {
this.mPosDescription = mLocDetail;
}
public int getmFidCat1_Main() {
return mFidCat1_Main;
}
public void setmFidCat1_Main(int mFidCat1_Main) {
this.mFidCat1_Main = mFidCat1_Main;
}
public int getmFidCat1_Sub() {
return mFidCat1_Sub;
}
public void setmFidCat1_Sub(int mFidCat1_Sub) {
this.mFidCat1_Sub = mFidCat1_Sub;
}
public String getmCat1_Sub_etc() {
return mCat1_Sub_etc;
}
public void setmCat1_Sub_etc(String mCat1_Sub_etc) {
this.mCat1_Sub_etc = mCat1_Sub_etc;
}
} }

View File

@@ -260,7 +260,7 @@ public abstract class BaseActivity extends AppCompatActivity {
public void gotoReportActivity(String position){ public void gotoReportActivity(String position){
Intent intent; Intent intent;
intent = new Intent(getApplicationContext(), ReportActivity.class); intent = new Intent(getApplicationContext(), ReportWFActivity.class);
intent.putExtra(EXTRA_MESSAGE, position); intent.putExtra(EXTRA_MESSAGE, position);
startActivity(intent); startActivity(intent);
} }
@@ -302,7 +302,7 @@ public abstract class BaseActivity extends AppCompatActivity {
startActivity(intent); startActivity(intent);
} }
public void gotoViewReportActivity(String uid){ public void gotoViewReportActivity(Integer uid){
Intent intent; Intent intent;
intent = new Intent(getApplicationContext(), ViewReportActivity.class); intent = new Intent(getApplicationContext(), ViewReportActivity.class);
intent.putExtra(EXTRA_MESSAGE, uid); intent.putExtra(EXTRA_MESSAGE, uid);

View File

@@ -3,5 +3,5 @@
<solid android:color="#CCdedede"/> <solid android:color="#CCdedede"/>
<stroke android:width="1dip" android:color="#66808080" /> <stroke android:width="1dip" android:color="#66808080" />
<corners android:radius="3dip"/> <corners android:radius="3dip"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" /> <padding android:left="5dip" android:top="5dip" android:right="5dip" android:bottom="5dip" />
</shape> </shape>

View File

@@ -3,9 +3,9 @@
<item> <item>
<shape> <shape>
<gradient <gradient
android:angle="90" android:angle="-90"
android:startColor="#d9d9d9" android:startColor="#dbe1e1"
android:endColor="#f2f2f2" android:endColor="#afafaf"
android:type="linear" /> android:type="linear" />
</shape> </shape>
</item> </item>

View File

@@ -2,7 +2,6 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:bootstrap="http://schemas.android.com/apk/res-auto" xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
style="@style/CustomActionBarTheme"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:background="@drawable/layout_bg_gradient" android:background="@drawable/layout_bg_gradient"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:bootstrap="http://schemas.android.com/apk/res-auto" xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:background="@color/bg_common_2" android:background="@drawable/layout_bg_gradient"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ReportActivity"> tools:context=".ReportActivity">
@@ -24,8 +24,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="15dp" android:padding="15dp"
android:layout_weight="1" android:layout_weight="1">
android:orientation="vertical">
<TextView <TextView
android:id="@+id/lbl_report_short" android:id="@+id/lbl_report_short"

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:bootstrap="http://schemas.android.com/apk/res-auto" xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:background="@color/bg_common_2" android:background="@drawable/layout_bg_gradient"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">

View File

@@ -2,12 +2,11 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android" <TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1" android:id="@android:id/text1"
style="?android:attr/spinnerItemStyle" style="?android:attr/spinnerItemStyle"
android:layout_width="300dp" android:layout_width="150dp"
android:layout_height="50dp" android:layout_height="47dp"
android:maxLength="30"
android:gravity="left|center"
android:layout_margin="5dp" android:layout_margin="5dp"
android:background="@drawable/dropdown_2" android:gravity="left|center"
android:background="@drawable/dd_bg"
android:textSize="18sp" android:textSize="18sp"
android:textColor="#808080" android:textColor="#808080"
android:text="Please select..." /> android:text="Please select..." />

View File

@@ -1,57 +1,120 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
xmlns:bootstrap="http://schemas.android.com/apk/res-auto" xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
android:padding="0dip" android:fillViewport="true"
android:background="@drawable/layout_bg_gradient"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout android:id="@+id/menu_ll" <LinearLayout
android:layout_width="wrap_content" android:id="@+id/ll_01"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_gravity="center_horizontal" android:layout_height="match_parent"
android:animateLayoutChanges="true"> android:gravity="center"
android:orientation="vertical" >
<TextView <LinearLayout
android:id="@+id/lbl_reportwf_1_question" android:id="@+id/ll_01_01"
android:layout_centerHorizontal="true" android:layout_width="wrap_content"
android:text="What happened?" android:layout_height="match_parent"
android:layout_width="wrap_content" android:gravity="center_horizontal"
android:layout_height="wrap_content" android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceLarge" android:animateLayoutChanges="true"
android:layout_margin="20dp" android:orientation="vertical">
android:textColor="@color/bg_common" />
<Spinner <TextView
android:layout_width="300dp" android:id="@+id/lbl_reportwf_1_question"
android:layout_height="50dp" android:layout_centerHorizontal="true"
android:layout_margin="5dp" android:text="What happened?"
android:maxLength="10" android:layout_width="wrap_content"
android:background="@drawable/dropbox_2" android:layout_height="wrap_content"
android:id="@+id/dd_reportwf_1_cat_main" android:textAppearance="?android:attr/textAppearanceLarge"
android:spinnerMode="dialog" android:layout_margin="20dp"
android:prompt="@string/lbl_spinner_choose" android:textColor="@color/bg_common" />
android:layout_below="@id/lbl_reportwf_1_question"/>
<Spinner <Spinner
android:layout_width="300dp" android:id="@+id/dd_reportwf_1_cat_main"
android:layout_height="50dp" android:background="@drawable/dropdown_4"
android:layout_margin="5dp" android:layout_width="300dp"
android:maxLength="10" android:layout_height="52dp"
android:background="@drawable/dropbox_2" android:layout_margin="5dp"
android:id="@+id/dd_reportwf_1_cat_sub" android:spinnerMode="dialog"
android:spinnerMode="dropdown" android:prompt="@string/lbl_spinner_choose"
android:layout_below="@id/dd_reportwf_1_cat_main"/> android:layout_below="@id/lbl_reportwf_1_question"/>
<EditText <Spinner
android:layout_width="300dp" android:id="@+id/dd_reportwf_1_cat_sub"
android:layout_height="wrap_content" android:background="@drawable/dropdown_4"
android:visibility="invisible" android:layout_width="300dp"
android:hint="Please enter your info here" android:layout_height="52dp"
android:id="@+id/txt_reportwf_1_cat_etc" android:layout_margin="5dp"
android:layout_below="@id/dd_reportwf_1_cat_sub"/> android:spinnerMode="dialog"
android:prompt="@string/lbl_spinner_choose"
android:layout_below="@id/dd_reportwf_1_cat_main"/>
<EditText
android:layout_width="300dp"
android:layout_height="wrap_content"
android:visibility="invisible"
android:hint="Please enter your info here"
android:id="@+id/txt_reportwf_1_cat_etc"
android:layout_below="@id/dd_reportwf_1_cat_sub"/>
<RelativeLayout
android:id="@+id/ll_pos"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/lbl_reportwf_1_question_2"
android:layout_centerHorizontal="true"
android:text="Can you tell us the place?"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_margin="20dp"
android:textColor="@color/bg_common" />
<TextView
android:layout_width="200dp"
android:layout_height="70dp"
android:background="@drawable/layout_bg"
android:hint="No position choosen yet"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/lbl_reportwf_position_detail"
android:layout_alignTop="@+id/btn_reportwf_position"
android:layout_toRightOf="@+id/btn_reportwf_position"
android:layout_marginLeft="20dp" />
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/btn_reportwf_position"
android:layout_marginTop="3dp"
bootstrap:bootstrapText="@string/btn_report_position"
android:layout_below="@+id/lbl_reportwf_1_question_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
bootstrap:bootstrapBrand="primary"
bootstrap:roundedCorners="true"
bootstrap:bootstrapSize="lg"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_01_02"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:animateLayoutChanges="true"
android:layout_marginBottom="0dp">
<com.beardedhen.androidbootstrap.AwesomeTextView <com.beardedhen.androidbootstrap.AwesomeTextView
android:id="@+id/atv_reportwf_1_finish" android:id="@+id/atv_reportwf_1_finish"
@@ -64,5 +127,7 @@
android:layout_alignTop="@+id/txt_reportwf_1_cat_etc" android:layout_alignTop="@+id/txt_reportwf_1_cat_etc"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="19dp" /> android:layout_marginTop="19dp" />
</RelativeLayout> </LinearLayout>
</LinearLayout>
</ScrollView> </ScrollView>

View File

@@ -1,148 +1,172 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
xmlns:bootstrap="http://schemas.android.com/apk/res-auto" xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/layout_bg_gradient"
android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout android:id="@+id/menu_ll" <LinearLayout
android:id="@+id/ll_01"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:padding="5dp" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical" >
<TextView <LinearLayout
android:id="@+id/lbl_reportwf_2_question" android:id="@+id/ll_01_01"
android:text="When did it happen?"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/lbl_reportwf_2_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="20dp"
android:text="When did it happen?"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/bg_common" />
<Spinner
android:id="@+id/dd_reportwf_2_time_main"
android:background="@drawable/dropdown_4"
android:layout_width="300dp"
android:layout_height="52dp"
android:layout_margin="5dp"
android:spinnerMode="dialog"
android:prompt="@string/lbl_spinner_choose"
android:layout_gravity="center_horizontal" />
<Spinner
android:id="@+id/dd_reportwf_2_time_sub"
android:background="@drawable/dropdown_4"
android:layout_width="300dp"
android:layout_height="52dp"
android:layout_margin="5dp"
android:spinnerMode="dialog"
android:prompt="@string/lbl_spinner_choose"
android:layout_gravity="center_horizontal"/>
<RelativeLayout
android:id="@+id/ll_report_from_time"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/lbl_report_from_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/dd_report_category"
android:layout_marginTop="10dp"
android:text="@string/lbl_report_from_date" />
<TextView
android:id="@+id/lbl_report_from_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/input_report_from_time"
android:layout_alignLeft="@+id/input_report_from_time"
android:layout_alignStart="@+id/input_report_from_time"
android:layout_marginTop="10dp"
android:text="@string/lbl_report_from_time"/>
<EditText
android:id="@+id/input_report_from_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/lbl_report_from_date"
android:layout_alignStart="@+id/lbl_report_from_date"
android:layout_below="@+id/lbl_report_from_date"
android:layout_marginRight="5dp"
android:ems="10"
android:focusable="false"
android:inputType="date"/>
<EditText
android:id="@+id/input_report_from_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/input_report_from_date"
android:layout_toEndOf="@+id/input_report_from_date"
android:layout_toRightOf="@+id/input_report_from_date"
android:ems="10"
android:focusable="false"
android:inputType="time"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/ll_report_to_time"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/lbl_report_to_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/dd_report_category"
android:layout_marginTop="10dp"
android:text="@string/lbl_report_to_date" />
<TextView
android:id="@+id/lbl_report_to_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/input_report_to_time"
android:layout_alignLeft="@+id/input_report_to_time"
android:layout_alignStart="@+id/input_report_to_time"
android:layout_marginTop="10dp"
android:text="@string/lbl_report_to_time"/>
<EditText
android:id="@+id/input_report_to_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/lbl_report_to_date"
android:layout_alignStart="@+id/lbl_report_to_date"
android:layout_below="@+id/lbl_report_to_date"
android:layout_marginRight="5dp"
android:ems="10"
android:focusable="false"
android:inputType="date"/>
<EditText
android:id="@+id/input_report_to_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/input_report_to_date"
android:layout_toEndOf="@+id/input_report_to_date"
android:layout_toRightOf="@+id/input_report_to_date"
android:ems="10"
android:focusable="false"
android:inputType="time"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_01_02"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" android:animateLayoutChanges="true"
android:layout_margin="20dp" android:gravity="center"
android:textColor="@color/bg_common" android:layout_marginBottom="0dp">
android:layout_gravity="center_horizontal" />
<Spinner <com.beardedhen.androidbootstrap.AwesomeTextView
android:layout_width="300dp" android:id="@+id/atv_reportwf_2_finish"
android:layout_height="50dp" android:layout_width="wrap_content"
android:layout_margin="5dp" android:layout_height="wrap_content"
android:background="@drawable/dropdown_2" android:textSize="80dp"
android:id="@+id/dd_reportwf_2_time_main" android:visibility="invisible"
android:layout_gravity="center_horizontal" /> bootstrap:bootstrapBrand="success"
bootstrap:fontAwesomeIcon="fa_check_circle_o" />
<Spinner </LinearLayout>
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_margin="5dp"
android:background="@drawable/dropdown_2"
android:id="@+id/dd_reportwf_2_time_sub"
android:layout_gravity="center_horizontal" />
<RelativeLayout
android:id="@+id/ll_report_from_time"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/lbl_report_from_date"
android:text="@string/lbl_report_from_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_below="@+id/dd_report_category" />
<TextView
android:id="@+id/lbl_report_from_time"
android:text="@string/lbl_report_from_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_above="@+id/input_report_from_time"
android:layout_alignLeft="@+id/input_report_from_time"
android:layout_alignStart="@+id/input_report_from_time"/>
<EditText
android:id="@+id/input_report_from_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="date"
android:layout_marginRight="5dp"
android:ems="10"
android:layout_below="@+id/lbl_report_from_date"
android:layout_alignLeft="@+id/lbl_report_from_date"
android:layout_alignStart="@+id/lbl_report_from_date"
android:focusable="false"/>
<EditText
android:id="@+id/input_report_from_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="time"
android:ems="10"
android:layout_alignBottom="@+id/input_report_from_date"
android:layout_toRightOf="@+id/input_report_from_date"
android:layout_toEndOf="@+id/input_report_from_date"
android:focusable="false"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/ll_report_to_time"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/lbl_report_to_date"
android:text="@string/lbl_report_to_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_below="@+id/dd_report_category" />
<TextView
android:id="@+id/lbl_report_to_time"
android:text="@string/lbl_report_to_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_above="@+id/input_report_to_time"
android:layout_alignLeft="@+id/input_report_to_time"
android:layout_alignStart="@+id/input_report_to_time"/>
<EditText
android:id="@+id/input_report_to_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="date"
android:layout_marginRight="5dp"
android:ems="10"
android:layout_below="@+id/lbl_report_to_date"
android:layout_alignLeft="@+id/lbl_report_to_date"
android:layout_alignStart="@+id/lbl_report_to_date"
android:focusable="false"/>
<EditText
android:id="@+id/input_report_to_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="time"
android:ems="10"
android:layout_alignBottom="@+id/input_report_to_date"
android:layout_toRightOf="@+id/input_report_to_date"
android:layout_toEndOf="@+id/input_report_to_date"
android:focusable="false"/>
</RelativeLayout>
<com.beardedhen.androidbootstrap.AwesomeTextView
android:id="@+id/atv_reportwf_2_finish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="80dp"
android:visibility="invisible"
bootstrap:bootstrapBrand="success"
bootstrap:fontAwesomeIcon="fa_check_circle_o"
android:layout_gravity="center_horizontal" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@@ -3,8 +3,11 @@
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="1dp" android:paddingLeft="7dp"
android:background="#CCc9c9c9"> android:paddingRight="5dp"
android:paddingTop="3dp"
android:paddingBottom="13dp"
android:background="@drawable/infowindow">
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
@@ -12,16 +15,15 @@
android:background="#e45151" android:background="#e45151"
android:layout_width="5dp" android:layout_width="5dp"
android:layout_height="match_parent"> android:layout_height="match_parent">
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="144dp"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#a6000000" android:textColor="#a6000000"
android:id="@+id/txt_infowindow_title" android:id="@+id/txt_infowindow_title"
@@ -31,16 +33,19 @@
android:typeface="serif" /> android:typeface="serif" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="120dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:typeface="serif"
android:textColor="#b9000000" android:textColor="#b9000000"
android:text="Long Text" android:text="Textabfdfdgregreger"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:id="@+id/txt_infowindow_description" android:id="@+id/txt_infowindow_description"
android:typeface="serif" /> android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#b9000000" android:textColor="#b9000000"
android:text="Category" android:text="Category"
@@ -54,11 +59,12 @@
android:id="@+id/lay_infowindow_2" android:id="@+id/lay_infowindow_2"
android:background="#55151515" android:background="#55151515"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="3dp" android:padding="3dp"
android:layout_height="match_parent"> >
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#b9000000" android:textColor="#b9000000"
android:text="Username" android:text="Username"
@@ -66,7 +72,7 @@
android:typeface="serif" /> android:typeface="serif" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#b9000000" android:textColor="#b9000000"
android:text="Points:" android:text="Points:"

View File

@@ -2,8 +2,15 @@
<color name="bg_login">#26ae90</color> <color name="bg_login">#26ae90</color>
<color name="bg_register">#2e3237</color> <color name="bg_register">#2e3237</color>
<color name="bg_common_2">#ececec</color>
<color name="bg_common">#0461A8</color>
<color name="bg_common">#1175b7</color>
<color name="bg_common_2">#0461a8</color>
<color name="common_text">#333333</color>
<color name="actionbar_text">#fdfdfd</color>
<color name="white">#ffffff</color> <color name="white">#ffffff</color>
<color name="title">#ffffff</color> <color name="title">#ffffff</color>
<color name="red">#ff0000</color> <color name="red">#ff0000</color>

View File

@@ -5,24 +5,16 @@
<item name="android:layout_marginRight">@dimen/micro_padding</item> <item name="android:layout_marginRight">@dimen/micro_padding</item>
</style> </style>
<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light"> <style name="MyRiskAheadTheme" parent="Theme.AppCompat.Light">
<item name="android:actionBarStyle" tools:ignore="NewApi">@style/MyActionBar</item> <item name="colorPrimary">@color/bg_common</item>
<item name="actionBarStyle">@style/MyActionBar</item> <item name="android:textColorPrimary">@color/actionbar_text</item>
<item name="actionBarTheme">@style/MyActionBarTheme</item> <item name="colorPrimaryDark">@color/bg_common_2</item>
<item name="android:textColor">@color/common_text</item>
<item name="android:editTextStyle">@style/App_EditTextStyle</item>
</style> </style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> <style name="App_EditTextStyle" parent="@android:style/Widget.EditText">
<item name="android:background" tools:ignore="NewApi">@color/white</item> <item name="android:textColor">@color/common_text</item>
<item name="titleTextStyle">@style/MyActionBar.ActionBar.TitleTextStyle</item>
<item name="background">@color/bg_common</item>
</style> </style>
<style name="MyActionBarTheme" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="actionMenuTextColor">@color/title</item>
<item name="colorControlNormal">@color/title</item>
</style>
<style name="MyActionBar.ActionBar.TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/title</item>
</style>
</resources> </resources>