Merge pull request 'SD-203- added dialogs similar to SafeDispatch History to inform of 0 positions or >2000 positions' (#17) from features/SD-203-add-dialogs-for-history-tab into develop

Reviewed-on: #17
This commit is contained in:
Bogdan Ungureanu 2022-03-31 05:13:10 +00:00
commit b2fdb1c8d7
2 changed files with 42 additions and 1 deletions

View File

@ -57,6 +57,7 @@ import com.safemobile.services.TCPService.TCPBinder;
import android.Manifest; import android.Manifest;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
@ -1395,7 +1396,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
HistCountmsg histCountMsg = new HistCountmsg(msg); HistCountmsg histCountMsg = new HistCountmsg(msg);
SM.Debug("Message Count:" + histCountMsg.histcountValue.count); 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 //list for live
SM.Debug("currentActivity instanceof HistoryActivity"); SM.Debug("currentActivity instanceof HistoryActivity");
try { try {
@ -1406,6 +1407,44 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
} catch (Exception ex) { } catch (Exception ex) {
SM.Debug(HASH_ERROR_MESSAGE + 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="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="microphone">Microphone</string>
<string name="radio_tab">Radio Tab</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> </resources>