1515import android .util .Log ;
1616import android .view .LayoutInflater ;
1717
18+ import com .atakmap .android .cot .CotMapComponent ;
19+ import com .atakmap .android .gui .AlertDialogHelper ;
1820import com .atakmap .android .gui .EditText ;
21+ import com .atakmap .android .importexport .CotEventFactory ;
1922import com .atakmap .android .maps .MapView ;
2023import com .atakmap .android .cotexplorer .plugin .R ;
2124import com .atakmap .android .dropdown .DropDown .OnStateListener ;
@@ -51,7 +54,7 @@ public class cotexplorerDropDownReceiver extends DropDownReceiver implements
5154
5255 private boolean paused = false ;
5356 private TextView cotexplorerlog = null ;
54- private Button clearBtn , pauseBtn , filterBtn , saveBtn = null ;
57+ private Button sendBtn , clearBtn , pauseBtn , filterBtn , saveBtn = null ;
5558 private SharedPreferences _sharedPreference = null ;
5659 private String cotFilter = "" ;
5760
@@ -71,9 +74,33 @@ public cotexplorerDropDownReceiver(final MapView mapView,
7174 pauseBtn = mainView .findViewById (R .id .pauseBtn );
7275 filterBtn = mainView .findViewById (R .id .filterBtn );
7376 saveBtn = mainView .findViewById (R .id .saveBtn );
77+ sendBtn = mainView .findViewById (R .id .sendBtn );
7478
7579 _sharedPreference = PreferenceManager .getDefaultSharedPreferences (mapView .getContext ().getApplicationContext ());
7680
81+ sendBtn .setOnClickListener (new View .OnClickListener () {
82+ @ Override
83+ public void onClick (View v ) {
84+
85+
86+ EditText et = new EditText (mapView .getContext ());
87+
88+ AlertDialog .Builder alertDialog = new AlertDialog .Builder (mapView .getContext ());
89+ alertDialog .setTitle ("Enter CoT to send" );
90+ alertDialog .setView (et );
91+ alertDialog .setNegativeButton ("Cancel" , null );
92+ alertDialog .setPositiveButton ("Send" , (dialogInterface , i ) -> {
93+ CotEvent cot = CotEvent .parse (et .getText ().toString ());
94+ if (cot .isValid ()) {
95+ CotMapComponent .getExternalDispatcher ().dispatch (cot );
96+ } else {
97+ Toast .makeText (mapView .getContext (), "Invalid CoT" , Toast .LENGTH_LONG ).show ();
98+ }
99+ });
100+ alertDialog .show ();
101+ }
102+ });
103+
77104 saveBtn .setOnClickListener (new View .OnClickListener () {
78105 @ Override
79106 public void onClick (View v ) {
0 commit comments