diff --git a/res/values/strings.xml b/res/values/strings.xml
index 40f182af..c1fbf30f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -61,7 +61,6 @@
Show changelog
https://download.lineageos.org/%1$s/changes
- Checking for updates
New updates found
No new updates found
The update check failed. Please check your internet connection and try again later.
diff --git a/src/org/lineageos/updater/UpdatesActivity.java b/src/org/lineageos/updater/UpdatesActivity.java
index a3c7b7d4..416e1e31 100644
--- a/src/org/lineageos/updater/UpdatesActivity.java
+++ b/src/org/lineageos/updater/UpdatesActivity.java
@@ -15,11 +15,9 @@
*/
package org.lineageos.updater;
-import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
@@ -42,6 +40,9 @@ import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.LinearInterpolator;
+import android.view.animation.RotateAnimation;
import android.widget.TextView;
import org.json.JSONException;
@@ -71,6 +72,9 @@ public class UpdatesActivity extends UpdatesListActivity {
private UpdatesListAdapter mAdapter;
+ private View mRefreshIconView;
+ private RotateAnimation mRefreshAnimation;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -147,6 +151,11 @@ public class UpdatesActivity extends UpdatesListActivity {
// This can't be collapsed without a touchscreen
appBar.setExpanded(false);
}
+
+ mRefreshAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
+ Animation.RELATIVE_TO_SELF, 0.5f);
+ mRefreshAnimation.setInterpolator(new LinearInterpolator());
+ mRefreshAnimation.setDuration(1000);
}
@Override
@@ -353,12 +362,6 @@ public class UpdatesActivity extends UpdatesListActivity {
String url = Utils.getServerURL(this);
Log.d(TAG, "Checking " + url);
- final ProgressDialog progressDialog = new ProgressDialog(this);
- progressDialog.setTitle(R.string.app_name);
- progressDialog.setMessage(getString(R.string.dialog_checking_for_updates));
- progressDialog.setIndeterminate(true);
- progressDialog.setCancelable(true);
-
DownloadClient.DownloadCallback callback = new DownloadClient.DownloadCallback() {
@Override
public void onFailure(final boolean cancelled) {
@@ -366,10 +369,10 @@ public class UpdatesActivity extends UpdatesListActivity {
runOnUiThread(new Runnable() {
@Override
public void run() {
- progressDialog.dismiss();
if (!cancelled) {
showSnackbar(R.string.snack_updates_check_failed, Snackbar.LENGTH_LONG);
}
+ refreshAnimationStop();
}
});
}
@@ -386,7 +389,7 @@ public class UpdatesActivity extends UpdatesListActivity {
public void run() {
Log.d(TAG, "List downloaded");
processNewJson(jsonFile, jsonFileTmp, manualRefresh);
- progressDialog.dismiss();
+ refreshAnimationStop();
}
});
}
@@ -405,14 +408,7 @@ public class UpdatesActivity extends UpdatesListActivity {
return;
}
- progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
- @Override
- public void onCancel(DialogInterface dialog) {
- progressDialog.dismiss();
- downloadClient.cancel();
- }
- });
- progressDialog.show();
+ refreshAnimationStart();
downloadClient.start();
}
@@ -446,4 +442,22 @@ public class UpdatesActivity extends UpdatesListActivity {
public void showSnackbar(int stringId, int duration) {
Snackbar.make(findViewById(R.id.main_container), stringId, duration).show();
}
+
+ private void refreshAnimationStart() {
+ if (mRefreshIconView == null) {
+ mRefreshIconView = findViewById(R.id.menu_refresh);
+ }
+ if (mRefreshIconView != null) {
+ mRefreshAnimation.setRepeatCount(Animation.INFINITE);
+ mRefreshIconView.startAnimation(mRefreshAnimation);
+ mRefreshIconView.setEnabled(false);
+ }
+ }
+
+ private void refreshAnimationStop() {
+ if (mRefreshIconView != null) {
+ mRefreshAnimation.setRepeatCount(0);
+ mRefreshIconView.setEnabled(true);
+ }
+ }
}