Skip to content

Commit 73cb234

Browse files
committed
1.1
Add button to send a CoT
1 parent 4d4249d commit 73cb234

3 files changed

Lines changed: 34 additions & 16 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
buildscript {
1010

11-
ext.PLUGIN_VERSION = "1.0"
11+
ext.PLUGIN_VERSION = "1.1"
1212
ext.ATAK_VERSION = "4.10.0"
1313

1414
def takdevVersion = '2.+'

app/src/main/java/com/atakmap/android/cotexplorer/cotexplorerDropDownReceiver.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
import android.util.Log;
1616
import android.view.LayoutInflater;
1717

18+
import com.atakmap.android.cot.CotMapComponent;
19+
import com.atakmap.android.gui.AlertDialogHelper;
1820
import com.atakmap.android.gui.EditText;
21+
import com.atakmap.android.importexport.CotEventFactory;
1922
import com.atakmap.android.maps.MapView;
2023
import com.atakmap.android.cotexplorer.plugin.R;
2124
import 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) {

app/src/main/res/layout/main_layout.xml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,11 @@
1717
android:background="#444444"
1818
android:orientation="horizontal">
1919

20-
<TextView
21-
android:id="@+id/title"
22-
android:layout_width="0dp"
23-
android:layout_height="wrap_content"
24-
android:layout_alignParentTop="true"
25-
android:layout_weight="1"
26-
android:background="#444444"
27-
android:paddingStart="10dp"
28-
android:paddingTop="10dp"
29-
android:paddingEnd="0dp"
30-
android:paddingBottom="10dp"
31-
android:text="CoT Explorer Log"
32-
android:textColor="@color/white"
33-
android:textSize="20sp" />
20+
<Button
21+
android:id="@+id/sendBtn"
22+
android:layout_width="wrap_content"
23+
android:layout_height="match_parent"
24+
android:text=" Send " />
3425
<Button
3526
android:id="@+id/saveBtn"
3627
android:layout_width="wrap_content"

0 commit comments

Comments
 (0)