Compare commits

...

3 Commits

4 changed files with 65 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package com.safemobile.safedispatch;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.graphics.Color;
@ -124,6 +125,18 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14));
}
@Override
public void onBackPressed() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.exit))
.setCancelable(false)
.setNeutralButton(getString(R.string.logout), (dialog, id) -> parentTab.whenBackPressed(AppParams.ActivityResult.logout))
.setPositiveButton(getString(R.string.ext), (dialog, id) -> parentTab.whenBackPressed(AppParams.ActivityResult.exit))
.setNegativeButton(getString(R.string.cancel), (dialog, id) -> dialog.cancel());
AlertDialog alert = builder.create();
alert.show();
}
private void setDate() {
Calendar calendar = Calendar.getInstance();
endDate = calendar.getTime();

View File

@ -42,6 +42,7 @@ public class RecordingsActivity extends Activity {
private GridView gridView;
private RecordingsGridViewAdapter adapter;
private View convertViewRecording;
private boolean isRecordingPlaying = false;
private int playingPosition = -1;
@ -89,6 +90,7 @@ public class RecordingsActivity extends Activity {
gridView.setAdapter(adapter);
gridView.setOnItemClickListener(onItemClickListener);
gridView.setOnTouchListener((v, event) -> isRecordingPlaying);
if (recHandle == null && !AppParams.DEMO)
recHandle = new RecordingHandle(AppParams.IP);
@ -171,12 +173,17 @@ public class RecordingsActivity extends Activity {
SM.Debug("onResume");
}
private final OnItemClickListener onItemClickListener = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
// disable grid scrolling and item click
gridView.setEnabled(false);
// disable grid scrolling and item click
if (isRecordingPlaying)
return;
isRecordingPlaying = true;
setConvertViewRecording(view);
// change background to playing
@ -262,7 +269,7 @@ public class RecordingsActivity extends Activity {
adapter.changePlaying(getPlayingPosition(), false);
// enable grid
gridView.setEnabled(true);
isRecordingPlaying = false;
// set playing Recording position to -1
setPlayingPosition(-1);

View File

@ -57,6 +57,7 @@ import com.safemobile.services.TCPService.TCPBinder;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationManager;
@ -1395,7 +1396,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
HistCountmsg histCountMsg = new HistCountmsg(msg);
SM.Debug("Message Count:" + histCountMsg.histcountValue.count);
if (histCountMsg.histcountValue.count >= 2000 && AppParams.crtTab == AppParams.Tabs.history) {
if (AppParams.crtTab != AppParams.Tabs.history) {
//list for live
SM.Debug("currentActivity instanceof HistoryActivity");
try {
@ -1406,6 +1407,44 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
} catch (Exception ex) {
SM.Debug(HASH_ERROR_MESSAGE + ex);
}
return;
}
if (histCountMsg.histcountValue.count >= 2000) {
try {
if (getHistoryActivity() != null) {
getHistoryActivity().UpdateCancel();
getHistoryActivity().UpdateUnableDisp();
}
} catch (Exception ex) {
SM.Debug(HASH_ERROR_MESSAGE + ex);
}
runOnUiThread(new Runnable() {
public void run() {
DialogService dialogService = new DialogService();
dialogService.showError(getHistoryActivity(), getString(R.string.too_many_positions, String.valueOf(histCountMsg.histcountValue.count)));
}
});
return;
}
if (histCountMsg.histcountValue.count == 0) {
try {
if (getHistoryActivity() != null) {
getHistoryActivity().UpdateCancel();
getHistoryActivity().UpdateUnableDisp();
}
} catch (Exception ex) {
SM.Debug(HASH_ERROR_MESSAGE + ex);
}
runOnUiThread(new Runnable() {
public void run() {
DialogService dialogService = new DialogService();
dialogService.showError(getHistoryActivity(), getString(R.string.no_data_for_interval));
}
});
return;
}
}

View File

@ -263,5 +263,7 @@
<string name="permissionBlocked">%1$s permission was not accepted. To be able to use the %2$s, please open application settings and grant the %3$s permission</string>
<string name="microphone">Microphone</string>
<string name="radio_tab">Radio Tab</string>
<string name="too_many_positions">You have selected %1$s positions.\nPlease select a smalled interval.</string>
<string name="no_data_for_interval">No data for this interval</string>
</resources>