2012-06-11 Santiago Munin <burning1@gmail.com>

* src/pandroid_event_viewer/pandorafms/Options.java,
	src/pandroid_event_viewer/pandorafms/Main.java,
	res/layout/main.xml,
	res/layout/options.xml: Changed advanced filter from Options to Filter.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6486 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
santimunin 2012-06-11 14:46:18 +00:00
parent efaf54c47c
commit fbb0318785
5 changed files with 83 additions and 79 deletions

View File

@ -1,10 +1,9 @@
2012-06-06 Santiago Munín <burning1@gmail.com>
2012-06-11 Santiago Munín <burning1@gmail.com>
* src/pandroid_event_viewer/pandorafms/CreateIncidentActivity.java: All api operations are now asynchronous.
* res/layout/create_incident.xml: Progress circle next to groups spinner.
* res/values/strings.xml: New entries.
* res/menu/options_menu_list_events.xml, res/menu/options_menu.xml: New incident icon.
* res/drawable-ldpi/incident.png: Added new icon
* src/pandroid_event_viewer/pandorafms/Options.java,
src/pandroid_event_viewer/pandorafms/Main.java,
res/layout/main.xml,
res/layout/options.xml: Changed advanced filter from Options to Filter.
2012-06-06 Santiago Munín <burning1@gmail.com>

View File

@ -91,10 +91,30 @@
android:id="@+id/loading_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:orientation="horizontal" >
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="3"
android:text="@string/advanced_options"
android:textColor="#ffffff" />
<CheckBox
android:id="@+id/checkBox_advanced_options"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/show_hide_layout"
android:layout_width="match_parent"

View File

@ -124,28 +124,6 @@
android:textColor="#ffffff" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="3"
android:text="@string/advanced_options"
android:textColor="#ffffff" />
<CheckBox
android:id="@+id/checkBox_advanced_options"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -35,6 +35,7 @@ import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
@ -44,6 +45,9 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
@ -103,7 +107,7 @@ public class Main extends Activity {
new GetTagsAsyncTask().execute();
}
SharedPreferences preferences = getSharedPreferences(
final SharedPreferences preferences = getSharedPreferences(
this.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
@ -153,6 +157,36 @@ public class Main extends Activity {
save_filter_watcher();
}
});
LinearLayout advancedOptions = (LinearLayout) findViewById(R.id.show_hide_layout);
// Show advanced options?
if (preferences.getBoolean("show_advanced", false)) {
advancedOptions.setVisibility(View.VISIBLE);
} else {
advancedOptions.setVisibility(View.INVISIBLE);
setAdvancedOptionsDefaults();
clearAdvancedOptions();
}
CheckBox cb = (CheckBox) findViewById(R.id.checkBox_advanced_options);
cb.setChecked(preferences.getBoolean("show_advanced", false));
cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
LinearLayout advancedOptions = (LinearLayout) findViewById(R.id.show_hide_layout);
Editor preferencesEditor = preferences.edit();
if (isChecked) {
advancedOptions.setVisibility(View.VISIBLE);
preferencesEditor.putBoolean("show_advanced", true);
} else {
advancedOptions.setVisibility(View.INVISIBLE);
preferencesEditor.putBoolean("show_advanced", false);
setAdvancedOptionsDefaults();
clearAdvancedOptions();
}
preferencesEditor.commit();
}
});
if (this.object.show_popup_info) {
this.object.show_popup_info = false;
@ -161,23 +195,6 @@ public class Main extends Activity {
}
}
@Override
protected void onResume() {
super.onResume();
SharedPreferences preferences = getSharedPreferences(
this.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
// Show advanced options?
if (preferences.getBoolean("show_advanced", false)) {
((LinearLayout) findViewById(R.id.show_hide_layout))
.setVisibility(View.VISIBLE);
} else {
((LinearLayout) findViewById(R.id.show_hide_layout))
.setVisibility(View.INVISIBLE);
clearAdvancedOptions();
}
}
public void onRestart() {
super.onRestart();
SharedPreferences preferences = getSharedPreferences(
@ -552,4 +569,22 @@ public class Main extends Activity {
text.setText("");
}
/**
* Puts advanced options to default values.
*/
private void setAdvancedOptionsDefaults() {
SharedPreferences preferences = getSharedPreferences(
this.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences.Editor editorPreferences = preferences.edit();
editorPreferences.putString("filterAgentName", "");
editorPreferences.putInt("filterIDGroup", 0);
editorPreferences.putInt("filterSeverity", -1);
editorPreferences.putString("filterEventSearch", "");
editorPreferences.putInt("filterLastTime", 6);
// There were changes
editorPreferences.putBoolean("filterChanges", true);
editorPreferences.commit();
}
}

View File

@ -81,9 +81,6 @@ public class Options extends Activity {
text = (EditText) findViewById(R.id.password);
text.setText(password);
((CheckBox) findViewById(R.id.checkBox_advanced_options))
.setChecked(preferences.getBoolean("show_advanced", false));
Spinner combo = (Spinner) findViewById(R.id.refresh_combo);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.refresh_combo,
@ -163,12 +160,11 @@ public class Options extends Activity {
* Saves all options
*/
private void save_options() {
boolean advancedFilterOff = false;
SharedPreferences preferences = getSharedPreferences(
this.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences.Editor editorPreferences = preferences.edit();
// Connection settings
EditText text = (EditText) findViewById(R.id.url);
String url = text.getText().toString();
@ -177,7 +173,8 @@ public class Options extends Activity {
}
editorPreferences.putString("url", url);
//MainActivity uses this to know if it has to check tags and groups again
// 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());
@ -188,13 +185,8 @@ public class Options extends Activity {
editorPreferences.putInt("refreshTimeKey",
combo.getSelectedItemPosition());
CheckBox cb = (CheckBox) findViewById(R.id.checkBox_advanced_options);
editorPreferences.putBoolean("show_advanced", cb.isChecked());
if (!cb.isChecked()) {
advancedFilterOff = true;
}
// Notification settings
cb = (CheckBox) findViewById(R.id.vibration_on);
CheckBox cb = (CheckBox) findViewById(R.id.vibration_on);
editorPreferences.putBoolean("vibration", cb.isChecked());
cb = (CheckBox) findViewById(R.id.led_flash_on);
editorPreferences.putBoolean("led", cb.isChecked());
@ -214,8 +206,6 @@ public class Options extends Activity {
Toast.LENGTH_LONG);
toast.show();
}
if (advancedFilterOff)
setAdvancedOptionsDefaults();
}
/**
@ -260,24 +250,6 @@ public class Options extends Activity {
button.setText(getString(R.string.silence));
}
}
/**
* Puts advanced options to default values.
*/
private void setAdvancedOptionsDefaults() {
SharedPreferences preferences = getSharedPreferences(
this.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences.Editor editorPreferences = preferences.edit();
editorPreferences.putString("filterAgentName", "");
editorPreferences.putInt("filterIDGroup", 0);
editorPreferences.putInt("filterSeverity", -1);
editorPreferences.putString("filterEventSearch", "");
editorPreferences.putInt("filterLastTime", 6);
// There were changes
editorPreferences.putBoolean("filterChanges", true);
editorPreferences.commit();
}
/**
* Checks if connection parameters are ok.