Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 83 → Rev 84

/DUBwise/src/Android/AndroidManifest.xml
0,0 → 1,11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.ligi">
<application>
<activity android:icon="@drawable/icon" android:name=".DUBwise" android:label="DUBwise">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
/DUBwise/src/Android/bin/DUBwise.apk
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/bin/classes/org/ligi/DUBwise.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/bin/classes/org/ligi/DUBwiseDefinitions.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/bin/classes/org/ligi/DUBwiseView.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/bin/classes/org/ligi/R$attr.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/bin/classes/org/ligi/R$drawable.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/bin/classes/org/ligi/R$layout.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/bin/classes/org/ligi/R$string.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/bin/classes/org/ligi/R.class
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/bin/classes.dex
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/build.xml
0,0 → 1,177
<?xml version="1.0" ?>
<project name="DUBwise" default="package">
<property name="sdk-folder" value="/home/ligi/bin/android" />
<property name="android-tools" value="/home/ligi/bin/android/tools" />
<property name="android-framework" value="${android-tools}/lib/framework.aidl" />
 
<!-- The intermediates directory -->
<!-- Eclipse uses "bin" for its own output, so we do the same. -->
<property name="outdir" value="bin" />
 
<!-- No user servicable parts below. -->
 
<!-- Input directories -->
<property name="resource-dir" value="res" />
<property name="asset-dir" value="assets" />
<property name="srcdir" value="src" />
 
<!-- Output directories -->
<property name="outdir-classes" value="${outdir}/classes" />
 
<!-- Create R.java in the source directory -->
<property name="outdir-r" value="src" />
 
<!-- Intermediate files -->
<property name="dex-file" value="classes.dex" />
<property name="intermediate-dex" value="${outdir}/${dex-file}" />
 
<!-- The final package file to generate -->
<property name="out-package" value="${outdir}/${ant.project.name}.apk" />
 
<!-- Tools -->
<property name="aapt" value="${android-tools}/aapt" />
<property name="aidl" value="${android-tools}/aidl" />
<property name="dx" value="${android-tools}/dx" />
<property name="adb" value="${android-tools}/adb" />
<property name="android-jar" value="${sdk-folder}/android.jar" />
<property name="zip" value="zip" />
 
<!-- Rules -->
 
<!-- Create the output directories if they don't exist yet. -->
<target name="dirs">
<mkdir dir="${outdir}" />
<mkdir dir="${outdir-classes}" />
</target>
 
<!-- Generate the R.java file for this project's resources. -->
<target name="resource-src" depends="dirs">
<echo>Generating R.java...</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="compile" />
<arg value="-m" />
<arg value="-J" />
<arg value="${outdir-r}" />
<arg value="-M" />
<arg value="AndroidManifest.xml" />
<arg value="-S" />
<arg value="${resource-dir}" />
<arg value="-I" />
<arg value="${android-jar}" />
</exec>
</target>
 
<!-- Generate java classes from .aidl files. -->
<target name="aidl" depends="dirs">
<apply executable="${aidl}" failonerror="true">
<arg value="-p${android-framework}" />
<arg value="-I${srcdir}" />
<fileset dir="${srcdir}">
<include name="**/*.aidl"/>
</fileset>
</apply>
</target>
 
<!-- Compile this project's .java files into .class files. -->
<target name="compile" depends="dirs, resource-src, aidl">
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
srcdir="."
destdir="${outdir-classes}"
bootclasspath="${android-jar}" />
</target>
 
<!-- Convert this project's .class files into .dex files. -->
<target name="dex" depends="compile">
<exec executable="${dx}" failonerror="true">
<arg value="-JXmx384M" />
<arg value="--dex" />
<arg value="--output=${basedir}/${intermediate-dex}" />
<arg value="--locals=full" />
<arg value="--positions=lines" />
<arg path="${basedir}/${outdir-classes}" />
</exec>
</target>
 
<!-- Put the project's resources into the output package file. -->
<target name="package-res-and-assets">
<echo>Packaging resources and assets...</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-f" />
<arg value="-c" />
<arg value="-M" />
<arg value="AndroidManifest.xml" />
<arg value="-S" />
<arg value="${resource-dir}" />
<arg value="-A" />
<arg value="${asset-dir}" />
<arg value="-I" />
<arg value="${android-jar}" />
<arg value="${out-package}" />
</exec>
</target>
 
<!-- Same as package-res-and-assets, but without "-A ${asset-dir}" -->
<target name="package-res-no-assets">
<echo>Packaging resources...</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-f" />
<arg value="-c" />
<arg value="-M" />
<arg value="AndroidManifest.xml" />
<arg value="-S" />
<arg value="${resource-dir}" />
<!-- No assets directory -->
<arg value="-I" />
<arg value="${android-jar}" />
<arg value="${out-package}" />
</exec>
</target>
 
<!-- Invoke the proper target depending on whether or not
an assets directory is present. -->
<!-- TODO: find a nicer way to include the "-A ${asset-dir}" argument
only when the assets dir exists. -->
<target name="package-res">
<available file="${asset-dir}" type="dir"
property="res-target" value="and-assets" />
<property name="res-target" value="no-assets" />
<antcall target="package-res-${res-target}" />
</target>
 
<!-- Put the project's .class files into the output package file. -->
<target name="package-java" depends="compile, package-res">
<echo>Packaging java...</echo>
<jar destfile="${out-package}"
basedir="${outdir-classes}"
update="true" />
</target>
 
<!-- Put the project's .dex files into the output package file.
Use the "zip" command, available on most un*x/Linux/MacOS systems,
to create the new package (Ant 1.7 has an internal 'zip' command,
however Ant 1.6.5 lacks it and is still widely installed.)
-->
<target name="package-dex" depends="dex, package-res">
<echo>Packaging dex...</echo>
<exec executable="${zip}" failonerror="true">
<arg value="-qj" />
<arg value="${out-package}" />
<arg value="${intermediate-dex}" />
</exec>
</target>
 
<!-- Create the package file for this project from the sources. -->
<target name="package" depends="package-dex" />
 
<!-- Create the package and install package on the default emulator -->
<target name="install" depends="package">
<echo>Sending package to default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="${out-package}" />
</exec>
</target>
 
</project>
/DUBwise/src/Android/res/drawable/icon.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/res/drawable/lcd_green.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/res/drawable/starfield.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/DUBwise/src/Android/res/layout/main.xml
0,0 → 1,13
<?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, DUBwise"
/>
</LinearLayout>
 
/DUBwise/src/Android/res/values/strings.xml
0,0 → 1,4
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">DUBwise</string>
</resources>
/DUBwise/src/Android/src/org/ligi/DUBwise.java
0,0 → 1,42
package org.ligi;
 
import android.app.Activity;
import android.os.Bundle;
 
import android.app.Activity;
import android.os.Bundle;
 
import android.view.View;
import android.widget.TextView;
 
 
import android.app.Activity;
import android.content.Context;
import android.graphics.*;
import android.os.Bundle;
import android.os.*;
import android.view.View;
 
import java.util.Random;
 
import android.view.Window;
import android.view.WindowManager;
 
import org.bluez.*;
 
public class DUBwise extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NO_STATUS_BAR,
WindowManager.LayoutParams.FLAG_NO_STATUS_BAR);
 
setContentView(new DUBwiseView(this));
//super.onCreate(icicle);
}
}
/DUBwise/src/Android/src/org/ligi/DUBwiseDefinitions.java
0,0 → 1,42
package org.ligi;
public interface DUBwiseDefinitions
{
// id for each state - must just be uniq - order isnt important
public final static int STATEID_SCANNING =0;
public final static int STATEID_DEVICESELECT =1;
public final static int STATEID_MAINMENU =2;
public final static int STATEID_MOTORTEST =3;
public final static int STATEID_SELECT_PARAMSET =4;
public final static int STATEID_EDIT_PARAMS =5;
public final static int STATEID_HANDLE_PARAMS =6;
public final static int STATEID_FLIGHTVIEW =7;
public final static int STATEID_RAWDEBUG =8;
public final static int STATEID_KEYCONTROL =9;
public final static int STATEID_SETTINGSMENU =10;
public final static int STATEID_STICKVIEW =11;
public final static int STATEID_CAMMODE =12;
 
 
public String[] main_menu_items={"Telemetry","Raw Debug", "view RC-data", "MK-KeyControl", "Motor Test" , "Flight Settings","Tool Settings","Remote Cam","Proxy","Change Device" , "Quit " };
public final static int MAINMENU_TELEMETRY =0;
public final static int MAINMENU_RAWDEBUG =1+MAINMENU_TELEMETRY;
public final static int MAINMENU_STICKS =1+MAINMENU_RAWDEBUG;
public final static int MAINMENU_KEYCONTROL =1+MAINMENU_STICKS;
public final static int MAINMENU_MOTORTEST =1+MAINMENU_KEYCONTROL;
public final static int MAINMENU_PARAMS =1+MAINMENU_MOTORTEST;
public final static int MAINMENU_SETTINGSMENU =1+MAINMENU_PARAMS;
public final static int MAINMENU_CAMMODE =1+MAINMENU_SETTINGSMENU;
public final static int MAINMENU_PROXY =1+MAINMENU_CAMMODE;
public final static int MAINMENU_DEVICESELECT =1+MAINMENU_PROXY;
public final static int MAINMENU_QUIT =1+MAINMENU_DEVICESELECT;
 
public String[] settings_menu_items={"Skin ","Sound ","Vibra " ,"Graph ","FullScreen " ,"Keep BGLight " ,"Back" };
public final static int SETTINGSMENU_CHANGESKIN =0;
public final static int SETTINGSMENU_SOUNDTOGGLE =1;
public final static int SETTINGSMENU_VIBRATOGGLE =2;
public final static int SETTINGSMENU_GRAPHTOGGLE =3;
public final static int SETTINGSMENU_FULLSCREENTOGGLE =4;
public final static int SETTINGSMENU_LIGHTTOGGLE =5;
public final static int SETTINGSMENU_BACK =6;
 
}
/DUBwise/src/Android/src/org/ligi/DUBwiseView
0,0 → 1,71
package org.ligi;
 
import android.app.Activity;
import android.os.Bundle;
 
import android.app.Activity;
import android.os.Bundle;
 
import android.view.View;
import android.widget.TextView;
 
 
import android.app.Activity;
import android.content.Context;
import android.graphics.*;
import android.os.Bundle;
import android.os.*;
import android.view.View;
 
import java.util.Random;
 
import android.view.Window;
import android.view.WindowManager;
 
import org.bluez.*;
 
public class DUBwiseView extends View {
private Paint mPaint = new Paint();
private Bitmap mBitmap;
private int pos=0;
private int dir=1;
 
String str1="";
 
long last_run=0;
public DUBwiseView(Context context) {
super(context);
mBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.intro_anim);
}
 
@Override protected void onDraw(Canvas canvas) {
Paint paint = mPaint;
paint.setAntiAlias(true);
 
 
canvas.drawColor(Color.WHITE);
paint.setColor(Color.BLACK);
canvas.clipRect(new RectF(0,0,getWidth(),getHeight()));
canvas.drawText("test123"+str1+" " + getLeft() + " <> "+getTop(),getLeft(),200,paint);
 
pos+=dir;
if (pos==3) dir=-1;
if (pos==0) dir=1;
 
float x=(getLeft()+ (this.getWidth()-mBitmap.getWidth()/4)/2);
float y= getTop() + (this.getHeight()-mBitmap.getHeight())/2 ;
 
canvas.clipRect(new RectF(x,y,x+mBitmap.getWidth()/4,y+mBitmap.getHeight()));
canvas.drawColor(Color.BLACK);
canvas.drawBitmap(mBitmap,x -pos*(mBitmap.getWidth()/4) ,y , paint);
 
 
 
SystemClock.sleep(500);
 
invalidate();
}
}
/DUBwise/src/Android/src/org/ligi/DUBwiseView.java
0,0 → 1,177
package org.ligi;
 
import android.app.Activity;
import android.os.Bundle;
 
import android.app.Activity;
import android.os.Bundle;
 
import android.view.View;
import android.widget.TextView;
 
 
import android.app.Activity;
import android.content.Context;
import android.graphics.*;
import android.os.Bundle;
import android.os.*;
import android.view.View;
 
import java.util.Random;
 
import android.view.Window;
import android.view.WindowManager;
import android.view.KeyEvent;
 
import android.graphics.Region.Op;
 
import org.bluez.*;
 
public class DUBwiseView
extends View
implements DUBwiseDefinitions
 
