@@ -238,7 +238,7 @@ public void onSaveInstanceState(Bundle savedInstanceState) {
238
238
// Store the currently selected tool
239
239
savedInstanceState .putString (STATE_SELECTED_TOOL , tool .name ());
240
240
241
- for (EditorToolsImpl toolImpl : editorToolsImpls ){
241
+ for (EditorToolsImpl toolImpl : editorToolsImpls ) {
242
242
toolImpl .onSaveInstanceState (savedInstanceState );
243
243
}
244
244
}
@@ -399,9 +399,11 @@ void setMissionProxy(MissionProxy missionProxy) {
399
399
this .missionProxy = missionProxy ;
400
400
}
401
401
402
- void onSaveInstanceState (Bundle outState ){}
402
+ void onSaveInstanceState (Bundle outState ) {
403
+ }
403
404
404
- void onRestoreInstanceState (Bundle savedState ){}
405
+ void onRestoreInstanceState (Bundle savedState ) {
406
+ }
405
407
406
408
public void onMapClick (LatLong point ) {
407
409
if (missionProxy == null ) return ;
@@ -451,13 +453,13 @@ private static class MarkerToolsImpl extends EditorToolsImpl implements AdapterV
451
453
super (fragment );
452
454
}
453
455
454
- void onSaveInstanceState (Bundle outState ){
456
+ void onSaveInstanceState (Bundle outState ) {
455
457
super .onSaveInstanceState (outState );
456
- if (selectedType != null )
458
+ if (selectedType != null )
457
459
outState .putString (EXTRA_SELECTED_MARKER_MISSION_ITEM_TYPE , selectedType .name ());
458
460
}
459
461
460
- void onRestoreInstanceState (Bundle savedState ){
462
+ void onRestoreInstanceState (Bundle savedState ) {
461
463
super .onRestoreInstanceState (savedState );
462
464
final String selectedTypeName = savedState .getString (EXTRA_SELECTED_MARKER_MISSION_ITEM_TYPE ,
463
465
MARKER_ITEMS_TYPE [0 ].name ());
@@ -495,7 +497,8 @@ public void setup() {
495
497
listener .skipMarkerClickEvents (true );
496
498
}
497
499
498
- missionProxy .selection .clearSelection ();
500
+ if (missionProxy != null )
501
+ missionProxy .selection .clearSelection ();
499
502
}
500
503
501
504
@ Override
@@ -530,13 +533,13 @@ private static class DrawToolsImpl extends EditorToolsImpl implements AdapterVie
530
533
super (fragment );
531
534
}
532
535
533
- void onSaveInstanceState (Bundle outState ){
536
+ void onSaveInstanceState (Bundle outState ) {
534
537
super .onSaveInstanceState (outState );
535
- if (selectedType != null )
538
+ if (selectedType != null )
536
539
outState .putString (EXTRA_SELECTED_DRAW_MISSION_ITEM_TYPE , selectedType .name ());
537
540
}
538
541
539
- void onRestoreInstanceState (Bundle savedState ){
542
+ void onRestoreInstanceState (Bundle savedState ) {
540
543
super .onRestoreInstanceState (savedState );
541
544
final String selectedTypeName = savedState .getString (EXTRA_SELECTED_DRAW_MISSION_ITEM_TYPE ,
542
545
DRAW_ITEMS_TYPE [0 ].name ());
@@ -556,7 +559,8 @@ public void setup() {
556
559
listener .skipMarkerClickEvents (false );
557
560
}
558
561
559
- missionProxy .selection .clearSelection ();
562
+ if (missionProxy != null )
563
+ missionProxy .selection .clearSelection ();
560
564
561
565
if (selectedType == MissionItemType .SURVEY ) {
562
566
Toast .makeText (editorToolsFragment .getContext (), R .string .draw_the_survey_region , Toast .LENGTH_SHORT ).show ();
@@ -641,6 +645,9 @@ private static class TrashToolsImpl extends EditorToolsImpl implements OnClickLi
641
645
642
646
@ Override
643
647
public void onListItemClick (MissionItemProxy item ) {
648
+ if (missionProxy == null )
649
+ return ;
650
+
644
651
missionProxy .removeItem (item );
645
652
missionProxy .selection .clearSelection ();
646
653
@@ -708,7 +715,7 @@ public void onYes() {
708
715
709
716
@ Override
710
717
public void onNo () {
711
- if (missionProxy != null )
718
+ if (missionProxy != null )
712
719
missionProxy .selection .clearSelection ();
713
720
}
714
721
});
@@ -733,6 +740,9 @@ private static class SelectorToolsImpl extends EditorToolsImpl implements OnClic
733
740
734
741
@ Override
735
742
public void onListItemClick (MissionItemProxy item ) {
743
+ if (missionProxy == null )
744
+ return ;
745
+
736
746
if (missionProxy .selection .selectionContains (item )) {
737
747
missionProxy .selection .removeItemFromSelection (item );
738
748
} else {
@@ -741,6 +751,9 @@ public void onListItemClick(MissionItemProxy item) {
741
751
}
742
752
743
753
private void selectAll () {
754
+ if (missionProxy == null )
755
+ return ;
756
+
744
757
missionProxy .selection .setSelectionTo (missionProxy .getItems ());
745
758
EditorToolListener listener = editorToolsFragment .listener ;
746
759
if (listener != null )
@@ -762,7 +775,9 @@ public void setup() {
762
775
763
776
Toast .makeText (editorToolsFragment .getContext (), "Click on mission items to select them." ,
764
777
Toast .LENGTH_SHORT ).show ();
765
- missionProxy .selection .clearSelection ();
778
+
779
+ if (missionProxy != null )
780
+ missionProxy .selection .clearSelection ();
766
781
}
767
782
768
783
@ Override
0 commit comments