mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2012-05-25 Santiago Munín <burning1@gmail.com>
* src/pandroid_event_viewer/pandorafms/Options.java: Added the option to show or hide advanced options (filter view). * res/layout/options.xml: Checkbox to select show or hide advanced options. * res/layout/main.xml: Show/hide advanced options (layout) and tag filter. * res/values/strings.xml: Added new entries. * src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java, src/pandroid_event_viewer/pandorafms/PandroidEventviewerService.java: Adapted event parsing to Pandora FMS v5 and added the tag filter. * src/pandroid_event_viewer/pandorafms/Main.java: Now, removes advanced filter options if "hide advanced options" is selected in options view. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6347 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
3efaf75d3d
commit
28f0284bc3
@ -1,3 +1,13 @@
|
|||||||
|
2012-05-25 Santiago Munín <burning1@gmail.com>
|
||||||
|
|
||||||
|
* src/pandroid_event_viewer/pandorafms/Options.java: Added the option to show or hide advanced options (filter view).
|
||||||
|
* res/layout/options.xml: Checkbox to select show or hide advanced options.
|
||||||
|
* res/layout/main.xml: Show/hide advanced options (layout) and tag filter.
|
||||||
|
* res/values/strings.xml: Added new entries.
|
||||||
|
* src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java,
|
||||||
|
src/pandroid_event_viewer/pandorafms/PandroidEventviewerService.java: Adapted event parsing to Pandora FMS v5 and added the tag filter.
|
||||||
|
* src/pandroid_event_viewer/pandorafms/Main.java: Now, removes advanced filter options if "hide advanced options" is selected in options view.
|
||||||
|
|
||||||
2012-05-23 Santiago Munín <burning1@gmail.com>
|
2012-05-23 Santiago Munín <burning1@gmail.com>
|
||||||
|
|
||||||
* Core.java: Added a generic function which will serialize given params in order to send an API request.
|
* Core.java: Added a generic function which will serialize given params in order to send an API request.
|
||||||
|
@ -21,41 +21,21 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/agent_label_str" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/agent_name"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="text"
|
|
||||||
android:singleLine="true" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/event_search_label_str" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/event_search_text"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="text"
|
|
||||||
android:singleLine="true" />
|
|
||||||
|
|
||||||
<TableLayout
|
<TableLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<TableRow>
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:paddingRight="5dip"
|
android:paddingRight="5dip"
|
||||||
android:text="@string/group_label_str" />
|
android:text="@string/group_label_str" />
|
||||||
@ -63,8 +43,7 @@
|
|||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/group_combo"
|
android:id="@+id/group_combo"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content" />
|
||||||
/>
|
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/loading_group"
|
android:id="@+id/loading_group"
|
||||||
@ -73,25 +52,14 @@
|
|||||||
android:layout_gravity="right" />
|
android:layout_gravity="right" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_gravity="center_vertical"
|
||||||
android:paddingRight="5dip"
|
|
||||||
android:text="@string/severity_label_str" />
|
|
||||||
|
|
||||||
<Spinner
|
|
||||||
android:id="@+id/severity_combo"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow>
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:paddingRight="5dip"
|
android:paddingRight="5dip"
|
||||||
android:text="@string/status_label_str" />
|
android:text="@string/status_label_str" />
|
||||||
@ -99,24 +67,99 @@
|
|||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/status_combo"
|
android:id="@+id/status_combo"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:paddingRight="5dip"
|
android:paddingRight="5dip"
|
||||||
android:text="@string/max_time_old_event_str"/>
|
android:text="@string/tag_label_str" />
|
||||||
|
|
||||||
<Spinner
|
<EditText
|
||||||
android:id="@+id/max_time_old_event_combo"
|
android:id="@+id/tag"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:inputType="text"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/show_hide_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:visibility="invisible" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/agent_label_str" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/agent_name"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="text"
|
||||||
|
android:singleLine="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/event_search_label_str" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/event_search_text"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="text"
|
||||||
|
android:singleLine="true" />
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<TableRow>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:paddingRight="5dip"
|
||||||
|
android:text="@string/severity_label_str" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/severity_combo"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:paddingRight="5dip"
|
||||||
|
android:text="@string/max_time_old_event_str" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/max_time_old_event_combo"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</TableRow>
|
||||||
|
</TableLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="2dp"
|
android:layout_height="2dp"
|
||||||
|
@ -87,8 +87,8 @@
|
|||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -112,7 +112,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -124,6 +124,28 @@
|
|||||||
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>
|
||||||
|
|
||||||
@ -198,7 +220,7 @@
|
|||||||
android:layout_width="200dp"
|
android:layout_width="200dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:text="@string/update_button_str"/>
|
android:text="@string/update_button_str" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
@ -15,22 +15,17 @@
|
|||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
-->
|
-->
|
||||||
<resources>
|
<resources>
|
||||||
<!-- CONST -->
|
|
||||||
<string name="pandroid_event_viewer_str">Pandroid Event Viewer</string>
|
|
||||||
|
|
||||||
<string name="const_string_preferences">PANDROID_EVENT_VIEWER_PREFERENCES</string>
|
|
||||||
|
|
||||||
<string name="item_tab_main_text">Filter</string>
|
<!-- CONST -->
|
||||||
<string name="item_tab_event_list_text">Event list</string>
|
<string name="pandroid_event_viewer_str">Pandroid Event Viewer</string>
|
||||||
|
<string name="const_string_preferences">PANDROID_EVENT_VIEWER_PREFERENCES</string>
|
||||||
|
<string name="item_tab_main_text">Filter</string>
|
||||||
|
<string name="item_tab_event_list_text">Event list</string>
|
||||||
<string name="main_text">main text (value)</string>
|
<string name="main_text">main text (value)</string>
|
||||||
<string name="list_text">list (value)</string>
|
<string name="list_text">list (value)</string>
|
||||||
|
|
||||||
<string name="system_str">System</string>
|
<string name="system_str">System</string>
|
||||||
|
|
||||||
<string name="empty_str">- Empty -</string>
|
<string name="empty_str">- Empty -</string>
|
||||||
<string name="all_str">All</string>
|
<string name="all_str">All</string>
|
||||||
|
|
||||||
<string name="tags_label_str">Tags</string>
|
<string name="tags_label_str">Tags</string>
|
||||||
<string name="comments_label_str">Comments</string>
|
<string name="comments_label_str">Comments</string>
|
||||||
<string name="group_label_str">Group</string>
|
<string name="group_label_str">Group</string>
|
||||||
@ -55,36 +50,29 @@
|
|||||||
<string name="refresh_time_label_str">Refresh time</string>
|
<string name="refresh_time_label_str">Refresh time</string>
|
||||||
<string name="set_as_filter_watcher_button_str">Filter by default</string>
|
<string name="set_as_filter_watcher_button_str">Filter by default</string>
|
||||||
<string name="validate_event_button_str">Validate Event</string>
|
<string name="validate_event_button_str">Validate Event</string>
|
||||||
|
<string name="config_update_succesful_str">Update configuration successful.</string>
|
||||||
<string name="config_update_succesful_str">Update configuration successful.</string>
|
|
||||||
<string name="config_update_fail_str">Update configuration is failed.</string>
|
<string name="config_update_fail_str">Update configuration is failed.</string>
|
||||||
<string name="please_set_preferences_str">Please set the preferences as the API URL, user and password for your Pandora FMS.</string>
|
<string name="please_set_preferences_str">Please set the preferences as the API URL, user and password for your Pandora FMS.</string>
|
||||||
<string name="preferences_set_demo_pandora_str">Pandroid Event Viewer is connecting with PandoraFMS public demo, please change the preferences for your Pandora FMS.</string>
|
<string name="preferences_set_demo_pandora_str">Pandroid Event Viewer is connecting with PandoraFMS public demo, please change the preferences for your Pandora FMS.</string>
|
||||||
<string name="filter_update_succesful_str">Update filter successful.</string>
|
<string name="filter_update_succesful_str">Update filter successful.</string>
|
||||||
<string name="filter_update_fail_str">Update filter is failed.</string>
|
<string name="filter_update_fail_str">Update filter is failed.</string>
|
||||||
|
|
||||||
<string name="notification_criticity_0_str">There are %s events and all in Maintenance state.</string>
|
<string name="notification_criticity_0_str">There are %s events and all in Maintenance state.</string>
|
||||||
<string name="notification_criticity_1_str">There are %s events and some are in Informational state.</string>
|
<string name="notification_criticity_1_str">There are %s events and some are in Informational state.</string>
|
||||||
<string name="notification_criticity_2_str">There are %s events and some are in Normal state.</string>
|
<string name="notification_criticity_2_str">There are %s events and some are in Normal state.</string>
|
||||||
<string name="notification_criticity_3_str">There are %s events and some are in Warning state.</string>
|
<string name="notification_criticity_3_str">There are %s events and some are in Warning state.</string>
|
||||||
<string name="notification_criticity_4_str">There are %s events and some are in Critical state.</string>
|
<string name="notification_criticity_4_str">There are %s events and some are in Critical state.</string>
|
||||||
|
|
||||||
<string name="loading_events_criticity_0_str">Loading the %s events and all in Maintenance state.</string>
|
<string name="loading_events_criticity_0_str">Loading the %s events and all in Maintenance state.</string>
|
||||||
<string name="loading_events_criticity_1_str">Loading the %s events and some are in Informational state.</string>
|
<string name="loading_events_criticity_1_str">Loading the %s events and some are in Informational state.</string>
|
||||||
<string name="loading_events_criticity_2_str">Loading the %s events and some are in Normal state.</string>
|
<string name="loading_events_criticity_2_str">Loading the %s events and some are in Normal state.</string>
|
||||||
<string name="loading_events_criticity_3_str">Loading the %s events and some are in Warning state.</string>
|
<string name="loading_events_criticity_3_str">Loading the %s events and some are in Warning state.</string>
|
||||||
<string name="loading_events_criticity_4_str">Loading the %s events and some are in Critical state.</string>
|
<string name="loading_events_criticity_4_str">Loading the %s events and some are in Critical state.</string>
|
||||||
|
|
||||||
<string name="successful_validate_event_str">The event validation is successful.</string>
|
<string name="successful_validate_event_str">The event validation is successful.</string>
|
||||||
<string name="fail_validate_event_str">The event validation is failed.</string>
|
<string name="fail_validate_event_str">The event validation is failed.</string>
|
||||||
|
|
||||||
<string name="status_label_str">Status</string>
|
<string name="status_label_str">Status</string>
|
||||||
<string name="event_search_label_str">Event search</string>
|
<string name="event_search_label_str">Event search</string>
|
||||||
<string name="max_time_old_event_str">Oldest event</string>
|
<string name="max_time_old_event_str">Oldest event</string>
|
||||||
|
|
||||||
<string name="licensed_under_gpl_str">Licensed under GPL v2</string>
|
<string name="licensed_under_gpl_str">Licensed under GPL v2</string>
|
||||||
<string name="develop_team_str">Developer: Miguel de Dios</string>
|
<string name="develop_team_str">Developer: Miguel de Dios</string>
|
||||||
|
|
||||||
<string name="alert_recovered_str">Alert recovered</string>
|
<string name="alert_recovered_str">Alert recovered</string>
|
||||||
<string name="alert_manual_validation_str">Alert manually validated</string>
|
<string name="alert_manual_validation_str">Alert manually validated</string>
|
||||||
<string name="going_up_warning_str">Going from critical to warning</string>
|
<string name="going_up_warning_str">Going from critical to warning</string>
|
||||||
@ -96,14 +84,10 @@
|
|||||||
<string name="new_agent_str">New agent created</string>
|
<string name="new_agent_str">New agent created</string>
|
||||||
<string name="unknown_str">Unknown type:</string>
|
<string name="unknown_str">Unknown type:</string>
|
||||||
<string name="unknown_event_str">Unknown event</string>
|
<string name="unknown_event_str">Unknown event</string>
|
||||||
|
|
||||||
<string name="validate_event_label_str">Event validated</string>
|
<string name="validate_event_label_str">Event validated</string>
|
||||||
|
|
||||||
<string name="pandroid_event_viewer_description_str">Realtime event viewer for Pandora FMS.</string>
|
<string name="pandroid_event_viewer_description_str">Realtime event viewer for Pandora FMS.</string>
|
||||||
<string name="pandroid_info_txt"><b>Welcome to Pandora FMS Event viewer for Android</b></string>
|
<string name="pandroid_info_txt"><b>Welcome to Pandora FMS Event viewer for Android</b></string>
|
||||||
<string name="pandroid_info_long_txt"><p>This app is used for to see confortable and standaralone the events status from the monitoring server of Pandora FMS. From this app you can see in realtime the events and validate or filter.</p>
|
<string name="pandroid_info_long_txt"><p>This app is used for to see confortable and standaralone the events status from the monitoring server of Pandora FMS. From this app you can see in realtime the events and validate or filter.</p><p>The configuration as default connecting with public demo of Pandora FMS in firefly.artica.es. Please change the configuration for to use your Pandora FMS server.</p></string>
|
||||||
<p>The configuration as default connecting with public demo of Pandora FMS in firefly.artica.es. Please change the configuration for to use your Pandora FMS server.</p></string>
|
|
||||||
|
|
||||||
<string name="check_connection">Connection status</string>
|
<string name="check_connection">Connection status</string>
|
||||||
<string name="connection">Connection</string>
|
<string name="connection">Connection</string>
|
||||||
<string name="notification">Notification</string>
|
<string name="notification">Notification</string>
|
||||||
@ -111,5 +95,7 @@
|
|||||||
<string name="led_flash">Led flashes</string>
|
<string name="led_flash">Led flashes</string>
|
||||||
<string name="sound">Sound</string>
|
<string name="sound">Sound</string>
|
||||||
<string name="select_sound">Select notification sound</string>
|
<string name="select_sound">Select notification sound</string>
|
||||||
<string name="silence">Silence</string>
|
<string name="silence">Silence</string>
|
||||||
</resources>
|
<string name="tag_label_str">Tag</string>
|
||||||
|
<string name="advanced_options">Show advanced search options</string>
|
||||||
|
</resources>
|
@ -45,6 +45,7 @@ import android.view.View;
|
|||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -159,6 +160,23 @@ 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();
|
||||||
|
|
||||||
@ -169,7 +187,7 @@ public class Main extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get groups throught an api call.
|
* Get groups through an api call.
|
||||||
*
|
*
|
||||||
* @return A list of groups.
|
* @return A list of groups.
|
||||||
*/
|
*/
|
||||||
@ -332,6 +350,8 @@ public class Main extends Activity {
|
|||||||
combo = (Spinner) findViewById(R.id.status_combo);
|
combo = (Spinner) findViewById(R.id.status_combo);
|
||||||
this.object.status = combo.getSelectedItemPosition() - 0;
|
this.object.status = combo.getSelectedItemPosition() - 0;
|
||||||
|
|
||||||
|
text = (EditText) findViewById(R.id.tag);
|
||||||
|
this.object.eventTag = text.getText().toString();
|
||||||
text = (EditText) findViewById(R.id.event_search_text);
|
text = (EditText) findViewById(R.id.event_search_text);
|
||||||
this.object.eventSearch = text.getText().toString();
|
this.object.eventSearch = text.getText().toString();
|
||||||
|
|
||||||
@ -352,6 +372,7 @@ public class Main extends Activity {
|
|||||||
int filterStatus = -1;
|
int filterStatus = -1;
|
||||||
int filterLastTime = 0;
|
int filterLastTime = 0;
|
||||||
String filterEventSearch = "";
|
String filterEventSearch = "";
|
||||||
|
String filterTag = "";
|
||||||
|
|
||||||
EditText text = (EditText) findViewById(R.id.agent_name);
|
EditText text = (EditText) findViewById(R.id.agent_name);
|
||||||
filterAgentName = text.getText().toString();
|
filterAgentName = text.getText().toString();
|
||||||
@ -381,9 +402,12 @@ public class Main extends Activity {
|
|||||||
combo = (Spinner) findViewById(R.id.max_time_old_event_combo);
|
combo = (Spinner) findViewById(R.id.max_time_old_event_combo);
|
||||||
filterLastTime = combo.getSelectedItemPosition();
|
filterLastTime = combo.getSelectedItemPosition();
|
||||||
|
|
||||||
|
text = (EditText) findViewById(R.id.tag);
|
||||||
|
filterTag = text.getText().toString();
|
||||||
|
|
||||||
text = (EditText) findViewById(R.id.event_search_text);
|
text = (EditText) findViewById(R.id.event_search_text);
|
||||||
filterEventSearch = text.getText().toString();
|
filterEventSearch = text.getText().toString();
|
||||||
|
|
||||||
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);
|
||||||
@ -393,6 +417,7 @@ public class Main extends Activity {
|
|||||||
editorPreferences.putInt("filterIDGroup", filterIDGroup);
|
editorPreferences.putInt("filterIDGroup", filterIDGroup);
|
||||||
editorPreferences.putInt("filterSeverity", filterSeverity);
|
editorPreferences.putInt("filterSeverity", filterSeverity);
|
||||||
editorPreferences.putInt("filterStatus", filterStatus);
|
editorPreferences.putInt("filterStatus", filterStatus);
|
||||||
|
editorPreferences.putString("filterTag", filterTag);
|
||||||
editorPreferences.putString("filterEventSearch", filterEventSearch);
|
editorPreferences.putString("filterEventSearch", filterEventSearch);
|
||||||
editorPreferences.putInt("filterLastTime", filterLastTime);
|
editorPreferences.putInt("filterLastTime", filterLastTime);
|
||||||
|
|
||||||
@ -412,13 +437,18 @@ public class Main extends Activity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the filter form.
|
* Resets the filter form.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
private void reset_form() {
|
private void reset_form() {
|
||||||
EditText text = (EditText) findViewById(R.id.agent_name);
|
|
||||||
text.setText("");
|
|
||||||
|
|
||||||
Spinner combo = (Spinner) findViewById(R.id.group_combo);
|
Spinner combo = (Spinner) findViewById(R.id.group_combo);
|
||||||
combo.setSelection(0);
|
combo.setSelection(0);
|
||||||
|
combo = (Spinner) findViewById(R.id.status_combo);
|
||||||
|
combo.setSelection(3);
|
||||||
|
EditText text = (EditText) findViewById(R.id.tag);
|
||||||
|
text.setText("");
|
||||||
|
|
||||||
|
text = (EditText) findViewById(R.id.agent_name);
|
||||||
|
text.setText("");
|
||||||
|
|
||||||
combo = (Spinner) findViewById(R.id.severity_combo);
|
combo = (Spinner) findViewById(R.id.severity_combo);
|
||||||
combo.setSelection(0);
|
combo.setSelection(0);
|
||||||
@ -426,11 +456,27 @@ public class Main extends Activity {
|
|||||||
combo = (Spinner) findViewById(R.id.max_time_old_event_combo);
|
combo = (Spinner) findViewById(R.id.max_time_old_event_combo);
|
||||||
combo.setSelection(6);
|
combo.setSelection(6);
|
||||||
|
|
||||||
combo = (Spinner) findViewById(R.id.status_combo);
|
|
||||||
combo.setSelection(3);
|
|
||||||
|
|
||||||
text = (EditText) findViewById(R.id.event_search_text);
|
text = (EditText) findViewById(R.id.event_search_text);
|
||||||
text.setText("");
|
text.setText("");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears advanced options.
|
||||||
|
*/
|
||||||
|
private void clearAdvancedOptions() {
|
||||||
|
|
||||||
|
EditText text = (EditText) findViewById(R.id.agent_name);
|
||||||
|
text.setText("");
|
||||||
|
|
||||||
|
Spinner combo = (Spinner) findViewById(R.id.severity_combo);
|
||||||
|
combo.setSelection(0);
|
||||||
|
|
||||||
|
combo = (Spinner) findViewById(R.id.max_time_old_event_combo);
|
||||||
|
combo.setSelection(6);
|
||||||
|
|
||||||
|
text = (EditText) findViewById(R.id.event_search_text);
|
||||||
|
text.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,9 @@ 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,
|
||||||
@ -160,10 +163,12 @@ 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();
|
||||||
@ -181,8 +186,13 @@ 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
|
||||||
CheckBox cb = (CheckBox) findViewById(R.id.vibration_on);
|
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());
|
||||||
@ -202,6 +212,8 @@ public class Options extends Activity {
|
|||||||
Toast.LENGTH_LONG);
|
Toast.LENGTH_LONG);
|
||||||
toast.show();
|
toast.show();
|
||||||
}
|
}
|
||||||
|
if (advancedFilterOff)
|
||||||
|
setAdvancedOptionsDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -246,6 +258,24 @@ 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.
|
||||||
|
@ -70,9 +70,10 @@ public class PandroidEventviewerActivity extends TabActivity implements
|
|||||||
public int pagination;
|
public int pagination;
|
||||||
public long offset;
|
public long offset;
|
||||||
public int status;
|
public int status;
|
||||||
|
public String eventTag;
|
||||||
public String eventSearch;
|
public String eventSearch;
|
||||||
public int filterLastTime;
|
public int filterLastTime;
|
||||||
|
|
||||||
public boolean showOptionsFirstTime;
|
public boolean showOptionsFirstTime;
|
||||||
public boolean showTabListFirstTime;
|
public boolean showTabListFirstTime;
|
||||||
|
|
||||||
@ -110,6 +111,7 @@ public class PandroidEventviewerActivity extends TabActivity implements
|
|||||||
this.agentNameStr = preferences.getString("filterAgentName", "");
|
this.agentNameStr = preferences.getString("filterAgentName", "");
|
||||||
this.severity = preferences.getInt("filterSeverity", -1);
|
this.severity = preferences.getInt("filterSeverity", -1);
|
||||||
this.status = preferences.getInt("filterStatus", 3);
|
this.status = preferences.getInt("filterStatus", 3);
|
||||||
|
this.eventTag = preferences.getString("filterTag", "");
|
||||||
this.eventSearch = preferences.getString("filterEventSearch", "");
|
this.eventSearch = preferences.getString("filterEventSearch", "");
|
||||||
this.filterLastTime = preferences.getInt("filterLastTime", 6);
|
this.filterLastTime = preferences.getInt("filterLastTime", 6);
|
||||||
this.timestamp = Core.convertMaxTimeOldEventValuesToTimestamp(0,
|
this.timestamp = Core.convertMaxTimeOldEventValuesToTimestamp(0,
|
||||||
@ -156,15 +158,26 @@ public class PandroidEventviewerActivity extends TabActivity implements
|
|||||||
|
|
||||||
Intent i = getIntent();
|
Intent i = getIntent();
|
||||||
long count_events = i.getLongExtra("count_events", 0);
|
long count_events = i.getLongExtra("count_events", 0);
|
||||||
|
SharedPreferences preferences = getSharedPreferences(
|
||||||
|
this.getString(R.string.const_string_preferences),
|
||||||
|
Activity.MODE_PRIVATE);
|
||||||
|
boolean changes = false;
|
||||||
|
|
||||||
|
//Checks if there are filter changes
|
||||||
|
if (!preferences.getBoolean("filterChanges", false)) {
|
||||||
|
SharedPreferences.Editor editorPreferences = preferences.edit();
|
||||||
|
editorPreferences.putBoolean("filterChanges", false);
|
||||||
|
editorPreferences.commit();
|
||||||
|
changes = true;
|
||||||
|
}
|
||||||
if (count_events > 0) {
|
if (count_events > 0) {
|
||||||
process_notification(i);
|
process_notification(i);
|
||||||
} else {
|
|
||||||
if (this.showTabListFirstTime) {
|
|
||||||
executeBackgroundGetEvents();
|
|
||||||
this.showTabListFirstTime = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (changes || this.showTabListFirstTime ) {
|
||||||
|
executeBackgroundGetEvents();
|
||||||
|
this.showTabListFirstTime = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
@ -255,9 +268,7 @@ public class PandroidEventviewerActivity extends TabActivity implements
|
|||||||
*/
|
*/
|
||||||
private String serializeParams2Api(boolean total) {
|
private String serializeParams2Api(boolean total) {
|
||||||
String totalStr = (total) ? "total" : "-1";
|
String totalStr = (total) ? "total" : "-1";
|
||||||
if (!total) {
|
|
||||||
totalStr = "-1";
|
|
||||||
}
|
|
||||||
return Core.serializeParams2Api(new String[] { ";", // Separator
|
return Core.serializeParams2Api(new String[] { ";", // Separator
|
||||||
Integer.toString(this.severity), // Severity
|
Integer.toString(this.severity), // Severity
|
||||||
this.agentNameStr, // Agent name
|
this.agentNameStr, // Agent name
|
||||||
@ -271,7 +282,8 @@ public class PandroidEventviewerActivity extends TabActivity implements
|
|||||||
String.valueOf(this.pagination), // Pagination
|
String.valueOf(this.pagination), // Pagination
|
||||||
String.valueOf(this.offset), // Event list offset
|
String.valueOf(this.offset), // Event list offset
|
||||||
totalStr, // Count or show
|
totalStr, // Count or show
|
||||||
String.valueOf(this.id_group) // Group id
|
String.valueOf(this.id_group), // Group id
|
||||||
|
this.eventTag
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,11 +390,11 @@ public class PandroidEventviewerActivity extends TabActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < lines.length; i++) {
|
for (int i = 0; i < lines.length; i++) {
|
||||||
String[] items = lines[i].split(";", 21);
|
String[] items = lines[i].split(";",23);
|
||||||
|
|
||||||
EventListItem event = new EventListItem();
|
EventListItem event = new EventListItem();
|
||||||
|
|
||||||
if (items.length != 21) {
|
if (items.length != 23) {
|
||||||
event.event = getApplication().getString(
|
event.event = getApplication().getString(
|
||||||
R.string.unknown_event_str);
|
R.string.unknown_event_str);
|
||||||
} else {
|
} else {
|
||||||
@ -432,13 +444,13 @@ public class PandroidEventviewerActivity extends TabActivity implements
|
|||||||
}
|
}
|
||||||
event.user_comment = items[12];
|
event.user_comment = items[12];
|
||||||
event.tags = items[13];
|
event.tags = items[13];
|
||||||
event.agent_name = items[14];
|
event.agent_name = items[16];
|
||||||
event.group_name = items[15];
|
event.group_name = items[17];
|
||||||
event.group_icon = items[16];
|
event.group_icon = items[18];
|
||||||
event.description_event = items[17];
|
event.description_event = items[19];
|
||||||
event.description_image = items[18];
|
event.description_image = items[20];
|
||||||
event.criticity_name = items[19];
|
event.criticity_name = items[21];
|
||||||
event.criticity_image = items[20];
|
event.criticity_image = items[22];
|
||||||
|
|
||||||
event.opened = false;
|
event.opened = false;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,8 @@ public class PandroidEventviewerService extends IntentService {
|
|||||||
|
|
||||||
httpPost = new HttpPost(this.url + "/include/api.php");
|
httpPost = new HttpPost(this.url + "/include/api.php");
|
||||||
|
|
||||||
String parametersAPI = serializeParams2Api(context, true, false, false);
|
String parametersAPI = serializeParams2Api(context, true,
|
||||||
|
false, false);
|
||||||
Log.d(TAG, "Parameters checking new events: " + parametersAPI);
|
Log.d(TAG, "Parameters checking new events: " + parametersAPI);
|
||||||
|
|
||||||
// Get total count.
|
// Get total count.
|
||||||
@ -203,6 +204,7 @@ public class PandroidEventviewerService extends IntentService {
|
|||||||
int filterStatus = preferences.getInt("filterStatus", 3);
|
int filterStatus = preferences.getInt("filterStatus", 3);
|
||||||
String filterEventSearch = preferences.getString("filterEventSearch",
|
String filterEventSearch = preferences.getString("filterEventSearch",
|
||||||
"");
|
"");
|
||||||
|
String filterTag = preferences.getString("filterTag", "");
|
||||||
|
|
||||||
Calendar c = Calendar.getInstance();
|
Calendar c = Calendar.getInstance();
|
||||||
long now = (c.getTimeInMillis() / 1000);
|
long now = (c.getTimeInMillis() / 1000);
|
||||||
@ -242,7 +244,7 @@ public class PandroidEventviewerService extends IntentService {
|
|||||||
Long.toString(0), // The offset of list events
|
Long.toString(0), // The offset of list events
|
||||||
totalStr, // Count or show
|
totalStr, // Count or show
|
||||||
Integer.toString(idGroup), // Group ID
|
Integer.toString(idGroup), // Group ID
|
||||||
});
|
filterTag });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user