2013-02-22 Miguel de Dios <miguel.dedios@artica.es>

* PandoraFMS_android_console/*: added first version of PandoraFMS
	android console (it is a custom browser standaralone for the
	Pandora Web Console Mobile).




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7699 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-02-21 23:27:05 +00:00
parent adce1e391d
commit f701d33a98
70 changed files with 1021 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2013-02-22 Miguel de Dios <miguel.dedios@artica.es>
* PandoraFMS_android_console/*: added first version of PandoraFMS
android console (it is a custom browser standaralone for the
Pandora Web Console Mobile).
2012-09-11 Dario Rodriguez <dario.rodriguez@artica.es>
* chrome_extension/manifest.json,

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PandoraFMSAndroidConsole</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pandorafms.pandorafmsandroidconsole"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="pandorafms.pandorafmsandroidconsole.PandoraWebView"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Help"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity
android:name=".Options"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity
android:name=".ConnectionCustomToast"
android:configChanges="orientation|keyboardHidden"
android:label="@string/connection_str"
android:theme="@android:style/Theme.Dialog" >
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pandorafms.pandorafmsandroidconsole"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="pandorafms.pandorafmsandroidconsole.PandoraWebView"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Help"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity
android:name=".Options"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity
android:name=".ConnectionCustomToast"
android:configChanges="orientation|keyboardHidden"
android:label="@string/connection_str"
android:theme="@android:style/Theme.Dialog" >
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

View File

@ -0,0 +1,6 @@
/** Automatically generated file. DO NOT MODIFY */
package pandorafms.pandorafmsandroidconsole;
public final class BuildConfig {
public final static boolean DEBUG = true;
}

View File

@ -0,0 +1,118 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package pandorafms.pandorafmsandroidconsole;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int config=0x7f020000;
public static final int exit=0x7f020001;
public static final int help=0x7f020002;
public static final int ic_launcher=0x7f020003;
public static final int loading=0x7f020004;
public static final int loading_1=0x7f020005;
public static final int loading_10=0x7f020006;
public static final int loading_11=0x7f020007;
public static final int loading_12=0x7f020008;
public static final int loading_2=0x7f020009;
public static final int loading_3=0x7f02000a;
public static final int loading_4=0x7f02000b;
public static final int loading_5=0x7f02000c;
public static final int loading_6=0x7f02000d;
public static final int loading_7=0x7f02000e;
public static final int loading_8=0x7f02000f;
public static final int loading_9=0x7f020010;
public static final int pandorafms_logo=0x7f020011;
public static final int refresh=0x7f020012;
}
public static final class id {
public static final int cancel_options=0x7f080008;
public static final int exit_button_menu_options=0x7f08000d;
public static final int help_button_menu_options=0x7f08000c;
public static final int img_logo_about=0x7f080002;
public static final int loading_anim=0x7f080001;
public static final int options_button_menu_options=0x7f08000a;
public static final int password_option=0x7f080007;
public static final int refresh_button_menu_options=0x7f08000b;
public static final int save_options=0x7f080009;
public static final int tableRow1=0x7f080004;
public static final int url_option=0x7f080005;
public static final int url_pandora=0x7f080003;
public static final int user_option=0x7f080006;
public static final int webview=0x7f080000;
}
public static final class layout {
public static final int activity_web_view=0x7f030000;
public static final int connection_custom_toast=0x7f030001;
public static final int help=0x7f030002;
public static final int options=0x7f030003;
}
public static final class menu {
public static final int web_view=0x7f070000;
}
public static final class string {
public static final int app_name=0x7f050001;
public static final int cancel_button_str=0x7f050010;
public static final int connection_str=0x7f050011;
public static final int const_string_preferences=0x7f050000;
public static final int dont_show_again=0x7f050007;
public static final int exit_label_str=0x7f050005;
public static final int help_label_str=0x7f050003;
public static final int loading_desc=0x7f050012;
public static final int options_label_str=0x7f050002;
public static final int pandorafms_logo_description=0x7f050006;
public static final int pandroid_info_long_txt=0x7f050009;
public static final int pandroid_info_txt=0x7f050008;
public static final int pandroid_options_txt=0x7f05000a;
public static final int password_option=0x7f05000d;
public static final int refresh_label_str=0x7f050004;
public static final int save_button_str=0x7f05000e;
public static final int update_button_str=0x7f05000f;
public static final int url_option=0x7f05000b;
public static final int user_option=0x7f05000c;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f060000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f060001;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -0,0 +1,14 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-17

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,14 @@
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@drawable/loading_1" android:duration="60" />
<item android:drawable="@drawable/loading_2" android:duration="60" />
<item android:drawable="@drawable/loading_3" android:duration="60" />
<item android:drawable="@drawable/loading_4" android:duration="60" />
<item android:drawable="@drawable/loading_5" android:duration="60" />
<item android:drawable="@drawable/loading_6" android:duration="60" />
<item android:drawable="@drawable/loading_7" android:duration="60" />
<item android:drawable="@drawable/loading_8" android:duration="60" />
<item android:drawable="@drawable/loading_9" android:duration="60" />
<item android:drawable="@drawable/loading_10" android:duration="60" />
<item android:drawable="@drawable/loading_11" android:duration="60" />
<item android:drawable="@drawable/loading_12" android:duration="60" />
</animation-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,16 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="0px"
android:paddingLeft="0px"
android:paddingRight="0px"
android:paddingTop="0px"
tools:context=".WebView" >
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:gravity="center" >
<ImageView
android:id="@+id/loading_anim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/loading_desc" />
</LinearLayout>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:gravity="center" >
<ImageView
android:layout_weight="0"
android:contentDescription="@string/pandorafms_logo_description"
android:id="@+id/img_logo_about"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="5dp"
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>

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pandroid_options_txt"
/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/url_option"
android:singleLine="true"
android:layout_weight="1" />
<EditText
android:id="@+id/url_option"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="text"
android:layout_weight="5" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/user_option"
android:singleLine="true"
android:layout_weight="1" />
<EditText
android:id="@+id/user_option"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="text"
android:layout_weight="5" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/password_option"
android:singleLine="true"
android:layout_weight="1" />
<EditText
android:id="@+id/password_option"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:layout_weight="5" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/cancel_options"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="@string/cancel_button_str"
android:layout_weight="1" />
<Button
android:id="@+id/save_options"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="@string/save_button_str"
android:layout_weight="1" />
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>

View File

@ -0,0 +1,24 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/options_button_menu_options"
android:icon="@drawable/config"
android:title="@string/options_label_str" />
<item
android:id="@+id/refresh_button_menu_options"
android:icon="@drawable/refresh"
android:title="@string/refresh_label_str" />
<item
android:id="@+id/help_button_menu_options"
android:icon="@drawable/help"
android:title="@string/help_label_str" />
<item
android:id="@+id/exit_button_menu_options"
android:icon="@drawable/exit"
android:title="@string/exit_label_str" />
</menu>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Pandora FMS Android Console</string>
<string name="options_label_str">Opciones</string>
<string name="help_label_str">Ayuda</string>
<string name="refresh_label_str">Refrescar</string>
<string name="exit_label_str">Salir</string>
<string name="pandorafms_logo_description">Logo PandoraFMS</string>
<string name="dont_show_again">No mostrar más</string>
<string name="pandroid_info_txt">Need a large string for to fill this space with pretty things and rainbows.</string>
<string name="pandroid_info_long_txt">Need a large string for to fill this space with pretty things and rainbows.</string>
<string name="pandroid_options_txt">Need a large string for to fill this space with pretty things and rainbows.</string>
<string name="url_option">URL:</string>
<string name="user_option">Usuario:</string>
<string name="password_option">Contraseña:</string>
<string name="save_button_str">Guardar</string>
<string name="update_button_str">Actualizar</string>
<string name="cancel_button_str">Cancelar</string>
</resources>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Pandora FMS Android Console</string>
<string name="options_label_str">オプション</string>
<string name="help_label_str">Help</string>
<string name="refresh_label_str">Refresh</string>
<string name="exit_label_str">Exit</string>
<string name="pandorafms_logo_description">PandoraFMS\'s logo</string>
<string name="dont_show_again">Don\'t show again</string>
<string name="pandroid_info_txt">Need a large string for to fill this space with pretty things and rainbows.</string>
<string name="pandroid_info_long_txt">Need a large string for to fill this space with pretty things and rainbows.</string>
<string name="pandroid_options_txt">Need a large string for to fill this space with pretty things and rainbows.</string>
<string name="url_option">URL:</string>
<string name="user_option">User:</string>
<string name="password_option">Password:</string>
<string name="save_button_str">Save</string>
<string name="update_button_str">Update</string>
<string name="cancel_button_str">Cancel</string>
</resources>

View File

@ -0,0 +1,8 @@
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw600dp devices (e.g. 7" tablets) here.
-->
</resources>

View File

@ -0,0 +1,9 @@
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-->
<dimen name="activity_horizontal_margin">128dp</dimen>
</resources>

View File

@ -0,0 +1,11 @@
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>

View File

@ -0,0 +1,12 @@
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>

View File

@ -0,0 +1,7 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="const_string_preferences">PANDROID_EVENT_VIEWER_PREFERENCES</string>
<string name="app_name">Pandora FMS Android Console</string>
<string name="options_label_str">Options</string>
<string name="help_label_str">Help</string>
<string name="refresh_label_str">Refresh</string>
<string name="exit_label_str">Exit</string>
<string name="pandorafms_logo_description">PandoraFMS\'s logo</string>
<string name="dont_show_again">Don\'t show again</string>
<string name="pandroid_info_txt">Need a large string for to fill this space with pretty things and rainbows.</string>
<string name="pandroid_info_long_txt">Need a large string for to fill this space with pretty things and rainbows.</string>
<string name="pandroid_options_txt">Need a large string for to fill this space with pretty things and rainbows.</string>
<string name="url_option">URL:</string>
<string name="user_option">User:</string>
<string name="password_option">Password:</string>
<string name="save_button_str">Save</string>
<string name="update_button_str">Update</string>
<string name="cancel_button_str">Cancel</string>
<string name="connection_str">Connecting&#8230;</string>
<string name="loading_desc">Connecting&#8230;</string>
</resources>

View File

@ -0,0 +1,20 @@
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>

View File

@ -0,0 +1,53 @@
/*
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.
*/
/**
* Activity of help view.
*
* @author Miguel de Dios Matías
*
*/
package pandorafms.pandorafmsandroidconsole;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.widget.ImageView;
public class ConnectionCustomToast extends Activity {
private AnimationDrawable loadAnimation;
public static Activity activity;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Hack to close the activity from other activity.
activity = this;
setContentView(R.layout.connection_custom_toast);
ImageView loading_anim = (ImageView)findViewById(R.id.loading_anim);
loading_anim.setImageResource(R.drawable.loading);
loadAnimation = (AnimationDrawable)loading_anim.getDrawable();
}
@Override
public void onWindowFocusChanged(boolean hasFocus){
loadAnimation.start();
}
}

View File

@ -0,0 +1,47 @@
/*
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.
*/
/**
* Activity of help view.
*
* @author Miguel de Dios Matías
*
*/
package pandorafms.pandorafmsandroidconsole;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
public class Help extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.help);
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

