2012-08-10 Santiago Munín <burning1@gmail.com>

* 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.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6853 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
santimunin 2012-08-09 22:22:02 +00:00
parent 60fc295dc9
commit 48988e0f49
4 changed files with 22 additions and 34 deletions

View File

@ -1,3 +1,8 @@
2012-08-10 Santiago Munín <burning1@gmail.com>
* 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 <burning1@gmail.com> 2012-08-02 Santiago Munín <burning1@gmail.com>
* src/pandroid_event_viewer/pandorafms/Core.java: Changed timeout from 10 to 5 seconds. * 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. * res/layout/item_list_event_layout.xml: Increased drawablePadding of timestamp textview.

View File

@ -88,7 +88,7 @@ public class Core {
* @param is * @param is
* @return A string with all data read. * @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), BufferedReader reader = new BufferedReader(new InputStreamReader(is),
8 * 1024); 8 * 1024);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@ -114,23 +114,11 @@ public class Main extends Activity {
this.getString(R.string.preferences_set_demo_pandora_str), this.getString(R.string.preferences_set_demo_pandora_str),
Toast.LENGTH_LONG); Toast.LENGTH_LONG);
toast.show(); toast.show();
} else { }
buttonSearch.setEnabled(false); buttonSearch.setEnabled(false);
buttonSetAsFilterWatcher.setEnabled(false); buttonSetAsFilterWatcher.setEnabled(false);
buttonDeleteProfile.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();
}
}
comboSeverity = (Spinner) findViewById(R.id.severity_combo); comboSeverity = (Spinner) findViewById(R.id.severity_combo);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.severity_array_values, this, R.array.severity_array_values,
@ -277,21 +265,19 @@ public class Main extends Activity {
} }
} }
public void onRestart() { public void onResume() {
super.onRestart(); super.onResume();
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"); Log.i(TAG, "Getting groups and tags");
new GetGroupsAsyncTask().execute(); new GetGroupsAsyncTask().execute();
if (!version402) { 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(); new GetTagsAsyncTask().execute();
} }
editorPreferences.putBoolean("url_changed", false);
editorPreferences.commit();
}
} }
/** /**

View File

@ -84,7 +84,7 @@ public class Options extends Activity {
text = (EditText) findViewById(R.id.password); text = (EditText) findViewById(R.id.password);
text.setText(preferences.getString("password", "demo")); text.setText(preferences.getString("password", "demo"));
text = (EditText) findViewById(R.id.api_password); 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); Spinner combo = (Spinner) findViewById(R.id.refresh_combo);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
@ -193,9 +193,6 @@ public class Options extends Activity {
url = url.substring(0, url.length() - 1); url = url.substring(0, url.length() - 1);
} }
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);