Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
096e35f1
Kaydet (Commit)
096e35f1
authored
Tem 09, 2012
tarafından
Andrzej J. R. Hunt
Kaydeden (comit)
Michael Meeks
Agu 06, 2012
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Initial commit of android remote.
Change-Id: Ia8cfce4af87d121acacf9a29632435c4c786822f
üst
e4239e04
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
631 additions
and
0 deletions
+631
-0
.classpath
android/sdremote/.classpath
+8
-0
.project
android/sdremote/.project
+33
-0
AndroidManifest.xml
android/sdremote/AndroidManifest.xml
+27
-0
ant.properties
android/sdremote/ant.properties
+17
-0
build.xml
android/sdremote/build.xml
+83
-0
proguard-project.txt
android/sdremote/proguard-project.txt
+20
-0
project.properties
android/sdremote/project.properties
+14
-0
ic_launcher.png
android/sdremote/res/drawable-hdpi/ic_launcher.png
+0
-0
ic_launcher.png
android/sdremote/res/drawable-ldpi/ic_launcher.png
+0
-0
ic_launcher.png
android/sdremote/res/drawable-mdpi/ic_launcher.png
+0
-0
main.xml
android/sdremote/res/layout/main.xml
+13
-0
testlayout.xml
android/sdremote/res/layout/testlayout.xml
+29
-0
strings.xml
android/sdremote/res/values/strings.xml
+4
-0
Launcher.java
.../sdremote/src/org/libreoffice/impressremote/Launcher.java
+14
-0
TestClient.java
...dremote/src/org/libreoffice/impressremote/TestClient.java
+99
-0
Client.java
...c/org/libreoffice/impressremote/communication/Client.java
+111
-0
CommunicationService.java
...ice/impressremote/communication/CommunicationService.java
+66
-0
NetworkClient.java
...ibreoffice/impressremote/communication/NetworkClient.java
+37
-0
Transmitter.java
.../libreoffice/impressremote/communication/Transmitter.java
+56
-0
No files found.
android/sdremote/.classpath
0 → 100644
Dosyayı görüntüle @
096e35f1
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"con"
path=
"com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"
/>
<classpathentry
kind=
"con"
path=
"com.android.ide.eclipse.adt.LIBRARIES"
/>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"src"
path=
"gen"
/>
<classpathentry
kind=
"output"
path=
"bin/classes"
/>
</classpath>
android/sdremote/.project
0 → 100644
Dosyayı görüntüle @
096e35f1
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
ImpressRemote
</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>
android/sdremote/AndroidManifest.xml
0 → 100644
Dosyayı görüntüle @
096e35f1
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"org.libreoffice.impressremote"
android:versionCode=
"1"
android:versionName=
"1.0"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<application
android:icon=
"@drawable/ic_launcher"
android:label=
"@string/app_name"
>
<activity
android:name=
"TestClient"
android:label=
"@string/app_name"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<service
android:name=
".communication.CommunicationService"
>
</service>
</application>
</manifest>
\ No newline at end of file
android/sdremote/ant.properties
0 → 100644
Dosyayı görüntüle @
096e35f1
# This file is used to override default values used by the Ant build system.
#
# This file must be checked into Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
android/sdremote/build.xml
0 → 100644
Dosyayı görüntüle @
096e35f1
<?xml version="1.0" encoding="UTF-8"?>
<project
name=
"ImpressRemote"
default=
"help"
>
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property
file=
"local.properties"
/>
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property
file=
"ant.properties"
/>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties
srcFile=
"project.properties"
/>
<!-- quick check on sdk.dir -->
<fail
message=
"sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
unless=
"sdk.dir"
/>
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import
file=
"custom_rules.xml"
optional=
"true"
/>
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import
file=
"${sdk.dir}/tools/ant/build.xml"
/>
</project>
android/sdremote/proguard-project.txt
0 → 100644
Dosyayı görüntüle @
096e35f1
# 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 *;
#}
android/sdremote/project.properties
0 → 100644
Dosyayı görüntüle @
096e35f1
# 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-15
android/sdremote/res/drawable-hdpi/ic_launcher.png
0 → 100644
Dosyayı görüntüle @
096e35f1
4.05 KB
android/sdremote/res/drawable-ldpi/ic_launcher.png
0 → 100644
Dosyayı görüntüle @
096e35f1
1.68 KB
android/sdremote/res/drawable-mdpi/ic_launcher.png
0 → 100644
Dosyayı görüntüle @
096e35f1
2.51 KB
android/sdremote/res/layout/main.xml
0 → 100644
Dosyayı görüntüle @
096e35f1
<?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:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:text=
"Hello World, Launcher"
/>
</LinearLayout>
android/sdremote/res/layout/testlayout.xml
0 → 100644
Dosyayı görüntüle @
096e35f1
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/label_curSlide"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:text=
"Slide: XXX"
/>
<Button
android:id=
"@+id/button_next"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:text=
"Next"
/>
<Button
android:id=
"@+id/button_previous"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:text=
"Previous"
/>
</LinearLayout>
\ No newline at end of file
android/sdremote/res/values/strings.xml
0 → 100644
Dosyayı görüntüle @
096e35f1
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string
name=
"app_name"
>
Launcher
</string>
</resources>
android/sdremote/src/org/libreoffice/impressremote/Launcher.java
0 → 100644
Dosyayı görüntüle @
096e35f1
package
org
.
libreoffice
.
impressremote
;
import
android.app.Activity
;
import
android.os.Bundle
;
public
class
Launcher
extends
Activity
{
/** Called when the activity is first created. */
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
main
);
}
}
android/sdremote/src/org/libreoffice/impressremote/TestClient.java
0 → 100644
Dosyayı görüntüle @
096e35f1
package
org
.
libreoffice
.
impressremote
;
import
org.libreoffice.impressremote.communication.CommunicationService
;
import
org.libreoffice.impressremote.communication.Transmitter
;
import
android.app.Activity
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.ServiceConnection
;
import
android.os.Bundle
;
import
android.os.IBinder
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.widget.Button
;
public
class
TestClient
extends
Activity
{
private
boolean
mIsBound
=
false
;
private
CommunicationService
mCommunicationService
;
/** Called when the activity is first created. */
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
testlayout
);
setupUI
();
doBindService
();
}
private
ServiceConnection
mConnection
=
new
ServiceConnection
()
{
public
void
onServiceConnected
(
ComponentName
aClassName
,
IBinder
aService
)
{
mCommunicationService
=
((
CommunicationService
.
CBinder
)
aService
)
.
getService
();
mCommunicationService
.
connectTo
(
CommunicationService
.
Protocol
.
NETWORK
,
"128.232.128.144"
);
enableButtons
(
true
);
}
public
void
onServiceDisconnected
(
ComponentName
aClassName
)
{
mCommunicationService
=
null
;
enableButtons
(
false
);
}
};
void
doBindService
()
{
bindService
(
new
Intent
(
this
,
CommunicationService
.
class
),
mConnection
,
Context
.
BIND_AUTO_CREATE
);
mIsBound
=
true
;
}
void
doUnbindService
()
{
if
(
mIsBound
)
{
unbindService
(
mConnection
);
mIsBound
=
false
;
}
}
private
Button
mButtonNext
;
private
Button
mButtonPrevious
;
private
void
setupUI
()
{
mButtonNext
=
(
Button
)
findViewById
(
R
.
id
.
button_next
);
mButtonPrevious
=
(
Button
)
findViewById
(
R
.
id
.
button_previous
);
enableButtons
(
false
);
mButtonNext
.
setOnClickListener
(
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
mCommunicationService
.
getTransmitter
().
nextTransition
();
}
});
mButtonPrevious
.
setOnClickListener
(
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
mCommunicationService
.
getTransmitter
().
previousTransition
();
}
});
}
private
void
enableButtons
(
boolean
aEnabled
)
{
mButtonNext
.
setEnabled
(
aEnabled
);
mButtonPrevious
.
setEnabled
(
aEnabled
);
}
}
android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
0 → 100644
Dosyayı görüntüle @
096e35f1
package
org
.
libreoffice
.
impressremote
.
communication
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
org.apache.http.util.ByteArrayBuffer
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
/**
* Generic Client for the remote control. To implement a Client for a specific
* transport medium you must provide input and output streams (
* <code>mInputStream</code> and <code>mOutputStream</code> before calling any
* methods.
*
* @author Andrzej J.R. Hunt
*
*/
public
abstract
class
Client
{
private
static
final
String
CHARSET
=
"UTF-16"
;
protected
InputStream
mInputStream
;
protected
OutputStream
mOutputStream
;
private
void
listen
()
{
ByteArrayBuffer
aBuffer
=
new
ByteArrayBuffer
(
10
);
byte
aTemp
;
try
{
while
((
aTemp
=
(
byte
)
mInputStream
.
read
())
!=
0x0d
)
{
aBuffer
.
append
(
aTemp
);
}
}
catch
(
IOException
e1
)
{
// TODO stream couldn't be opened.
e1
.
printStackTrace
();
}
String
aLengthString
;
try
{
aLengthString
=
new
String
(
aBuffer
.
toByteArray
(),
CHARSET
);
}
catch
(
UnsupportedEncodingException
e1
)
{
throw
new
Error
(
"Specified network encoding ["
+
CHARSET
+
" not available."
);
}
int
aLength
=
Integer
.
parseInt
(
aLengthString
);
byte
[]
aCommand
=
new
byte
[
aLength
];
try
{
mInputStream
.
read
(
aCommand
,
0
,
aLength
);
}
catch
(
IOException
e
)
{
// TODO close and notify that the connection has closed
e
.
printStackTrace
();
}
String
aCommandString
;
try
{
aCommandString
=
new
String
(
aCommand
,
CHARSET
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
Error
(
"Specified network encoding ["
+
CHARSET
+
" not available."
);
}
parseCommand
(
aCommandString
);
}
private
void
parseCommand
(
String
aCommand
)
{
JSONObject
aCommandObject
;
String
aInstruction
;
try
{
aCommandObject
=
new
JSONObject
(
aCommand
);
aInstruction
=
aCommandObject
.
getString
(
"command"
);
if
(
aInstruction
.
equals
(
"slide_changed"
))
{
// TODO: process and notify
}
}
catch
(
JSONException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
/**
* Send a valid JSON string to the server.
*
* @param command
* Must be a valid JSON string.
*/
public
void
sendCommand
(
String
command
)
{
String
aLengthString
=
Integer
.
toString
(
command
.
length
());
byte
[]
aLengthBytes
;
try
{
aLengthBytes
=
aLengthString
.
getBytes
(
CHARSET
);
mOutputStream
.
write
(
aLengthBytes
);
mOutputStream
.
write
(
0x0d
);
mOutputStream
.
write
(
command
.
getBytes
(
CHARSET
));
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
Error
(
"Specified network encoding ["
+
CHARSET
+
" not available."
);
}
catch
(
IOException
e
)
{
// TODO Notify that stream has closed.
}
}
}
android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
0 → 100644
Dosyayı görüntüle @
096e35f1
package
org
.
libreoffice
.
impressremote
.
communication
;
import
android.app.Service
;
import
android.content.Intent
;
import
android.os.Binder
;
import
android.os.IBinder
;
public
class
CommunicationService
extends
Service
{
/**
* Return the service to clients.
*/
public
class
CBinder
extends
Binder
{
public
CommunicationService
getService
()
{
return
CommunicationService
.
this
;
}
}
private
final
IBinder
mBinder
=
new
CBinder
();
public
enum
Protocol
{
NETWORK
,
BLUETOOTH
};
private
Transmitter
mTransmitter
;
private
Client
mClient
;
@Override
public
IBinder
onBind
(
Intent
intent
)
{
// TODO Auto-generated method stub
return
mBinder
;
}
@Override
public
void
onCreate
()
{
// TODO Create a notification (if configured).
}
@Override
public
void
onDestroy
()
{
// TODO Destroy the notification (as necessary).
}
public
Transmitter
getTransmitter
()
{
return
mTransmitter
;
}
public
void
connectTo
(
Protocol
aProtocol
,
String
address
)
{
switch
(
aProtocol
)
{
case
NETWORK:
mClient
=
new
NetworkClient
(
address
);
mTransmitter
=
new
Transmitter
(
mClient
);
break
;
}
}
public
void
disconnect
()
{
}
}
android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
0 → 100644
Dosyayı görüntüle @
096e35f1
package
org
.
libreoffice
.
impressremote
.
communication
;
import
java.io.IOException
;
import
java.net.Socket
;
import
java.net.UnknownHostException
;
import
android.content.Context
;
import
android.content.ServiceConnection
;
/**
* Standard Network client. Connects to a server using Sockets.
*
* @author Andrzej J.R. Hunt
*
*/
public
class
NetworkClient
extends
Client
{
private
static
final
int
PORT
=
1599
;
public
NetworkClient
(
String
ipAddress
)
{
Socket
aSocket
;
try
{
aSocket
=
new
Socket
(
ipAddress
,
PORT
);
mInputStream
=
aSocket
.
getInputStream
();
mOutputStream
=
aSocket
.
getOutputStream
();
}
catch
(
UnknownHostException
e
)
{
// TODO Tell the user we have a problem
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
// TODO As above
e
.
printStackTrace
();
}
}
}
android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
0 → 100644
Dosyayı görüntüle @
096e35f1
package
org
.
libreoffice
.
impressremote
.
communication
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
/**
* Interface to send commands to the server.
*
* @author Andrzej J.R. Hunt
*
*/
public
class
Transmitter
{
private
Client
mClient
;
public
Transmitter
(
Client
aClient
)
{
mClient
=
aClient
;
}
public
void
nextTransition
()
{
JSONObject
aCommand
=
new
JSONObject
();
try
{
aCommand
.
put
(
"command"
,
"transition_next"
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
// TODO: clean
}
// Create JSON
mClient
.
sendCommand
(
aCommand
.
toString
());
}
public
void
previousTransition
()
{
JSONObject
aCommand
=
new
JSONObject
();
try
{
aCommand
.
put
(
"command"
,
"transition_previous"
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
// TODO: clean
}
// Create JSON
mClient
.
sendCommand
(
aCommand
.
toString
());
}
public
void
gotoSlide
(
int
slide
)
{
JSONObject
aCommand
=
new
JSONObject
();
try
{
aCommand
.
put
(
"command"
,
"goto_slide"
);
aCommand
.
put
(
"slide_numer"
,
slide
);
}
catch
(
JSONException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
mClient
.
sendCommand
(
aCommand
.
toString
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment