Skip to content

Commit

Permalink
fixed when the podax has no wi-fi warning
Browse files Browse the repository at this point in the history
  • Loading branch information
thasmin committed Jun 5, 2012
1 parent 6426bc9 commit 7610dc1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
3 changes: 0 additions & 3 deletions src/com/axelby/podax/BootReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/com/axelby/podax/PodcastProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
2 changes: 1 addition & 1 deletion src/com/axelby/podax/SubscriptionUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void update(int subscriptionId) {
if (cursor != null)
cursor.close();
removeUpdateNotification();
UpdateService.downloadPodcasts(_context);
UpdateService.downloadPodcastsSilently(_context);
}
};

Expand Down
17 changes: 16 additions & 1 deletion src/com/axelby/podax/UpdateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -47,18 +48,32 @@ 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();
if (action == null)
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;
}

Expand Down
12 changes: 0 additions & 12 deletions src/com/axelby/podax/ui/SubscriptionListFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Cursor> {
private SubscriptionAdapter _adapter = null;
Expand All @@ -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
Expand Down

0 comments on commit 7610dc1

Please sign in to comment.