mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
2011-09-25 Miguel de Dios <miguel.dedios@artica.es>
* src/pandroid_event_viewer/pandorafms/PopupValidationEvent.java: added empty file for to work in this in the monday. * src/pandroid_event_viewer/pandorafms/AlarmReceiver.java, src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java, src/pandroid_event_viewer/pandorafms/Main.java, src/pandroid_event_viewer/pandorafms/EventList.java: added the hook to list event from notification. And fixed the search. * res/values/strings.xml, res/values-en/strings.xml, res/values-es/strings.xml: added more strings values. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4998 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
8de3c37f5c
commit
2aacfee9cb
@ -1,3 +1,17 @@
|
|||||||
|
2011-09-25 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* src/pandroid_event_viewer/pandorafms/PopupValidationEvent.java: added
|
||||||
|
empty file for to work in this in the monday.
|
||||||
|
|
||||||
|
* src/pandroid_event_viewer/pandorafms/AlarmReceiver.java,
|
||||||
|
src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java,
|
||||||
|
src/pandroid_event_viewer/pandorafms/Main.java,
|
||||||
|
src/pandroid_event_viewer/pandorafms/EventList.java: added the hook to
|
||||||
|
list event from notification. And fixed the search.
|
||||||
|
|
||||||
|
* res/values/strings.xml, res/values-en/strings.xml,
|
||||||
|
res/values-es/strings.xml: added more strings values.
|
||||||
|
|
||||||
2011-09-23 Miguel de Dios <miguel.dedios@artica.es>
|
2011-09-23 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* src/pandroid_event_viewer/pandorafms/AlarmReceiver.java,
|
* src/pandroid_event_viewer/pandorafms/AlarmReceiver.java,
|
||||||
@ -23,7 +37,6 @@
|
|||||||
* res/layout/main.xml: added a third button, the filter, to set the actual
|
* res/layout/main.xml: added a third button, the filter, to set the actual
|
||||||
search as filter for the background event watcher.
|
search as filter for the background event watcher.
|
||||||
|
|
||||||
|
|
||||||
2011-09-22 Miguel de Dios <miguel.dedios@artica.es>
|
2011-09-22 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* AndroidManifest.xml: added the lines for the service and broadcastreciver.
|
* AndroidManifest.xml: added the lines for the service and broadcastreciver.
|
||||||
|
@ -59,4 +59,10 @@
|
|||||||
<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_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_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>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -59,4 +59,10 @@
|
|||||||
<string name="notification_criticity_2_str">Hay %s eventos y algunos son Normales.</string>
|
<string name="notification_criticity_2_str">Hay %s eventos y algunos son Normales.</string>
|
||||||
<string name="notification_criticity_3_str">Hay %s eventos y algunos son Aviso.</string>
|
<string name="notification_criticity_3_str">Hay %s eventos y algunos son Aviso.</string>
|
||||||
<string name="notification_criticity_4_str">Hay %s eventos y algunos son Criticos.</string>
|
<string name="notification_criticity_4_str">Hay %s eventos y algunos son Criticos.</string>
|
||||||
|
|
||||||
|
<string name="loading_events_criticity_0_str">Cargando los %s eventos y todos son de Mantenimiento.</string>
|
||||||
|
<string name="loading_events_criticity_1_str">Cargando los %s eventos y algunos son Información.</string>
|
||||||
|
<string name="loading_events_criticity_2_str">Cargando los %s eventos y algunos son Normales.</string>
|
||||||
|
<string name="loading_events_criticity_3_str">Cargando los %s eventos y algunos son Aviso.</string>
|
||||||
|
<string name="loading_events_criticity_4_str">Cargando los %s eventos y algunos son Criticos.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -64,4 +64,10 @@
|
|||||||
<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_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_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>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -130,6 +130,7 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||||||
long filterTimestamp = preferences.getLong("filterTimestamp", now);
|
long filterTimestamp = preferences.getLong("filterTimestamp", now);
|
||||||
SharedPreferences.Editor editorPreferences = preferences.edit();
|
SharedPreferences.Editor editorPreferences = preferences.edit();
|
||||||
editorPreferences.putLong("filterTimestamp", now); //Save for the next execution.
|
editorPreferences.putLong("filterTimestamp", now); //Save for the next execution.
|
||||||
|
editorPreferences.putLong("previous_filterTimestamp", filterTimestamp); //Save and the previous for the list.
|
||||||
editorPreferences.commit();
|
editorPreferences.commit();
|
||||||
|
|
||||||
|
|
||||||
@ -219,7 +220,10 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Intent notificationIntent = new Intent(context, Options.class);
|
Intent notificationIntent = new Intent(context, PandroidEventviewerActivity.class);
|
||||||
|
notificationIntent.putExtra("count_events", this.count_events);
|
||||||
|
notificationIntent.putExtra("more_criticity", this.more_criticity);
|
||||||
|
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
|
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
|
||||||
|
|
||||||
CharSequence title = context.getString(R.string.pandroid_event_viewer_str);
|
CharSequence title = context.getString(R.string.pandroid_event_viewer_str);
|
||||||
|
@ -43,7 +43,6 @@ public class EventList extends ListActivity {
|
|||||||
public HashMap<String, Bitmap> imgGroups;
|
public HashMap<String, Bitmap> imgGroups;
|
||||||
public HashMap<String, Bitmap> imgSeverity;
|
public HashMap<String, Bitmap> imgSeverity;
|
||||||
public HashMap<String, Bitmap> imgType;
|
public HashMap<String, Bitmap> imgType;
|
||||||
public String test;
|
|
||||||
|
|
||||||
private BroadcastReceiver onBroadcast;
|
private BroadcastReceiver onBroadcast;
|
||||||
|
|
||||||
@ -71,8 +70,6 @@ public class EventList extends ListActivity {
|
|||||||
|
|
||||||
lv.setAdapter(la);
|
lv.setAdapter(la);
|
||||||
|
|
||||||
test = "666";
|
|
||||||
|
|
||||||
onBroadcast = new BroadcastReceiver() {
|
onBroadcast = new BroadcastReceiver() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -128,13 +125,18 @@ public class EventList extends ListActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void toggleLoadingLayout() {
|
public void toggleLoadingLayout() {
|
||||||
LinearLayout loadingLayout = (LinearLayout) findViewById(R.id.loading_layout);
|
LinearLayout layout;
|
||||||
|
|
||||||
|
layout = (LinearLayout) findViewById(R.id.empty_list_layout);
|
||||||
|
layout.setVisibility(LinearLayout.GONE);
|
||||||
|
|
||||||
|
layout = (LinearLayout) findViewById(R.id.loading_layout);
|
||||||
|
|
||||||
if (this.object.loadInProgress) {
|
if (this.object.loadInProgress) {
|
||||||
loadingLayout.setVisibility(LinearLayout.VISIBLE);
|
layout.setVisibility(LinearLayout.VISIBLE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
loadingLayout.setVisibility(LinearLayout.GONE);
|
layout.setVisibility(LinearLayout.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,12 +226,14 @@ public class Main extends Activity {
|
|||||||
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() + 1;
|
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();
|
||||||
Date date = new Date(year, month, day, minute, hour);
|
Calendar c = Calendar.getInstance();
|
||||||
this.object.timestamp = date.getTime() / 1000;
|
c.set(year, month, day, hour, minute);
|
||||||
|
|
||||||
|
this.object.timestamp = c.getTimeInMillis() / 1000;
|
||||||
|
|
||||||
EditText agentName = (EditText) findViewById(R.id.agent_name);
|
EditText agentName = (EditText) findViewById(R.id.agent_name);
|
||||||
String agentNameStr = agentName.getText().toString();
|
String agentNameStr = agentName.getText().toString();
|
||||||
@ -253,9 +255,9 @@ public class Main extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
combo = (Spinner) findViewById(R.id.severity_combo);
|
combo = (Spinner) findViewById(R.id.severity_combo);
|
||||||
this.object.severity = combo.getSelectedItemPosition();
|
this.object.severity = combo.getSelectedItemPosition() - 1;
|
||||||
|
|
||||||
|
|
||||||
|
this.object.getNewListEvents = true;
|
||||||
this.object.executeBackgroundGetEvents();
|
this.object.executeBackgroundGetEvents();
|
||||||
|
|
||||||
TabActivity ta = (TabActivity) this.getParent();
|
TabActivity ta = (TabActivity) this.getParent();
|
||||||
|
@ -40,6 +40,7 @@ import android.os.AsyncTask;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.TabHost;
|
import android.widget.TabHost;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class PandroidEventviewerActivity extends TabActivity implements Serializable {
|
public class PandroidEventviewerActivity extends TabActivity implements Serializable {
|
||||||
//Data aplication
|
//Data aplication
|
||||||
@ -107,8 +108,6 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
|
|||||||
this.loadInProgress = true;
|
this.loadInProgress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
executeBackgroundGetEvents();
|
|
||||||
|
|
||||||
//Start the background service for the notifications
|
//Start the background service for the notifications
|
||||||
this.core = new Core();
|
this.core = new Core();
|
||||||
this.core.startServiceEventWatcher(getApplicationContext());
|
this.core.startServiceEventWatcher(getApplicationContext());
|
||||||
@ -140,6 +139,63 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
|
|||||||
|
|
||||||
tabHost.getTabWidget().getChildAt(0).getLayoutParams().height=45;
|
tabHost.getTabWidget().getChildAt(0).getLayoutParams().height=45;
|
||||||
tabHost.getTabWidget().getChildAt(1).getLayoutParams().height=45;
|
tabHost.getTabWidget().getChildAt(1).getLayoutParams().height=45;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
Intent i = getIntent();
|
||||||
|
long count_events = i.getLongExtra("count_events", 0);
|
||||||
|
int more_criticity = i.getIntExtra("more_criticity", -1);
|
||||||
|
|
||||||
|
CharSequence text;
|
||||||
|
|
||||||
|
Log.e("count_events", new Long(count_events).toString());
|
||||||
|
|
||||||
|
if (count_events > 0) {
|
||||||
|
switch (more_criticity) {
|
||||||
|
case 0:
|
||||||
|
text = getString(R.string.loading_events_criticity_0_str)
|
||||||
|
.replace("%s", new Long(count_events).toString());
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
text = getString(R.string.loading_events_criticity_1_str)
|
||||||
|
.replace("%s", new Long(count_events).toString());
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
text = getString(R.string.loading_events_criticity_2_str)
|
||||||
|
.replace("%s", new Long(count_events).toString());
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
text = getString(R.string.loading_events_criticity_3_str)
|
||||||
|
.replace("%s", new Long(count_events).toString());
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
text = getString(R.string.loading_events_criticity_4_str)
|
||||||
|
.replace("%s", new Long(count_events).toString());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
text = getString(R.string.loading_events_criticity_2_str)
|
||||||
|
.replace("%s", new Long(count_events).toString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Toast toast = Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
|
||||||
|
//Set the time when the watcher find the events.
|
||||||
|
SharedPreferences preferences = getSharedPreferences(
|
||||||
|
getString(R.string.const_string_preferences),
|
||||||
|
Activity.MODE_PRIVATE);
|
||||||
|
this.timestamp = preferences.getLong("previous_filterTimestamp", (new Date().getTime() / 1000));
|
||||||
|
|
||||||
|
|
||||||
|
this.getTabHost().setCurrentTab(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
executeBackgroundGetEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String serializeParams2Api() {
|
public String serializeParams2Api() {
|
||||||
@ -165,6 +221,8 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
|
|||||||
return_var += "|";
|
return_var += "|";
|
||||||
return_var += Long.toString(this.offset); //The offset of list events
|
return_var += Long.toString(this.offset); //The offset of list events
|
||||||
|
|
||||||
|
Log.e("getEvents", return_var);
|
||||||
|
|
||||||
return return_var;
|
return return_var;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,6 +255,7 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
|
|||||||
return_api = Core.convertStreamToString(entityResponse.getContent());
|
return_api = Core.convertStreamToString(entityResponse.getContent());
|
||||||
return_api = return_api.replace("\n", "");
|
return_api = return_api.replace("\n", "");
|
||||||
this.count_events = new Long(return_api).longValue();
|
this.count_events = new Long(return_api).longValue();
|
||||||
|
Log.e("count_events", return_api);
|
||||||
|
|
||||||
if (this.count_events == 0) {
|
if (this.count_events == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package pandroid_event_viewer.pandorafms;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
public class PopupValidationEvent extends Activity {
|
||||||
|
/** Called when the activity is first created. */
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user