@ -0,0 +1,101 @@
/*
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.
*/
/**
* Activity of option view.
*
* @author Miguel de Dios Matías
*
*/
package pandorafms.pandorafmsandroidconsole;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class Options extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.options);
Button save_button = (Button)findViewById(R.id.save_options);
Button cancel_button = (Button)findViewById(R.id.cancel_options);
SharedPreferences preferences = getSharedPreferences(
getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
EditText field;
field = (EditText)findViewById(R.id.url_option);
String url_pandora = preferences.getString("url_pandora", "");
field.setText(url_pandora);
field = (EditText)findViewById(R.id.user_option);
String user = preferences.getString("user", "");
field.setText(user);
field = (EditText)findViewById(R.id.password_option);
String password = preferences.getString("password", "");
field.setText(password);
//Check if not empty the data of connection
if (!url_pandora.equals("") && !user.equals("") && !password.equals("")) {
//And set the label of button as update
save_button.setText(getString(R.string.update_button_str));
}
//Add the listener for the save button.
save_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences preferences = getSharedPreferences(
getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences.Editor editorPreferences = preferences
.edit();
EditText field;
field = (EditText)findViewById(R.id.url_option);
editorPreferences.putString("url_pandora", field.getText().toString());
field = (EditText)findViewById(R.id.user_option);
editorPreferences.putString("user", field.getText().toString());
field = (EditText)findViewById(R.id.password_option);
editorPreferences.putString("password", field.getText().toString());
editorPreferences.commit();
setResult(666);
finish();
}
});
cancel_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}

