Skip to content

Commit

Permalink
Merge commit '0d3747860a4ce6779a60af4c7e886302742c0e28'
Browse files Browse the repository at this point in the history
  • Loading branch information
neolode committed Feb 29, 2012
2 parents 871a8dc + 0d37478 commit f175d38
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 8 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="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
2 changes: 0 additions & 2 deletions .gitignore
@@ -1,4 +1,2 @@
/bin/
/.settings/
/.classpath
/.project
33 changes: 33 additions & 0 deletions .project
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DrakeHome</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>
1 change: 0 additions & 1 deletion gen/.gitignore

This file was deleted.

1 change: 1 addition & 0 deletions gen/org/twoproject/drake/.gitignore
@@ -0,0 +1 @@
/R.java
5 changes: 3 additions & 2 deletions src/org/twoproject/drake/CellLayout.java
Expand Up @@ -68,7 +68,7 @@ public class CellLayout extends WidgetCellLayout {
private boolean mDirtyTag;
private boolean mLastDownOnOccupiedCell = false;

private final WallpaperManager mWallpaperManager;
private final DrakeWP mWallpaperManager;
//ADW: We'll have fixed rows/columns
private int mRows;
private int mColumns;
Expand Down Expand Up @@ -118,7 +118,8 @@ public CellLayout(Context context, AttributeSet attrs, int defStyle) {
}
}*/

mWallpaperManager = WallpaperManager.getInstance(getContext());
mWallpaperManager = DrakeWP.getInstance(getContext());
//mWallpaperManager = new DrakeWP(getContext(),wor);
mDesktopCacheType=AlmostNexusSettingsHelper.getScreenCache(context);
}

Expand Down
125 changes: 125 additions & 0 deletions src/org/twoproject/drake/DrakeWP.java
@@ -0,0 +1,125 @@
package org.twoproject.drake;

import android.app.WallpaperManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.IBinder;

public class DrakeWP {

private WallpaperManager mWallpaperManager;
private Workspace that;
public Workspace getWorkspace() {
return that;
}

public void setWorkspace(Workspace that) {
this.that = that;
}

private Boolean fakeIt = false;
private Context contextify;
private static DrakeWP singleton = null;

public DrakeWP(Context context, Workspace workspace) {
this.that = workspace;
this.contextify = context;
mWallpaperManager = WallpaperManager.getInstance(context);
if(mWallpaperManager == null){
this.fakeIt = true;
}
//this.fakeIt = true;
//DrakeWP.singleton = this;
}

public DrakeWP(Context context) {
this.that = null;
this.contextify = context;
mWallpaperManager = WallpaperManager.getInstance(context);
if(mWallpaperManager == null){
this.fakeIt = true;
}
//this.fakeIt = true;
//DrakeWP.singleton = this;
}

// public static void setSingleton(DrakeWP singleton) {
// DrakeWP.singleton = singleton;
// }

public static DrakeWP getInstance(Context context) {
if(singleton == null){
singleton = new DrakeWP(context);
}
singleton.contextify = context;
return singleton;
}

public void setWallpaperOffsetSteps(float f, int i) {
// TODO Auto-generated method stub
if(this.fakeIt) return;

mWallpaperManager.setWallpaperOffsetSteps(f, i);
}

public void setWallpaperOffsets(IBinder windowToken, float f, int i) {
// TODO Auto-generated method stub
if(this.fakeIt) return;

mWallpaperManager.setWallpaperOffsets( windowToken, f, i);
}

public void sendWallpaperCommand(IBinder windowToken, String string, int i,
int j, int k, Bundle object) {
// TODO Auto-generated method stub
if(this.fakeIt) return;

mWallpaperManager.sendWallpaperCommand( windowToken, string, i,
j, k, object);
}

public Drawable getDrawable() {
// TODO Auto-generated method stub
HEIGHT = this.contextify.getWallpaperDesiredMinimumHeight();
WIDTH = this.contextify.getWallpaperDesiredMinimumWidth();
STRIDE = WIDTH;
if(this.fakeIt){
Bitmap buff;// = BitmapFactory.decodeResource(this.that.getResources(), R.drawable.ic_launcher_application);
buff = Bitmap.createBitmap(createColors(), 0, STRIDE, WIDTH, HEIGHT,
Bitmap.Config.ARGB_8888);

return new BitmapDrawable(buff);//new BitmapDrawable(R.drawable.ic_launcher_application);
}
return mWallpaperManager.getDrawable();
}

public Object getWallpaperInfo() {
// TODO Auto-generated method stub
if(this.fakeIt) return null;

return mWallpaperManager.getWallpaperInfo();
}

/*****/
private static int WIDTH = 1280;
private static int HEIGHT = 600;
private static int STRIDE = 1280; // must be >= WIDTH

private static int[] createColors() {
int[] colors = new int[STRIDE * HEIGHT];
for (int y = 0; y < HEIGHT; y++) {
for (int x = 0; x < WIDTH; x++) {
int r = x * 255 / (WIDTH - 1);
int g = y * 255 / (HEIGHT - 1);
int b = 255 - Math.min(r, g);
int a = Math.max(r, g);
colors[y * STRIDE + x] = (a << 24) | (r << 16) | (g << 8) | b;
}
}
return colors;
}
}
9 changes: 6 additions & 3 deletions src/org/twoproject/drake/Workspace.java
Expand Up @@ -64,7 +64,7 @@ public class Workspace extends WidgetSpace implements DropTarget, DragSource, Dr

private int mDefaultScreen;

private final WallpaperManager mWallpaperManager;
private final DrakeWP mWallpaperManager;

private boolean mFirstLayout = true;

Expand Down Expand Up @@ -192,8 +192,8 @@ public Workspace(Context context, AttributeSet attrs) {
public Workspace(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);

mWallpaperManager = WallpaperManager.getInstance(context);

mWallpaperManager = DrakeWP.getInstance(context);//new DrakeWP(context,this);
//mWallpaperManager.setWorkspace(this);
/* Rogro82@xda Extended : Load the default and number of homescreens from the settings database */
mHomeScreens = AlmostNexusSettingsHelper.getDesktopScreens(context);
mDefaultScreen = AlmostNexusSettingsHelper.getDefaultScreen(context);
Expand Down Expand Up @@ -1660,6 +1660,9 @@ public void setWallpaper(boolean fromIntentReceiver){
lwpSupport=false;
}
mLauncher.setWindowBackground(lwpSupport);
// mWallpaperDrawable=null;
// mWallpaperLoaded=false;
// mLauncher.setWindowBackground(false);
invalidate();
requestLayout();
}
Expand Down

0 comments on commit f175d38

Please sign in to comment.