Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MasDennis committed Jul 7, 2011
0 parents commit cf42276
Show file tree
Hide file tree
Showing 47 changed files with 4,274 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .classpath
@@ -0,0 +1,7 @@
<?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="output" path="bin"/>
</classpath>
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@

/bin
/gen
33 changes: 33 additions & 0 deletions .project
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Rajawali</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>
27 changes: 27 additions & 0 deletions AndroidManifest.xml
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.monyetmabuk.livewallpapers.photosdof"
android:versionCode="1"
android:versionName="1.0">


<application android:icon="@drawable/icon" android:label="@string/app_name">
<service android:name="com.monyetmabuk.livewallpapers.engine.wallpaper.Wallpaper"
android:label="@string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data android:name="android.service.wallpaper" android:resource="@xml/albums" />
</service>

<activity
android:label="@string/wallpaper_settings"
android:name="com.monyetmabuk.livewallpapers.engine.wallpaper.WallpaperSettings"
android:exported="true">
</activity>
</application>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
<uses-feature android:glEsVersion="0x00020000"/>
<uses-feature android:name="android.software.live_wallpaper" />
</manifest>
11 changes: 11 additions & 0 deletions default.properties
@@ -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-8
36 changes: 36 additions & 0 deletions proguard.cfg
@@ -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 *;
}
Binary file added res/drawable-hdpi/icon.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/icon.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/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions res/layout/main.xml
@@ -0,0 +1,7 @@
<?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"
>
</LinearLayout>
4 changes: 4 additions & 0 deletions res/values/defaultvalues.xml
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="ribbon_default_amplitude">5</integer>
</resources>
6 changes: 6 additions & 0 deletions res/values/strings.xml
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name"></string>
<string name="wallpaper_settings"></string>
<string name="description"></string>
</resources>
5 changes: 5 additions & 0 deletions res/xml/albums.xml
@@ -0,0 +1,5 @@
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="@drawable/icon"
android:description="@string/description"
android:settingsActivity="rajawali.wallpaper.WallpaperSettings"
/>
13 changes: 13 additions & 0 deletions res/xml/settings.xml
@@ -0,0 +1,13 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/app_settings"
android:key="appsettings">

<PreferenceCategory>
<!-- CheckBoxPreference
android:key="touchAnimation"
android:title="@string/touch_animation_setting"
android:summary="@string/touch_animation_summary"
android:defaultValue="true" />
</PreferenceCategory>
</PreferenceScreen>
132 changes: 132 additions & 0 deletions src/net/rbgrn/opengl/BaseConfigChooser.java
@@ -0,0 +1,132 @@
package net.rbgrn.opengl;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;

import android.opengl.GLSurfaceView.EGLConfigChooser;

