From 48988e0f4941f73b9e12cc571260c252e55af774 Mon Sep 17 00:00:00 2001 From: santimunin Date: Thu, 9 Aug 2012 22:22:02 +0000 Subject: [PATCH] =?UTF-8?q?2012-08-10=20Santiago=20Mun=C3=ADn=20=20=09*=20src/pandroid=5Fevent=5Fviewer/pandorafms/Op?= =?UTF-8?q?tions.java:=20Removed=20url=5Fchanged=20in=20SharedPreferences.?= =?UTF-8?q?=20=09*=20src/pandroid=5Fevent=5Fviewer/pandorafms/Main.java:?= =?UTF-8?q?=20Tags=20and=20groups=20are=20loading=20onResume.=20Also,=20th?= =?UTF-8?q?ey=20are=20always=20loaded=20(url=5Fchanged=20isn't=20used=20an?= =?UTF-8?q?ymore).=20=09*=20src/pandroid=5Fevent=5Fviewer/pandorafms/Core.?= =?UTF-8?q?java:=20Changed=20method=20visibility.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6853 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- extras/pandroid_event_viewer/ChangeLog | 5 +++ .../pandorafms/Core.java | 2 +- .../pandorafms/Main.java | 44 +++++++------------ .../pandorafms/Options.java | 5 +-- 4 files changed, 22 insertions(+), 34 deletions(-) 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);