Created
November 29, 2012 16:35
-
-
Save raziel23x/4170208 to your computer and use it in GitHub Desktop.
add goo.im support
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
// Start | |
if(getUrl.toString().contains("goo.im")){ | |
// do a dl then wait for timer | |
conn.connect(); | |
Log.v("OTA::Download", "Waiting out timer"); | |
publishProgress(-1); // pending on dialog | |
// dl the catch page then wait | |
is = new BufferedInputStream(conn.getInputStream()); | |
os = new FileOutputStream(destFile); | |
// get the timer page all 15 | |
byte[] buf = new byte[4096]; | |
int nRead = -1; | |
while ((nRead = is.read(buf)) != -1) { | |
if (this.isCancelled()) break; | |
os.write(buf, 0, nRead); | |
} | |
// got hold page pause | |
try { | |
Thread.sleep(10500); // pause the async task for 10.5 seconds | |
} catch (InterruptedException e) { | |
// don't panic and reset the link | |
} | |
Log.v("OTA::Download", "Timer Complete, Continuing with File Download"); | |
getUrl = new URL(info.url); | |
conn = getUrl.openConnection(); | |
} | |
// end do your thing as normal | |
// begin progress snipplet | |
if (values[0] == -1) { // i'm not sure yet please hold | |
dialog.setIndeterminate(true); | |
return; | |
} | |
dialog.setIndeterminate(false); // make sure dialog is ALWAYS sure for progress | |
// end progress snipplet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment