2012-12-27 Miguel de Dios <miguel.dedios@artica.es>

* AndroidManifest.xml,
	src/pandroid_event_viewer/pandorafms/PopupValidationEvent.java,
	src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java,
	src/pandroid_event_viewer/pandorafms/Main.java,
	src/pandroid_event_viewer/pandorafms/About.java,
	src/pandroid_event_viewer/pandorafms/Options.java,
	src/pandroid_event_viewer/pandorafms/Info.java,
	src/pandroid_event_viewer/pandorafms/EventList.java,
	res/values/strings.xml,res/values-en/strings.xml,
	res/values-es/strings.xml,res/layout/info.xml: fixed some things and
	added more stability and a pretty splashscreen.
	
	MERGED FROM BRANCH 4.0.2




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6209 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-04-27 12:30:31 +00:00
parent f250a7a61e
commit 8a14d45a7c
13 changed files with 191 additions and 20 deletions

View File

@ -73,6 +73,13 @@
android:theme="@android:style/Theme.Dialog"
android:configChanges="orientation|keyboardHidden"
>
</activity>
<activity
android:name=".Info"
android:label="@string/pandroid_event_viewer_str"
android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.Dialog"
>
</activity>
<service android:name=".PandroidEventviewerService"></service>

View File

@ -1,7 +1,23 @@
2011-12-25 Miguel de Dios <miguel.dedios@artica.es>
2012-12-27 Miguel de Dios <miguel.dedios@artica.es>
* AndroidManifest.xml,
src/pandroid_event_viewer/pandorafms/PopupValidationEvent.java,
src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java,
src/pandroid_event_viewer/pandorafms/Main.java,
src/pandroid_event_viewer/pandorafms/About.java,
src/pandroid_event_viewer/pandorafms/Options.java,
src/pandroid_event_viewer/pandorafms/Info.java,
src/pandroid_event_viewer/pandorafms/EventList.java,
res/values/strings.xml,res/values-en/strings.xml,
res/values-es/strings.xml,res/layout/info.xml: fixed some things and
added more stability and a pretty splashscreen.
MERGED FROM BRANCH 4.0.2
2012-04-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.

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
>
<ImageView
android:layout_weight="0"
android:id="@+id/img_logo_about"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="5px"
android:src="@drawable/pandorafms_logo"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pandroid_info_txt"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pandroid_info_long_txt"
android:gravity="center_horizontal"
/>
<TextView
android:id="@+id/url_pandora"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't show again"
android:layout_weight="2"
/>
<CheckBox
android:id="@+id/dont_show_again_extended"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>

View File

@ -53,6 +53,7 @@
<string name="config_update_succesful_str">Update configuration successful.</string>
<string name="config_update_fail_str">Update configuration is failed.</string>
<string name="please_set_preferences_str">Please set the preferences as the API URL, user and password for your Pandora FMS.</string>
<string name="preferences_set_demo_pandora_str">Pandroid Event Viewer is connecting with PandoraFMS public demo, please change the preferences for your Pandora FMS.</string>
<string name="filter_update_succesful_str">Update filter sucessful.</string>
<string name="filter_update_fail_str">Update filter is failed.</string>
<string name="validate_event_button_str">Validate Event</string>

View File

@ -54,6 +54,7 @@
<string name="config_update_succesful_str">Configuración guardada correctamente.</string>
<string name="config_update_fail_str">Configuración no ha podido guardarse..</string>
<string name="please_set_preferences_str">Por favor configure sus preferencias, como la API URL, usuario y contraseña de su Pandora FMS.</string>
<string name="preferences_set_demo_pandora_str">Pandroid Event Viewer esta conectando con la demo pública, por favor cambia en las preferencias para tu Pandora FMS.</string>
<string name="filter_update_succesful_str">Actualizado filtro correctamente.</string>
<string name="filter_update_fail_str">Actualización filtro no ha podido guardarse.</string>
@ -93,4 +94,7 @@
<string name="validate_event_label_str">Evento validado</string>
<string name="pandroid_event_viewer_description_str">Visor de eventos para Pandora FMS.</string>
<string name="pandroid_info_txt"><b>Bienvenido al visor de eventos de Pandora FMS para Android</b></string>
<string name="pandroid_info_long_txt"><p>Esta aplicación se usa para ver de forma autónoma y cómoda, el estado de los eventos resportados por un servidor de monitorización Pandora FMS. Desde esta aplicación podrá ver en tiempo real los eventos, e incluso validar o filtrarlos.</p>
<p>La configuración por defecto apunta al servidor de demo de Pandora FMS en firefly.artica.es. Cambie la configuración para que apunte a su propio servidor de Pandora FMS.</p></string>
</resources>

