--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="de.android.androidtetris"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <uses-sdk android:minSdkVersion="13" />
+
+ <application android:icon="@drawable/icon" android:label="@string/app_name">
+ <activity android:name=".AndroidTetrisActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ </application>
+</manifest>
\ No newline at end of file
--- /dev/null
+# 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-13
--- /dev/null
+/* 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 de.android.androidtetris;
+
+public final class R {
+ public static final class attr {
+ }
+ public static final class drawable {
+ public static final int greenstar=0x7f020000;
+ public static final int icon=0x7f020001;
+ public static final int redstar=0x7f020002;
+ public static final int yellowstar=0x7f020003;
+ }
+ public static final class layout {
+ public static final int main=0x7f030000;
+ }
+ public static final class string {
+ public static final int app_name=0x7f040001;
+ public static final int hello=0x7f040000;
+ }
+}
--- /dev/null
+-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 *;
+}
--- /dev/null
+<?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="@string/hello"
+ />
+</LinearLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="hello">Hello World, AndroidTetrisActivity!</string>
+ <string name="app_name">AndroidTetris</string>
+</resources>
--- /dev/null
+package de.android.androidtetris;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.DisplayMetrics;
+
+public class AndroidTetrisActivity extends Activity {
+ DrawView drawView;
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
+
+ setContentView(R.layout.main);
+ drawView = new DrawView(this);
+ drawView.setDimensions(displayMetrics.widthPixels, displayMetrics.heightPixels);
+ this.setContentView(drawView);
+ drawView.requestFocus();
+ }
+}
\ No newline at end of file
--- /dev/null
+/**
+ *
+ */
+package de.android.androidtetris;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.drawable.Drawable;
+import android.view.View;
+
+/**
+ * @author gustavo
+ *
+ */
+public class DrawView extends View {
+ Paint paint = new Paint();
+ private int width;
+ private int height;
+ private static final int WIDTH = 50;
+ private static final int HEIGHT = 50;
+ private static final int STRIDE = 64; //
+
+ DrawView(Context context)
+ {
+ super(context);
+ paint.setColor(Color.RED);
+ paint.setAntiAlias(true);
+ }
+
+ @Override
+ public void onDraw(Canvas canvas)
+ {
+ super.onDraw(canvas);
+ 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;
+ }
+ }
+ //Resources r = this.getContext().getResources();
+ Bitmap bitmap = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888);
+ bitmap.setPixels(colors, 0, STRIDE, 0, 0, WIDTH, HEIGHT);
+ Bitmap bitmapnew = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888);
+ bitmapnew.setPixels(colors, 0, STRIDE, 0, 0, WIDTH, HEIGHT);
+ //Canvas canvasnew = new Canvas(bitmap);
+ //Drawable tile = r.getDrawable(R.drawable.greenstar);
+ //tile.setBounds(1000, 1000, 1000, 1000);
+ //tile.draw(canvasnew);
+ canvas.drawBitmap(bitmap, 150, 150, this.paint);
+ canvas.drawBitmap(bitmapnew, 300, 300, this.paint);
+ //canvas.drawCircle(150, 150, 100, paint);
+ }
+
+ public void setDimensions(int width, int height)
+ {
+ this.width = width;
+ this.height = height;
+ }
+}
\ No newline at end of file