2011-10-03 Miguel de Dios <miguel.dedios@artica.es>

* AndroidManifest.xml: added permission to vibrate mobile.
	
	* src/pandroid_event_viewer/pandorafms/PopupValidationEvent.java,
	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/PandroidEventviewerService.java,
	src/pandroid_event_viewer/pandorafms/Core.java,
	src/pandroid_event_viewer/pandorafms/Options.java,
	src/pandroid_event_viewer/pandorafms/EventListItem.java,
	src/pandroid_event_viewer/pandorafms/EventList.java: wip and fixes.
	
	* res/values/strings.xml, res/values-en/strings.xml,
	res/values-es/strings.xml: added more values.
	
	* res/drawable-ldpi/tick_off.png, res/drawable-ldpi/tick.png: added images.
	
	* res/layout/list_view_layout.xml, res/layout/item_list_event_layout.xml,
	res/layout/item_list_event_extended.xml: wip and fixes.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5033 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-10-03 19:51:37 +00:00
parent c98475ec99
commit e77a261581
19 changed files with 410 additions and 185 deletions

View File

@ -20,6 +20,7 @@
android:versionName="1.0"> android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" /> <uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<!-- <!--
android:configChanges="orientation|keyboardHidden" android:configChanges="orientation|keyboardHidden"

View File

@ -1,3 +1,25 @@
2011-10-03 Miguel de Dios <miguel.dedios@artica.es>
* AndroidManifest.xml: added permission to vibrate mobile.
* src/pandroid_event_viewer/pandorafms/PopupValidationEvent.java,
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/PandroidEventviewerService.java,
src/pandroid_event_viewer/pandorafms/Core.java,
src/pandroid_event_viewer/pandorafms/Options.java,
src/pandroid_event_viewer/pandorafms/EventListItem.java,
src/pandroid_event_viewer/pandorafms/EventList.java: wip and fixes.
* res/values/strings.xml, res/values-en/strings.xml,
res/values-es/strings.xml: added more values.
* res/drawable-ldpi/tick_off.png, res/drawable-ldpi/tick.png: added images.
* res/layout/list_view_layout.xml, res/layout/item_list_event_layout.xml,
res/layout/item_list_event_extended.xml: wip and fixes.
2011-09-30 Miguel de Dios <miguel.dedios@artica.es> 2011-09-30 Miguel de Dios <miguel.dedios@artica.es>
* AndroidManifest.xml: level up the sdk requirements. * AndroidManifest.xml: level up the sdk requirements.

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

View File

@ -164,5 +164,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
/> />
<TextView
android:id="@+id/validate_event_label"
android:textColor="#000"
android:textStyle="bold"
android:visibility="gone"
android:text="@string/validate_event_label_str"
/>
</TableRow> </TableRow>
</TableLayout> </TableLayout>

View File

@ -27,8 +27,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
> >
<ImageView
android:layout_weight="0"
android:id="@+id/img_severity_colapse_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="5px"
/>
<TextView <TextView
android:id="@+id/event_name" android:id="@+id/event_name"
android:layout_toRightOf="@id/img_severity_colapse_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="#000" android:textColor="#000"
@ -40,6 +50,14 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_below="@id/event_name" android:layout_below="@id/event_name"
> >
<ImageView
android:layout_weight="0"
android:id="@+id/img_group_colapse_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="5px"
/>
<TextView <TextView
android:id="@+id/agent_name" android:id="@+id/agent_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -49,15 +67,22 @@
android:textColorHighlight="#000" android:textColorHighlight="#000"
android:layout_weight="1" android:layout_weight="1"
/> />
<ImageView
android:layout_weight="0"
android:id="@+id/img_validate_colapse_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="5px"
/>
<TextView <TextView
android:id="@+id/timestamp" android:id="@+id/timestamp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@id/agent_name"
android:layout_below="@id/event_name"
android:textColor="#000" android:textColor="#000"
android:textColorHighlight="#000" android:textColorHighlight="#000"
android:layout_weight="0" android:layout_weight="0"
android:textSize="10sp"
/> />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -59,5 +59,6 @@
android:id="@id/android:list" android:id="@id/android:list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fadingEdge="none"
/> />
</LinearLayout> </LinearLayout>

View File

@ -89,4 +89,7 @@
<string name="recon_host_detected_str">Recon server detected a new host</string> <string name="recon_host_detected_str">Recon server detected a new host</string>
<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="validate_event_label_str">Event validated</string>
</resources> </resources>

View File

@ -89,4 +89,7 @@
<string name="recon_host_detected_str">El servidor Recon detectó un equipo nuevo</string> <string name="recon_host_detected_str">El servidor Recon detectó un equipo nuevo</string>
<string name="new_agent_str">Agente nuevo creado</string> <string name="new_agent_str">Agente nuevo creado</string>
<string name="unknown_str">Tipo desconocido:</string> <string name="unknown_str">Tipo desconocido:</string>
<string name="unknown_event_str">Evento desconocido</string>
<string name="validate_event_label_str">Evento validado</string>
</resources> </resources>