View File

@ -0,0 +1,158 @@
/*
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.
*/
/**
* Activity of main view.
*
* @author Miguel de Dios Matías
*
*/
package pandorafms.pandorafmsandroidconsole;
import pandorafms.pandorafmsandroidconsole.R;
import pandorafms.pandorafmsandroidconsole.Help;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.SslErrorHandler;
import android.widget.Toast;
import android.net.http.SslError;
public class PandoraWebView extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent i;
setContentView(R.layout.activity_web_view);
SharedPreferences preferences = getSharedPreferences(
getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
String url_pandora = preferences.getString("url_pandora", "");
String user = preferences.getString("user", "");
String password = preferences.getString("password", "");
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.setWebViewClient(new WebViewClient(){
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed(); // Ignore SSL certificate errors
}
public void onPageFinished(WebView view, String url) {
//Check the first load the page for to hide a toast with the
//connection message
//Close the CustomToast (I love this hack, fuck javalovers and yours patterns.).
ConnectionCustomToast connectionCustomToast = new ConnectionCustomToast();
if (connectionCustomToast.activity != null)
connectionCustomToast.activity.finish();
}
});
//Check if not empty the data of connection
if (url_pandora.equals("")) {
//Show the config dialog for to set a URL (normally the first execution)
i = new Intent(this, Options.class);
startActivityForResult(i, 666);
}
else {
//myWebView.loadUrl("http://192.168.10.14/test.php");
myWebView.loadUrl(url_pandora + "/index.php?action=login&password=" + password + "&user=" + user);
Log.e("URL", url_pandora + "/index.php?action=login&password=" + password + "&user=" + user);
i = new Intent(this, ConnectionCustomToast.class);
startActivity(i);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.web_view, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent i;
switch (item.getItemId()) {
case R.id.options_button_menu_options:
i = new Intent(this, Options.class);
startActivityForResult(i, 666);
break;
case R.id.help_button_menu_options:
i = new Intent(this, Help.class);
startActivity(i);
break;
case R.id.refresh_button_menu_options:
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.reload();
break;
case R.id.exit_button_menu_options:
finish();
break;
}
return true;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch(resultCode) {
case 666:
SharedPreferences preferences = getSharedPreferences(
getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
String url_pandora = preferences.getString("url_pandora", "");
String user = preferences.getString("user", "");
String password = preferences.getString("password", "");
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadUrl(url_pandora + "/index.php?action=login&password=" + password + "&user=" + user);
Log.e("URL", url_pandora + "/index.php?action=login&password=" + password + "&user=" + user);
Intent i = new Intent(this, ConnectionCustomToast.class);
startActivity(i);
break;
}
}
}