FIX: Reload list if there are changes, remove ads.
authorgumartinm <gustavo@gumartinm.name>
Sun, 17 Jun 2012 03:23:14 +0000 (05:23 +0200)
committergumartinm <gustavo@gumartinm.name>
Sun, 17 Jun 2012 03:23:14 +0000 (05:23 +0200)
Android/MobiAdsTabs/src/de/android/mobiads/MobiAdsPreferences.java
Android/MobiAdsTabs/src/de/android/mobiads/list/MobiAdsList.java

index 5033dfb..e717474 100644 (file)
@@ -11,12 +11,17 @@ import android.preference.PreferenceFragment;
 
 public class MobiAdsPreferences extends PreferenceFragment {
 
-       @Override 
-       public void onActivityCreated(Bundle savedInstanceState) {
-               super.onActivityCreated(savedInstanceState);
+       @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
 
         // Load the preferences from an XML resource
         addPreferencesFromResource(R.xml.preferences);
+    }
+       
+       @Override 
+       public void onActivityCreated(Bundle savedInstanceState) {
+               super.onActivityCreated(savedInstanceState);
         
         CheckBoxPreference checkBoxPreference = (CheckBoxPreference) findPreference("service_started");
         checkBoxPreference.setChecked(isMyServiceRunning());
index 94daec8..2d76af8 100644 (file)
@@ -190,14 +190,14 @@ public class MobiAdsList extends Activity {
                AdsEntryAdapter mAdapter;
                // If non-null, this is the current filter the user has provided.
                String mCurFilter;
-
+               
                @Override 
                public void onActivityCreated(Bundle savedInstanceState) {
                        super.onActivityCreated(savedInstanceState);
                        
                        ListView listView = getListView();
                        
-                       getActivity().registerForContextMenu(listView);
+                       registerForContextMenu(listView);
                        
                        listView.setOnItemClickListener(new OnItemClickListener() {
 
@@ -221,8 +221,10 @@ public class MobiAdsList extends Activity {
                        setListShown(false);
 
                        // Prepare the loader.  Either re-connect with an existing one,
-                       // or start a new one.
-                       getLoaderManager().initLoader(0, null, this);
+                       // or start a new one.                  
+                       //TODO: reload just if there are changes in the data base :/
+                       //getLoaderManager().initLoader(0, null, this);
+                       getLoaderManager().restartLoader(0, null, this);
                }
 
                @Override