diff --git a/safeDispatch/src/main/java/com/safemobile/safedispatch/TabLayoutActivity.java b/safeDispatch/src/main/java/com/safemobile/safedispatch/TabLayoutActivity.java index 4a3a056..5c6f535 100644 --- a/safeDispatch/src/main/java/com/safemobile/safedispatch/TabLayoutActivity.java +++ b/safeDispatch/src/main/java/com/safemobile/safedispatch/TabLayoutActivity.java @@ -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; } } diff --git a/safeDispatch/src/main/res/values/strings.xml b/safeDispatch/src/main/res/values/strings.xml index 6834004..cfb58a5 100644 --- a/safeDispatch/src/main/res/values/strings.xml +++ b/safeDispatch/src/main/res/values/strings.xml @@ -263,5 +263,7 @@ %1$s permission was not accepted. To be able to use the %2$s, please open application settings and grant the %3$s permission Microphone Radio Tab + You have selected %1$s positions.\nPlease select a smalled interval. + No data for this interval \ No newline at end of file