2011-12-25 Miguel de Dios <miguel.dedios@artica.es>
Apply patch from user Santiago Munín González <burning1@gmail.com> * src/pandroid_event_viewer/pandorafms/Main.java: fixed the empty combo group because sometimes this is as null. Fixes: #3495038 MERGED FROM BRANCH 4.0.2 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6164 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
d0f2e121ec
commit
cf006dbcc1
|
@ -1,3 +1,14 @@
|
||||||
|
2011-12-25 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
Apply patch from user Santiago Munín González <burning1@gmail.com>
|
||||||
|
|
||||||
|
* src/pandroid_event_viewer/pandorafms/Main.java: fixed the empty
|
||||||
|
combo group because sometimes this is as null.
|
||||||
|
|
||||||
|
Fixes: #3495038
|
||||||
|
|
||||||
|
MERGED FROM BRANCH 4.0.2
|
||||||
|
|
||||||
2011-10-24 Miguel de Dios <miguel.dedios@artica.es>
|
2011-10-24 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* AndroidManifest.xml: update num version.
|
* AndroidManifest.xml: update num version.
|
||||||
|
|
|
@ -38,156 +38,156 @@ public class Main extends Activity {
|
||||||
public Spinner comboSeverity;
|
public Spinner comboSeverity;
|
||||||
public Core core;
|
public Core core;
|
||||||
|
|
||||||
/** Called when the activity is first created. */
|
/** Called when the activity is first created. */
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
Intent i = getIntent();
|
Intent i = getIntent();
|
||||||
this.object = (PandroidEventviewerActivity)i.getSerializableExtra("object");
|
this.object = (PandroidEventviewerActivity)i.getSerializableExtra("object");
|
||||||
this.core = (Core)i.getSerializableExtra("core");
|
this.core = (Core)i.getSerializableExtra("core");
|
||||||
|
|
||||||
this.pandoraGroups = new HashMap<Integer, String>();
|
this.pandoraGroups = new HashMap<Integer, String>();
|
||||||
|
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
|
|
||||||
final Button buttonReset = (Button) findViewById(R.id.button_reset);
|
final Button buttonReset = (Button) findViewById(R.id.button_reset);
|
||||||
final Button buttonSearch = (Button) findViewById(R.id.button_send);
|
final Button buttonSearch = (Button) findViewById(R.id.button_send);
|
||||||
final Button buttonbuttonSetAsFilterWatcher = (Button) findViewById(R.id.button_set_as_filter_watcher);
|
final Button buttonbuttonSetAsFilterWatcher = (Button) findViewById(R.id.button_set_as_filter_watcher);
|
||||||
|
|
||||||
//Check if the user preferences it is set.
|
//Check if the user preferences it is set.
|
||||||
if ((object.user.length() == 0) && (object.password.length() == 0)
|
if ((object.user.length() == 0) && (object.password.length() == 0)
|
||||||
&& (object.url.length() == 0)) {
|
&& (object.url.length() == 0)) {
|
||||||
Toast toast = Toast.makeText(this.getApplicationContext(),
|
Toast toast = Toast.makeText(this.getApplicationContext(),
|
||||||
this.getString(R.string.please_set_preferences_str),
|
this.getString(R.string.please_set_preferences_str),
|
||||||
Toast.LENGTH_SHORT);
|
Toast.LENGTH_SHORT);
|
||||||
toast.show();
|
toast.show();
|
||||||
|
|
||||||
buttonReset.setEnabled(false);
|
buttonReset.setEnabled(false);
|
||||||
buttonSearch.setEnabled(false);
|
buttonSearch.setEnabled(false);
|
||||||
buttonbuttonSetAsFilterWatcher.setEnabled(false);
|
buttonbuttonSetAsFilterWatcher.setEnabled(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buttonSearch.setEnabled(false);
|
buttonSearch.setEnabled(false);
|
||||||
buttonReset.setEnabled(false);
|
buttonReset.setEnabled(false);
|
||||||
buttonbuttonSetAsFilterWatcher.setEnabled(false);
|
buttonbuttonSetAsFilterWatcher.setEnabled(false);
|
||||||
|
|
||||||
new GetGroupsAsyncTask().execute();
|
new GetGroupsAsyncTask().execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
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, android.R.layout.simple_spinner_item);
|
this, R.array.severity_array_values, android.R.layout.simple_spinner_item);
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
comboSeverity.setAdapter(adapter);
|
comboSeverity.setAdapter(adapter);
|
||||||
|
|
||||||
|
|
||||||
Spinner combo;
|
Spinner combo;
|
||||||
combo = (Spinner) findViewById(R.id.status_combo);
|
combo = (Spinner) findViewById(R.id.status_combo);
|
||||||
adapter = ArrayAdapter.createFromResource(
|
adapter = ArrayAdapter.createFromResource(
|
||||||
this, R.array.event_status_values, android.R.layout.simple_spinner_item);
|
this, R.array.event_status_values, android.R.layout.simple_spinner_item);
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
combo.setAdapter(adapter);
|
combo.setAdapter(adapter);
|
||||||
combo.setSelection(3);
|
combo.setSelection(3);
|
||||||
|
|
||||||
combo = (Spinner) findViewById(R.id.max_time_old_event_combo);
|
combo = (Spinner) findViewById(R.id.max_time_old_event_combo);
|
||||||
adapter = ArrayAdapter.createFromResource(
|
adapter = ArrayAdapter.createFromResource(
|
||||||
this, R.array.max_time_old_event_values, android.R.layout.simple_spinner_item);
|
this, R.array.max_time_old_event_values, android.R.layout.simple_spinner_item);
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
combo.setAdapter(adapter);
|
combo.setAdapter(adapter);
|
||||||
combo.setSelection(preferences.getInt("filterLastTime", 6));
|
combo.setSelection(preferences.getInt("filterLastTime", 6));
|
||||||
|
|
||||||
|
|
||||||
buttonReset.setOnClickListener(new View.OnClickListener() {
|
buttonReset.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
reset_form();
|
reset_form();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonSearch.setOnClickListener(new View.OnClickListener() {
|
buttonSearch.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
search_form();
|
search_form();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonbuttonSetAsFilterWatcher.setOnClickListener(new View.OnClickListener() {
|
buttonbuttonSetAsFilterWatcher.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
save_filter_watcher();
|
save_filter_watcher();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRestart() {
|
public void onRestart() {
|
||||||
super.onRestart();
|
super.onRestart();
|
||||||
|
|
||||||
if (this.pandoraGroups.size() == 0) {
|
if (this.pandoraGroups.size() == 0) {
|
||||||
Log.e("Main onRestart", "Main onRestart");
|
Log.e("Main onRestart", "Main onRestart");
|
||||||
new GetGroupsAsyncTask().execute();
|
new GetGroupsAsyncTask().execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<String> getGroups() {
|
public ArrayList<String> getGroups() {
|
||||||
ArrayList<String> array = new ArrayList<String>();
|
ArrayList<String> array = new ArrayList<String>();
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
String url = preferences.getString("url", "");
|
String url = preferences.getString("url", "");
|
||||||
String user = preferences.getString("user", "");
|
String user = preferences.getString("user", "");
|
||||||
String password = preferences.getString("password", "");
|
String password = preferences.getString("password", "");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
DefaultHttpClient httpClient = new DefaultHttpClient();
|
DefaultHttpClient httpClient = new DefaultHttpClient();
|
||||||
|
|
||||||
HttpPost httpPost = new HttpPost(url + "/include/api.php");
|
HttpPost httpPost = new HttpPost(url + "/include/api.php");
|
||||||
|
|
||||||
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
|
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
|
||||||
parameters.add(new BasicNameValuePair("user", user));
|
parameters.add(new BasicNameValuePair("user", user));
|
||||||
parameters.add(new BasicNameValuePair("pass", password));
|
parameters.add(new BasicNameValuePair("pass", password));
|
||||||
parameters.add(new BasicNameValuePair("op", "get"));
|
parameters.add(new BasicNameValuePair("op", "get"));
|
||||||
parameters.add(new BasicNameValuePair("op2", "groups"));
|
parameters.add(new BasicNameValuePair("op2", "groups"));
|
||||||
parameters.add(new BasicNameValuePair("other_mode", "url_encode_separator_|"));
|
parameters.add(new BasicNameValuePair("other_mode", "url_encode_separator_|"));
|
||||||
parameters.add(new BasicNameValuePair("return_type", "csv"));
|
parameters.add(new BasicNameValuePair("return_type", "csv"));
|
||||||
parameters.add(new BasicNameValuePair("other", ";"));
|
parameters.add(new BasicNameValuePair("other", ";"));
|
||||||
|
|
||||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(parameters);
|
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(parameters);
|
||||||
|
|
||||||
httpPost.setEntity(entity);
|
httpPost.setEntity(entity);
|
||||||
|
|
||||||
HttpResponse response = httpClient.execute(httpPost);
|
HttpResponse response = httpClient.execute(httpPost);
|
||||||
HttpEntity entityResponse = response.getEntity();
|
HttpEntity entityResponse = response.getEntity();
|
||||||
|
|
||||||
String return_api = Core.convertStreamToString(entityResponse.getContent());
|
String return_api = Core.convertStreamToString(entityResponse.getContent());
|
||||||
|
|
||||||
String[] lines = return_api.split("\n");
|
String[] lines = return_api.split("\n");
|
||||||
|
|
||||||
for (int i= 0; i < lines.length; i++) {
|
for (int i= 0; i < lines.length; i++) {
|
||||||
String[] groups = lines[i].split(";", 21);
|
String[] groups = lines[i].split(";", 21);
|
||||||
|
|
||||||
this.pandoraGroups.put(new Integer(groups[0]), groups[1]);
|
this.pandoraGroups.put(new Integer(groups[0]), groups[1]);
|
||||||
|
|
||||||
array.add(groups[1]);
|
array.add(groups[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.e("EXCEPTION ArrayList", e.getMessage());
|
Log.e("EXCEPTION ArrayList", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetGroupsAsyncTask extends AsyncTask<Void, Void, Void> {
|
public class GetGroupsAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
public ArrayList<String> lista;
|
public ArrayList<String> lista;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
lista = getGroups();
|
lista = getGroups();
|
||||||
|
@ -199,213 +199,215 @@ public class Main extends Activity {
|
||||||
protected void onPostExecute(Void unused)
|
protected void onPostExecute(Void unused)
|
||||||
{
|
{
|
||||||
Spinner combo = (Spinner)findViewById(R.id.group_combo);
|
Spinner combo = (Spinner)findViewById(R.id.group_combo);
|
||||||
|
|
||||||
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(getApplicationContext(),
|
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(getApplicationContext(),
|
||||||
android.R.layout.simple_spinner_item,
|
android.R.layout.simple_spinner_item,
|
||||||
lista);
|
lista);
|
||||||
combo.setAdapter(spinnerArrayAdapter);
|
combo.setAdapter(spinnerArrayAdapter);
|
||||||
combo.setSelection(0);
|
combo.setSelection(0);
|
||||||
|
|
||||||
ProgressBar loadingGroup = (ProgressBar) findViewById(R.id.loading_group);
|
ProgressBar loadingGroup = (ProgressBar) findViewById(R.id.loading_group);
|
||||||
|
|
||||||
loadingGroup.setVisibility(ProgressBar.GONE);
|
loadingGroup.setVisibility(ProgressBar.GONE);
|
||||||
combo.setVisibility(Spinner.VISIBLE);
|
combo.setVisibility(Spinner.VISIBLE);
|
||||||
|
|
||||||
Button buttonReset = (Button) findViewById(R.id.button_reset);
|
Button buttonReset = (Button) findViewById(R.id.button_reset);
|
||||||
Button buttonSearch = (Button) findViewById(R.id.button_send);
|
Button buttonSearch = (Button) findViewById(R.id.button_send);
|
||||||
Button buttonbuttonSetAsFilterWatcher = (Button) findViewById(R.id.button_set_as_filter_watcher);
|
Button buttonbuttonSetAsFilterWatcher = (Button) findViewById(R.id.button_set_as_filter_watcher);
|
||||||
|
|
||||||
buttonReset.setEnabled(true);
|
buttonReset.setEnabled(true);
|
||||||
buttonSearch.setEnabled(true);
|
buttonSearch.setEnabled(true);
|
||||||
buttonbuttonSetAsFilterWatcher.setEnabled(true);
|
buttonbuttonSetAsFilterWatcher.setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//For options
|
//For options
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.options_menu, menu);
|
inflater.inflate(R.menu.options_menu, menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
Intent i;
|
Intent i;
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.options_button_menu_options:
|
case R.id.options_button_menu_options:
|
||||||
i = new Intent(this, Options.class);
|
i = new Intent(this, Options.class);
|
||||||
//i.putExtra("object", object);
|
//i.putExtra("object", object);
|
||||||
i.putExtra("core", new Core());
|
i.putExtra("core", new Core());
|
||||||
|
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
break;
|
break;
|
||||||
case R.id.about_button_menu_options:
|
case R.id.about_button_menu_options:
|
||||||
i = new Intent(this, About.class);
|
i = new Intent(this, About.class);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void search_form() {
|
public void search_form() {
|
||||||
//Clean the EventList
|
//Clean the EventList
|
||||||
this.object.eventList = new ArrayList<EventListItem>();
|
this.object.eventList = new ArrayList<EventListItem>();
|
||||||
|
|
||||||
this.object.loadInProgress = true;
|
this.object.loadInProgress = true;
|
||||||
|
|
||||||
//Get form data
|
//Get form data
|
||||||
/*
|
/*
|
||||||
DatePicker datePicker = (DatePicker)findViewById(R.id.date);
|
DatePicker datePicker = (DatePicker)findViewById(R.id.date);
|
||||||
TimePicker timePicker = (TimePicker)findViewById(R.id.time);
|
TimePicker timePicker = (TimePicker)findViewById(R.id.time);
|
||||||
int day = datePicker.getDayOfMonth();
|
int day = datePicker.getDayOfMonth();
|
||||||
int month = datePicker.getMonth();
|
int month = datePicker.getMonth();
|
||||||
int year = datePicker.getYear();
|
int year = datePicker.getYear();
|
||||||
int hour = timePicker.getCurrentHour();
|
int hour = timePicker.getCurrentHour();
|
||||||
int minute = timePicker.getCurrentMinute();
|
int minute = timePicker.getCurrentMinute();
|
||||||
Calendar c = Calendar.getInstance();
|
Calendar c = Calendar.getInstance();
|
||||||
c.set(year, month, day, hour, minute);
|
c.set(year, month, day, hour, minute);
|
||||||
|
|
||||||
this.object.timestamp = c.getTimeInMillis() / 1000;
|
this.object.timestamp = c.getTimeInMillis() / 1000;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int timeKey = 0;
|
int timeKey = 0;
|
||||||
Spinner combo = (Spinner)findViewById(R.id.max_time_old_event_combo);
|
Spinner combo = (Spinner)findViewById(R.id.max_time_old_event_combo);
|
||||||
timeKey = combo.getSelectedItemPosition();
|
timeKey = combo.getSelectedItemPosition();
|
||||||
|
|
||||||
this.object.timestamp = this.core.convertMaxTimeOldEventValuesToTimestamp(0, timeKey);
|
this.object.timestamp = this.core.convertMaxTimeOldEventValuesToTimestamp(0, timeKey);
|
||||||
|
|
||||||
EditText text = (EditText) findViewById(R.id.agent_name);
|
EditText text = (EditText) findViewById(R.id.agent_name);
|
||||||
this.object.agentNameStr = text.getText().toString();
|
this.object.agentNameStr = text.getText().toString();
|
||||||
|
|
||||||
this.object.id_group = 0;
|
this.object.id_group = 0;
|
||||||
|
|
||||||
combo = (Spinner) findViewById(R.id.group_combo);
|
combo = (Spinner) findViewById(R.id.group_combo);
|
||||||
String selectedGroup = combo.getSelectedItem().toString();
|
String selectedGroup = combo.getSelectedItem().toString();
|
||||||
|
|
||||||
Iterator it = pandoraGroups.entrySet().iterator();
|
Iterator it = pandoraGroups.entrySet().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<Integer, String> e = (Map.Entry<Integer, String>)it.next();
|
Map.Entry<Integer, String> e = (Map.Entry<Integer, String>)it.next();
|
||||||
|
|
||||||
if (e.getValue().equals(selectedGroup)) {
|
if (e.getValue().equals(selectedGroup)) {
|
||||||
this.object.id_group = e.getKey();
|
this.object.id_group = e.getKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
combo = (Spinner) findViewById(R.id.severity_combo);
|
combo = (Spinner) findViewById(R.id.severity_combo);
|
||||||
this.object.severity = combo.getSelectedItemPosition() - 1;
|
this.object.severity = combo.getSelectedItemPosition() - 1;
|
||||||
|
|
||||||
combo = (Spinner)findViewById(R.id.status_combo);
|
combo = (Spinner)findViewById(R.id.status_combo);
|
||||||
Log.e("Main search_form", "status_combo = " + combo.getSelectedItemPosition());
|
Log.e("Main search_form", "status_combo = " + combo.getSelectedItemPosition());
|
||||||
//this.object.status = combo.getSelectedItemPosition() - 1;//The next version re-add please
|
//this.object.status = combo.getSelectedItemPosition() - 1;//The next version re-add please
|
||||||
this.object.status = combo.getSelectedItemPosition() - 0;
|
this.object.status = combo.getSelectedItemPosition() - 0;
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
this.object.getNewListEvents = true;
|
this.object.getNewListEvents = true;
|
||||||
this.object.executeBackgroundGetEvents();
|
this.object.executeBackgroundGetEvents();
|
||||||
|
|
||||||
TabActivity ta = (TabActivity) this.getParent();
|
TabActivity ta = (TabActivity) this.getParent();
|
||||||
ta.getTabHost().setCurrentTab(1);
|
ta.getTabHost().setCurrentTab(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save_filter_watcher() {
|
public void save_filter_watcher() {
|
||||||
String filterAgentName = "";
|
String filterAgentName = "";
|
||||||
int filterIDGroup = 0;
|
int filterIDGroup = 0;
|
||||||
int filterSeverity = -1;
|
int filterSeverity = -1;
|
||||||
int filterStatus = -1;
|
int filterStatus = -1;
|
||||||
int filterLastTime = 0;
|
int filterLastTime = 0;
|
||||||
String filterEventSearch = "";
|
String filterEventSearch = "";
|
||||||
|
|
||||||
|
|
||||||
EditText text = (EditText) findViewById(R.id.agent_name);
|
EditText text = (EditText) findViewById(R.id.agent_name);
|
||||||
filterAgentName = text.getText().toString();
|
filterAgentName = text.getText().toString();
|
||||||
|
|
||||||
Spinner combo;
|
Spinner combo;
|
||||||
combo = (Spinner) findViewById(R.id.group_combo);
|
combo = (Spinner) findViewById(R.id.group_combo);
|
||||||
String selectedGroup = combo.getSelectedItem().toString();
|
if ((combo != null) && (combo.getSelectedItem() != null)) {
|
||||||
|
String selectedGroup = combo.getSelectedItem().toString();
|
||||||
Iterator it = pandoraGroups.entrySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
Iterator it = pandoraGroups.entrySet().iterator();
|
||||||
Map.Entry<Integer, String> e = (Map.Entry<Integer, String>)it.next();
|
while (it.hasNext()) {
|
||||||
|
Map.Entry<Integer, String> e = (Map.Entry<Integer, String>)it.next();
|
||||||
if (e.getValue().equals(selectedGroup)) {
|
|
||||||
filterIDGroup = e.getKey();
|
if (e.getValue().equals(selectedGroup)) {
|
||||||
}
|
filterIDGroup = e.getKey();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
combo = (Spinner) findViewById(R.id.severity_combo);
|
}
|
||||||
filterSeverity = combo.getSelectedItemPosition() - 1;
|
|
||||||
|
combo = (Spinner) findViewById(R.id.severity_combo);
|
||||||
combo = (Spinner)findViewById(R.id.status_combo);
|
filterSeverity = combo.getSelectedItemPosition() - 1;
|
||||||
//filterStatus = combo.getSelectedItemPosition() - 1;//The next version re-add please
|
|
||||||
filterStatus = combo.getSelectedItemPosition() - 0;
|
combo = (Spinner)findViewById(R.id.status_combo);
|
||||||
|
//filterStatus = combo.getSelectedItemPosition() - 1;//The next version re-add please
|
||||||
combo = (Spinner)findViewById(R.id.max_time_old_event_combo);
|
filterStatus = combo.getSelectedItemPosition() - 0;
|
||||||
filterLastTime = combo.getSelectedItemPosition();
|
|
||||||
|
combo = (Spinner)findViewById(R.id.max_time_old_event_combo);
|
||||||
text = (EditText)findViewById(R.id.event_search_text);
|
filterLastTime = combo.getSelectedItemPosition();
|
||||||
filterEventSearch = text.getText().toString();
|
|
||||||
|
text = (EditText)findViewById(R.id.event_search_text);
|
||||||
|
filterEventSearch = text.getText().toString();
|
||||||
SharedPreferences preferences = getSharedPreferences(
|
|
||||||
this.getString(R.string.const_string_preferences),
|
|
||||||
Activity.MODE_PRIVATE);
|
SharedPreferences preferences = getSharedPreferences(
|
||||||
SharedPreferences.Editor editorPreferences = preferences.edit();
|
this.getString(R.string.const_string_preferences),
|
||||||
|
Activity.MODE_PRIVATE);
|
||||||
editorPreferences.putString("filterAgentName", filterAgentName);
|
SharedPreferences.Editor editorPreferences = preferences.edit();
|
||||||
editorPreferences.putInt("filterIDGroup", filterIDGroup);
|
|
||||||
editorPreferences.putInt("filterSeverity", filterSeverity);
|
editorPreferences.putString("filterAgentName", filterAgentName);
|
||||||
editorPreferences.putInt("filterStatus", filterStatus);
|
editorPreferences.putInt("filterIDGroup", filterIDGroup);
|
||||||
editorPreferences.putString("filterEventSearch", filterEventSearch);
|
editorPreferences.putInt("filterSeverity", filterSeverity);
|
||||||
editorPreferences.putInt("filterLastTime", filterLastTime);
|
editorPreferences.putInt("filterStatus", filterStatus);
|
||||||
|
editorPreferences.putString("filterEventSearch", filterEventSearch);
|
||||||
if (editorPreferences.commit()) {
|
editorPreferences.putInt("filterLastTime", filterLastTime);
|
||||||
this.core.stopServiceEventWatcher(getApplicationContext());
|
|
||||||
this.core.startServiceEventWatcher(getApplicationContext());
|
if (editorPreferences.commit()) {
|
||||||
|
this.core.stopServiceEventWatcher(getApplicationContext());
|
||||||
Toast toast = Toast.makeText(getApplicationContext(),
|
this.core.startServiceEventWatcher(getApplicationContext());
|
||||||
this.getString(R.string.filter_update_succesful_str), Toast.LENGTH_SHORT);
|
|
||||||
toast.show();
|
Toast toast = Toast.makeText(getApplicationContext(),
|
||||||
}
|
this.getString(R.string.filter_update_succesful_str), Toast.LENGTH_SHORT);
|
||||||
else {
|
toast.show();
|
||||||
Toast toast = Toast.makeText(getApplicationContext(),
|
}
|
||||||
this.getString(R.string.filter_update_fail_str), Toast.LENGTH_SHORT);
|
else {
|
||||||
toast.show();
|
Toast toast = Toast.makeText(getApplicationContext(),
|
||||||
}
|
this.getString(R.string.filter_update_fail_str), Toast.LENGTH_SHORT);
|
||||||
}
|
toast.show();
|
||||||
|
}
|
||||||
public void reset_form() {
|
}
|
||||||
EditText text = (EditText)findViewById(R.id.agent_name);
|
|
||||||
text.setText("");
|
public void reset_form() {
|
||||||
|
EditText text = (EditText)findViewById(R.id.agent_name);
|
||||||
Spinner combo = (Spinner) findViewById(R.id.group_combo);
|
text.setText("");
|
||||||
combo.setSelection(0);
|
|
||||||
|
Spinner combo = (Spinner) findViewById(R.id.group_combo);
|
||||||
combo = (Spinner) findViewById(R.id.severity_combo);
|
combo.setSelection(0);
|
||||||
combo.setSelection(0);
|
|
||||||
|
combo = (Spinner) findViewById(R.id.severity_combo);
|
||||||
combo = (Spinner)findViewById(R.id.max_time_old_event_combo);
|
combo.setSelection(0);
|
||||||
combo.setSelection(6);
|
|
||||||
|
combo = (Spinner)findViewById(R.id.max_time_old_event_combo);
|
||||||
combo = (Spinner)findViewById(R.id.status_combo);
|
combo.setSelection(6);
|
||||||
combo.setSelection(4);
|
|
||||||
|
combo = (Spinner)findViewById(R.id.status_combo);
|
||||||
text = (EditText)findViewById(R.id.event_search_text);
|
combo.setSelection(4);
|
||||||
text.setText("");
|
|
||||||
|
text = (EditText)findViewById(R.id.event_search_text);
|
||||||
/*
|
text.setText("");
|
||||||
Calendar c = Calendar.getInstance();
|
|
||||||
DatePicker datePicker = (DatePicker)findViewById(R.id.date);
|
/*
|
||||||
datePicker.updateDate(c.get(Calendar.YEAR),
|
Calendar c = Calendar.getInstance();
|
||||||
c.get(Calendar.MONTH),
|
DatePicker datePicker = (DatePicker)findViewById(R.id.date);
|
||||||
c.get(Calendar.DAY_OF_MONTH));
|
datePicker.updateDate(c.get(Calendar.YEAR),
|
||||||
|
c.get(Calendar.MONTH),
|
||||||
TimePicker timePicker = (TimePicker)findViewById(R.id.time);
|
c.get(Calendar.DAY_OF_MONTH));
|
||||||
timePicker.setCurrentHour(c.get(Calendar.HOUR_OF_DAY));
|
|
||||||
timePicker.setCurrentMinute(c.get(Calendar.MINUTE));
|
TimePicker timePicker = (TimePicker)findViewById(R.id.time);
|
||||||
*/
|
timePicker.setCurrentHour(c.get(Calendar.HOUR_OF_DAY));
|
||||||
}
|
timePicker.setCurrentMinute(c.get(Calendar.MINUTE));
|
||||||
}
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue