Skip to content

Commit

Permalink
Show toasts when no network or unable to fetch projects
Browse files Browse the repository at this point in the history
Issue #1
  • Loading branch information
ylogx committed May 30, 2015
1 parent 8d5c2d8 commit ffe7b4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
//noinspection SimplifiableIfStatement

if (item.getItemId() == R.id.action_refresh) {
Toast.makeText(this, "Refreshing", Toast.LENGTH_SHORT).show();
Toast.makeText(this, getString(R.string.toast_refreshing), Toast.LENGTH_SHORT).show();
refresh();
return true;
}
Expand Down Expand Up @@ -185,6 +185,7 @@ public void refresh() {
downloadXmlTask.execute(projectUrl);
} else {
Log.v(TAG, "refresh: No Network");
Toast.makeText(this, getString(R.string.toast_network_unavailable), Toast.LENGTH_SHORT).show();
}
}

Expand Down Expand Up @@ -222,6 +223,7 @@ public void onClick(DialogInterface dialog, int id) {

public void updateListView(List<Project> projects) {
if (projects == null) {
Toast.makeText(this, getString(R.string.toast_unable_to_fetch_project_list), Toast.LENGTH_SHORT).show();
Log.d(TAG, "Error: project list came empty");
return;
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
<string name="action_add_url">Add Url</string>
<string name="dialog_message_add_url">Specify the cctray xml url from your build server</string>
<string name="dialog_title_add_url">Add Url</string>
<string name="toast_unable_to_fetch_project_list">Unable to fetch project list</string>
<string name="toast_network_unavailable">Network Unavailable</string>
<string name="toast_refreshing">Refreshing</string>

</resources>

0 comments on commit ffe7b4c

Please # to comment.