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:
mdtrooper 2011-09-25 17:30:47 +00:00
parent bd7af0c547
commit 2d0ec03600
9 changed files with 126 additions and 16 deletions

View File

@ -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>
* 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
search as filter for the background event watcher.
2011-09-22 Miguel de Dios <miguel.dedios@artica.es>
* AndroidManifest.xml: added the lines for the service and broadcastreciver.

View File

@ -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_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="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>

View File

@ -59,4 +59,10 @@
<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_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>

View File

@ -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_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="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>

View File

@ -130,6 +130,7 @@ public class AlarmReceiver extends BroadcastReceiver {
long filterTimestamp = preferences.getLong("filterTimestamp", now);
SharedPreferences.Editor editorPreferences = preferences.edit();
editorPreferences.putLong("filterTimestamp", now); //Save for the next execution.
editorPreferences.putLong("previous_filterTimestamp", filterTimestamp); //Save and the previous for the list.
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);
CharSequence title = context.getString(R.string.pandroid_event_viewer_str);

View File

@ -43,7 +43,6 @@ public class EventList extends ListActivity {
public HashMap<String, Bitmap> imgGroups;
public HashMap<String, Bitmap> imgSeverity;
public HashMap<String, Bitmap> imgType;
public String test;
private BroadcastReceiver onBroadcast;
@ -71,8 +70,6 @@ public class EventList extends ListActivity {
lv.setAdapter(la);
test = "666";
onBroadcast = new BroadcastReceiver() {
@Override
@ -128,13 +125,18 @@ public class EventList extends ListActivity {
}
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) {
loadingLayout.setVisibility(LinearLayout.VISIBLE);
layout.setVisibility(LinearLayout.VISIBLE);
}
else {
loadingLayout.setVisibility(LinearLayout.GONE);
layout.setVisibility(LinearLayout.GONE);
}
}

View File

@ -226,12 +226,14 @@ public class Main extends Activity {
DatePicker datePicker = (DatePicker)findViewById(R.id.date);
TimePicker timePicker = (TimePicker)findViewById(R.id.time);
int day = datePicker.getDayOfMonth();
int month = datePicker.getMonth() + 1;
int month = datePicker.getMonth();
int year = datePicker.getYear();
int hour = timePicker.getCurrentHour();
int minute = timePicker.getCurrentMinute();
Date date = new Date(year, month, day, minute, hour);
this.object.timestamp = date.getTime() / 1000;
Calendar c = Calendar.getInstance();
c.set(year, month, day, hour, minute);
this.object.timestamp = c.getTimeInMillis() / 1000;
EditText agentName = (EditText) findViewById(R.id.agent_name);
String agentNameStr = agentName.getText().toString();
@ -253,9 +255,9 @@ public class Main extends Activity {
}
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();
TabActivity ta = (TabActivity) this.getParent();

View File

@ -40,6 +40,7 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.TabHost;
import android.widget.Toast;
public class PandroidEventviewerActivity extends TabActivity implements Serializable {
//Data aplication
@ -107,8 +108,6 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
this.loadInProgress = true;
}
executeBackgroundGetEvents();
//Start the background service for the notifications
this.core = new Core();
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(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() {
@ -165,6 +221,8 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
return_var += "|";
return_var += Long.toString(this.offset); //The offset of list events
Log.e("getEvents", return_var);
return return_var;
}
@ -197,6 +255,7 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
return_api = Core.convertStreamToString(entityResponse.getContent());
return_api = return_api.replace("\n", "");
this.count_events = new Long(return_api).longValue();
Log.e("count_events", return_api);
if (this.count_events == 0) {
return;
@ -332,7 +391,7 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
loadInProgress = false;
getNewListEvents = false;
i.putExtra("load_more", 0);
i.putExtra("load_more", 0);
}
else {
i.putExtra("load_more", 1);

View File

@ -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);
}
}