mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
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:
parent
97c10da4a6
commit
cf1ef448e7
@ -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.
|
* src/pandroid_event_viewer/pandorafms/Options.java,
|
||||||
* res/layout/create_incident.xml: Progress circle next to groups spinner.
|
src/pandroid_event_viewer/pandorafms/Main.java,
|
||||||
* res/values/strings.xml: New entries.
|
res/layout/main.xml,
|
||||||
* res/menu/options_menu_list_events.xml, res/menu/options_menu.xml: New incident icon.
|
res/layout/options.xml: Changed advanced filter from Options to Filter.
|
||||||
* res/drawable-ldpi/incident.png: Added new icon
|
|
||||||
|
|
||||||
2012-06-06 Santiago Munín <burning1@gmail.com>
|
2012-06-06 Santiago Munín <burning1@gmail.com>
|
||||||
|
|
||||||
|
@ -91,10 +91,30 @@
|
|||||||
android:id="@+id/loading_tag"
|
android:id="@+id/loading_tag"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
</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
|
<LinearLayout
|
||||||
android:id="@+id/show_hide_layout"
|
android:id="@+id/show_hide_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -124,28 +124,6 @@
|
|||||||
android:textColor="#ffffff" />
|
android:textColor="#ffffff" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</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>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ import android.app.Activity;
|
|||||||
import android.app.TabActivity;
|
import android.app.TabActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.SharedPreferences.Editor;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -44,6 +45,9 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
@ -103,7 +107,7 @@ public class Main extends Activity {
|
|||||||
new GetTagsAsyncTask().execute();
|
new GetTagsAsyncTask().execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences preferences = getSharedPreferences(
|
final SharedPreferences preferences = getSharedPreferences(
|
||||||
this.getString(R.string.const_string_preferences),
|
this.getString(R.string.const_string_preferences),
|
||||||
Activity.MODE_PRIVATE);
|
Activity.MODE_PRIVATE);
|
||||||
|
|
||||||
@ -153,6 +157,36 @@ public class Main extends Activity {
|
|||||||
save_filter_watcher();
|
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) {
|
if (this.object.show_popup_info) {
|
||||||
this.object.show_popup_info = false;
|
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() {
|
public void onRestart() {
|
||||||
super.onRestart();
|
super.onRestart();
|
||||||
SharedPreferences preferences = getSharedPreferences(
|
SharedPreferences preferences = getSharedPreferences(
|
||||||
@ -552,4 +569,22 @@ public class Main extends Activity {
|
|||||||
text.setText("");
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
@ -81,9 +81,6 @@ public class Options extends Activity {
|
|||||||
text = (EditText) findViewById(R.id.password);
|
text = (EditText) findViewById(R.id.password);
|
||||||
text.setText(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);
|
Spinner combo = (Spinner) findViewById(R.id.refresh_combo);
|
||||||
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
|
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
|
||||||
this, R.array.refresh_combo,
|
this, R.array.refresh_combo,
|
||||||
@ -163,12 +160,11 @@ public class Options extends Activity {
|
|||||||
* Saves all options
|
* Saves all options
|
||||||
*/
|
*/
|
||||||
private void save_options() {
|
private void save_options() {
|
||||||
boolean advancedFilterOff = false;
|
|
||||||
SharedPreferences preferences = getSharedPreferences(
|
SharedPreferences preferences = getSharedPreferences(
|
||||||
this.getString(R.string.const_string_preferences),
|
this.getString(R.string.const_string_preferences),
|
||||||
Activity.MODE_PRIVATE);
|
Activity.MODE_PRIVATE);
|
||||||
SharedPreferences.Editor editorPreferences = preferences.edit();
|
SharedPreferences.Editor editorPreferences = preferences.edit();
|
||||||
|
|
||||||
// Connection settings
|
// Connection settings
|
||||||
EditText text = (EditText) findViewById(R.id.url);
|
EditText text = (EditText) findViewById(R.id.url);
|
||||||
String url = text.getText().toString();
|
String url = text.getText().toString();
|
||||||
@ -177,7 +173,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
|
// MainActivity uses this to know if it has to check tags and groups
|
||||||
|
// again
|
||||||
editorPreferences.putBoolean("url_changed", true);
|
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());
|
||||||
@ -188,13 +185,8 @@ public class Options extends Activity {
|
|||||||
editorPreferences.putInt("refreshTimeKey",
|
editorPreferences.putInt("refreshTimeKey",
|
||||||
combo.getSelectedItemPosition());
|
combo.getSelectedItemPosition());
|
||||||
|
|
||||||
CheckBox cb = (CheckBox) findViewById(R.id.checkBox_advanced_options);
|
|
||||||
editorPreferences.putBoolean("show_advanced", cb.isChecked());
|
|
||||||
if (!cb.isChecked()) {
|
|
||||||
advancedFilterOff = true;
|
|
||||||
}
|
|
||||||
// Notification settings
|
// Notification settings
|
||||||
cb = (CheckBox) findViewById(R.id.vibration_on);
|
CheckBox cb = (CheckBox) findViewById(R.id.vibration_on);
|
||||||
editorPreferences.putBoolean("vibration", cb.isChecked());
|
editorPreferences.putBoolean("vibration", cb.isChecked());
|
||||||
cb = (CheckBox) findViewById(R.id.led_flash_on);
|
cb = (CheckBox) findViewById(R.id.led_flash_on);
|
||||||
editorPreferences.putBoolean("led", cb.isChecked());
|
editorPreferences.putBoolean("led", cb.isChecked());
|
||||||
@ -214,8 +206,6 @@ public class Options extends Activity {
|
|||||||
Toast.LENGTH_LONG);
|
Toast.LENGTH_LONG);
|
||||||
toast.show();
|
toast.show();
|
||||||
}
|
}
|
||||||
if (advancedFilterOff)
|
|
||||||
setAdvancedOptionsDefaults();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -260,24 +250,6 @@ public class Options extends Activity {
|
|||||||
button.setText(getString(R.string.silence));
|
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.
|
* Checks if connection parameters are ok.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user