Fix new version checking
This commit is contained in:
parent
9b2c616baa
commit
38ec856198
1 changed files with 8 additions and 6 deletions
|
@ -121,7 +121,7 @@ public class LauncherActivity extends Activity {
|
||||||
|
|
||||||
if(mPref.getBoolean("check_updates", true))
|
if(mPref.getBoolean("check_updates", true))
|
||||||
{
|
{
|
||||||
new RetrieveJSON(true).execute(UPDATE_LINK);
|
new CheckUpdate(true).execute(UPDATE_LINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -221,12 +221,12 @@ public class LauncherActivity extends Activity {
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RetrieveJSON extends AsyncTask<String, Void, String> {
|
private class CheckUpdate extends AsyncTask<String, Void, String> {
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
ByteArrayOutputStream os = null;
|
ByteArrayOutputStream os = null;
|
||||||
boolean mSilent;
|
boolean mSilent;
|
||||||
|
|
||||||
public RetrieveJSON( boolean silent )
|
public CheckUpdate( boolean silent )
|
||||||
{
|
{
|
||||||
mSilent = silent;
|
mSilent = silent;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,8 @@ public class LauncherActivity extends Activity {
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (os != null) {
|
if (os != null)
|
||||||
|
{
|
||||||
os.close();
|
os.close();
|
||||||
os = null;
|
os = null;
|
||||||
}
|
}
|
||||||
|
@ -288,9 +289,10 @@ public class LauncherActivity extends Activity {
|
||||||
Log.d("Xash", "Found: " + version +
|
Log.d("Xash", "Found: " + version +
|
||||||
", I: " + getString(R.string.version_string));
|
", I: " + getString(R.string.version_string));
|
||||||
|
|
||||||
if( !getString(R.string.version_string).equals(version) )
|
// this is an update
|
||||||
|
if( getString(R.string.version_string).compareTo(version) < 0 )
|
||||||
{
|
{
|
||||||
String dialog_message = getString(R.string.update_message).format(name);
|
String dialog_message = String.format(getString(R.string.update_message), name);
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getBaseContext());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getBaseContext());
|
||||||
builder.setMessage(dialog_message)
|
builder.setMessage(dialog_message)
|
||||||
.setPositiveButton(R.string.update, new DialogInterface.OnClickListener()
|
.setPositiveButton(R.string.update, new DialogInterface.OnClickListener()
|
||||||
|
|
Loading…
Add table
Reference in a new issue