View File

@ -94,4 +94,7 @@
<string name="recon_host_detected_str">Recon server detected a new host</string> <string name="recon_host_detected_str">Recon server detected a new host</string>
<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="validate_event_label_str">Event validated</string>
</resources> </resources>

View File

@ -32,8 +32,7 @@ public class AlarmReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.e("OnetimeAlarmReceiver", "onReceive"); Log.e("AlarmReceiver", "onReceive");
checkNewEvents(context); checkNewEvents(context);
} }
@ -79,7 +78,7 @@ public class AlarmReceiver extends BroadcastReceiver {
response = httpClient.execute(httpPost); response = httpClient.execute(httpPost);
entityResponse = response.getEntity(); entityResponse = response.getEntity();
return_api = Core.convertStreamToString(entityResponse.getContent()); return_api = Core.convertStreamToString(entityResponse.getContent());
Log.e("checkNewEvents count", return_api);
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();
@ -98,7 +97,6 @@ public class AlarmReceiver extends BroadcastReceiver {
response = httpClient.execute(httpPost); response = httpClient.execute(httpPost);
entityResponse = response.getEntity(); entityResponse = response.getEntity();
return_api = Core.convertStreamToString(entityResponse.getContent()); return_api = Core.convertStreamToString(entityResponse.getContent());
Log.e("checkNewEvents criticity", return_api);
return_api = return_api.replace("\n", ""); return_api = return_api.replace("\n", "");
this.more_criticity = new Integer(return_api).intValue(); this.more_criticity = new Integer(return_api).intValue();
@ -110,7 +108,7 @@ public class AlarmReceiver extends BroadcastReceiver {
} }
catch (Exception e) { catch (Exception e) {
Log.e("ERROR THE ", e.getMessage()); Log.e("EXCEPTION checkNewEvents", e.getMessage());
return; return;
} }
@ -167,8 +165,6 @@ public class AlarmReceiver extends BroadcastReceiver {
return_var += "|"; return_var += "|";
return_var += Long.toString(0); //The offset of list events return_var += Long.toString(0); //The offset of list events
Log.e("serializeParams2Api", return_var);
return return_var; return return_var;
} }
@ -224,12 +220,15 @@ public class AlarmReceiver extends BroadcastReceiver {
Notification notification = new Notification(icon, tickerText, when); Notification notification = new Notification(icon, tickerText, when);
notification.defaults |= Notification.DEFAULT_ALL;
notification.flags |= Notification.FLAG_AUTO_CANCEL; notification.flags |= Notification.FLAG_AUTO_CANCEL;
Intent notificationIntent = new Intent(context, PandroidEventviewerActivity.class); Intent notificationIntent = new Intent(context, PandroidEventviewerActivity.class);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
notificationIntent.putExtra("count_events", this.count_events); notificationIntent.putExtra("count_events", this.count_events);
notificationIntent.putExtra("more_criticity", this.more_criticity); notificationIntent.putExtra("more_criticity", this.more_criticity);

View File

@ -4,14 +4,15 @@ import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Serializable;
import java.util.Calendar; import java.util.Calendar;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Parcel;
import android.os.Parcelable;
public class Core implements Parcelable{ public class Core implements Serializable {
private static final long serialVersionUID = 7071445033114548174L;
public Intent intent_service; public Intent intent_service;
//public Context context; //Fucking marshall exception //public Context context; //Fucking marshall exception
@ -20,11 +21,6 @@ public class Core implements Parcelable{
//context = null; //Fucking marshall exception //context = null; //Fucking marshall exception
} }
public Core(Parcel in) {
intent_service = (Intent)in.readValue(null);
//context = (Context)in.readValue(null); //Fucking marshall exception
}
public void startServiceEventWatcher(Context context) { public void startServiceEventWatcher(Context context) {
if (intent_service == null) { if (intent_service == null) {
@ -36,9 +32,21 @@ public class Core implements Parcelable{
} }
public void stopServiceEventWatcher(Context context) { public void stopServiceEventWatcher(Context context) {
if (intent_service == null) {
intent_service = new Intent(context, PandroidEventviewerService.class);
//this.context = context; //Fucking marshall exception
}
context.stopService(this.intent_service); context.stopService(this.intent_service);
} }
///////////////////////
/*
public Core(Parcel in) {
intent_service = (Intent)in.readValue(null);
//context = (Context)in.readValue(null); //Fucking marshall exception
}
public static final Parcelable.Creator<Core> CREATOR public static final Parcelable.Creator<Core> CREATOR
= new Parcelable.Creator<Core>() { = new Parcelable.Creator<Core>() {
@ -68,6 +76,8 @@ public class Core implements Parcelable{
dest.writeValue(this.intent_service); dest.writeValue(this.intent_service);
//dest.writeValue(this.context); //Fucking marshall exception //dest.writeValue(this.context); //Fucking marshall exception
} }
*/
///////////
public static String convertStreamToString (InputStream is) public static String convertStreamToString (InputStream is)

View File

@ -37,7 +37,6 @@ import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
public class EventList extends ListActivity { public class EventList extends ListActivity {
private ListView lv; private ListView lv;
@ -65,7 +64,7 @@ public class EventList extends ListActivity {
Intent i = getIntent(); Intent i = getIntent();
this.object = (PandroidEventviewerActivity)i.getSerializableExtra("object"); this.object = (PandroidEventviewerActivity)i.getSerializableExtra("object");
this.core = (Core)i.getParcelableExtra("core"); this.core = (Core)i.getSerializableExtra("core");
setContentView(R.layout.list_view_layout); setContentView(R.layout.list_view_layout);
@ -81,14 +80,10 @@ public class EventList extends ListActivity {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.e("onReceive", "onReceive");
int load_more = intent.getIntExtra("load_more", 0); int load_more = intent.getIntExtra("load_more", 0);
Log.e("load_more", "" + load_more);
Button button = (Button) findViewById(R.id.button_load_more_events); Button button = (Button) findViewById(R.id.button_load_more_events);
Log.e("object.eventList.size", object.eventList.size() + "");
Log.e("object.count_events", object.count_events + "");
if (object.eventList.size() == 0) { if (object.eventList.size() == 0) {
button.setVisibility(Button.GONE); button.setVisibility(Button.GONE);
} }
@ -100,42 +95,58 @@ public class EventList extends ListActivity {
} }
if (load_more == 1) { if (load_more == 1) {
LinearLayout layout = (LinearLayout) findViewById(R.id.loading_layout);
layout.setVisibility(LinearLayout.GONE);
la.showLoadingEvents = false; la.showLoadingEvents = false;
la.notifyDataSetChanged();
} }
else { else {
LinearLayout layout = (LinearLayout) findViewById(R.id.loading_layout); LinearLayout layout = (LinearLayout) findViewById(R.id.loading_layout);
layout.setVisibility(LinearLayout.GONE); layout.setVisibility(LinearLayout.GONE);
if (object.count_events == 0) { if (((int)object.count_events) == 0) {
layout = (LinearLayout) findViewById(R.id.empty_list_layout); layout = (LinearLayout) findViewById(R.id.empty_list_layout);
layout.setVisibility(LinearLayout.VISIBLE); layout.setVisibility(LinearLayout.VISIBLE);
} }
} }
la.notifyDataSetChanged();
} }
}; };
registerReceiver(onBroadcast, new IntentFilter("eventlist.java")); registerReceiver(onBroadcast, new IntentFilter("eventlist.java"));
this.toggleLoadingLayout(); this.toggleLoadingLayout();
}
public void onRestart() {
super.onRestart();
Log.e("EventList", "onCreate"); if (this.object.showOptionsFirstTime) {
this.object.loadInProgress = true;
toggleLoadingLayout();
this.object.showOptionsFirstTime = false;
this.object.executeBackgroundGetEvents();
}
} }
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
Log.e("EventList", "onResume");
registerReceiver(onBroadcast, new IntentFilter("eventlist.java")); registerReceiver(onBroadcast, new IntentFilter("eventlist.java"));
this.toggleLoadingLayout(); this.toggleLoadingLayout();
if (!this.object.loadInProgress) {
if (((int)object.count_events) == 0) {
LinearLayout layout = (LinearLayout) findViewById(R.id.empty_list_layout);
layout.setVisibility(LinearLayout.VISIBLE);
}
}
} }
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
Log.e("EventList", "onConfigurationChanged");
} }
@Override @Override
@ -150,13 +161,12 @@ public class EventList extends ListActivity {
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);
//FAIL//i.putExtra("object", object); //i.putExtra("object", object);
i.putExtra("core", this.core); i.putExtra("core", this.core);
startActivity(i); startActivity(i);
break; break;
case R.id.refresh_button_menu_options: case R.id.refresh_button_menu_options:
Log.e("onOptionsItemSelected","refresh_button_menu_options");
this.object.loadInProgress = true; this.object.loadInProgress = true;
this.object.getNewListEvents = true; this.object.getNewListEvents = true;
this.object.eventList = new ArrayList<EventListItem>(); this.object.eventList = new ArrayList<EventListItem>();
@ -188,7 +198,7 @@ public class EventList extends ListActivity {
} }
} }
public Bitmap downloadFile(String fileUrl) {Log.e("downloadFile", fileUrl); public Bitmap downloadFile(String fileUrl) {
URL myFileUrl =null; URL myFileUrl =null;
try { try {
myFileUrl= new URL(fileUrl); myFileUrl= new URL(fileUrl);
@ -284,9 +294,8 @@ public class EventList extends ListActivity {
{ {
super.onListItemClick(l, v, position, id); super.onListItemClick(l, v, position, id);
Log.e("onListItemClick", new Integer(position).toString());
EventListItem item = this.object.eventList.get(position); EventListItem item = this.object.eventList.get(position);
Log.e("onListItemClick", position + "");
item.opened = !item.opened; item.opened = !item.opened;
this.object.eventList.set(position, item); this.object.eventList.set(position, item);
la.notifyDataSetChanged(); la.notifyDataSetChanged();
@ -431,6 +440,20 @@ public class EventList extends ListActivity {
TextView timestamp = (TextView)view.findViewById(R.id.timestamp); TextView timestamp = (TextView)view.findViewById(R.id.timestamp);
timestamp.setText(item.timestamp); timestamp.setText(item.timestamp);
if (item.criticity_image.length() != 0)
setImageType(view, item.criticity_image, R.id.img_severity_colapse_item);
if (item.group_icon.length() != 0)
setImageGroup(view, item.group_icon, R.id.img_group_colapse_item);
ImageView imgValidate = (ImageView)view.findViewById(R.id.img_validate_colapse_item);
if (item.status == 1) {
imgValidate.setImageResource(R.drawable.tick);
}
else {
imgValidate.setImageResource(R.drawable.tick_off);
}
//Show extended info //Show extended info
if (item.opened) { if (item.opened) {
View viewEventExtended; View viewEventExtended;
@ -450,7 +473,8 @@ public class EventList extends ListActivity {
if (item.group_name.length() != 0) { if (item.group_name.length() != 0) {
text = (TextView)viewEventExtended.findViewById(R.id.group_text); text = (TextView)viewEventExtended.findViewById(R.id.group_text);
text.setText(item.group_name); text.setText(item.group_name);
setImageGroup(viewEventExtended, item.group_icon, R.id.img_group); if (item.group_icon.length() != 0)
setImageGroup(viewEventExtended, item.group_icon, R.id.img_group);
} }
else { else {
//ALL //ALL
@ -471,7 +495,8 @@ public class EventList extends ListActivity {
text.setMovementMethod(LinkMovementMethod.getInstance()); text.setMovementMethod(LinkMovementMethod.getInstance());
} }
setImageType(viewEventExtended, item.description_image, R.id.img_type); if (item.description_image.length() != 0)
setImageType(viewEventExtended, item.description_image, R.id.img_type);
text = (TextView)viewEventExtended.findViewById(R.id.type_text); text = (TextView)viewEventExtended.findViewById(R.id.type_text);
text.setText(eventType2Text(item.event_type)); text.setText(eventType2Text(item.event_type));
@ -479,20 +504,34 @@ public class EventList extends ListActivity {
text = (TextView)viewEventExtended.findViewById(R.id.severity_text); text = (TextView)viewEventExtended.findViewById(R.id.severity_text);
text.setText(item.criticity_name); text.setText(item.criticity_name);
setImageType(viewEventExtended, item.criticity_image, R.id.img_severity); if (item.criticity_image.length() != 0)
setImageType(viewEventExtended, item.criticity_image, R.id.img_severity);
} }
Button button; Button button;
button = (Button)viewEventExtended.findViewById(R.id.validate_button_extended); button = (Button)viewEventExtended.findViewById(R.id.validate_button_extended);
//button.setOnClickListener(this); if (item.status == -1) {
//For unknow events
OnClickListenerButtonValidate clickListener = new OnClickListenerButtonValidate(); button.setVisibility(Button.GONE);
clickListener.id_event = item.id_event; text = (TextView)viewEventExtended.findViewById(R.id.validate_event_label);
//clickListener.object = this.object; text.setText("");
clickListener.core = this.core; text.setVisibility(TextView.VISIBLE);
button.setOnClickListener(clickListener); }
else if (item.status != 1) {
view.setOnClickListener(new OnItemClickListener(position, this.object)); OnClickListenerButtonValidate clickListener = new OnClickListenerButtonValidate();
clickListener.id_event = item.id_event;
clickListener.core = this.core;
button.setOnClickListener(clickListener);
view.setOnClickListener(new OnItemClickListener(position, this.object));
text = (TextView)viewEventExtended.findViewById(R.id.validate_event_label);
text.setVisibility(TextView.GONE);
}
else {
button.setVisibility(Button.GONE);
text = (TextView)viewEventExtended.findViewById(R.id.validate_event_label);
text.setVisibility(TextView.VISIBLE);
}
LinearLayout itemLinearLayout = (LinearLayout)view.findViewById(R.id.item_linear_layout); LinearLayout itemLinearLayout = (LinearLayout)view.findViewById(R.id.item_linear_layout);
itemLinearLayout.addView(viewEventExtended); itemLinearLayout.addView(viewEventExtended);
@ -571,7 +610,6 @@ public class EventList extends ListActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Log.e("id_event", "" + id_event);
Intent i = new Intent(getApplicationContext(), PopupValidationEvent.class); Intent i = new Intent(getApplicationContext(), PopupValidationEvent.class);
i.putExtra("id_event", id_event); i.putExtra("id_event", id_event);
//i.putExtra("object", this.object); //i.putExtra("object", this.object);

View File

@ -23,5 +23,29 @@ public class EventListItem {
public String criticity_name; public String criticity_name;
public String criticity_image; public String criticity_image;
public boolean opened; public boolean opened;
public EventListItem() {
id_event = 0;
id_agent = 0;
id_user = "";
id_group = 0;
status = -1;
timestamp = "";
event = "";
utimestamp = 0;
event_type = "";
id_agentmodule = 0;
id_alert_am = 0;
criticity = 0;
user_comment = "";
tags = "";
agent_name = "";
group_name = "";
group_icon = "";
description_event = "";
description_image = "";
criticity_name = "";
criticity_image = "";
}
} }

View File

@ -45,7 +45,7 @@ public class Main extends Activity {
Intent i = getIntent(); Intent i = getIntent();
this.object = (PandroidEventviewerActivity)i.getSerializableExtra("object"); this.object = (PandroidEventviewerActivity)i.getSerializableExtra("object");
this.core = (Core)i.getParcelableExtra("core"); this.core = (Core)i.getSerializableExtra("core");
this.pandoraGroups = new HashMap<Integer, String>(); this.pandoraGroups = new HashMap<Integer, String>();
@ -127,17 +127,34 @@ public class Main extends Activity {
}); });
} }
public void onRestart() {
super.onRestart();
if (this.pandoraGroups.size() == 0) {
Log.e("Main onRestart", "Main onRestart");
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(
this.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
String url = preferences.getString("url", "");
String user = preferences.getString("user", "");
String password = preferences.getString("password", "");
try { try {
DefaultHttpClient httpClient = new DefaultHttpClient(); DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(this.object.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", this.object.user)); parameters.add(new BasicNameValuePair("user", user));
parameters.add(new BasicNameValuePair("pass", this.object.password));Log.e("getGroups", this.object.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_|"));
@ -152,7 +169,6 @@ public class Main extends Activity {
HttpEntity entityResponse = response.getEntity(); HttpEntity entityResponse = response.getEntity();
String return_api = Core.convertStreamToString(entityResponse.getContent()); String return_api = Core.convertStreamToString(entityResponse.getContent());
Log.e("getGroups", return_api);
String[] lines = return_api.split("\n"); String[] lines = return_api.split("\n");
@ -165,7 +181,7 @@ public class Main extends Activity {
} }
} }
catch (Exception e) { catch (Exception e) {
Log.e("ERROR getGroups ", e.getMessage()); Log.e("EXCEPTION ArrayList", e.getMessage());
} }
return array; return array;
@ -216,11 +232,12 @@ public class Main extends Activity {
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
Intent i;
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.options_button_menu_options: case R.id.options_button_menu_options:
Intent i = new Intent(this, Options.class); i = new Intent(this, Options.class);
//FAIL//i.putExtra("object", object); //i.putExtra("object", object);
i.putExtra("core", this.core); i.putExtra("core", new Core());
startActivity(i); startActivity(i);
break; break;
@ -236,7 +253,7 @@ public class Main extends Activity {
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>();
Log.e("search_form", "" +this.object.eventList.size());
this.object.loadInProgress = true; this.object.loadInProgress = true;
//Get form data //Get form data
@ -321,7 +338,7 @@ public class Main extends Activity {
} }
combo = (Spinner) findViewById(R.id.severity_combo); combo = (Spinner) findViewById(R.id.severity_combo);
filterSeverity = combo.getSelectedItemPosition(); filterSeverity = combo.getSelectedItemPosition() - 1;
combo = (Spinner)findViewById(R.id.status_combo); combo = (Spinner)findViewById(R.id.status_combo);
filterStatus = combo.getSelectedItemPosition() - 1; filterStatus = combo.getSelectedItemPosition() - 1;

View File

@ -5,7 +5,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
@ -20,13 +19,18 @@ public class Options extends Activity {
public int refreshTimeKey; public int refreshTimeKey;
public Core core; public Core core;
public PandroidEventviewerActivity object;
@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.core = (Core)i.getParcelableExtra("core"); this.core = (Core)i.getSerializableExtra("core");
//this.object = (PandroidEventviewerActivity)i.getSerializableExtra("object");
//this.core = this.object.core;
setContentView(R.layout.options); setContentView(R.layout.options);
@ -47,7 +51,7 @@ public class Options extends Activity {
text.setText(password); text.setText(password);
Spinner combo = (Spinner) findViewById(R.id.refresh_combo); Spinner combo = (Spinner) findViewById(R.id.refresh_combo);
ArrayAdapter adapter = ArrayAdapter.createFromResource( ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.refresh_combo, android.R.layout.simple_spinner_item); this, R.array.refresh_combo, 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);
@ -75,10 +79,13 @@ public class Options extends Activity {
} }
editorPreferences.putString("url", url); editorPreferences.putString("url", url);
//this.object.url = url;
text = (EditText) findViewById(R.id.user); text = (EditText) findViewById(R.id.user);
editorPreferences.putString("user", text.getText().toString()); editorPreferences.putString("user", text.getText().toString());
//this.object.user = text.getText().toString();
text = (EditText) findViewById(R.id.password); text = (EditText) findViewById(R.id.password);
editorPreferences.putString("password", text.getText().toString()); editorPreferences.putString("password", text.getText().toString());
//this.object.password = text.getText().toString();
Spinner combo = (Spinner) findViewById(R.id.refresh_combo); Spinner combo = (Spinner) findViewById(R.id.refresh_combo);
editorPreferences.putInt("refreshTimeKey", combo.getSelectedItemPosition()); editorPreferences.putInt("refreshTimeKey", combo.getSelectedItemPosition());
@ -88,7 +95,6 @@ public class Options extends Activity {
if (editorPreferences.commit()) { if (editorPreferences.commit()) {
if (this.core != null) { if (this.core != null) {
Log.e("Options", "reset service");
this.core.stopServiceEventWatcher(getApplicationContext()); this.core.stopServiceEventWatcher(getApplicationContext());
this.core.startServiceEventWatcher(getApplicationContext()); this.core.startServiceEventWatcher(getApplicationContext());
} }

View File

@ -16,7 +16,6 @@ package pandroid_event_viewer.pandorafms;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -40,6 +39,8 @@ import android.widget.TabHost;
import android.widget.Toast; import android.widget.Toast;
public class PandroidEventviewerActivity extends TabActivity implements Serializable { public class PandroidEventviewerActivity extends TabActivity implements Serializable {
private static final long serialVersionUID = 1L;
//Data aplication //Data aplication
public ArrayList<EventListItem> eventList; public ArrayList<EventListItem> eventList;
public long count_events; public long count_events;
@ -67,6 +68,9 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
public Intent intent_service; public Intent intent_service;
public Core core; public Core core;
public boolean showOptionsFirstTime;
public boolean showTabListFirstTime;
/** Called when the activity is first created. */ /** Called when the activity is first created. */
@Override @Override
@ -81,8 +85,31 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
this.user = preferences.getString("user", ""); this.user = preferences.getString("user", "");
this.password = preferences.getString("password", ""); this.password = preferences.getString("password", "");
Calendar c = Calendar.getInstance(); final TabHost tabHost = getTabHost();
this.timestamp = (c.getTimeInMillis() / 1000) - (4 * 60 * 60);
this.loadInProgress = false;
this.core = new Core();
//Check if the preferences is setted, if not show the option activity.
if ((user.length() == 0) && (password.length() == 0)
&& (url.length() == 0)) {
Intent i = new Intent(this, Options.class);
//i.putExtra("object", this);
i.putExtra("core", this.core);
startActivity(i);
this.showOptionsFirstTime = true;
}
else {
this.loadInProgress = true;
this.showOptionsFirstTime = false;
this.showTabListFirstTime = true;
}
this.pagination = 20; this.pagination = 20;
this.offset = 0; this.offset = 0;
this.agentNameStr = preferences.getString("filterAgentName", ""); this.agentNameStr = preferences.getString("filterAgentName", "");
@ -90,30 +117,15 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
this.status = preferences.getInt("filterStatus", 3); this.status = preferences.getInt("filterStatus", 3);
this.eventSearch = preferences.getString("filterEventSearch", ""); this.eventSearch = preferences.getString("filterEventSearch", "");
this.filterLastTime = preferences.getInt("filterLastTime", 6); this.filterLastTime = preferences.getInt("filterLastTime", 6);
this.timestamp = this.core.convertMaxTimeOldEventValuesToTimestamp(0, this.filterLastTime);
this.eventList = new ArrayList<EventListItem>(); this.eventList = new ArrayList<EventListItem>();
this.loadInProgress = false;
this.getNewListEvents = true; this.getNewListEvents = true;
final TabHost tabHost = getTabHost(); if (!this.showOptionsFirstTime) {
//Start the background service for the notifications
//Check if the preferences is setted, if not show the option activity. this.core.startServiceEventWatcher(getApplicationContext());
if ((user.length() == 0) && (password.length() == 0)
&& (url.length() == 0)) {
Intent i = new Intent(this, Options.class);
i.putExtra("object", this);
startActivity(i);
} }
else {
this.loadInProgress = true;
}
this.core = new Core();
//Start the background service for the notifications
this.core.startServiceEventWatcher(getApplicationContext());
Intent i_main = new Intent(this, Main.class); Intent i_main = new Intent(this, Main.class);
i_main.putExtra("object", this); i_main.putExtra("object", this);
@ -140,8 +152,6 @@ 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;
Log.e("PandroidEventviewerActivity", "onCreate");
} }
public void onResume() { public void onResume() {
@ -153,9 +163,8 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
CharSequence text; CharSequence text;
Log.e("count_events", new Long(count_events).toString());
if (count_events > 0) { if (count_events > 0) {
//From the notificy
switch (more_criticity) { switch (more_criticity) {
case 0: case 0:
text = getString(R.string.loading_events_criticity_0_str) text = getString(R.string.loading_events_criticity_0_str)
@ -195,15 +204,68 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
} }
this.getTabHost().setCurrentTab(1); this.getTabHost().setCurrentTab(1);
executeBackgroundGetEvents();
if (this.showTabListFirstTime) {
Log.e("PandroidEventviewerActivity", "onResume"); executeBackgroundGetEvents();
this.showTabListFirstTime = false;
}
} }
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
}
public void onNewIntent(Intent intent) {
//super.onNewIntent(intent);
Log.e("PandroidEventviewerActivity", "onConfigurationChanged"); Toast toast = Toast.makeText(getApplicationContext(), "PANDORA FMS TEST", Toast.LENGTH_SHORT);
toast.show();
Intent i = getIntent();
long count_events = i.getLongExtra("count_events", 0);Log.e("onNewIntent", "" + count_events);
int more_criticity = i.getIntExtra("more_criticity", -1);
CharSequence text;
if (count_events > 0) {
//From the notificy
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.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));
}
} }
public String serializeParams2Api() { public String serializeParams2Api() {
@ -233,12 +295,19 @@ 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); Log.e("serializeParams2Api", return_var);
return return_var; return return_var;
} }
public void getEvents(boolean newEvents) { public void getEvents(boolean newEvents) {
SharedPreferences preferences = getSharedPreferences(
this.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
String url = preferences.getString("url", "");
String user = preferences.getString("user", "");
String password = preferences.getString("password", "");
try { try {
DefaultHttpClient httpClient = new DefaultHttpClient(); DefaultHttpClient httpClient = new DefaultHttpClient();
@ -249,12 +318,12 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
HttpEntity entityResponse; HttpEntity entityResponse;
String return_api; String return_api;
httpPost = new HttpPost(this.url + "/include/api.php"); httpPost = new HttpPost(url + "/include/api.php");
//Get total count. //Get total count.
parameters = new ArrayList<NameValuePair>(); parameters = new ArrayList<NameValuePair>();
parameters.add(new BasicNameValuePair("user", this.user)); parameters.add(new BasicNameValuePair("user", user));
parameters.add(new BasicNameValuePair("pass", this.password)); parameters.add(new BasicNameValuePair("pass", password));
parameters.add(new BasicNameValuePair("op", "get")); parameters.add(new BasicNameValuePair("op", "get"));
parameters.add(new BasicNameValuePair("op2", "events")); parameters.add(new BasicNameValuePair("op2", "events"));
parameters.add(new BasicNameValuePair("other_mode", "url_encode_separator_|")); parameters.add(new BasicNameValuePair("other_mode", "url_encode_separator_|"));
@ -267,7 +336,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); Log.e("getEvents", return_api);
if (this.count_events == 0) { if (this.count_events == 0) {
return; return;
@ -275,8 +344,8 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
//Get the list of events. //Get the list of events.
parameters = new ArrayList<NameValuePair>(); parameters = new ArrayList<NameValuePair>();
parameters.add(new BasicNameValuePair("user", this.user)); parameters.add(new BasicNameValuePair("user", user));
parameters.add(new BasicNameValuePair("pass", this.password)); parameters.add(new BasicNameValuePair("pass", password));
parameters.add(new BasicNameValuePair("op", "get")); parameters.add(new BasicNameValuePair("op", "get"));
parameters.add(new BasicNameValuePair("op2", "events")); parameters.add(new BasicNameValuePair("op2", "events"));
parameters.add(new BasicNameValuePair("other_mode", "url_encode_separator_|")); parameters.add(new BasicNameValuePair("other_mode", "url_encode_separator_|"));
@ -299,82 +368,82 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
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(";", 21);
EventListItem event = new EventListItem();
if (items.length != 21) { if (items.length != 21) {
this.count_events --; //Discount invalid. event.description_event = getApplication().getString(R.string.unknown_event_str);
if (this.count_events < 0) this.count_events = 0;
continue;
}
EventListItem event = new EventListItem();
if (items[0].length() == 0) {
event.id_event = 0;
} }
else { else {
event.id_event = Integer.parseInt(items[0]); if (items[0].length() == 0) {
event.id_event = 0;
}
else {
event.id_event = Integer.parseInt(items[0]);
}
if (items[1].length() == 0) {
event.id_agent = 0;
}
else {
event.id_agent = Integer.parseInt(items[1]);
}
event.id_user = items[2];
if (items[3].length() == 0) {
event.id_group = 0;
}
else {
event.id_group = Integer.parseInt(items[3]);
}
if (items[4].length() == 0) {
event.status = 0;
}
else {
event.status = Integer.parseInt(items[4]);
}
event.timestamp = items[5];
event.event = items[6];
if (items[7].length() == 0) {
event.utimestamp = 0;
}
else {
event.utimestamp = Integer.parseInt(items[7]);
}
event.event_type = items[8];
if (items[9].length() == 0) {
event.id_agentmodule = 0;
}
else {
event.id_agentmodule = Integer.parseInt(items[9]);
}
if (items[10].length() == 0) {
event.id_alert_am = 0;
}
else {
event.id_alert_am = Integer.parseInt(items[10]);
}
if (items[11].length() == 0) {
event.criticity = 0;
}
else {
event.criticity = Integer.parseInt(items[11]);
}
event.user_comment = items[12];
event.tags = items[13];
event.agent_name = items[14];
event.group_name = items[15];
event.group_icon = items[16];
event.description_event = items[17];
event.description_image = items[18];
event.criticity_name = items[19];
event.criticity_image = items[20];
event.opened = false;
} }
if (items[1].length() == 0) {
event.id_agent = 0;
}
else {
event.id_agent = Integer.parseInt(items[1]);
}
event.id_user = items[2];
if (items[3].length() == 0) {
event.id_group = 0;
}
else {
event.id_group = Integer.parseInt(items[3]);
}
if (items[4].length() == 0) {
event.status = 0;
}
else {
event.status = Integer.parseInt(items[4]);
}
event.timestamp = items[5];
event.event = items[6];
if (items[7].length() == 0) {
event.utimestamp = 0;
}
else {
event.utimestamp = Integer.parseInt(items[7]);
}
event.event_type = items[8];
if (items[9].length() == 0) {
event.id_agentmodule = 0;
}
else {
event.id_agentmodule = Integer.parseInt(items[9]);
}
if (items[10].length() == 0) {
event.id_alert_am = 0;
}
else {
event.id_alert_am = Integer.parseInt(items[10]);
}
if (items[11].length() == 0) {
event.criticity = 0;
}
else {
event.criticity = Integer.parseInt(items[11]);
}
event.user_comment = items[12];
event.tags = items[13];
event.agent_name = items[14];
event.group_name = items[15];
event.group_icon = items[16];
event.description_event = items[17];
event.description_image = items[18];
event.criticity_name = items[19];
event.criticity_image = items[20];
event.opened = false;
this.eventList.add(event); this.eventList.add(event);
} }
//this.count_events = (long)this.eventList.size();
} }
catch (Exception e) { catch (Exception e) {
Log.e("ERROR THE ", e.getMessage()); Log.e("EXCEPTION PandroidEventviewerActivity getEvents", e.getMessage());
return; return;
} }
@ -415,7 +484,7 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
i.putExtra("load_more", 1); i.putExtra("load_more", 1);
} }
getApplicationContext().sendBroadcast(i); getApplicationContext().sendBroadcast(i);
} }
} }
} }

View File

@ -1,7 +1,5 @@
package pandroid_event_viewer.pandorafms; package pandroid_event_viewer.pandorafms;
import java.util.Calendar;
import android.app.Activity; import android.app.Activity;
import android.app.AlarmManager; import android.app.AlarmManager;
import android.app.PendingIntent; import android.app.PendingIntent;
@ -23,22 +21,24 @@ public class PandroidEventviewerService extends Service {
} }
public void onCreate() { public void onCreate() {
Log.e("testService", "onCreate");
alarmM = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarmM = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Intent intentAlarm = new Intent(this, AlarmReceiver.class); Intent intentAlarm = new Intent(this, AlarmReceiver.class);
this.pendingI = PendingIntent.getBroadcast(this, 0, intentAlarm, 0); this.pendingI = PendingIntent.getBroadcast(this, 0, intentAlarm, 0);
alarmM.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), convertRefreshTimeKeyToTime(), this.pendingI); int sleepTimeAlarm = convertRefreshTimeKeyToTime();
Log.e("PandroidEventviewerService", "sleepTimeAlarm = " + sleepTimeAlarm);
alarmM.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), sleepTimeAlarm, this.pendingI);
} }
public int convertRefreshTimeKeyToTime() { public int convertRefreshTimeKeyToTime() {
int returnvar = 60 * 10; int returnvar = 60 * 10;
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);
int refreshTimeKey = preferences.getInt("refreshTimeKey", 3); int refreshTimeKey = preferences.getInt("refreshTimeKey", 3);
@ -106,7 +106,6 @@ public class PandroidEventviewerService extends Service {
} }
public void onDestroy() { public void onDestroy() {
Log.e("testService", "onDestroy");
alarmM.cancel(this.pendingI); alarmM.cancel(this.pendingI);
} }
} }

View File

@ -44,7 +44,7 @@ public class PopupValidationEvent extends Activity {
Intent i = getIntent(); Intent i = getIntent();
this.id_event = i.getIntExtra("id_event", -1); this.id_event = i.getIntExtra("id_event", -1);
//this.object = (PandroidEventviewerActivity)i.getSerializableExtra("object"); //this.object = (PandroidEventviewerActivity)i.getSerializableExtra("object");
this.core = (Core)i.getParcelableExtra("core"); this.core = (Core)i.getSerializableExtra("core");
setContentView(R.layout.popup_validation_event); setContentView(R.layout.popup_validation_event);
@ -117,11 +117,9 @@ public class PopupValidationEvent extends Activity {
if (return_api.startsWith("Correct validation")) { if (return_api.startsWith("Correct validation")) {
return_var = true; return_var = true;
} }
Log.e("sendValidation", return_api);
} }
catch (Exception e) { catch (Exception e) {
Log.e("ERROR THE ", e.getMessage()); Log.e("EXCEPTION sendValidation", e.getMessage());
} }
return return_var; return return_var;