Initial commit
This commit is contained in:
commit
f80098ff1c
16 changed files with 264 additions and 0 deletions
8
.classpath
Normal file
8
.classpath
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?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="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
16
.gitignore
vendored
Normal file
16
.gitignore
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
# built application files
|
||||
*.apk
|
||||
*.ap_
|
||||
|
||||
# files for the dex VM
|
||||
*.dex
|
||||
|
||||
# Java class files
|
||||
*.class
|
||||
|
||||
# generated files
|
||||
bin/
|
||||
gen/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
33
.project
Normal file
33
.project
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Juiz</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>
|
5
.settings/org.eclipse.jdt.core.prefs
Normal file
5
.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#Fri Dec 30 17:01:40 EST 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
21
AndroidManifest.xml
Normal file
21
AndroidManifest.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="net.phoenixinquis.android.juiz"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="7" />
|
||||
<uses-feature android:name="android.software.live_wallpaper"/>
|
||||
|
||||
<application
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name" >
|
||||
<service android:name="JuizWallpaper" 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/juizwallpaper"/>
|
||||
</service>
|
||||
</application>
|
||||
|
||||
</manifest>
|
40
proguard.cfg
Normal file
40
proguard.cfg
Normal file
|
@ -0,0 +1,40 @@
|
|||
-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>;
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
}
|
||||
|
||||
-keepclassmembers class * extends android.app.Activity {
|
||||
public void *(android.view.View);
|
||||
}
|
||||
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
-keep class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
11
project.properties
Normal file
11
project.properties
Normal file
|
@ -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,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-7
|
BIN
res/drawable-hdpi/ic_launcher.png
Normal file
BIN
res/drawable-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4 KiB |
BIN
res/drawable-ldpi/ic_launcher.png
Normal file
BIN
res/drawable-ldpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
res/drawable-mdpi/ic_launcher.png
Normal file
BIN
res/drawable-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
res/drawable/noblesse_logo.png
Normal file
BIN
res/drawable/noblesse_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
res/drawable/noblesse_oblige.png
Normal file
BIN
res/drawable/noblesse_oblige.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
12
res/layout/main.xml
Normal file
12
res/layout/main.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/hello" />
|
||||
|
||||
</LinearLayout>
|
7
res/values/strings.xml
Normal file
7
res/values/strings.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="hello">Hello World, JuizWallpaper!</string>
|
||||
<string name="app_name">Juiz</string>
|
||||
|
||||
</resources>
|
1
res/xml/juizwallpaper.xml
Normal file
1
res/xml/juizwallpaper.xml
Normal file
|
@ -0,0 +1 @@
|
|||
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"></wallpaper>
|
110
src/net/phoenixinquis/android/juiz/JuizWallpaper.java
Normal file
110
src/net/phoenixinquis/android/juiz/JuizWallpaper.java
Normal file
|
@ -0,0 +1,110 @@
|
|||
package net.phoenixinquis.android.juiz;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.content.res.Resources;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.service.wallpaper.WallpaperService;
|
||||
import android.service.wallpaper.WallpaperService.Engine;
|
||||
|
||||
public class JuizWallpaper extends WallpaperService {
|
||||
private final Handler mHandler = new Handler();
|
||||
|
||||
@Override
|
||||
public Engine onCreateEngine() {
|
||||
return new JuizEngine();
|
||||
}
|
||||
class JuizEngine extends Engine {
|
||||
private final Paint mPaint = new Paint();
|
||||
private boolean mVisible;
|
||||
private long mStartTime;
|
||||
private int mWidth;
|
||||
private int mHeight;
|
||||
private Bitmap mLogo;
|
||||
private Bitmap mNoblesse;
|
||||
|
||||
private final Runnable mDrawWallpaper = new Runnable() {
|
||||
public void run() {
|
||||
drawFrame();
|
||||
}
|
||||
};
|
||||
|
||||
JuizEngine() {
|
||||
final Paint paint = mPaint;
|
||||
mStartTime = SystemClock.elapsedRealtime();
|
||||
Resources res = getResources();
|
||||
mLogo = BitmapFactory.decodeResource(res, R.drawable.noblesse_logo);
|
||||
mNoblesse = BitmapFactory.decodeResource(res, R.drawable.noblesse_oblige);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVisibilityChanged(boolean visible) {
|
||||
mVisible = visible;
|
||||
if (visible) {
|
||||
drawFrame();
|
||||
} else {
|
||||
mHandler.removeCallbacks(mDrawWallpaper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||
super.onSurfaceChanged(holder, format, width, height);
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
drawFrame();
|
||||
}
|
||||
void drawFrame() {
|
||||
final SurfaceHolder holder = getSurfaceHolder();
|
||||
|
||||
Canvas c = null;
|
||||
try {
|
||||
c = holder.lockCanvas();
|
||||
if (c != null) {
|
||||
c.drawColor(0xff000000);
|
||||
// draw something
|
||||
DrawLogo(c);
|
||||
DrawNoblesse(c);
|
||||
}
|
||||
} finally {
|
||||
if (c != null) holder.unlockCanvasAndPost(c);
|
||||
}
|
||||
|
||||
// Reschedule the next redraw
|
||||
mHandler.removeCallbacks(mDrawWallpaper);
|
||||
if (mVisible) {
|
||||
mHandler.postDelayed(mDrawWallpaper, 1000 / 25);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawLogo(Canvas c) {
|
||||
c.drawBitmap(mLogo, 100, mHeight - 300, mPaint);
|
||||
}
|
||||
void DrawNoblesse(Canvas c) {
|
||||
c.save(Canvas.CLIP_SAVE_FLAG);
|
||||
int x = mWidth - 150;
|
||||
int y = 200;
|
||||
int w = mNoblesse.getWidth();
|
||||
int h = mHeight - y;
|
||||
long now = SystemClock.elapsedRealtime();
|
||||
long offset = mNoblesse.getHeight() - (((now - mStartTime) / 10) % mNoblesse.getHeight());
|
||||
mPaint.setColor(0xffffffff);
|
||||
mPaint.setStyle(Paint.Style.FILL);
|
||||
Rect clip = new Rect(x, y, x + w, y + h);
|
||||
c.clipRect(clip);
|
||||
mPaint.setAlpha(0xaa);
|
||||
long top = y + h + mNoblesse.getHeight() - offset;
|
||||
while (top > y - mNoblesse.getHeight()) {
|
||||
c.drawBitmap(mNoblesse, x, top, mPaint);
|
||||
top -= mNoblesse.getHeight();
|
||||
}
|
||||
c.drawBitmap(mNoblesse, x - w, y - h, mPaint);
|
||||
c.restore();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue