openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #08306
[Merge] lp:~trb143/openlp/android1 into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/android1 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~trb143/openlp/android1/+merge/59100
Final set of cleanups for now.
Code still works!
--
https://code.launchpad.net/~trb143/openlp/android1/+merge/59100
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/android1 into lp:openlp.
=== added file '.bzrignore'
--- .bzrignore 1970-01-01 00:00:00 +0000
+++ .bzrignore 2011-04-26 16:53:24 +0000
@@ -0,0 +1,3 @@
+bin/
+assets/
+gen/
\ No newline at end of file
=== renamed file '.bzrignore' => '.bzrignore.moved'
=== added file '.classpath'
--- .classpath 1970-01-01 00:00:00 +0000
+++ .classpath 2011-04-26 16:53:24 +0000
@@ -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="lib" path="/home/samme/workspace/android/google-gson-1.6-release.zip"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
=== added file '.project'
--- .project 1970-01-01 00:00:00 +0000
+++ .project 2011-04-26 16:53:24 +0000
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>OpenlpRemote</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>
=== added file 'AndroidManifest.xml'
--- AndroidManifest.xml 1970-01-01 00:00:00 +0000
+++ AndroidManifest.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.openlp.android"
+ android:versionCode="1"
+ android:installLocation="auto"
+ android:versionName="0.1">
+ <uses-sdk android:minSdkVersion="3" />
+ <uses-permission android:name="android.permission.INTERNET" />
+
+ <application android:icon="@drawable/openlp_logo" android:label="@string/app_name">
+ <activity android:name=".openlp"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="misc"></activity>
+ <activity android:name="PreferenceActivity"></activity>
+ <activity android:name="preferences"></activity>
+ <activity android:name="slide"></activity>
+ <activity android:name="service"></activity>
+ </application>
+</manifest>
\ No newline at end of file
=== added file 'OpenLP.apk'
Binary files OpenLP.apk 1970-01-01 00:00:00 +0000 and OpenLP.apk 2011-04-26 16:53:24 +0000 differ
=== added directory 'assets'
=== added file 'default.properties'
--- default.properties 1970-01-01 00:00:00 +0000
+++ default.properties 2011-04-26 16:53:24 +0000
@@ -0,0 +1,11 @@
+# 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 use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-9
=== added file 'proguard.cfg'
--- proguard.cfg 1970-01-01 00:00:00 +0000
+++ proguard.cfg 2011-04-26 16:53:24 +0000
@@ -0,0 +1,36 @@
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+-keepclasseswithmembernames class * {
+ public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembernames class * {
+ public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+ public static final android.os.Parcelable$Creator *;
+}
=== added directory 'res'
=== added directory 'res/drawable-hdpi'
=== added file 'res/drawable-hdpi/icon.png'
Binary files res/drawable-hdpi/icon.png 1970-01-01 00:00:00 +0000 and res/drawable-hdpi/icon.png 2011-04-26 16:53:24 +0000 differ
=== added file 'res/drawable-hdpi/openlp_logo.png'
Binary files res/drawable-hdpi/openlp_logo.png 1970-01-01 00:00:00 +0000 and res/drawable-hdpi/openlp_logo.png 2011-04-26 16:53:24 +0000 differ
=== added directory 'res/drawable-ldpi'
=== added file 'res/drawable-ldpi/icon.png'
Binary files res/drawable-ldpi/icon.png 1970-01-01 00:00:00 +0000 and res/drawable-ldpi/icon.png 2011-04-26 16:53:24 +0000 differ
=== added file 'res/drawable-ldpi/openlp_logo.png'
Binary files res/drawable-ldpi/openlp_logo.png 1970-01-01 00:00:00 +0000 and res/drawable-ldpi/openlp_logo.png 2011-04-26 16:53:24 +0000 differ
=== added directory 'res/drawable-mdpi'
=== added file 'res/drawable-mdpi/icon.png'
Binary files res/drawable-mdpi/icon.png 1970-01-01 00:00:00 +0000 and res/drawable-mdpi/icon.png 2011-04-26 16:53:24 +0000 differ
=== added file 'res/drawable-mdpi/openlp_logo.png'
Binary files res/drawable-mdpi/openlp_logo.png 1970-01-01 00:00:00 +0000 and res/drawable-mdpi/openlp_logo.png 2011-04-26 16:53:24 +0000 differ
=== added directory 'res/layout'
=== added file 'res/layout/listitem.xml'
--- res/layout/listitem.xml 1970-01-01 00:00:00 +0000
+++ res/layout/listitem.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent" android:layout_height="fill_parent">
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="0dip" android:layout_weight="1"
+ android:layout_height="fill_parent">
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/listitem" />
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
=== added file 'res/layout/main.xml'
--- res/layout/main.xml 1970-01-01 00:00:00 +0000
+++ res/layout/main.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/tabhost"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:padding="5dp">
+ <TabWidget
+ android:id="@android:id/tabs"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
+ <FrameLayout
+ android:id="@android:id/tabcontent"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:padding="5dp" />
+ </LinearLayout>
+</TabHost>
+
=== added file 'res/layout/misc.xml'
--- res/layout/misc.xml 1970-01-01 00:00:00 +0000
+++ res/layout/misc.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,27 @@
+<?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"
+ >
+<Button android:text="@string/blank"
+android:id="@+id/blank"
+android:layout_width="fill_parent"
+android:layout_height="wrap_content"></Button>
+<Button android:text="@string/unblank"
+android:id="@+id/unblank"
+android:layout_width="fill_parent"
+android:layout_height="wrap_content"></Button>
+<TextView android:text="@string/alert"
+android:layout_width="wrap_content"
+android:layout_height="wrap_content"/>
+<EditText android:id="@+id/alert"
+android:layout_height="wrap_content"
+android:text=""
+android:layout_width="match_parent"></EditText>
+<Button android:text="@string/send"
+android:id="@+id/send"
+android:layout_width="fill_parent"
+android:layout_height="wrap_content"></Button>
+</LinearLayout>
+
=== added file 'res/layout/service.xml'
--- res/layout/service.xml 1970-01-01 00:00:00 +0000
+++ res/layout/service.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,22 @@
+<?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"
+ >
+<Button android:text="@string/prev"
+android:id="@+id/prev"
+android:layout_width="fill_parent"
+android:layout_height="wrap_content"></Button>
+<Button android:text="@string/next"
+android:id="@+id/next"
+android:layout_width="fill_parent"
+android:layout_height="wrap_content"></Button>
+<TextView
+android:id="@+id/services"
+android:layout_width="fill_parent"
+android:layout_height="wrap_content"></TextView>
+<ListView android:id="@+id/list"
+android:layout_width="wrap_content"
+android:layout_height="wrap_content" />
+</LinearLayout>
=== added file 'res/layout/settings.xml'
--- res/layout/settings.xml 1970-01-01 00:00:00 +0000
+++ res/layout/settings.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,28 @@
+<?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"
+ >
+<TextView android:text="@string/url"
+android:layout_width="wrap_content"
+android:layout_height="wrap_content"/>
+<EditText android:id="@+id/url"
+android:layout_height="wrap_content"
+android:text="192.168.1."
+android:inputType="number"
+android:layout_width="match_parent"></EditText>
+<TextView android:text="@string/port"
+android:layout_width="wrap_content"
+android:layout_height="wrap_content"/>
+<EditText android:id="@+id/port"
+android:layout_height="wrap_content"
+android:text="4316"
+android:layout_width="match_parent"
+android:inputType="number"></EditText>
+<Button android:text="@string/save"
+android:id="@+id/save"
+android:layout_width="fill_parent"
+android:layout_height="wrap_content"></Button>
+</LinearLayout>
+
=== added file 'res/layout/slide.xml'
--- res/layout/slide.xml 1970-01-01 00:00:00 +0000
+++ res/layout/slide.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,22 @@
+<?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"
+ >
+<Button android:text="@string/prev"
+android:id="@+id/prev" android:layout_width="fill_parent"
+android:layout_height="wrap_content"></Button>
+<Button android:text="@string/next"
+android:id="@+id/next"
+android:layout_width="fill_parent"
+android:layout_height="wrap_content"></Button>
+<TextView
+android:id="@+id/slides"
+android:layout_width="fill_parent"
+android:layout_height="wrap_content"></TextView>
+<ListView android:id="@+id/list"
+android:layout_width="wrap_content"
+android:layout_height="wrap_content" />
+
+</LinearLayout>
=== added directory 'res/menu'
=== added file 'res/menu/menu.xml'
--- res/menu/menu.xml 1970-01-01 00:00:00 +0000
+++ res/menu/menu.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:enabled="true" android:titleCondensed="@string/settings" android:title="@string/settings" android:id="@+id/preferences"></item>
+</menu>
=== added directory 'res/values'
=== added directory 'res/values-en'
=== added file 'res/values-en/strings.xml'
--- res/values-en/strings.xml 1970-01-01 00:00:00 +0000
+++ res/values-en/strings.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Openlp</string>
+ <string name="settings">Settings</string>
+ <string name="exit">Exit</string>
+ <string name="prev">Previous</string>
+ <string name="next">Next</string>
+ <string name="alert">Alert:</string>
+ <string name="blank">Blank</string>
+ <string name="unblank">Unblank</string>
+ <string name="send">Send</string>
+ <string name="Slide">Slide</string>
+ <string name="Service">Service</string>
+ <string name="misc">Miscellaneous</string>
+ <string name="url">Server</string>
+ <string name="port">Port</string>
+ <string name="save">Save</string>
+ <string name="unable">Unable to load page -</string>
+ <string name="fail">Connection failed</string>
+ <string name="jsonfail">JSON failed</string>
+ <string name="loading">Connecting...</string>
+</resources>
=== added directory 'res/values-sv'
=== added file 'res/values-sv/strings.xml'
--- res/values-sv/strings.xml 1970-01-01 00:00:00 +0000
+++ res/values-sv/strings.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Openlp</string>
+ <string name="settings">Inställningar</string>
+ <string name="exit">Avsluta</string>
+ <string name="prev">Föregående</string>
+ <string name="next">Nästa</string>
+ <string name="blank">Dölj</string>
+ <string name="unblank">Visa</string>
+ <string name="alert">Varning:</string>
+ <string name="send">Skicka</string>
+ <string name="Slide">Bild</string>
+ <string name="Service">Planering</string>
+ <string name="misc">Diverse</string>
+ <string name="url">Server</string>
+ <string name="port">Port</string>
+ <string name="save">Spara</string>
+ <string name="unable">Lyckas inte ladda sidan -</string>
+ <string name="fail">Anslutningen misslyckades</string>
+ <string name="jsonfail">JSON misslyckades</string>
+ <string name="loading">Ansluter...</string>
+</resources>
=== added file 'res/values/strings.xml'
--- res/values/strings.xml 1970-01-01 00:00:00 +0000
+++ res/values/strings.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Openlp</string>
+ <string name="settings">Settings</string>
+ <string name="exit">Exit</string>
+ <string name="prev">Previous</string>
+ <string name="next">Next</string>
+ <string name="blank">Blank</string>
+ <string name="unblank">Unblank</string>
+ <string name="alert">Alert:</string>
+ <string name="send">Send</string>
+ <string name="Slide">Slide</string>
+ <string name="Service">Service</string>
+ <string name="misc">Miscellaneous</string>
+ <string name="url">Server</string>
+ <string name="port">Port</string>
+ <string name="save">Save</string>
+ <string name="unable">Unable to load page -</string>
+ <string name="fail">Connection failed</string>
+ <string name="jsonfail">JSON failed</string>
+ <string name="loading">Connecting...</string>
+
+</resources>
=== added directory 'res/xml'
=== added file 'res/xml/preferences.xml'
--- res/xml/preferences.xml 1970-01-01 00:00:00 +0000
+++ res/xml/preferences.xml 2011-04-26 16:53:24 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <PreferenceCategory
+ android:title="Server">
+ <EditTextPreference
+ android:title="url"
+ android:key="url"
+ android:defaultValue="192.168.1." android:inputType="phone" android:name="@string/url"/>
+ <EditTextPreference
+ android:defaultValue="4316"
+ android:title="port"
+ android:key="port"
+ android:name="@string/url"
+ android:inputType="number"/>
+</PreferenceCategory>
+</PreferenceScreen>
=== added directory 'src'
=== added directory 'src/org'
=== added directory 'src/org/openlp'
=== added directory 'src/org/openlp/android'
=== added file 'src/org/openlp/android/misc.java'
--- src/org/openlp/android/misc.java 1970-01-01 00:00:00 +0000
+++ src/org/openlp/android/misc.java 2011-04-26 16:53:24 +0000
@@ -0,0 +1,100 @@
+/**
+ ###############################################################################
+ # OpenLP - Open Source Lyrics Projection #
+ # --------------------------------------------------------------------------- #
+ # Copyright (c) 2008-2011 Raoul Snyman #
+ # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
+ # Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, #
+ # Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
+ # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
+ # --------------------------------------------------------------------------- #
+ # This program is free software; you can redistribute it and/or modify it #
+ # under the terms of the GNU General Public License as published by the Free #
+ # Software Foundation; version 2 of the License. #
+ # #
+ # 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. #
+ # #
+ # You should have received a copy of the GNU General Public License along #
+ # with this program; if not, write to the Free Software Foundation, Inc., 59 #
+ # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+ ###############################################################################
+ */
+package org.openlp.android;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.json.JSONStringer;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+public class misc extends openlpActivity {
+ public Button.OnClickListener mBlank = new Button.OnClickListener() {
+ public void onClick(View v) {
+ String urlAll = getURL() + ":" + getPort() + "/api/display/hide";
+ webCall(urlAll);
+ }
+ };
+
+ public Button.OnClickListener mUnblank = new Button.OnClickListener() {
+ public void onClick(View v) {
+ String urlAll = getURL() + ":" + getPort() + "/api/display/show";
+ webCall(urlAll);
+ }
+ };
+
+ public Button.OnClickListener mSend = new Button.OnClickListener() {
+ public void onClick(View v) {
+ EditText edittext = (EditText) findViewById(R.id.alert);
+ String alert;
+ try {
+ JSONObject jo = new JSONObject();
+ jo.put("text", edittext.getText());
+ alert = new JSONStringer().object().key("request").value(jo)
+ .endObject().toString();
+ alert = java.net.URLEncoder.encode(alert);
+ }
+ catch (JSONException e) {
+ alert = e.toString();
+ }
+ String urlAll = (getURL() + ":" + getPort() + "/api/alert?data=" + alert);
+ webCall(urlAll);
+ }
+ };
+
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.misc);
+ findViewById(R.id.blank).setOnClickListener(mBlank);
+ findViewById(R.id.unblank).setOnClickListener(mUnblank);
+ findViewById(R.id.send).setOnClickListener(mSend);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.menu, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle item selection
+ switch (item.getItemId()) {
+ case R.id.preferences:
+ startActivity(new Intent(this, preferences.class));
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+}
\ No newline at end of file
=== added file 'src/org/openlp/android/openlp.java'
--- src/org/openlp/android/openlp.java 1970-01-01 00:00:00 +0000
+++ src/org/openlp/android/openlp.java 2011-04-26 16:53:24 +0000
@@ -0,0 +1,42 @@
+package org.openlp.android;
+
+import android.app.TabActivity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.widget.TabHost;
+
+public class openlp extends TabActivity {
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.main);
+
+ TabHost tabHost = getTabHost(); // The activity TabHost
+ TabHost.TabSpec spec; // Reusable TabSpec for each tab
+ Intent intent; // Reusable Intent for each tab
+
+ // Create an Intent to launch an Activity for the tab (to be reused)
+ intent = new Intent().setClass(this, slide.class);
+
+ // Initialise a TabSpec for each tab and add it to the TabHost
+ spec = tabHost.newTabSpec("artists").setIndicator("Slide")
+ .setContent(intent);
+ tabHost.addTab(spec);
+ tabHost.setCurrentTab(1);
+
+ // Do the same for the other tabs
+ intent = new Intent().setClass(this, service.class);
+ spec = tabHost.newTabSpec("albums").setIndicator("Service")
+ .setContent(intent);
+ tabHost.addTab(spec);
+
+ // Do the same for the other tabs
+ intent = new Intent().setClass(this, misc.class);
+ spec = tabHost.newTabSpec("albums").setIndicator("Misc")
+ .setContent(intent);
+ tabHost.addTab(spec);
+
+ }
+}
\ No newline at end of file
=== added file 'src/org/openlp/android/openlpActivity.java'
--- src/org/openlp/android/openlpActivity.java 1970-01-01 00:00:00 +0000
+++ src/org/openlp/android/openlpActivity.java 2011-04-26 16:53:24 +0000
@@ -0,0 +1,66 @@
+/**
+ ###############################################################################
+ # OpenLP - Open Source Lyrics Projection #
+ # --------------------------------------------------------------------------- #
+ # Copyright (c) 2008-2011 Raoul Snyman #
+ # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
+ # Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, #
+ # Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
+ # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
+ # --------------------------------------------------------------------------- #
+ # This program is free software; you can redistribute it and/or modify it #
+ # under the terms of the GNU General Public License as published by the Free #
+ # Software Foundation; version 2 of the License. #
+ # #
+ # 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. #
+ # #
+ # You should have received a copy of the GNU General Public License along #
+ # with this program; if not, write to the Free Software Foundation, Inc., 59 #
+ # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+ ###############################################################################
+ */
+package org.openlp.android;
+
+import java.io.IOException;
+
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+import android.app.Activity;
+import android.content.SharedPreferences;
+
+/**
+ * @author timali
+ *
+ */
+public class openlpActivity extends Activity {
+ public String getURL() {
+ SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
+ return "http://" + prefs.getString("url", "192.168.0.3");
+ }
+
+ public String getPort() {
+ SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
+ return prefs.getString("port", "4316");
+ }
+
+ public void webCall(String url) {
+ // Create a new HttpClient and post header
+ HttpClient httpclient = new DefaultHttpClient();
+ HttpGet httpget = new HttpGet(url);
+ try {
+ // Execute HTTP Post Request
+ httpclient.execute(httpget);
+ }
+ catch (ClientProtocolException e) {
+ }
+ catch (IOException e) {
+ }
+ }
+
+}
=== added file 'src/org/openlp/android/preferences.java'
--- src/org/openlp/android/preferences.java 1970-01-01 00:00:00 +0000
+++ src/org/openlp/android/preferences.java 2011-04-26 16:53:24 +0000
@@ -0,0 +1,65 @@
+/**
+ ###############################################################################
+ # OpenLP - Open Source Lyrics Projection #
+ # --------------------------------------------------------------------------- #
+ # Copyright (c) 2008-2011 Raoul Snyman #
+ # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
+ # Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, #
+ # Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
+ # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
+ # --------------------------------------------------------------------------- #
+ # This program is free software; you can redistribute it and/or modify it #
+ # under the terms of the GNU General Public License as published by the Free #
+ # Software Foundation; version 2 of the License. #
+ # #
+ # 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. #
+ # #
+ # You should have received a copy of the GNU General Public License along #
+ # with this program; if not, write to the Free Software Foundation, Inc., 59 #
+ # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+ ###############################################################################
+ */
+package org.openlp.android;
+
+import android.app.Activity;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+public class preferences extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.settings);
+ findViewById(R.id.save).setOnClickListener(mSend);
+ EditText url = (EditText) findViewById(R.id.url);
+ EditText port = (EditText) findViewById(R.id.port);
+ SharedPreferences settings = getSharedPreferences("prefs", 0);
+ url.setText(settings.getString("url", "192.168.0.3"));
+ port.setText(settings.getString("port", "4316"));
+ }
+
+ public Button.OnClickListener mSend = new Button.OnClickListener() {
+ public void onClick(View v) {
+ EditText url1 = (EditText) findViewById(R.id.url);
+ EditText port1 = (EditText) findViewById(R.id.port);
+ String url = "" + url1.getText();
+ String port = "" + port1.getText();
+ // We need an Editor object to make preference changes.
+ // All objects are from android.context.Context
+ SharedPreferences settings = getSharedPreferences("prefs", 0);
+ SharedPreferences.Editor editor = settings.edit();
+ editor.putString("url", url);
+ editor.putString("port", port);
+ url1.setText(settings.getString("url", "192.168.0.3"));
+ port1.setText(settings.getString("port", "4316"));
+ // Commit the edits!
+ editor.commit();
+ }
+ };
+}
=== added file 'src/org/openlp/android/service.java'
--- src/org/openlp/android/service.java 1970-01-01 00:00:00 +0000
+++ src/org/openlp/android/service.java 2011-04-26 16:53:24 +0000
@@ -0,0 +1,216 @@
+/**
+ ###############################################################################
+ # OpenLP - Open Source Lyrics Projection #
+ # --------------------------------------------------------------------------- #
+ # Copyright (c) 2008-2011 Raoul Snyman #
+ # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
+ # Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, #
+ # Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
+ # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
+ # --------------------------------------------------------------------------- #
+ # This program is free software; you can redistribute it and/or modify it #
+ # under the terms of the GNU General Public License as published by the Free #
+ # Software Foundation; version 2 of the License. #
+ # #
+ # 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. #
+ # #
+ # You should have received a copy of the GNU General Public License along #
+ # with this program; if not, write to the Free Software Foundation, Inc., 59 #
+ # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+ ###############################################################################
+ */
+package org.openlp.android;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.TextView;
+
+public class service extends openlpActivity {
+
+ private ListView lv1;
+
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.service);
+ findViewById(R.id.prev).setOnClickListener(mPrev);
+ findViewById(R.id.next).setOnClickListener(mNext);
+ TextView txt = (TextView) findViewById(R.id.services);
+ // Set the text and call the connect function.
+ txt.setText(R.string.loading);
+ String urlAll = getURL() + ":" + getPort() + "/api/service/list";
+ txt.setText(connect(urlAll));
+ }
+
+ private String connect(String url) {
+
+ // Create the httpclient
+ HttpClient httpclient = new DefaultHttpClient();
+
+ // Prepare a request object
+ HttpGet httpget = new HttpGet(url);
+
+ // Execute the request
+ HttpResponse response;
+
+ // return string
+ String returnString = null;
+
+ try {
+
+ // Open the webpage
+ response = httpclient.execute(httpget);
+ if (response.getStatusLine().getStatusCode() == 200) {
+ // Connection was established. Get the content.
+
+ HttpEntity entity = response.getEntity();
+ // If the response does not enclose an entity, there is no need
+ // to worry about connection release
+
+ if (entity != null) {
+ // A Simple JSON Response Read
+ InputStream instream = entity.getContent();
+
+ String result = convertStreamToString(instream);
+ Log.i("Praeda", result);
+
+ // Load the requested page converted to a string into a
+ // JSONObject.
+
+ // Build the return string.
+ JSONObject jObject = new JSONObject(result);
+
+ JSONObject results = jObject.getJSONObject("results");
+
+ JSONArray items = results.getJSONArray("items");
+
+ ArrayList<String> result1 = new ArrayList<String>();
+
+ returnString = "";
+
+ for (int i = 0; i < items.length(); i++) {
+
+ result1.add(items.getJSONObject(i).getString("title")
+ .toString());
+ }
+ lv1 = (ListView) findViewById(R.id.list);
+
+ lv1.setAdapter(new ArrayAdapter<String>(this,
+ android.R.layout.simple_list_item_1, result1));
+
+ // Cose the stream.
+ instream.close();
+ }
+ }
+ else {
+ // code here for a response other than 200. A response 200 means
+ // the webpage was ok
+ // Other codes include 404 - not found, 301 - redirect etc...
+ // Display the response line.
+ returnString = "Unable to load page - "
+ + response.getStatusLine();
+ }
+ }
+ catch (IOException ex) {
+ // thrown by line 80 - getContent();
+ // Connection was not established
+ returnString = "Connection failed; " + ex.getMessage();
+ }
+ catch (JSONException ex) {
+ // JSON errors
+ returnString = "JSON failed; " + ex.getMessage();
+ }
+ return returnString;
+ }
+
+ private static String convertStreamToString(InputStream is) {
+ /*
+ * To convert the InputStream to String we use the
+ * BufferedReader.readLine() method. We iterate until the BufferedReader
+ * return null which means there's no more data to read. Each line will
+ * appended to a StringBuilder and returned as String.
+ */
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+ StringBuilder sb = new StringBuilder();
+
+ String line = null;
+ try {
+ while ((line = reader.readLine()) != null) {
+ sb.append(line + "\n");
+ }
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ is.close();
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ return sb.toString();
+ }
+
+ ;
+
+ public Button.OnClickListener mPrev = new Button.OnClickListener() {
+ public void onClick(View v) {
+ String urlAll = getURL() + ":" + getPort()
+ + "/api/service/previous";
+ webCall(urlAll);
+ }
+ };
+
+ public Button.OnClickListener mNext = new Button.OnClickListener() {
+ public void onClick(View v) {
+ String urlAll = getURL() + ":" + getPort() + "/api/service/next";
+ webCall(urlAll);
+ }
+ };
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.menu, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle item selection
+ switch (item.getItemId()) {
+ case R.id.preferences:
+ startActivity(new Intent(this, preferences.class));
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+}
\ No newline at end of file
=== added file 'src/org/openlp/android/slide.java'
--- src/org/openlp/android/slide.java 1970-01-01 00:00:00 +0000
+++ src/org/openlp/android/slide.java 2011-04-26 16:53:24 +0000
@@ -0,0 +1,208 @@
+/**
+ ###############################################################################
+ # OpenLP - Open Source Lyrics Projection #
+ # --------------------------------------------------------------------------- #
+ # Copyright (c) 2008-2011 Raoul Snyman #
+ # Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
+ # Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, #
+ # Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, #
+ # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
+ # --------------------------------------------------------------------------- #
+ # This program is free software; you can redistribute it and/or modify it #
+ # under the terms of the GNU General Public License as published by the Free #
+ # Software Foundation; version 2 of the License. #
+ # #
+ # 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. #
+ # #
+ # You should have received a copy of the GNU General Public License along #
+ # with this program; if not, write to the Free Software Foundation, Inc., 59 #
+ # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+ ###############################################################################
+ */
+package org.openlp.android;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.ListView;
+import android.widget.TextView;
+
+public class slide extends openlpActivity {
+ private ListView lv1;
+
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.slide);
+ findViewById(R.id.prev).setOnClickListener(mPrev);
+ findViewById(R.id.next).setOnClickListener(mNext);
+ TextView txt = (TextView) findViewById(R.id.slides);
+ // Set the text and call the connect function.
+ txt.setText(R.string.loading);
+ final String urlAll = getURL() + ":" + getPort()
+ + "/api/controller/live/text";
+ txt.setText(connect(urlAll));
+ }
+
+ private String connect(String url) {
+
+ // Create the http client
+ HttpClient httpclient = new DefaultHttpClient();
+
+ // Prepare a request object
+ HttpGet httpget = new HttpGet(url);
+
+ // Execute the request
+ HttpResponse response;
+
+ // return string
+ String returnString = null;
+
+ try {
+
+ // Open the webpage
+ response = httpclient.execute(httpget);
+ if (response.getStatusLine().getStatusCode() == 200) {
+ // Connection was established. Get the content.
+
+ HttpEntity entity = response.getEntity();
+ // If the response does not enclose an entity, there is no need
+ // to worry about connection release
+
+ if (entity != null) {
+ // A Simple JSON Response Read
+ InputStream instream = entity.getContent();
+
+ String result = convertStreamToString(instream);
+ Log.i("Praeda", result);
+
+ // Load the requested page converted to a string into a
+ // JSONObject.
+
+ // Build the return string.
+ JSONObject jObject = new JSONObject(result);
+ JSONObject results = jObject.getJSONObject("results");
+ JSONArray slides = results.getJSONArray("slides");
+ ArrayList<String> result1 = new ArrayList<String>();
+ returnString = "";
+
+ for (int i = 0; i < slides.length(); i++) {
+ result1.add(slides.getJSONObject(i).getString("text")
+ .toString());
+ }
+ lv1 = (ListView) findViewById(R.id.list);
+ lv1.setAdapter(new ArrayAdapter<String>(this,
+ android.R.layout.simple_list_item_1, result1));
+ // Close the stream.
+ instream.close();
+ }
+ }
+ else {
+ // code here for a response other than 200. A response 200 means
+ // the webpage was ok
+ // Other codes include 404 - not found, 301 - redirect etc...
+ // Display the response line.
+ returnString = "Unable to load page - "
+ + response.getStatusLine();
+ }
+ }
+ catch (IOException ex) {
+ // thrown by line 80 - getContent();
+ // Connection was not established
+ returnString = "Connection failed; " + ex.getMessage();
+ }
+ catch (JSONException ex) {
+ // JSON errors
+ returnString = "JSON failed; " + ex.getMessage();
+ }
+ return returnString;
+ }
+
+ private static String convertStreamToString(InputStream is) {
+ /*
+ * To convert the InputStream to String we use the
+ * BufferedReader.readLine() method. We iterate until the BufferedReader
+ * return null which means there's no more data to read. Each line will
+ * appended to a StringBuilder and returned as String.
+ */
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+ StringBuilder sb = new StringBuilder();
+
+ String line = null;
+ try {
+ while ((line = reader.readLine()) != null) {
+ sb.append(line + "\n");
+ }
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ is.close();
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ return sb.toString();
+ }
+
+ public Button.OnClickListener mPrev = new Button.OnClickListener() {
+ public void onClick(View v) {
+ String urlAll = getURL() + ":" + getPort()
+ + "/api/controller/live/previous";
+ webCall(urlAll);
+ }
+ };
+
+ public Button.OnClickListener mNext = new Button.OnClickListener() {
+ public void onClick(View v) {
+ String urlAll = getURL() + ":" + getPort()
+ + "/api/controller/live/next";
+ webCall(urlAll);
+ }
+ };
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.menu, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle item selection
+ switch (item.getItemId()) {
+ case R.id.preferences:
+ startActivity(new Intent(this, preferences.class));
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+}