Created
August 31, 2013 10:01
-
-
Save harshalbhakta/6397309 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void loadUpdates(boolean loadWordADay) | |
| { | |
| try | |
| { | |
| if (Util.isNetworkAvailable(this)) | |
| { | |
| sendProgress(ProgressMode.UPDATE_STARTED.ordinal()); | |
| //-- Update Word of the day | |
| if(loadWordADay) { | |
| Util.updateWordOfTheDay(); | |
| sendProgress(ProgressMode.WORD_A_DAY_UPDATE_COMPLETE.ordinal()); | |
| } | |
| // Note: made delete first and then update to ensure words not to be looped are all cleared | |
| //-- Remove deleted words | |
| Util.removeDeletedWords(); | |
| sendProgress(ProgressMode.DELETE_COMPLETE.ordinal()); | |
| //-- Update words & sentences. | |
| Util.updateWords(); | |
| sendProgress(ProgressMode.UPDATE_COMPLETE.ordinal()); | |
| }else | |
| { | |
| sendProgress(ProgressMode.NETWORK_CONNECTIVITY_FAILED.ordinal()); | |
| Thread.sleep(1000); | |
| sendProgress(ProgressMode.UPDATE_FAILED.ordinal()); | |
| } | |
| // wait for some time before setting old subtitle | |
| Thread.sleep(2000); | |
| // to change subtitle status back to the default subtitle | |
| sendProgress(ProgressMode.RESET_TITLE.ordinal()); | |
| }catch (Exception e) { | |
| e.printStackTrace(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment