From baca47c47cd0e315ff8151a99ed2fa5fa9dc6d62 Mon Sep 17 00:00:00 2001 From: gumartinm Date: Sun, 24 Jun 2012 00:26:01 +0200 Subject: [PATCH] MobiAds: fix background color and item click Background color when item selected blue by default. URI item click was not correct. --- Android/MobiAdsReloaded/res/layout/ads_entry_list_item.xml | 6 +++--- .../src/de/android/mobiads/list/AdsEntryAdapter.java | 2 +- .../src/de/android/mobiads/list/MobiAdsLatestList.java | 7 +++---- .../src/de/android/mobiads/list/MobiAdsList.java | 11 +++++++---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Android/MobiAdsReloaded/res/layout/ads_entry_list_item.xml b/Android/MobiAdsReloaded/res/layout/ads_entry_list_item.xml index 623ede1..a95c7c7 100644 --- a/Android/MobiAdsReloaded/res/layout/ads_entry_list_item.xml +++ b/Android/MobiAdsReloaded/res/layout/ads_entry_list_item.xml @@ -4,8 +4,7 @@ + android:orientation="vertical"> + android:contentDescription="@string/desc" + android:background="?android:attr/activatedBackgroundIndicator"/> { color = Color.BLACK; colorText = Color.GRAY; } + view.setBackgroundColor(color); // Setting the text view @@ -64,7 +65,6 @@ public final class AdsEntryAdapter extends ArrayAdapter { // Setting image view viewHolder.imageView.setImageBitmap(entry.getIcon()); - viewHolder.imageView.setBackgroundColor(Color.BLACK); return view; diff --git a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java index 8033c29..5d44ffe 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java @@ -32,13 +32,13 @@ import de.android.mobiads.provider.Indexer; public class MobiAdsLatestList extends ListActivity implements LoaderManager.LoaderCallbacks> { - AdsEntryAdapter mAdapter; + AdsEntryLatestAdapter mAdapter; @Override public void onResume() { super.onResume(); - mAdapter = new AdsEntryAdapter(this, R.layout.ads_entry_list_item); + mAdapter = new AdsEntryLatestAdapter(this, R.layout.ads_entry_list_item); setListAdapter(mAdapter); getListView().setTextFilterEnabled(true); @@ -58,13 +58,12 @@ public class MobiAdsLatestList extends ListActivity implements LoaderManager.Loa //Change notification (if there is one) Intent updateDatabase = new Intent("de.android.mobiads.MOBIADSRECEIVER"); - sendBroadcast(updateDatabase); Uri uri = Uri.parse(mAdapter.getItem(position).getURL()); startActivity(new Intent(Intent.ACTION_VIEW, uri)); - //Hopefully this will update our view showing a nice black background for this item in our list :/ + //This will update our view showing a nice black background for this item in our list :/ 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 979e78b..36e59bf 100644 --- a/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java +++ b/Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java @@ -335,8 +335,7 @@ public class MobiAdsList extends Activity { @Override public void onDestroyActionMode(ActionMode mode) { - //TODO: Save state (checked items) in order to keep them when coming back from - //the home screen. + //Nothing to do here. } @Override @@ -383,14 +382,13 @@ 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)); - //Hopefully this will update our view showing a nice black background for this item in our list :/ + //This will update our view showing a nice black background for this item in our list :/ mAdapter.notifyDataSetChanged(); } @@ -412,6 +410,11 @@ public class MobiAdsList extends Activity { getActivity().getContentResolver().delete(uriDelete, null, null); mAdapter.remove(entry); + + //Change notification (if there is one) + Intent updateDatabase = new Intent("de.android.mobiads.MOBIADSRECEIVER"); + getActivity().sendBroadcast(updateDatabase); + mAdapter.notifyDataSetChanged(); } -- 2.1.4