View File

@ -59,6 +59,7 @@
<string name="config_update_succesful_str">Update configuration successful.</string>
<string name="config_update_fail_str">Update configuration is failed.</string>
<string name="please_set_preferences_str">Please set the preferences as the API URL, user and password for your Pandora FMS.</string>
<string name="preferences_set_demo_pandora_str">Pandroid Event Viewer is connecting with PandoraFMS public demo, please change the preferences for your Pandora FMS.</string>
<string name="filter_update_succesful_str">Update filter successful.</string>
<string name="filter_update_fail_str">Update filter is failed.</string>
@ -97,8 +98,9 @@
<string name="unknown_event_str">Unknown event</string>
<string name="validate_event_label_str">Event validated</string>
<string name="pandroid_event_viewer_description_str">Realtime event viewer for Pandora FMS.
</string>
<string name="pandroid_event_viewer_description_str">Realtime event viewer for Pandora FMS.</string>
<string name="pandroid_info_txt"><b>Welcome to Pandora FMS Event viewer for Android</b></string>
<string name="pandroid_info_long_txt"><p>This app is used for to see confortable and standaralone the events status from the monitoring server of Pandora FMS. From this app you can see in realtime the events and validate or filter.</p>
<p>The configuration as default connecting with public demo of Pandora FMS in firefly.artica.es. Please change the configuration for to use your Pandora FMS server.</p></string>
</resources>

View File

@ -1,9 +1,13 @@
package pandroid_event_viewer.pandorafms;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
public class About extends Activity {
@ -11,10 +15,35 @@ public class About extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
setContentView(R.layout.info);
TextView text = (TextView) findViewById(R.id.url_pandora);
text.setText(Html.fromHtml("<a href='http://pandorafms.org/'>PandoraFMS.org</a>"));
text.setMovementMethod(LinkMovementMethod.getInstance());
CheckBox check_show = (CheckBox)findViewById(R.id.dont_show_again_extended);
check_show.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CheckBox check_show = (CheckBox)v;
if (check_show.isChecked()) {
SharedPreferences preferences = getSharedPreferences(
getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences.Editor editorPreferences = preferences.edit();
editorPreferences.putBoolean("show_popup_info", false);
editorPreferences.commit();
}
else {
SharedPreferences preferences = getSharedPreferences(
getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences.Editor editorPreferences = preferences.edit();
editorPreferences.putBoolean("show_popup_info", true);
editorPreferences.commit();
}
}
});
}
}

View File

