2012-05-31 Santiago Munín <burnin1@gmail.com>

* src/pandroid_event_viewer/pandorafms/Main.java: Now, on MainActivity's restart, fetches groups and tags if url was changed.
	* src/pandroid_event_viewer/pandorafms/Options.java: Puts a boolean in SharedPreferences if url was changed.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6393 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
santimunin 2012-05-31 17:34:45 +00:00
parent 9e3000e6e8
commit abe4634acf
3 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2012-05-31 Santiago Munín <burnin1@gmail.com>
* src/pandroid_event_viewer/pandorafms/Main.java: Now, on MainActivity's restart, fetches groups and tags if url was changed.
* src/pandroid_event_viewer/pandorafms/Options.java: Puts a boolean in SharedPreferences if url was changed.
2012-05-31 Santiago Munín <burnin1@gmail.com> 2012-05-31 Santiago Munín <burnin1@gmail.com>
* src/pandroid_event_viewer/pandorafms/Main.java: Added tag retrieving. * src/pandroid_event_viewer/pandorafms/Main.java: Added tag retrieving.
* res/layout/main.xml: Added tags' spinner. * res/layout/main.xml: Added tags' spinner.

View File

@ -180,10 +180,16 @@ public class Main extends Activity {
public void onRestart() { public void onRestart() {
super.onRestart(); super.onRestart();
SharedPreferences preferences = getSharedPreferences(
if (this.pandoraGroups.size() == 0) { this.getString(R.string.const_string_preferences),
Log.i(TAG, "onRestart: getting groups"); Activity.MODE_PRIVATE);
SharedPreferences.Editor editorPreferences = preferences.edit();
if (preferences.getBoolean("url_changed", false)) {
Log.i(TAG, "Getting groups and tags");
new GetGroupsAsyncTask().execute(); new GetGroupsAsyncTask().execute();
new GetTagsAsyncTask().execute();
editorPreferences.putBoolean("url_changed", false);
editorPreferences.commit();
} }
} }
@ -329,7 +335,7 @@ public class Main extends Activity {
array.add(tags[1]); array.add(tags[1]);
} }
} catch (Exception e) { } catch (Exception e) {
// Log.e(TAG + ": getting tags", e.getMessage()); Log.e(TAG, "getting tags problem");
} }
return array; return array;

View File

@ -177,6 +177,8 @@ public class Options extends Activity {
} }
editorPreferences.putString("url", url); editorPreferences.putString("url", url);
//MainActivity uses this to know if it has to check tags and groups again
editorPreferences.putBoolean("url_changed", true);
text = (EditText) findViewById(R.id.user); text = (EditText) findViewById(R.id.user);
editorPreferences.putString("user", text.getText().toString()); editorPreferences.putString("user", text.getText().toString());
text = (EditText) findViewById(R.id.password); text = (EditText) findViewById(R.id.password);