Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
Created Project Zmq Video Chat
Showcase project to display the use of zmq on android together with a node.js server in order to send video and chat from one phone over the internet to another phone
  • Loading branch information
Dominik Egger committed Feb 27, 2013
0 parents commit 404d504
Show file tree
Hide file tree
Showing 26 changed files with 1,850 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
@@ -0,0 +1,9 @@

# /
/gen
/bin
/*.*
!AndroidManifest.xml
!.gitignore
!README.md
/libs/*.properties
36 changes: 36 additions & 0 deletions AndroidManifest.xml
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.dobots.zmqvideochat"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="10" />

<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:screenOrientation="portrait"
android:keepScreenOn="true"
android:label="@string/app_name" >
<activity
android:name="org.dobots.zmqvideochat.ZmqVideoChatActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:keepScreenOn="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Binary file added libs/armeabi/libjzmq.so
Binary file not shown.
Binary file added libs/zmq.jar
Binary file not shown.
Binary file added res/drawable-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-ldpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions res/layout/chat_settings.xml
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">

<TableRow>

<TextView
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:text="@string/nick_name"
android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
android:id="@+id/txtNickName"
android:layout_marginRight="6dip"
android:inputType="text"
android:singleLine="true" >

<requestFocus />
</EditText>
</TableRow>

<TableRow>

<TextView
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:text="@string/address"
android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
android:id="@+id/txtAddress"
android:layout_marginRight="6dip"
android:inputType="textUri"
android:singleLine="true" />

</TableRow>
<TableRow>

<TextView
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:text="@string/chat_port"
android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
android:id="@+id/txtChatPort"
android:layout_marginRight="6dip"
android:inputType="numberDecimal"
android:singleLine="true" />

</TableRow>

<TableRow>

<TextView
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:text="@string/video_port"
android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
android:id="@+id/txtVideoPort"
android:layout_marginRight="6dip"
android:inputType="numberDecimal"
android:singleLine="true" />

</TableRow>

<TableRow>

<TextView
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:text="@string/clients_port"
android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
android:id="@+id/txtClientsPort"
android:layout_marginRight="6dip"
android:inputType="numberDecimal"
android:singleLine="true" />

</TableRow>
</TableLayout>

7 changes: 7 additions & 0 deletions res/layout/clients.xml
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="User" />
115 changes: 115 additions & 0 deletions res/layout/main.xml
@@ -0,0 +1,115 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical" >

<org.dobots.zmqvideochat.gui.CameraPreview
android:id="@+id/svCameraUser"
android:scaleType="fitCenter"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:adjustViewBounds="true" />

<TextView
android:id="@+id/lblFPSUser"
android:scaleType="fitCenter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#e0ff0000"
android:textSize="24sp" />

</FrameLayout>

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical" >

<org.dobots.zmqvideochat.gui.ScalableSurfaceView
android:id="@+id/svCameraPartner"
android:scaleType="fitCenter"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:adjustViewBounds="true"/>

<TextView
android:id="@+id/lblFPSPartner"
android:scaleType="fitCenter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#e0ff0000"
android:textSize="24sp" />

</FrameLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >

<ListView
android:id="@+id/lvChatView"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="match_parent"
android:layout_marginLeft="5dp" >
</ListView>

<View
android:layout_width="2dip"
android:layout_height="match_parent"
android:background="#FF909090" />

<ListView
android:id="@+id/lvUsers"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_marginLeft="5dp" >
</ListView>

</LinearLayout>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<EditText
android:id="@+id/edtMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:layout_marginRight="26dp"
android:ems="10"
android:inputType="textMultiLine"
android:text="Test" />

<Button
android:id="@+id/btnSend"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Send" />

</LinearLayout>

</LinearLayout>
6 changes: 6 additions & 0 deletions res/layout/message.xml
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Message" />
12 changes: 12 additions & 0 deletions res/values/strings.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">ZMQ Video Chat</string>
<string name="menu_settings">Settings</string>
<string name="nick_name">Nick Name</string>
<string name="address">Address</string>
<string name="chat_port">Chat Port</string>
<string name="video_port">Video Port</string>
<string name="clients_port">Clients Port</string>

</resources>
20 changes: 20 additions & 0 deletions res/values/styles.xml
@@ -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>
38 changes: 38 additions & 0 deletions src/org/dobots/utils/Utils.java
@@ -0,0 +1,38 @@
package org.dobots.utils;

import org.dobots.zmqvideochat.ZmqVideoChatActivity;

import android.os.Handler;
import android.os.Looper;
import android.widget.Toast;

public class Utils {

// show a toast message
public static void showToast(String textToShow, int duration) {
Toast oToast = Toast.makeText(ZmqVideoChatActivity.getContext(), textToShow, duration);
oToast.show();
}

// run an asynchronous task, if the task has to modifie UI elements
// use runAsyncUiTask instead
public static void runAsyncTask(Runnable runner) {
new Thread(runner).start();
}

// run an asynchronous UI task
public static void runAsyncUiTask(Runnable runner) {
Handler oHandler = new Handler(Looper.getMainLooper());
oHandler.post(runner);
}

public static void waitSomeTime(int millis) {
try {
Thread.sleep(millis);

} catch (InterruptedException e) {
e.printStackTrace();
}
}

}

0 comments on commit 404d504

Please sign in to comment.