From 9f3d22da6c34c52440ae70f20142cb40fd96a815 Mon Sep 17 00:00:00 2001 From: gumartinm Date: Sun, 24 Jun 2012 03:13:48 +0200 Subject: [PATCH] MobiAds: show first the no already read ads. --- Android/MobiAdsReloaded/AndroidManifest.xml | 2 +- .../src/de/android/mobiads/MobiAdsService.java | 4 +- .../de/android/mobiads/list/MobiAdsLatestList.java | 62 +++++++++++++--------- .../src/de/android/mobiads/list/MobiAdsList.java | 14 ++--- .../src/de/android/mobiads/provider/Indexer.java | 2 +- 5 files changed, 49 insertions(+), 35 deletions(-) diff --git a/Android/MobiAdsReloaded/AndroidManifest.xml b/Android/MobiAdsReloaded/AndroidManifest.xml index c444fa6..614c48f 100644 --- a/Android/MobiAdsReloaded/AndroidManifest.xml +++ b/Android/MobiAdsReloaded/AndroidManifest.xml @@ -18,7 +18,7 @@ - + data) { mAdapter.setData(data); - + mAdapter.notifyDataSetChanged(); } @Override @@ -146,12 +155,17 @@ public class MobiAdsLatestList extends ListActivity implements LoaderManager.Loa + "/idad/" + idAd); getContentResolver().delete(uriDelete, null, null); - mAdapter.remove(entry); - + //Change notification (if there is one) - Intent updateDatabase = new Intent("de.android.mobiads.MOBIADSRECEIVER"); + Intent updateDatabase = new Intent("de.android.mobiads.MOBIADSSERVICERECEIVER"); + sendBroadcast(updateDatabase); + + //Update view lists + updateDatabase = new Intent("de.android.mobiads.MOBIADSLISTRECEIVER"); sendBroadcast(updateDatabase); + mAdapter.remove(entry); + mAdapter.notifyDataSetChanged(); } diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java index e747b83..18ae170 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java @@ -398,15 +398,15 @@ public class MobiAdsList extends Activity { } //Change notification (if there is one) - Intent updateDatabase = new Intent("de.android.mobiads.MOBIADSRECEIVER"); - getActivity().sendBroadcast(updateDatabase); - - //Going to open the web navigator whatever it is... - Uri uri = Uri.parse(entry.getURL()); - startActivity(new Intent(Intent.ACTION_VIEW, uri)); + Intent updateDatabase = new Intent("de.android.mobiads.MOBIADSSERVICERECEIVER"); + getActivity().sendBroadcast(updateDatabase); //This will update our view showing a nice black background for this item in our list :/ mAdapter.notifyDataSetChanged(); + + //Going to open the web navigator whatever it is... + Uri uri = Uri.parse(entry.getURL()); + startActivity(new Intent(Intent.ACTION_VIEW, uri)); } private void setIsReadEntry(final AdsEntry entry) { @@ -429,7 +429,7 @@ public class MobiAdsList extends Activity { mAdapter.remove(entry); //Change notification (if there is one) - Intent updateDatabase = new Intent("de.android.mobiads.MOBIADSRECEIVER"); + Intent updateDatabase = new Intent("de.android.mobiads.MOBIADSSERVICERECEIVER"); getActivity().sendBroadcast(updateDatabase); mAdapter.notifyDataSetChanged(); diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/provider/Indexer.java b/Android/MobiAdsReloaded/src/de/android/mobiads/provider/Indexer.java index c44756c..454c843 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/provider/Indexer.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/provider/Indexer.java @@ -64,7 +64,7 @@ public final class Indexer { /** * The default sort order for this table */ - public static final String DEFAULT_SORT_ORDER = Index._ID; + public static final String DEFAULT_SORT_ORDER = Index.COLUMN_NAME_IS_READ; /** * The MIME type of {@link #CONTENT_URI} providing a directory of notes. -- 2.1.4