MobiAds: fix background color and item click
authorgumartinm <gustavo@gumartinm.name>
Sat, 23 Jun 2012 22:26:01 +0000 (00:26 +0200)
committergumartinm <gustavo@gumartinm.name>
Sat, 23 Jun 2012 22:26:01 +0000 (00:26 +0200)
Background color when item selected blue by default.
URI item click was not correct.

Android/MobiAdsReloaded/res/layout/ads_entry_list_item.xml
Android/MobiAdsReloaded/src/de/android/mobiads/list/AdsEntryAdapter.java
Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsLatestList.java
Android/MobiAdsReloaded/src/de/android/mobiads/list/MobiAdsList.java

index 623ede1..a95c7c7 100644 (file)
@@ -4,8 +4,7 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
-    android:orientation="vertical"
-    android:background="?android:attr/activatedBackgroundIndicator">
+    android:orientation="vertical">
     
     <!-- Icon shown next to the title/text -->
     <ImageView
@@ -16,7 +15,8 @@
         android:layout_alignParentLeft="true"
         android:padding="3dp"
         android:orientation="vertical"
-        android:contentDescription="@string/desc"/>
+        android:contentDescription="@string/desc"
+        android:background="?android:attr/activatedBackgroundIndicator"/>
     
     <!-- Title of the ads entry -->
     <TextView
index 97ca24b..8775452 100644 (file)
@@ -52,6 +52,7 @@ public final class AdsEntryAdapter extends ArrayAdapter<AdsEntry> {
                        color = Color.BLACK;
                        colorText = Color.GRAY;
                }
+               
                view.setBackgroundColor(color);
                
                // Setting the text view
@@ -64,7 +65,6 @@ public final class AdsEntryAdapter extends ArrayAdapter<AdsEntry> {
 
                // Setting image view
                viewHolder.imageView.setImageBitmap(entry.getIcon());
-               viewHolder.imageView.setBackgroundColor(Color.BLACK);
                
 
                return view;
index 8033c29..5d44ffe 100644 (file)
@@ -32,13 +32,13 @@ import de.android.mobiads.provider.Indexer;
 
 public class MobiAdsLatestList extends ListActivity implements LoaderManager.LoaderCallbacks<List<AdsEntry>> 
 {
-       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();
                        }
                 });
index 979e78b..36e59bf 100644 (file)
@@ -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();
            }