Skip to content

Commit

Permalink
bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
m4gr3d committed Jan 30, 2015
1 parent 959340a commit 3461b9d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ android {
applicationId 'org.droidplanner.android'
minSdkVersion 14
targetSdkVersion 21
versionCode 30016
versionCode 30017
versionName getGitVersion()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public void onSaveInstanceState(Bundle savedInstanceState) {
// Store the currently selected tool
savedInstanceState.putString(STATE_SELECTED_TOOL, tool.name());

for(EditorToolsImpl toolImpl : editorToolsImpls){
for (EditorToolsImpl toolImpl : editorToolsImpls) {
toolImpl.onSaveInstanceState(savedInstanceState);
}
}
Expand Down Expand Up @@ -399,9 +399,11 @@ void setMissionProxy(MissionProxy missionProxy) {
this.missionProxy = missionProxy;
}

void onSaveInstanceState(Bundle outState){}
void onSaveInstanceState(Bundle outState) {
}

void onRestoreInstanceState(Bundle savedState){}
void onRestoreInstanceState(Bundle savedState) {
}

public void onMapClick(LatLong point) {
if (missionProxy == null) return;
Expand Down Expand Up @@ -451,13 +453,13 @@ private static class MarkerToolsImpl extends EditorToolsImpl implements AdapterV
super(fragment);
}

void onSaveInstanceState(Bundle outState){
void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if(selectedType != null)
if (selectedType != null)
outState.putString(EXTRA_SELECTED_MARKER_MISSION_ITEM_TYPE, selectedType.name());
}

void onRestoreInstanceState(Bundle savedState){
void onRestoreInstanceState(Bundle savedState) {
super.onRestoreInstanceState(savedState);
final String selectedTypeName = savedState.getString(EXTRA_SELECTED_MARKER_MISSION_ITEM_TYPE,
MARKER_ITEMS_TYPE[0].name());
Expand Down Expand Up @@ -495,7 +497,8 @@ public void setup() {
listener.skipMarkerClickEvents(true);
}

missionProxy.selection.clearSelection();
if (missionProxy != null)
missionProxy.selection.clearSelection();
}

@Override
Expand Down Expand Up @@ -530,13 +533,13 @@ private static class DrawToolsImpl extends EditorToolsImpl implements AdapterVie
super(fragment);
}

void onSaveInstanceState(Bundle outState){
void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if(selectedType != null)
if (selectedType != null)
outState.putString(EXTRA_SELECTED_DRAW_MISSION_ITEM_TYPE, selectedType.name());
}

void onRestoreInstanceState(Bundle savedState){
void onRestoreInstanceState(Bundle savedState) {
super.onRestoreInstanceState(savedState);
final String selectedTypeName = savedState.getString(EXTRA_SELECTED_DRAW_MISSION_ITEM_TYPE,
DRAW_ITEMS_TYPE[0].name());
Expand All @@ -556,7 +559,8 @@ public void setup() {
listener.skipMarkerClickEvents(false);
}

missionProxy.selection.clearSelection();
if (missionProxy != null)
missionProxy.selection.clearSelection();

if (selectedType == MissionItemType.SURVEY) {
Toast.makeText(editorToolsFragment.getContext(), R.string.draw_the_survey_region, Toast.LENGTH_SHORT).show();
Expand Down Expand Up @@ -641,6 +645,9 @@ private static class TrashToolsImpl extends EditorToolsImpl implements OnClickLi

@Override
public void onListItemClick(MissionItemProxy item) {
if (missionProxy == null)
return;

missionProxy.removeItem(item);
missionProxy.selection.clearSelection();

Expand Down Expand Up @@ -708,7 +715,7 @@ public void onYes() {

@Override
public void onNo() {
if(missionProxy != null)
if (missionProxy != null)
missionProxy.selection.clearSelection();
}
});
Expand All @@ -733,6 +740,9 @@ private static class SelectorToolsImpl extends EditorToolsImpl implements OnClic

@Override
public void onListItemClick(MissionItemProxy item) {
if (missionProxy == null)
return;

if (missionProxy.selection.selectionContains(item)) {
missionProxy.selection.removeItemFromSelection(item);
} else {
Expand All @@ -741,6 +751,9 @@ public void onListItemClick(MissionItemProxy item) {
}

private void selectAll() {
if (missionProxy == null)
return;

missionProxy.selection.setSelectionTo(missionProxy.getItems());
EditorToolListener listener = editorToolsFragment.listener;
if (listener != null)
Expand All @@ -762,7 +775,9 @@ public void setup() {

Toast.makeText(editorToolsFragment.getContext(), "Click on mission items to select them.",
Toast.LENGTH_SHORT).show();
missionProxy.selection.clearSelection();

if (missionProxy != null)
missionProxy.selection.clearSelection();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ public void goToMyLocation() {
public void goToDroneLocation() {
super.goToDroneLocation();

if(this.drone == null)
return;

final Gps droneGps = this.drone.getAttribute(AttributeType.GPS);
if (droneGps == null || !droneGps.isValid())
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ public void onReceive(Context context, Intent intent) {
stopProgress();
/*** FALL - THROUGH ***/
case AttributeEvent.TYPE_UPDATED:
if (getDrone().isConnected()) {
final Parameters droneParams = getDrone().getAttribute(AttributeType.PARAMETERS);
final Drone drone = getDrone();
if (drone != null && drone.isConnected()) {
final Parameters droneParams = drone.getAttribute(AttributeType.PARAMETERS);
loadAdapter(droneParams.getParameters(), false);
}
break;
Expand Down

0 comments on commit 3461b9d

Please sign in to comment.