@ -115,6 +115,12 @@ public class EventList extends ListActivity {
registerReceiver(onBroadcast, new IntentFilter("eventlist.java"));
this.toggleLoadingLayout();
if (this.object.show_popup_info) {
this.object.show_popup_info = false;
i = new Intent(this, About.class);
startActivity(i);
}
}
public void onRestart() {
@ -588,7 +594,7 @@ public class EventList extends ListActivity {
return return_var;
}
private class OnItemClickListener implements OnClickListener{
private class OnItemClickListener implements OnClickListener{
private int mPosition;
private PandroidEventviewerActivity object;
OnItemClickListener(int position, PandroidEventviewerActivity object){
@ -600,8 +606,8 @@ public class EventList extends ListActivity {
EventListItem item = this.object.eventList.get(mPosition);
item.opened = !item.opened;
this.object.eventList.set(mPosition, item);
la.notifyDataSetChanged();
}
la.notifyDataSetChanged();
}
}
public class OnClickListenerButtonValidate implements OnClickListener {

View File

@ -0,0 +1,20 @@
package pandroid_event_viewer.pandorafms;
import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;
public class Info extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
TextView text = (TextView) findViewById(R.id.url_pandora);
text.setText(Html.fromHtml("<a href='http://pandorafms.org/'>PandoraFMS.org</a>"));
text.setMovementMethod(LinkMovementMethod.getInstance());
}
}

View File

@ -56,8 +56,8 @@ public class Main extends Activity {
final Button buttonbuttonSetAsFilterWatcher = (Button) findViewById(R.id.button_set_as_filter_watcher);
//Check if the user preferences it is set.
if ((object.user.length() == 0) && (object.password.length() == 0)
&& (object.url.length() == 0)) {
if (object.user.length() == 0 || object.password.length() == 0 ||
object.url.length() == 0) {
Toast toast = Toast.makeText(this.getApplicationContext(),
this.getString(R.string.please_set_preferences_str),
Toast.LENGTH_SHORT);
@ -67,6 +67,12 @@ public class Main extends Activity {
buttonSearch.setEnabled(false);
buttonbuttonSetAsFilterWatcher.setEnabled(false);
}
else if (object.user.equals("demo") || object.password.equals("demo")) {
Toast toast = Toast.makeText(this.getApplicationContext(),
this.getString(R.string.preferences_set_demo_pandora_str),
Toast.LENGTH_LONG);
toast.show();
}
else {
buttonSearch.setEnabled(false);
buttonReset.setEnabled(false);
@ -81,7 +87,7 @@ public class Main extends Activity {
comboSeverity = (Spinner) findViewById(R.id.severity_combo);
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);
comboSeverity.setAdapter(adapter);
@ -123,6 +129,12 @@ public class Main extends Activity {
save_filter_watcher();
}
});
if (this.object.show_popup_info) {
this.object.show_popup_info = false;
i = new Intent(this, About.class);
startActivity(i);
}
}
public void onRestart() {

View File

@ -38,9 +38,9 @@ public class Options extends Activity {
this.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
url = preferences.getString("url", "http://farscape.artica.es/pandora_console");
user = preferences.getString("user", "");
password = preferences.getString("password", "");
url = preferences.getString("url", "http://firefly.artica.es/pandora_demo");
user = preferences.getString("user", "demo");
password = preferences.getString("password", "demo");
refreshTimeKey = preferences.getInt("refreshTimeKey", 3);
EditText text = (EditText) findViewById(R.id.url);
@ -64,6 +64,12 @@ public class Options extends Activity {
save_options();
}
});
if (this.object.show_popup_info) {
this.object.show_popup_info = false;
i = new Intent(this, About.class);
startActivity(i);
}
}
public void save_options() {

View File

@ -54,6 +54,7 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
public boolean getNewListEvents;
//Configuration
public boolean show_popup_info;
public String url;
public String user;
public String password;
@ -84,7 +85,8 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
SharedPreferences preferences = getSharedPreferences(
this.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
this.show_popup_info = preferences.getBoolean("show_popup_info", true);
this.url = preferences.getString("url", "");
this.user = preferences.getString("user", "");
this.password = preferences.getString("password", "");
@ -316,6 +318,7 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
entityResponse = response.getEntity();
return_api = Core.convertStreamToString(entityResponse.getContent());
return_api = return_api.replace("\n", "");
Log.e("PandroidEventviewerActivity getEvents", return_api);
this.count_events = new Long(return_api).longValue();
Log.e("getEvents", return_api);

View File

@ -149,9 +149,7 @@ public class PopupValidationEvent extends Activity {
Toast toast = Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT);
toast.show();
if (result) {
destroyPopup();
}
destroyPopup();
}
}
}