abstract class BaseConfigChooser implements EGLConfigChooser {
// ===========================================================
// Constants
// ===========================================================

// ===========================================================
// Fields
// ===========================================================

protected int[] mConfigSpec;

// ===========================================================
// Constructors
// ===========================================================

public BaseConfigChooser(final int[] configSpec) {
this.mConfigSpec = configSpec;
}

// ===========================================================
// Getter & Setter
// ===========================================================

// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================

abstract EGLConfig chooseConfig(EGL10 egl, EGLDisplay display, EGLConfig[] configs);

public EGLConfig chooseConfig(final EGL10 egl, final EGLDisplay display) {
final int[] num_config = new int[1];
egl.eglChooseConfig(display, this.mConfigSpec, null, 0, num_config);

final int numConfigs = num_config[0];

if (numConfigs <= 0) {
throw new IllegalArgumentException("No configs match configSpec");
}

final EGLConfig[] configs = new EGLConfig[numConfigs];
egl.eglChooseConfig(display, this.mConfigSpec, configs, numConfigs, num_config);
final EGLConfig config = this.chooseConfig(egl, display, configs);
if (config == null) {
throw new IllegalArgumentException("No config chosen");
}
return config;
}

// ===========================================================
// Methods
// ===========================================================

// ===========================================================
// Inner and Anonymous Classes
// ===========================================================

public static class ComponentSizeChooser extends BaseConfigChooser {
public ComponentSizeChooser(final int redSize, final int greenSize, final int blueSize, final int alphaSize, final int depthSize, final int stencilSize) {
super(new int[] { EGL10.EGL_RED_SIZE, redSize, EGL10.EGL_GREEN_SIZE, greenSize, EGL10.EGL_BLUE_SIZE, blueSize, EGL10.EGL_ALPHA_SIZE, alphaSize, EGL10.EGL_DEPTH_SIZE, depthSize, EGL10.EGL_STENCIL_SIZE, stencilSize, EGL10.EGL_NONE });
this.mValue = new int[1];
this.mRedSize = redSize;
this.mGreenSize = greenSize;
this.mBlueSize = blueSize;
this.mAlphaSize = alphaSize;
this.mDepthSize = depthSize;
this.mStencilSize = stencilSize;
}

@Override
public EGLConfig chooseConfig(final EGL10 egl, final EGLDisplay display, final EGLConfig[] configs) {
EGLConfig closestConfig = null;
int closestDistance = 1000;
for (final EGLConfig config : configs) {
final int d = this.findConfigAttrib(egl, display, config, EGL10.EGL_DEPTH_SIZE, 0);
final int s = this.findConfigAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE, 0);
if (d >= this.mDepthSize && s >= this.mStencilSize) {
final int r = this.findConfigAttrib(egl, display, config, EGL10.EGL_RED_SIZE, 0);
final int g = this.findConfigAttrib(egl, display, config, EGL10.EGL_GREEN_SIZE, 0);
final int b = this.findConfigAttrib(egl, display, config, EGL10.EGL_BLUE_SIZE, 0);
final int a = this.findConfigAttrib(egl, display, config, EGL10.EGL_ALPHA_SIZE, 0);
final int distance = Math.abs(r - this.mRedSize) + Math.abs(g - this.mGreenSize) + Math.abs(b - this.mBlueSize) + Math.abs(a - this.mAlphaSize);
if (distance < closestDistance) {
closestDistance = distance;
closestConfig = config;
}
}
}
return closestConfig;
}

private int findConfigAttrib(final EGL10 egl, final EGLDisplay display, final EGLConfig config, final int attribute, final int defaultValue) {

if (egl.eglGetConfigAttrib(display, config, attribute, this.mValue)) {
return this.mValue[0];
}
return defaultValue;
}

private final int[] mValue;
// Subclasses can adjust these values:
protected int mRedSize;
protected int mGreenSize;
protected int mBlueSize;
protected int mAlphaSize;
protected int mDepthSize;
protected int mStencilSize;
}

/**
* This class will choose a supported surface as close to RGB565 as
* possible, with or without a depth buffer.
*
*/
public static class SimpleEGLConfigChooser extends ComponentSizeChooser {
public SimpleEGLConfigChooser(final boolean withDepthBuffer) {
super(4, 4, 4, 0, withDepthBuffer ? 16 : 0, 0);
// Adjust target values. This way we'll accept a 4444 or
// 555 buffer if there's no 565 buffer available.
this.mRedSize = 5;
this.mGreenSize = 6;
this.mBlueSize = 5;
}
}
}
46 changes: 46 additions & 0 deletions src/net/rbgrn/opengl/DefaultContextFactory.java
@@ -0,0 +1,46 @@
package net.rbgrn.opengl;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;

import android.opengl.GLSurfaceView.EGLContextFactory;

class DefaultContextFactory implements EGLContextFactory {
// ===========================================================
// Constants
// ===========================================================

// ===========================================================
// Fields
// ===========================================================

// ===========================================================
// Constructors
// ===========================================================

// ===========================================================
// Getter & Setter
// ===========================================================

// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================

public EGLContext createContext(final EGL10 egl, final EGLDisplay display, final EGLConfig config) {
return egl.eglCreateContext(display, config, EGL10.EGL_NO_CONTEXT, null);
}

public void destroyContext(final EGL10 egl, final EGLDisplay display, final EGLContext context) {
egl.eglDestroyContext(display, context);
}

// ===========================================================
// Methods
// ===========================================================

// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
46 changes: 46 additions & 0 deletions src/net/rbgrn/opengl/DefaultWindowSurfaceFactory.java
@@ -0,0 +1,46 @@
package net.rbgrn.opengl;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;

import android.opengl.GLSurfaceView.EGLWindowSurfaceFactory;

class DefaultWindowSurfaceFactory implements EGLWindowSurfaceFactory {
// ===========================================================
// Constants
// ===========================================================

// ===========================================================
// Fields
// ===========================================================

// ===========================================================
// Constructors
// ===========================================================

// ===========================================================
// Getter & Setter
// ===========================================================

// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================

public EGLSurface createWindowSurface(final EGL10 egl, final EGLDisplay display, final EGLConfig config, final Object nativeWindow) {
return egl.eglCreateWindowSurface(display, config, nativeWindow, null);
}

public void destroySurface(final EGL10 egl, final EGLDisplay display, final EGLSurface surface) {
egl.eglDestroySurface(display, surface);
}

// ===========================================================
// Methods
// ===========================================================

// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}

0 comments on commit cf42276

Please sign in to comment.