{
private Paint mPaint = new Paint();
 
public static int LCD_CHAR_COUNT=222;
// some images we need
private Bitmap bg_img,lcd_tiles,lcd_img;
 
// pos for scrolling
private int pos=0;
 
String str1="";
String[] lcd_lines;
long last_run=0;
int last_key=0;
 
int wi,he;
// Activity context;
 
Activity root;
int lcd_top;
int menu_y=0;
 
public DUBwiseView(Context context) {
super(context);
root=(Activity) context;
lcd_lines=new String[main_menu_items.length];
for (int y=0;y<main_menu_items.length;y++)
lcd_lines[y]=" " + main_menu_items[y];
// needed to get Key Events
setFocusable(true);
}
 
public Bitmap resize_to_screen(Bitmap orig,float x_scale_,float y_scale_)
{
// createa matrix for the manipulation
Matrix matrix = new Matrix();
float x_scale,y_scale;
if (y_scale_!=0f)
y_scale= (getHeight()*y_scale_ )/orig.height();
else // take x_scale
y_scale=(getWidth()*x_scale_ )/orig.width();
 
if (x_scale_!=0f)
x_scale= (getWidth()*x_scale_ )/orig.width();
else
x_scale= (getHeight()*y_scale_ )/orig.height();
 
matrix.postScale(x_scale , y_scale);
return Bitmap.createBitmap(orig, 0, 0,(int)( orig.width()),(int)( orig.height()), matrix, true);
}
 
 
public boolean onKeyDown(int keyCode, KeyEvent event)
{
switch ( keyCode)
{
case KeyEvent.KEYCODE_DPAD_DOWN :
menu_y++;
break;
case KeyEvent.KEYCODE_DPAD_UP :
menu_y--;
break;
 
case KeyEvent.KEYCODE_DPAD_CENTER :
root.finish();
break;
}
 
last_key=keyCode;
calc_lcd();
invalidate();
return true;
}
 
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh)
{
bg_img = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.starfield),0f,1f);
lcd_tiles = resize_to_screen(BitmapFactory.decodeResource(getResources(), R.drawable.lcd_green),0.05f*LCD_CHAR_COUNT,0f);
calc_lcd();
}
 
public void calc_lcd()
{
lcd_top=getHeight()-lcd_lines.length*lcd_tiles.height();
Paint paint = mPaint;
lcd_img= Bitmap.createBitmap(getWidth(),lcd_lines.length*lcd_tiles.height()+100,false);
Canvas lcd_canvas=new Canvas();
 
lcd_canvas.setDevice(lcd_img);
lcd_canvas.drawColor(Color.WHITE);
int char_width=(int)(lcd_tiles.width()/LCD_CHAR_COUNT);
for ( int lcd_line=0 ; lcd_line < lcd_lines.length ; lcd_line++)
for (int char_pos=0;char_pos<20;char_pos++)
{
int act_char=0;
if (char_pos<lcd_lines[lcd_line].length())
act_char=lcd_lines[lcd_line].charAt(char_pos)-32;
if ((menu_y==lcd_line)&& (char_pos==0))
act_char=30;
lcd_canvas.clipRect(new RectF(char_pos*char_width,lcd_tiles.height()*lcd_line,(char_pos+1)*char_width,lcd_tiles.height()*(lcd_line+1)),Op.REPLACE );
lcd_canvas.drawBitmap(lcd_tiles,(char_pos-act_char)*(char_width),lcd_tiles.height()*(lcd_line) , paint);
 
}
}
public void tick()
{
pos--;
pos%=bg_img.getWidth();
//SystemClock.sleep(50);
}
 
 
@Override protected void onDraw(Canvas canvas) {
tick();
 
Paint paint = mPaint;
paint.setAntiAlias(true);
 
canvas.drawBitmap(bg_img,pos,0 , paint);
 
if ((bg_img.width()+pos)<(getWidth()))
canvas.drawBitmap(bg_img,pos+bg_img.width(),0 , paint);
 
canvas.drawBitmap(lcd_img,0,lcd_top , paint);
paint.setColor(Color.GREEN);
canvas.drawText("LastKeyCode:"+last_key,10,10,paint);
 
invalidate();
}
}
/DUBwise/src/Android/src/org/ligi/R.java
0,0 → 1,24
/* 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 org.ligi;
 
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
public static final int lcd_green=0x7f020001;
public static final int starfield=0x7f020002;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040000;
}
}