Commit 9dde565e by Kunj Gupta

Fixed - We need to get updated data from server each time.

parent 254ec802
...@@ -86,17 +86,17 @@ public class CatalogueItemScreen extends AppCompatActivity { ...@@ -86,17 +86,17 @@ public class CatalogueItemScreen extends AppCompatActivity {
// Send initial screen view hit. // Send initial screen view hit.
Util.sendScreenName(tracker, actionBar.getTitle().toString()); Util.sendScreenName(tracker, actionBar.getTitle().toString());
List<CatalogueItem> catalogueItemList = CatalogueItemManager.getAllCatalogueItems(mCatalogue.getId());
if(catalogueItemList.isEmpty()) {
if(application.isNetConnected()) { if(application.isNetConnected()) {
new FetchCatalogueItem().execute(); new FetchCatalogueItem().execute();
} else { } else {
List<CatalogueItem> catalogueItemList = CatalogueItemManager.getAllCatalogueItems(mCatalogue.getId());
if(catalogueItemList.isEmpty()) {
DialogUtils.showNoConnectionDialogWithCloseActivity(CatalogueItemScreen.this); DialogUtils.showNoConnectionDialogWithCloseActivity(CatalogueItemScreen.this);
}
} else { } else {
setData(catalogueItemList); setData(catalogueItemList);
} }
} }
}
class FetchCatalogueItem extends AsyncTask<String, Void, SyncStatus> { class FetchCatalogueItem extends AsyncTask<String, Void, SyncStatus> {
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
......
...@@ -67,15 +67,15 @@ public class CatalogueScreen extends AppCompatActivity { ...@@ -67,15 +67,15 @@ public class CatalogueScreen extends AppCompatActivity {
// Send initial screen view hit. // Send initial screen view hit.
Util.sendScreenName(tracker, actionBar.getTitle().toString()); Util.sendScreenName(tracker, actionBar.getTitle().toString());
List<Catalogue> catalogueList = CatalogueManager.getAllCatalogues();
if(catalogueList.isEmpty()) {
if(application.isNetConnected()) { if(application.isNetConnected()) {
new FetchCatalogue().execute(); new FetchCatalogue().execute();
} else { } else {
List<Catalogue> catalogueList = CatalogueManager.getAllCatalogues();
if(!catalogueList.isEmpty()) {
setData(catalogueList);
} else {
DialogUtils.showNoConnectionDialogWithCloseActivity(CatalogueScreen.this); DialogUtils.showNoConnectionDialogWithCloseActivity(CatalogueScreen.this);
} }
} else {
setData(catalogueList);
} }
} }
......
...@@ -171,19 +171,19 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -171,19 +171,19 @@ public class CatalogueVariableScreen extends AppCompatActivity {
// Send initial screen view hit. // Send initial screen view hit.
Util.sendScreenName(tracker, actionBar.getTitle().toString()); Util.sendScreenName(tracker, actionBar.getTitle().toString());
mCatalogueVariableList = CatalogueVariableManager.getAllVariable(mCatalogueItem.getId());
setVariableChoices();
if (mCatalogueVariableList.isEmpty()) {
if (mApplication.isNetConnected()) { if (mApplication.isNetConnected()) {
new FetchCatalogueVariable().execute(); new FetchCatalogueVariable().execute();
} else { } else {
mCatalogueVariableList = CatalogueVariableManager.getAllVariable(mCatalogueItem.getId());
if (mCatalogueVariableList.isEmpty()) {
DialogUtils.showNoConnectionDialogWithCloseActivity(CatalogueVariableScreen.this); DialogUtils.showNoConnectionDialogWithCloseActivity(CatalogueVariableScreen.this);
}
} else { } else {
setVariableChoices();
createView(); createView();
runUIPolicyActions(null); runUIPolicyActions(null);
} }
} }
}
class FetchCatalogueVariable extends AsyncTask<String, Void, SyncStatus> { class FetchCatalogueVariable extends AsyncTask<String, Void, SyncStatus> {
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
......
...@@ -67,17 +67,17 @@ public class MyIncidentScreen extends AppCompatActivity { ...@@ -67,17 +67,17 @@ public class MyIncidentScreen extends AppCompatActivity {
// Send initial screen view hit. // Send initial screen view hit.
Util.sendScreenName(tracker, actionBar.getTitle().toString()); Util.sendScreenName(tracker, actionBar.getTitle().toString());
mIncidentList = MyIncidentsManager.getAllIncidents();
if(mIncidentList.isEmpty()) {
if (application.isNetConnected()) { if (application.isNetConnected()) {
new FetchIncident().execute(); new FetchIncident().execute();
} else { } else {
mIncidentList = MyIncidentsManager.getAllIncidents();
if(mIncidentList.isEmpty()) {
DialogUtils.showNoConnectionDialogWithCloseActivity(MyIncidentScreen.this); DialogUtils.showNoConnectionDialogWithCloseActivity(MyIncidentScreen.this);
}
} else { } else {
setData(mIncidentList); setData(mIncidentList);
} }
} }
}
@OnItemClick(R.id.my_incidents_screen_list_view) @OnItemClick(R.id.my_incidents_screen_list_view)
void listViewOnClicked(int position) { void listViewOnClicked(int position) {
......
...@@ -68,17 +68,17 @@ public class MyRequestActivity extends AppCompatActivity { ...@@ -68,17 +68,17 @@ public class MyRequestActivity extends AppCompatActivity {
mAdapter = new MyRequestAdapter(MyRequestActivity.this); mAdapter = new MyRequestAdapter(MyRequestActivity.this);
mListView.setAdapter(mAdapter); mListView.setAdapter(mAdapter);
List<MyRequest> myRequestList = MyRequestsManager.getAllRequests();
if(myRequestList.isEmpty()) {
if(application.isNetConnected()) { if(application.isNetConnected()) {
new FetchMyRequestData().execute(); new FetchMyRequestData().execute();
} else { } else {
List<MyRequest> myRequestList = MyRequestsManager.getAllRequests();
if(myRequestList.isEmpty()) {
DialogUtils.showNoConnectionDialogWithCloseActivity(MyRequestActivity.this); DialogUtils.showNoConnectionDialogWithCloseActivity(MyRequestActivity.this);
}
} else { } else {
setData(myRequestList); setData(myRequestList);
} }
} }
}
class FetchMyRequestData extends AsyncTask<String, Void, SyncStatus> { class FetchMyRequestData extends AsyncTask<String, Void, SyncStatus> {
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment