diff --git a/extras/pandroid_event_viewer/ChangeLog b/extras/pandroid_event_viewer/ChangeLog index e8c0aaf761..3b004fb199 100644 --- a/extras/pandroid_event_viewer/ChangeLog +++ b/extras/pandroid_event_viewer/ChangeLog @@ -1,3 +1,8 @@ +2012-08-10 Santiago Munín + * src/pandroid_event_viewer/pandorafms/Options.java: Removed url_changed in SharedPreferences. + * src/pandroid_event_viewer/pandorafms/Main.java: Tags and groups are loading onResume. Also, they are always loaded (url_changed isn't used anymore). + * src/pandroid_event_viewer/pandorafms/Core.java: Changed method visibility. + 2012-08-02 Santiago Munín * src/pandroid_event_viewer/pandorafms/Core.java: Changed timeout from 10 to 5 seconds. * res/layout/item_list_event_layout.xml: Increased drawablePadding of timestamp textview. diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Core.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Core.java index ffd11c2343..8000bccc39 100644 --- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Core.java +++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Core.java @@ -88,7 +88,7 @@ public class Core { * @param is * @return A string with all data read. */ - public static String convertStreamToString(InputStream is) { + private static String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is), 8 * 1024); StringBuilder sb = new StringBuilder(); diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Main.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Main.java index bc34af3d87..87ceac7367 100644 --- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Main.java +++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Main.java @@ -114,22 +114,10 @@ public class Main extends Activity { this.getString(R.string.preferences_set_demo_pandora_str), Toast.LENGTH_LONG); toast.show(); - } else { - buttonSearch.setEnabled(false); - buttonSetAsFilterWatcher.setEnabled(false); - buttonDeleteProfile.setEnabled(false); - - new GetGroupsAsyncTask().execute(); - if (version402) { - ((EditText) findViewById(R.id.tag_text)) - .setVisibility(View.VISIBLE); - ((ProgressBar) findViewById(R.id.loading_tag)) - .setVisibility(View.GONE); - ((Spinner) findViewById(R.id.tag)).setVisibility(View.GONE); - } else { - new GetTagsAsyncTask().execute(); - } } + buttonSearch.setEnabled(false); + buttonSetAsFilterWatcher.setEnabled(false); + buttonDeleteProfile.setEnabled(false); comboSeverity = (Spinner) findViewById(R.id.severity_combo); ArrayAdapter adapter = ArrayAdapter.createFromResource( @@ -277,20 +265,18 @@ public class Main extends Activity { } } - public void onRestart() { - super.onRestart(); - SharedPreferences preferences = getSharedPreferences( - this.getString(R.string.const_string_preferences), - Activity.MODE_PRIVATE); - SharedPreferences.Editor editorPreferences = preferences.edit(); - if (preferences.getBoolean("url_changed", false)) { - Log.i(TAG, "Getting groups and tags"); - new GetGroupsAsyncTask().execute(); - if (!version402) { - new GetTagsAsyncTask().execute(); - } - editorPreferences.putBoolean("url_changed", false); - editorPreferences.commit(); + public void onResume() { + super.onResume(); + Log.i(TAG, "Getting groups and tags"); + new GetGroupsAsyncTask().execute(); + if (version402) { + ((EditText) findViewById(R.id.tag_text)) + .setVisibility(View.VISIBLE); + ((ProgressBar) findViewById(R.id.loading_tag)) + .setVisibility(View.GONE); + ((Spinner) findViewById(R.id.tag)).setVisibility(View.GONE); + } else { + new GetTagsAsyncTask().execute(); } } diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Options.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Options.java index e0dc49aa0a..ad34560ac1 100644 --- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Options.java +++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Options.java @@ -84,7 +84,7 @@ public class Options extends Activity { text = (EditText) findViewById(R.id.password); text.setText(preferences.getString("password", "demo")); text = (EditText) findViewById(R.id.api_password); - text.setText(preferences.getString("api_password", "")); + text.setText(preferences.getString("api_password", "doreik0")); Spinner combo = (Spinner) findViewById(R.id.refresh_combo); ArrayAdapter adapter = ArrayAdapter.createFromResource( @@ -193,9 +193,6 @@ public class Options extends Activity { url = url.substring(0, url.length() - 1); } 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); editorPreferences.putString("user", text.getText().toString()); text = (EditText) findViewById(R.id.password);