diff --git a/src/com/axelby/podax/BootReceiver.java b/src/com/axelby/podax/BootReceiver.java index b5e83ba2..eca3edd8 100644 --- a/src/com/axelby/podax/BootReceiver.java +++ b/src/com/axelby/podax/BootReceiver.java @@ -5,7 +5,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.net.Uri; public class BootReceiver extends BroadcastReceiver { @@ -21,8 +20,6 @@ public static void setupAlarms(Context context) { // refresh the feeds Intent refreshIntent = new Intent(context, UpdateService.class); refreshIntent.setAction(Constants.ACTION_REFRESH_ALL_SUBSCRIPTIONS); - refreshIntent.setData(Uri.parse("podax://refreshSubscriptions/alarm")); - refreshIntent.putExtra(Constants.EXTRA_MANUAL_REFRESH, false); PendingIntent pendingRefreshIntent = PendingIntent.getService(context, 0, refreshIntent, 0); alarmManager.cancel(pendingRefreshIntent); alarmManager.setInexactRepeating(AlarmManager.RTC, diff --git a/src/com/axelby/podax/PodcastProvider.java b/src/com/axelby/podax/PodcastProvider.java index d7eaf4ae..39d339ca 100644 --- a/src/com/axelby/podax/PodcastProvider.java +++ b/src/com/axelby/podax/PodcastProvider.java @@ -281,7 +281,7 @@ public void updateQueuePosition(String podcastId, Integer newPosition) { + "WHERE queuePosition >= ?", new Object[] { newPosition }); // download the newly added podcast - UpdateService.downloadPodcasts(getContext()); + UpdateService.downloadPodcastsSilently(getContext()); } else if (oldPosition != null && newPosition == null) { // remove 3: 1 2 3 4 5 do: 4-- 5-- db.execSQL("UPDATE podcasts SET queuePosition = queuePosition - 1 " diff --git a/src/com/axelby/podax/SubscriptionUpdater.java b/src/com/axelby/podax/SubscriptionUpdater.java index 6ba64637..e74bb1ea 100644 --- a/src/com/axelby/podax/SubscriptionUpdater.java +++ b/src/com/axelby/podax/SubscriptionUpdater.java @@ -136,7 +136,7 @@ public void update(int subscriptionId) { if (cursor != null) cursor.close(); removeUpdateNotification(); - UpdateService.downloadPodcasts(_context); + UpdateService.downloadPodcastsSilently(_context); } }; diff --git a/src/com/axelby/podax/UpdateService.java b/src/com/axelby/podax/UpdateService.java index f3240adf..5348ab25 100644 --- a/src/com/axelby/podax/UpdateService.java +++ b/src/com/axelby/podax/UpdateService.java @@ -15,6 +15,7 @@ import android.content.Intent; import android.database.Cursor; import android.net.Uri; +import android.os.Handler; import android.preference.PreferenceManager; import android.util.Log; import android.widget.Toast; @@ -47,10 +48,18 @@ public static void downloadPodcasts(Context context) { context.startService(intent); } + public static void downloadPodcastsSilently(Context context) { + Intent intent = new Intent(context, UpdateService.class); + intent.setAction(Constants.ACTION_DOWNLOAD_PODCASTS); + context.startService(intent); + } + public UpdateService() { super("Podax_UpdateService"); } + Handler _handler = new Handler(); + @Override protected void onHandleIntent(Intent intent) { String action = intent.getAction(); @@ -58,7 +67,13 @@ protected void onHandleIntent(Intent intent) { return; if (intent.getBooleanExtra(Constants.EXTRA_MANUAL_REFRESH, false) && !Helper.ensureWifi(this)) { - Toast.makeText(this, R.string.update_request_no_wifi, Toast.LENGTH_SHORT).show(); + _handler.post(new Runnable() { + public void run() { + Toast.makeText(UpdateService.this, + R.string.update_request_no_wifi, + Toast.LENGTH_SHORT).show(); + } + }); return; } diff --git a/src/com/axelby/podax/ui/SubscriptionListFragment.java b/src/com/axelby/podax/ui/SubscriptionListFragment.java index adf0e2e3..3ebe1fb5 100644 --- a/src/com/axelby/podax/ui/SubscriptionListFragment.java +++ b/src/com/axelby/podax/ui/SubscriptionListFragment.java @@ -3,12 +3,10 @@ import java.io.File; import android.app.NotificationManager; -import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.graphics.BitmapFactory; -import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.ListFragment; @@ -30,7 +28,6 @@ import com.axelby.podax.R; import com.axelby.podax.SubscriptionCursor; import com.axelby.podax.SubscriptionProvider; -import com.axelby.podax.UpdateService; public class SubscriptionListFragment extends ListFragment implements LoaderManager.LoaderCallbacks { private SubscriptionAdapter _adapter = null; @@ -54,15 +51,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - Intent intent = getActivity().getIntent(); - // check if this was opened by android to save an RSS feed - if (intent.getDataString() != null) { - ContentValues values = new ContentValues(); - values.put(SubscriptionProvider.COLUMN_URL, intent.getDataString()); - Uri savedSubscription = getActivity().getContentResolver().insert(SubscriptionProvider.URI, values); - UpdateService.updateSubscription(getActivity(), Integer.valueOf(savedSubscription.getLastPathSegment())); - } - registerForContextMenu(getListView()); // remove any subscription update errors