Added a button that sends last known location to telegram.
This commit is contained in:
parent
137290e6d3
commit
eb8dc83846
|
|
@ -32,6 +32,7 @@ import io.jenetics.jpx.WayPoint;
|
||||||
public class MainActivity extends AppCompatActivity implements LocationListener, ServiceConnection {
|
public class MainActivity extends AppCompatActivity implements LocationListener, ServiceConnection {
|
||||||
private final String TAG = MainActivity.class.getName();
|
private final String TAG = MainActivity.class.getName();
|
||||||
private Button exportButton;
|
private Button exportButton;
|
||||||
|
private Button sendTelegramButton;
|
||||||
private WriteToFile writeToFile;
|
private WriteToFile writeToFile;
|
||||||
private static boolean includeComments = false;
|
private static boolean includeComments = false;
|
||||||
private static Double accuracyThreshold = 2.0;
|
private static Double accuracyThreshold = 2.0;
|
||||||
|
|
@ -54,6 +55,7 @@ public class MainActivity extends AppCompatActivity implements LocationListener,
|
||||||
});
|
});
|
||||||
|
|
||||||
exportButton = findViewById(R.id.buttonExport);
|
exportButton = findViewById(R.id.buttonExport);
|
||||||
|
sendTelegramButton = findViewById(R.id.buttonSendTelegram);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -89,6 +91,12 @@ public class MainActivity extends AppCompatActivity implements LocationListener,
|
||||||
LocationLoggingServiceBinder binder = (LocationLoggingServiceBinder) iBinder;
|
LocationLoggingServiceBinder binder = (LocationLoggingServiceBinder) iBinder;
|
||||||
binder.subscribeToLocationUpdates(this);
|
binder.subscribeToLocationUpdates(this);
|
||||||
|
|
||||||
|
if(sendTelegramButton != null){
|
||||||
|
sendTelegramButton.setOnClickListener(v -> {
|
||||||
|
binder.sendLastKnownLocationToTelegram();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(exportButton != null){
|
if(exportButton != null){
|
||||||
exportButton.setOnClickListener(v -> {
|
exportButton.setOnClickListener(v -> {
|
||||||
Log.d(TAG, "Export button clicked.");
|
Log.d(TAG, "Export button clicked.");
|
||||||
|
|
|
||||||
|
|
@ -26,5 +26,13 @@
|
||||||
android:text="Export"
|
android:text="Export"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/buttonSendTelegram"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/buttonExport"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:text="Send to telegram" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Loading…
Reference in a new issue