2012-06-06 Santiago Munin <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 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6432 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
67a6bb4eac
commit
358315f7e1
|
@ -1,4 +1,13 @@
|
|||
2012-06-06 Santiago Munín <burnin1@gmail.com>
|
||||
2012-06-06 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
|
||||
|
||||
2012-06-06 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* AndroidManifest.xml: Added CreateIncidentActivity (new activity).
|
||||
* src/pandroid_event_viewer/pandorafms/Core.java: Added some getAgents and getGroups
|
||||
* res/values/strings.xml: Added new entries
|
||||
|
@ -6,7 +15,8 @@
|
|||
* res/menu/options_menu_list_events.xml, res/menu/options_menu.xml: Added "Incidents" entry
|
||||
* res/layout/create_incident.xml: CreateIncidentActivity's layout.
|
||||
|
||||
2012-06-01 Santiago Munín <burnin1@gmail.com>
|
||||
2012-06-01 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* AndroidManifest.xml: Added IncidenList (new activity)
|
||||
* src/pandroid_event_viewer/pandorafms/IncidentListItem.java: Added, value object of incidents.
|
||||
* src/pandroid_event_viewer/pandorafms/IncidentList.java: New activity. It will show all incidents.
|
||||
|
@ -15,18 +25,22 @@
|
|||
* res/layout/item_list_incident_layout.xml: Layout of IncidentList items.
|
||||
* res/values/strings.xml: Added new entries.
|
||||
|
||||
2012-06-01 Santiago Munín <burnin1@gmail.com>
|
||||
2012-06-01 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* Little changes on the whole app: Fixed some Lint errors.
|
||||
|
||||
2012-06-01 Santiago Munín <burnin1@gmail.com>
|
||||
2012-06-01 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/Core.java: Added image setting methods.
|
||||
* src/pandroid_event_viewer/pandorafms/EventList.java: Removed image setting methods.
|
||||
* res/layout/item_list_event_layout.xml: Removed not needed ImageViews.
|
||||
|
||||
2012-06-01 Santiago Munín <burnin1@gmail.com>
|
||||
2012-06-01 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/EventList.java: Now Agent's link points to mobile console.
|
||||
|
||||
2012-05-31 Santiago Munín <burnin1@gmail.com>
|
||||
2012-05-31 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/Core.java: Added a method which performs http petitions.
|
||||
* src/pandroid_event_viewer/pandorafms/EventList.java: Added javadoc comments.
|
||||
* src/pandroid_event_viewer/pandorafms/PopupValidationEvent.java,
|
||||
|
@ -35,24 +49,26 @@
|
|||
src/pandroid_event_viewer/pandorafms/PandroidEventviewerService.java: Changed api request (now they use Core's new method).
|
||||
|
||||
|
||||
2012-05-31 Santiago Munín <burnin1@gmail.com>
|
||||
2012-05-31 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/Main.java: Now, on MainActivity's restart, fetches groups and tags if url was changed.
|
||||
* src/pandroid_event_viewer/pandorafms/Options.java: Puts a boolean in SharedPreferences if url was changed.
|
||||
|
||||
2012-05-31 Santiago Munín <burnin1@gmail.com>
|
||||
2012-05-31 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/Main.java: Added tag retrieving.
|
||||
* res/layout/main.xml: Added tags' spinner.
|
||||
|
||||
2012-05-30 Santiago Munín <burnin1@gmail.com>
|
||||
2012-05-30 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandroid_event_viewer/pandorafms/EventList.java: Removed unused methods and added two that will set images to the left of some textviews.
|
||||
* res/layout/item_list_event_extended.xml: Refactored some linear layouts with textviews and imageviews. Now, it is a single textview with an image on the left.
|
||||
|
||||
2012-05-29 Santiago Munín <burnin1@gmail.com>
|
||||
2012-05-29 Santiago Munín <burning1@gmail.com>
|
||||
|
||||
* src/pandrod_event_viewer/pandorafms/EventList.java: Now tags are links to their urls (if have).
|
||||
|
||||
2012-05-25 Santiago Munín <burning1@gmail.com>
|
||||
2012-05-25 Santiago Munín <burningg1@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.
|
||||
|
@ -62,21 +78,21 @@
|
|||
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 <burningg1@gmail.com>
|
||||
|
||||
* Core.java: Added a generic function which will serialize given params in order to send an API request.
|
||||
* PandroidEventviewerActivity.java, PandroidEventviewerService: Refactorized the serialization of parameters (now, they call Core.java function).
|
||||
|
||||
2012-05-22 Santiago Munín <burning1@gmail.com>
|
||||
2012-05-22 Santiago Munín <burningg1@gmail.com>
|
||||
|
||||
* PandroidEventviewerService.java, PandroidEventviewerActivity.java: Added group filter.
|
||||
* res/layout/main.xml: Enabled group spinner.
|
||||
|
||||
2012-05-21 Santiago Munín <burning1@gmail.com>
|
||||
2012-05-21 Santiago Munín <burningg1@gmail.com>
|
||||
|
||||
* EventList.java, PopupValidationEvent.java: Removed references to Core as an object.
|
||||
|
||||
2012-05-19 Santiago Munín <burning1@gmail.com>
|
||||
2012-05-19 Santiago Munín <burningg1@gmail.com>
|
||||
|
||||
* AlarmReceiver.java: Removed. Now it's the service which will retrieve data.
|
||||
* Core.java: The method of setting periodically data retrieval was changed.
|
||||
|
@ -84,7 +100,7 @@
|
|||
* PandroidEventviewerService.java: Every time it receives a call from the AlarmManager, will search for new events.
|
||||
* Most of files have little changes to adapt the new data retrieval subsystem.
|
||||
|
||||
2012-05-17 Santiago Munín <burning1@gmail.com>
|
||||
2012-05-17 Santiago Munín <burningg1@gmail.com>
|
||||
|
||||
* Core.java: Changed methods to static.
|
||||
|
||||
|
@ -95,7 +111,7 @@
|
|||
PandroidEventviewerActivity.java: Instances of "Core" removed.
|
||||
|
||||
|
||||
2012-05-12 Santiago Munín <burning1@gmail.com>
|
||||
2012-05-12 Santiago Munín <burningg1@gmail.com>
|
||||
|
||||
* Licenses and javadoc comments added to all files, refactorized code.
|
||||
|
||||
|
@ -106,7 +122,7 @@
|
|||
res/drawable-ldpi/ok.png,
|
||||
res/values/styles.xml: Added in order to build the new notification options' UI.
|
||||
|
||||
2012-05-08 Santiago Munín <burning1@gmail.com>
|
||||
2012-05-08 Santiago Munín <burningg1@gmail.com>
|
||||
|
||||
* Options.java: Fixed a null pointer bug which was making the
|
||||
app crash when accessing the options.
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 711 B |
|
@ -115,8 +115,8 @@
|
|||
<Spinner
|
||||
android:id="@+id/incident_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:entries="@array/incident_status"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/incident_status" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
|
@ -137,20 +137,25 @@
|
|||
android:id="@+id/incident_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/incident_create_button"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:text="@string/create" />
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
android:icon="@drawable/about"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/incidents_button_menu_options"
|
||||
android:title="@string/incidents_label_str"
|
||||
/>
|
||||
android:id="@+id/incidents_button_menu_options"
|
||||
android:icon="@drawable/incident"
|
||||
android:title="@string/incidents_label_str"/>
|
||||
|
||||
</menu>
|
|
@ -14,24 +14,23 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
-->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/options_button_menu_options"
|
||||
android:title="@string/options_label_str"
|
||||
android:icon="@drawable/config"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/refresh_button_menu_options"
|
||||
android:title="@string/refresh_label_str"
|
||||
android:icon="@drawable/refresh"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/about_button_menu_options"
|
||||
android:title="@string/about_label_str"
|
||||
android:icon="@drawable/about"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/incidents_button_menu_options"
|
||||
android:title="@string/incidents_label_str"
|
||||
/>
|
||||
</menu>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/options_button_menu_options"
|
||||
android:icon="@drawable/config"
|
||||
android:title="@string/options_label_str"/>
|
||||
<item
|
||||
android:id="@+id/refresh_button_menu_options"
|
||||
android:icon="@drawable/refresh"
|
||||
android:title="@string/refresh_label_str"/>
|
||||
<item
|
||||
android:id="@+id/about_button_menu_options"
|
||||
android:icon="@drawable/about"
|
||||
android:title="@string/about_label_str"/>
|
||||
<item
|
||||
android:id="@+id/incidents_button_menu_options"
|
||||
android:icon="@drawable/incident"
|
||||
android:title="@string/incidents_label_str"/>
|
||||
|
||||
</menu>
|
|
@ -97,19 +97,23 @@
|
|||
<string name="select_sound">Select notification sound</string>
|
||||
<string name="silence">Silence</string>
|
||||
<string name="tag_label_str">Tag</string>
|
||||
<string name="advanced_options">Show advanced search options</string>
|
||||
<string name="empty">- Empty -</string>
|
||||
<string name="img_severity">Severity image</string>
|
||||
<string name="img_group">Group image</string>
|
||||
<string name="img_type">Type image</string>
|
||||
<string name="artica_copyright">Copyright (©) 2011 Artica</string>
|
||||
<string name="dont_show_again">Don\'t show again</string>
|
||||
<string name="pandorafms_logo_description">PandoraFMS\'s logo</string>
|
||||
<string name="description">Description</string>
|
||||
<string name="incident_close_button">Close incident</string>
|
||||
<string name="incidents_label_str">Incidents</string>
|
||||
<string name="title">Title</string>
|
||||
<string name="priority">Priority</string>
|
||||
<string name="create">Create</string>
|
||||
<string name="source">Source</string>
|
||||
<string name="advanced_options">Show advanced search options</string>
|
||||
<string name="empty">- Empty -</string>
|
||||
<string name="img_severity">Severity image</string>
|
||||
<string name="img_group">Group image</string>
|
||||
<string name="img_type">Type image</string>
|
||||
<string name="artica_copyright">Copyright (©) 2011 Artica</string>
|
||||
<string name="dont_show_again">Don\'t show again</string>
|
||||
<string name="pandorafms_logo_description">PandoraFMS\'s logo</string>
|
||||
<string name="description">Description</string>
|
||||
<string name="incident_close_button">Close incident</string>
|
||||
<string name="incidents_label_str">Incidents</string>
|
||||
<string name="title">Title</string>
|
||||
<string name="priority">Priority</string>
|
||||
<string name="create">Create</string>
|
||||
<string name="source">Source</string>
|
||||
<string name="incident_created">Incident created</string>
|
||||
<string name="title_empty">Sorry, you must provide a title</string>
|
||||
<string name="creating_incident">Creating new incident…</string>
|
||||
|
||||
</resources>
|
|
@ -10,6 +10,7 @@ import org.apache.http.NameValuePair;
|
|||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
@ -20,7 +21,9 @@ import android.widget.AdapterView.OnItemSelectedListener;
|
|||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* Allows user to create an incident.
|
||||
|
@ -34,20 +37,28 @@ public class CreateIncidentActivity extends Activity {
|
|||
Spinner source, priority, group, status;
|
||||
int priority_code, status_code;
|
||||
Map<Integer, String> groups;
|
||||
ProgressBar groupLoadingStatus;
|
||||
ProgressDialog dialog;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.create_incident);
|
||||
setViews();
|
||||
initializeViews();
|
||||
resetViews();
|
||||
}
|
||||
|
||||
private void setViews() {
|
||||
/**
|
||||
* Initializes views.
|
||||
*/
|
||||
private void initializeViews() {
|
||||
title = (EditText) findViewById(R.id.incident_title);
|
||||
title.setText("");
|
||||
description = (EditText) findViewById(R.id.incident_description);
|
||||
description.setText("");
|
||||
priority = (Spinner) findViewById(R.id.incident_priority);
|
||||
group = (Spinner) findViewById(R.id.incident_group);
|
||||
source = (Spinner) findViewById(R.id.incident_source);
|
||||
status = (Spinner) findViewById(R.id.incident_status);
|
||||
groupLoadingStatus = (ProgressBar) findViewById(R.id.loading_group);
|
||||
priority.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
|
||||
@Override
|
||||
|
@ -63,9 +74,6 @@ public class CreateIncidentActivity extends Activity {
|
|||
public void onNothingSelected(AdapterView<?> arg0) {
|
||||
}
|
||||
});
|
||||
group = (Spinner) findViewById(R.id.incident_group);
|
||||
source = (Spinner) findViewById(R.id.incident_source);
|
||||
status = (Spinner) findViewById(R.id.incident_status);
|
||||
status.setOnItemSelectedListener(new OnItemSelectedListener() {
|
||||
|
||||
@Override
|
||||
|
@ -81,18 +89,41 @@ public class CreateIncidentActivity extends Activity {
|
|||
public void onNothingSelected(AdapterView<?> arg0) {
|
||||
}
|
||||
});
|
||||
new GetGroupsAsyncTask().execute((Void) null);
|
||||
|
||||
((Button) findViewById(R.id.incident_create_button))
|
||||
.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sendNewIncident();
|
||||
if (title != null && title.length() > 0) {
|
||||
dialog = ProgressDialog
|
||||
.show(CreateIncidentActivity.this,
|
||||
"",
|
||||
getString(R.string.creating_incident),
|
||||
true);
|
||||
new SetNewIncidentAsyncTask().execute((Void) null);
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
R.string.title_empty, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets views.
|
||||
*/
|
||||
private void resetViews() {
|
||||
|
||||
title.setText("");
|
||||
description.setText("");
|
||||
source.setSelection(0);
|
||||
priority.setSelection(0);
|
||||
group.setSelection(0);
|
||||
status.setSelection(0);
|
||||
new GetGroupsAsyncTask().execute((Void) null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the create incident petition.
|
||||
*/
|
||||
|
@ -101,11 +132,6 @@ public class CreateIncidentActivity extends Activity {
|
|||
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
|
||||
parameters.add(new BasicNameValuePair("op", "set"));
|
||||
parameters.add(new BasicNameValuePair("op2", "new_incident"));
|
||||
/*
|
||||
*
|
||||
* op=set&op2=new_incident&other=titulo|descripcion%20texto|Logfiles|2|10
|
||||
* |12&other_mode=url_encode_separator_|
|
||||
*/
|
||||
parameters.add(new BasicNameValuePair("other_mode",
|
||||
"url_encode_separator_|"));
|
||||
String incidentParams[] = new String[6];
|
||||
|
@ -148,36 +174,30 @@ public class CreateIncidentActivity extends Activity {
|
|||
android.R.layout.simple_spinner_item, list);
|
||||
group.setAdapter(spinnerArrayAdapter);
|
||||
group.setSelection(0);
|
||||
/*
|
||||
* ProgressBar loadingGroup = (ProgressBar)
|
||||
* findViewById(R.id.loading_group);
|
||||
*
|
||||
* loadingGroup.setVisibility(ProgressBar.GONE);
|
||||
* combo.setVisibility(Spinner.VISIBLE);
|
||||
*/
|
||||
groupLoadingStatus.setVisibility(ProgressBar.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* private class GetAgentsAsyncTask extends AsyncTask<Void, Void,
|
||||
* Map<Integer, String>> {
|
||||
/**
|
||||
* Performs the api call to add the new incident
|
||||
*
|
||||
* @Override protected Map<Integer, String> doInBackground(Void... params) {
|
||||
* return Core.getAgents(getApplicationContext()); }
|
||||
* @author Santiago Munín González
|
||||
*
|
||||
* @Override protected void onPostExecute(Map<Integer, String> result) {
|
||||
* agents = result; List<String> list = new LinkedList<String>(); for
|
||||
* (Entry<Integer, String> entry : result.entrySet()) {
|
||||
* list.add(entry.getValue()); } ArrayAdapter<String> spinnerArrayAdapter =
|
||||
* new ArrayAdapter<String>( getApplicationContext(),
|
||||
* android.R.layout.simple_spinner_item, list);
|
||||
* agent.setAdapter(spinnerArrayAdapter); agent.setSelection(0); /*
|
||||
* ProgressBar loadingGroup = (ProgressBar)
|
||||
* findViewById(R.id.loading_group);
|
||||
*
|
||||
* loadingGroup.setVisibility(ProgressBar.GONE);
|
||||
* combo.setVisibility(Spinner.VISIBLE);
|
||||
*/
|
||||
// }
|
||||
// }
|
||||
private class SetNewIncidentAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
sendNewIncident();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
Toast.makeText(getApplicationContext(), R.string.incident_created,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue