diff --git a/Acrylic_Paint/.classpath b/Acrylic_Paint/.classpath
new file mode 100644
index 0000000..a4763d1
--- /dev/null
+++ b/Acrylic_Paint/.classpath
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/Acrylic_Paint/.project b/Acrylic_Paint/.project
new file mode 100644
index 0000000..1444927
--- /dev/null
+++ b/Acrylic_Paint/.project
@@ -0,0 +1,33 @@
+
+
+ Acrylic_Paint
+
+
+
+
+
+ com.android.ide.eclipse.adt.ResourceManagerBuilder
+
+
+
+
+ com.android.ide.eclipse.adt.PreCompilerBuilder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ com.android.ide.eclipse.adt.ApkBuilder
+
+
+
+
+
+ com.android.ide.eclipse.adt.AndroidNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/Acrylic_Paint/.settings/org.eclipse.jdt.core.prefs b/Acrylic_Paint/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f77b31c
--- /dev/null
+++ b/Acrylic_Paint/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,4 @@
+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
diff --git a/Acrylic_Paint/AndroidManifest.xml b/Acrylic_Paint/AndroidManifest.xml
new file mode 100644
index 0000000..9337ea5
--- /dev/null
+++ b/Acrylic_Paint/AndroidManifest.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Acrylic_Paint/bin/Acrylic_Paint.apk b/Acrylic_Paint/bin/Acrylic_Paint.apk
new file mode 100644
index 0000000..e0e1882
Binary files /dev/null and b/Acrylic_Paint/bin/Acrylic_Paint.apk differ
diff --git a/Acrylic_Paint/bin/EasyPaint.apk b/Acrylic_Paint/bin/EasyPaint.apk
new file mode 100644
index 0000000..f14b75e
Binary files /dev/null and b/Acrylic_Paint/bin/EasyPaint.apk differ
diff --git a/Acrylic_Paint/bin/classes.dex b/Acrylic_Paint/bin/classes.dex
new file mode 100644
index 0000000..0de10e1
Binary files /dev/null and b/Acrylic_Paint/bin/classes.dex differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/BuildConfig.class b/Acrylic_Paint/bin/classes/anupam/acrylic/BuildConfig.class
new file mode 100644
index 0000000..8762ce3
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/BuildConfig.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog$1.class b/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog$1.class
new file mode 100644
index 0000000..e4daa6e
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog$1.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog$ColorPickerView.class b/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog$ColorPickerView.class
new file mode 100644
index 0000000..0b2a5be
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog$ColorPickerView.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog$OnColorChangedListener.class b/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog$OnColorChangedListener.class
new file mode 100644
index 0000000..24ccf25
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog$OnColorChangedListener.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog.class b/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog.class
new file mode 100644
index 0000000..1f73455
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/ColorPickerDialog.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$1.class b/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$1.class
new file mode 100644
index 0000000..94c7895
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$1.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$2.class b/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$2.class
new file mode 100644
index 0000000..da028f3
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$2.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$3.class b/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$3.class
new file mode 100644
index 0000000..091427e
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$3.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$MyView.class b/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$MyView.class
new file mode 100644
index 0000000..8876d4c
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint$MyView.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint.class b/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint.class
new file mode 100644
index 0000000..a896f52
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/EasyPaint.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/GraphicsActivity.class b/Acrylic_Paint/bin/classes/anupam/acrylic/GraphicsActivity.class
new file mode 100644
index 0000000..a707535
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/GraphicsActivity.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/PictureLayout.class b/Acrylic_Paint/bin/classes/anupam/acrylic/PictureLayout.class
new file mode 100644
index 0000000..9b84b46
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/PictureLayout.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/Places.class b/Acrylic_Paint/bin/classes/anupam/acrylic/Places.class
new file mode 100644
index 0000000..1a0c18b
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/Places.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/R$attr.class b/Acrylic_Paint/bin/classes/anupam/acrylic/R$attr.class
new file mode 100644
index 0000000..50fbba5
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/R$attr.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/R$drawable.class b/Acrylic_Paint/bin/classes/anupam/acrylic/R$drawable.class
new file mode 100644
index 0000000..f85007b
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/R$drawable.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/R$layout.class b/Acrylic_Paint/bin/classes/anupam/acrylic/R$layout.class
new file mode 100644
index 0000000..e60e661
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/R$layout.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/R$string.class b/Acrylic_Paint/bin/classes/anupam/acrylic/R$string.class
new file mode 100644
index 0000000..3189daf
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/R$string.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/R.class b/Acrylic_Paint/bin/classes/anupam/acrylic/R.class
new file mode 100644
index 0000000..98072d0
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/R.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/Splash$1.class b/Acrylic_Paint/bin/classes/anupam/acrylic/Splash$1.class
new file mode 100644
index 0000000..c83b07e
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/Splash$1.class differ
diff --git a/Acrylic_Paint/bin/classes/anupam/acrylic/Splash.class b/Acrylic_Paint/bin/classes/anupam/acrylic/Splash.class
new file mode 100644
index 0000000..2beeb11
Binary files /dev/null and b/Acrylic_Paint/bin/classes/anupam/acrylic/Splash.class differ
diff --git a/Acrylic_Paint/bin/jarlist.cache b/Acrylic_Paint/bin/jarlist.cache
new file mode 100644
index 0000000..1b5ec3f
--- /dev/null
+++ b/Acrylic_Paint/bin/jarlist.cache
@@ -0,0 +1,3 @@
+# cache for current jar dependecy. DO NOT EDIT.
+# format is
+# Encoding is UTF-8
diff --git a/Acrylic_Paint/bin/res/drawable-hdpi/about.png b/Acrylic_Paint/bin/res/drawable-hdpi/about.png
new file mode 100644
index 0000000..eb800d8
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-hdpi/about.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-hdpi/clear_all.png b/Acrylic_Paint/bin/res/drawable-hdpi/clear_all.png
new file mode 100644
index 0000000..3e69fc0
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-hdpi/clear_all.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-hdpi/color.png b/Acrylic_Paint/bin/res/drawable-hdpi/color.png
new file mode 100644
index 0000000..42c2c2e
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-hdpi/color.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-hdpi/erase.png b/Acrylic_Paint/bin/res/drawable-hdpi/erase.png
new file mode 100644
index 0000000..88edf4e
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-hdpi/erase.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-hdpi/ic_launcher.png b/Acrylic_Paint/bin/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..bcfa058
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-hdpi/ic_launcher.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-hdpi/icon.png b/Acrylic_Paint/bin/res/drawable-hdpi/icon.png
new file mode 100644
index 0000000..b3a56f6
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-hdpi/icon.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-hdpi/save.png b/Acrylic_Paint/bin/res/drawable-hdpi/save.png
new file mode 100644
index 0000000..fe12004
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-hdpi/save.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-hdpi/share.png b/Acrylic_Paint/bin/res/drawable-hdpi/share.png
new file mode 100644
index 0000000..6c6112f
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-hdpi/share.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-hdpi/splash.png b/Acrylic_Paint/bin/res/drawable-hdpi/splash.png
new file mode 100644
index 0000000..28ed70a
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-hdpi/splash.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-ldpi/ic_launcher.png b/Acrylic_Paint/bin/res/drawable-ldpi/ic_launcher.png
new file mode 100644
index 0000000..dd7c05b
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-ldpi/ic_launcher.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-mdpi/ic_launcher.png b/Acrylic_Paint/bin/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..85848ff
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-mdpi/ic_launcher.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-xhdpi/ic_launcher.png b/Acrylic_Paint/bin/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..916901e
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/Acrylic_Paint/bin/res/drawable-xhdpi/splash_xhdpi.png b/Acrylic_Paint/bin/res/drawable-xhdpi/splash_xhdpi.png
new file mode 100644
index 0000000..2e4af85
Binary files /dev/null and b/Acrylic_Paint/bin/res/drawable-xhdpi/splash_xhdpi.png differ
diff --git a/Acrylic_Paint/bin/resources.ap_ b/Acrylic_Paint/bin/resources.ap_
new file mode 100644
index 0000000..d8e6de9
Binary files /dev/null and b/Acrylic_Paint/bin/resources.ap_ differ
diff --git a/Acrylic_Paint/gen/anupam/acrylic/BuildConfig.java b/Acrylic_Paint/gen/anupam/acrylic/BuildConfig.java
new file mode 100644
index 0000000..2895ba8
--- /dev/null
+++ b/Acrylic_Paint/gen/anupam/acrylic/BuildConfig.java
@@ -0,0 +1,6 @@
+/** Automatically generated file. DO NOT MODIFY */
+package anupam.acrylic;
+
+public final class BuildConfig {
+ public final static boolean DEBUG = true;
+}
\ No newline at end of file
diff --git a/Acrylic_Paint/gen/anupam/acrylic/R.java b/Acrylic_Paint/gen/anupam/acrylic/R.java
new file mode 100644
index 0000000..e730e85
--- /dev/null
+++ b/Acrylic_Paint/gen/anupam/acrylic/R.java
@@ -0,0 +1,36 @@
+/* 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 anupam.acrylic;
+
+public final class R {
+ public static final class attr {
+ }
+ public static final class drawable {
+ public static final int about=0x7f020000;
+ public static final int clear_all=0x7f020001;
+ public static final int color=0x7f020002;
+ public static final int erase=0x7f020003;
+ public static final int ic_launcher=0x7f020004;
+ public static final int icon=0x7f020005;
+ public static final int save=0x7f020006;
+ public static final int share=0x7f020007;
+ public static final int splash=0x7f020008;
+ public static final int splash_xhdpi=0x7f020009;
+ }
+ 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;
+ public static final int no_way_to_share=0x7f040005;
+ public static final int share_text_template=0x7f040003;
+ public static final int share_title_template=0x7f040002;
+ public static final int toolbox_share_title=0x7f040004;
+ }
+}
diff --git a/Acrylic_Paint/proguard-project.txt b/Acrylic_Paint/proguard-project.txt
new file mode 100644
index 0000000..f2fe155
--- /dev/null
+++ b/Acrylic_Paint/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/Acrylic_Paint/project.properties b/Acrylic_Paint/project.properties
new file mode 100644
index 0000000..85aac54
--- /dev/null
+++ b/Acrylic_Paint/project.properties
@@ -0,0 +1,14 @@
+# 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 edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-8
diff --git a/Acrylic_Paint/res/drawable-hdpi/about.png b/Acrylic_Paint/res/drawable-hdpi/about.png
new file mode 100644
index 0000000..d7cb2c2
Binary files /dev/null and b/Acrylic_Paint/res/drawable-hdpi/about.png differ
diff --git a/Acrylic_Paint/res/drawable-hdpi/clear_all.png b/Acrylic_Paint/res/drawable-hdpi/clear_all.png
new file mode 100644
index 0000000..cfcc1e7
Binary files /dev/null and b/Acrylic_Paint/res/drawable-hdpi/clear_all.png differ
diff --git a/Acrylic_Paint/res/drawable-hdpi/color.png b/Acrylic_Paint/res/drawable-hdpi/color.png
new file mode 100644
index 0000000..99d7b93
Binary files /dev/null and b/Acrylic_Paint/res/drawable-hdpi/color.png differ
diff --git a/Acrylic_Paint/res/drawable-hdpi/erase.png b/Acrylic_Paint/res/drawable-hdpi/erase.png
new file mode 100644
index 0000000..326f3aa
Binary files /dev/null and b/Acrylic_Paint/res/drawable-hdpi/erase.png differ
diff --git a/Acrylic_Paint/res/drawable-hdpi/ic_launcher.png b/Acrylic_Paint/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..96a442e
Binary files /dev/null and b/Acrylic_Paint/res/drawable-hdpi/ic_launcher.png differ
diff --git a/Acrylic_Paint/res/drawable-hdpi/icon.png b/Acrylic_Paint/res/drawable-hdpi/icon.png
new file mode 100644
index 0000000..6b7e59f
Binary files /dev/null and b/Acrylic_Paint/res/drawable-hdpi/icon.png differ
diff --git a/Acrylic_Paint/res/drawable-hdpi/save.png b/Acrylic_Paint/res/drawable-hdpi/save.png
new file mode 100644
index 0000000..b55e2e1
Binary files /dev/null and b/Acrylic_Paint/res/drawable-hdpi/save.png differ
diff --git a/Acrylic_Paint/res/drawable-hdpi/share.png b/Acrylic_Paint/res/drawable-hdpi/share.png
new file mode 100644
index 0000000..30fb850
Binary files /dev/null and b/Acrylic_Paint/res/drawable-hdpi/share.png differ
diff --git a/Acrylic_Paint/res/drawable-hdpi/splash.png b/Acrylic_Paint/res/drawable-hdpi/splash.png
new file mode 100644
index 0000000..f8c1257
Binary files /dev/null and b/Acrylic_Paint/res/drawable-hdpi/splash.png differ
diff --git a/Acrylic_Paint/res/drawable-ldpi/ic_launcher.png b/Acrylic_Paint/res/drawable-ldpi/ic_launcher.png
new file mode 100644
index 0000000..9923872
Binary files /dev/null and b/Acrylic_Paint/res/drawable-ldpi/ic_launcher.png differ
diff --git a/Acrylic_Paint/res/drawable-mdpi/ic_launcher.png b/Acrylic_Paint/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..359047d
Binary files /dev/null and b/Acrylic_Paint/res/drawable-mdpi/ic_launcher.png differ
diff --git a/Acrylic_Paint/res/drawable-xhdpi/ic_launcher.png b/Acrylic_Paint/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..71c6d76
Binary files /dev/null and b/Acrylic_Paint/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/Acrylic_Paint/res/drawable-xhdpi/splash_xhdpi.png b/Acrylic_Paint/res/drawable-xhdpi/splash_xhdpi.png
new file mode 100644
index 0000000..b9a13f9
Binary files /dev/null and b/Acrylic_Paint/res/drawable-xhdpi/splash_xhdpi.png differ
diff --git a/Acrylic_Paint/res/layout-large/main.xml b/Acrylic_Paint/res/layout-large/main.xml
new file mode 100644
index 0000000..a5c4862
--- /dev/null
+++ b/Acrylic_Paint/res/layout-large/main.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/Acrylic_Paint/res/layout/main.xml b/Acrylic_Paint/res/layout/main.xml
new file mode 100644
index 0000000..295fe9d
--- /dev/null
+++ b/Acrylic_Paint/res/layout/main.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/Acrylic_Paint/res/values/strings.xml b/Acrylic_Paint/res/values/strings.xml
new file mode 100644
index 0000000..b6bea16
--- /dev/null
+++ b/Acrylic_Paint/res/values/strings.xml
@@ -0,0 +1,11 @@
+
+
+
+ Hello World, EasyPaint!
+ Acrylic Paint
+ See what dearest painted
+
+ Share
+ Can locate an app to share with...
+
+
\ No newline at end of file
diff --git a/Acrylic_Paint/src/anupam/acrylic/ColorPickerDialog.java b/Acrylic_Paint/src/anupam/acrylic/ColorPickerDialog.java
new file mode 100644
index 0000000..4ea91d9
--- /dev/null
+++ b/Acrylic_Paint/src/anupam/acrylic/ColorPickerDialog.java
@@ -0,0 +1,246 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package anupam.acrylic;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ColorMatrix;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.graphics.Shader;
+import android.graphics.SweepGradient;
+import android.os.Bundle;
+import android.view.MotionEvent;
+import android.view.View;
+
+public class ColorPickerDialog extends Dialog {
+
+ public interface OnColorChangedListener {
+ void colorChanged(int color);
+ }
+
+ private OnColorChangedListener mListener;
+ private int mInitialColor;
+
+
+ private static class ColorPickerView extends View {
+ private Paint mPaint;
+ private Paint mCenterPaint;
+ private final int[] mColors;
+ private OnColorChangedListener mListener;
+
+
+
+ ColorPickerView(Context c, OnColorChangedListener l, int color) {
+ super(c);
+ mListener = l;
+ mColors = new int[] {
+ 0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0xFF00FF00,
+ 0xFFFFFF00, 0xFFFF0000
+ };
+ Shader s = new SweepGradient(0, 0, mColors, null);
+
+ mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mPaint.setShader(s);
+ mPaint.setStyle(Paint.Style.STROKE);
+ mPaint.setStrokeWidth(32);
+
+ mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mCenterPaint.setColor(color);
+ mCenterPaint.setStrokeWidth(5);
+ }
+
+ private boolean mTrackingCenter;
+ private boolean mHighlightCenter;
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+
+
+
+ float r = CENTER_X - mPaint.getStrokeWidth()*0.5f;
+
+ canvas.translate(CENTER_X, CENTER_X);
+
+ canvas.drawOval(new RectF(-r, -r, r, r), mPaint);
+ canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint);
+
+ if (mTrackingCenter) {
+ int c = mCenterPaint.getColor();
+ mCenterPaint.setStyle(Paint.Style.STROKE);
+
+ if (mHighlightCenter) {
+ mCenterPaint.setAlpha(0xFF);
+ } else {
+ mCenterPaint.setAlpha(0x80);
+ }
+ canvas.drawCircle(0, 0,
+ CENTER_RADIUS + mCenterPaint.getStrokeWidth(),
+ mCenterPaint);
+
+ mCenterPaint.setStyle(Paint.Style.FILL);
+ mCenterPaint.setColor(c);
+ }
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ setMeasuredDimension(CENTER_X*2, CENTER_Y*2);
+ }
+
+ private static final int CENTER_X = 150;
+ private static final int CENTER_Y = 150;
+ private static final int CENTER_RADIUS = 60;
+
+ private int floatToByte(float x) {
+ int n = java.lang.Math.round(x);
+ return n;
+ }
+ private int pinToByte(int n) {
+ if (n < 0) {
+ n = 0;
+ } else if (n > 255) {
+ n = 255;
+ }
+ return n;
+ }
+
+ private int ave(int s, int d, float p) {
+ return s + java.lang.Math.round(p * (d - s));
+ }
+
+ private int interpColor(int colors[], float unit) {
+ if (unit <= 0) {
+ return colors[0];
+ }
+ if (unit >= 1) {
+ return colors[colors.length - 1];
+ }
+
+ float p = unit * (colors.length - 1);
+ int i = (int)p;
+ p -= i;
+
+ // now p is just the fractional part [0...1) and i is the index
+ int c0 = colors[i];
+ int c1 = colors[i+1];
+ int a = ave(Color.alpha(c0), Color.alpha(c1), p);
+ int r = ave(Color.red(c0), Color.red(c1), p);
+ int g = ave(Color.green(c0), Color.green(c1), p);
+ int b = ave(Color.blue(c0), Color.blue(c1), p);
+
+ return Color.argb(a, r, g, b);
+ }
+
+ @SuppressWarnings("unused")
+ private int rotateColor(int color, float rad) {
+ float deg = rad * 180 / 3.1415927f;
+ int r = Color.red(color);
+ int g = Color.green(color);
+ int b = Color.blue(color);
+
+ ColorMatrix cm = new ColorMatrix();
+ ColorMatrix tmp = new ColorMatrix();
+
+ cm.setRGB2YUV();
+ tmp.setRotate(0, deg);
+ cm.postConcat(tmp);
+ tmp.setYUV2RGB();
+ cm.postConcat(tmp);
+
+ final float[] a = cm.getArray();
+
+ int ir = floatToByte(a[0] * r + a[1] * g + a[2] * b);
+ int ig = floatToByte(a[5] * r + a[6] * g + a[7] * b);
+ int ib = floatToByte(a[10] * r + a[11] * g + a[12] * b);
+
+ return Color.argb(Color.alpha(color), pinToByte(ir),
+ pinToByte(ig), pinToByte(ib));
+ }
+
+ private static final float PI = 3.1415926f;
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ float x = event.getX() - CENTER_X;
+ float y = event.getY() - CENTER_Y;
+ boolean inCenter = java.lang.Math.sqrt(x*x + y*y) <= CENTER_RADIUS;
+
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ mTrackingCenter = inCenter;
+ if (inCenter) {
+ mHighlightCenter = true;
+ invalidate();
+ break;
+ }
+ case MotionEvent.ACTION_MOVE:
+ if (mTrackingCenter) {
+ if (mHighlightCenter != inCenter) {
+ mHighlightCenter = inCenter;
+ invalidate();
+ }
+ } else {
+ float angle = (float)java.lang.Math.atan2(y, x);
+ // need to turn angle [-PI ... PI] into unit [0....1]
+ float unit = angle/(2*PI);
+ if (unit < 0) {
+ unit += 1;
+ }
+ mCenterPaint.setColor(interpColor(mColors, unit));
+ invalidate();
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mTrackingCenter) {
+ if (inCenter) {
+ mListener.colorChanged(mCenterPaint.getColor());
+ }
+ mTrackingCenter = false; // so we draw w/o halo
+ invalidate();
+ }
+ break;
+ }
+ return true;
+ }
+ }
+
+ public ColorPickerDialog(Context context,
+ OnColorChangedListener listener,
+ int initialColor) {
+ super(context);
+
+ mListener = listener;
+ mInitialColor = initialColor;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ OnColorChangedListener l = new OnColorChangedListener() {
+ public void colorChanged(int color) {
+ mListener.colorChanged(color);
+ dismiss();
+ }
+ };
+
+ setContentView(new ColorPickerView(getContext(), l, mInitialColor));
+ setTitle("Pick a Color");
+ }
+}
diff --git a/Acrylic_Paint/src/anupam/acrylic/EasyPaint.java b/Acrylic_Paint/src/anupam/acrylic/EasyPaint.java
new file mode 100644
index 0000000..383f6b8
--- /dev/null
+++ b/Acrylic_Paint/src/anupam/acrylic/EasyPaint.java
@@ -0,0 +1,401 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package anupam.acrylic;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Calendar;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.ActivityInfo;
+import android.graphics.Bitmap;
+import android.graphics.Bitmap.CompressFormat;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Path;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+import anupam.acrylic.R;
+
+public class EasyPaint extends GraphicsActivity implements
+ ColorPickerDialog.OnColorChangedListener {
+
+ RelativeLayout rl;
+ TextView txt;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ setContentView(new MyView(this));
+
+ mPaint = new Paint();
+ mPaint.setAntiAlias(true);
+ mPaint.setDither(true);
+ mPaint.setColor(0xFFF00000);
+ mPaint.setStyle(Paint.Style.STROKE);
+ mPaint.setStrokeJoin(Paint.Join.ROUND);
+ mPaint.setStrokeCap(Paint.Cap.ROUND);
+ mPaint.setStrokeWidth(5);
+
+ if (isFirstTime()) {
+
+ AlertDialog.Builder alert = new AlertDialog.Builder(this);
+
+ alert.setTitle("Acrylic Paint - Info");
+
+ String msg1 = "Acrylic Paint is a coloring tool which helps you to make anything of your imagination. "
+ + "Pick your colors and start painting.";
+ String msg2 = "";
+ String msg3 = "";
+ String msg4 = "Press menu for more options !!";
+ String msg5 = "Happy Coloring !!!";
+
+ alert.setMessage(msg1 + "\n" + msg2 + "\n" + msg3 + "\n" + msg4
+ + "\n" + msg5);
+
+ alert.setNegativeButton("Continue",
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int whichButton) {
+
+ Toast.makeText(getApplicationContext(),
+ "Here is your canvas. Start coloring !!",
+ Toast.LENGTH_LONG).show();
+
+ }
+ });
+
+ alert.show();
+ }
+ if (isSecondTime()) {
+ Toast.makeText(getApplicationContext(),
+ "Here is your canvas. Start coloring !!", Toast.LENGTH_LONG)
+ .show();
+ }
+
+ }
+
+ private Paint mPaint;
+ private int bgColor = 0xFFFFFFFF;
+
+ public void colorChanged(int color) {
+ mPaint.setColor(color);
+ }
+
+ public class MyView extends View {
+
+ private Bitmap mBitmap;
+ private Canvas mCanvas;
+ private Path mPath;
+ private Paint mBitmapPaint;
+
+ public MyView(Context c) {
+ super(c);
+
+ mBitmap = Bitmap.createBitmap(1024, 1024, Bitmap.Config.ARGB_8888);
+ mCanvas = new Canvas(mBitmap);
+ mPath = new Path();
+ mBitmapPaint = new Paint(Paint.DITHER_FLAG);
+ }
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ super.onSizeChanged(w, h, oldw, oldh);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ canvas.drawColor(0xFFFFFFFF);
+
+ canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
+
+ canvas.drawPath(mPath, mPaint);
+ }
+
+ private float mX, mY;
+ private static final float TOUCH_TOLERANCE = 4;
+
+ private void touch_start(float x, float y) {
+ mPath.reset();
+ mPath.moveTo(x, y);
+ mX = x;
+ mY = y;
+ }
+
+ private void touch_move(float x, float y) {
+ float dx = Math.abs(x - mX);
+ float dy = Math.abs(y - mY);
+ if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
+ mPath.quadTo(mX, mY, (x + mX) / 2, (y + mY) / 2);
+ mX = x;
+ mY = y;
+ }
+ }
+
+ private void touch_up() {
+ mPath.lineTo(mX, mY);
+ // commit the path to our offscreen
+ mCanvas.drawPath(mPath, mPaint);
+ // kill this so we don't double draw
+ mPath.reset();
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ float x = event.getX();
+ float y = event.getY();
+
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ touch_start(x, y);
+ invalidate();
+ break;
+ case MotionEvent.ACTION_MOVE:
+ touch_move(x, y);
+ invalidate();
+ break;
+ case MotionEvent.ACTION_UP:
+ touch_up();
+ invalidate();
+ break;
+ }
+ return true;
+ }
+ }
+
+ private static final int COLOR_MENU_ID = Menu.FIRST;
+ private static final int ERASE_MENU_ID = Menu.FIRST + 1;
+ private static final int CLEAR_ALL = Menu.FIRST + 2;
+ private static final int SAVE = Menu.FIRST + 3;
+ private static final int SHARE = Menu.FIRST + 4;
+ private static final int ABOUT = Menu.FIRST + 5;
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+
+ menu.add(0, COLOR_MENU_ID, 0, "Color").setIcon(R.drawable.color);
+ menu.add(0, ERASE_MENU_ID, 0, "Erase").setIcon(R.drawable.erase);
+ menu.add(0, CLEAR_ALL, 0, "Clear All").setIcon(R.drawable.clear_all);
+ menu.add(0, SAVE, 0, "Save").setIcon(R.drawable.save);
+ menu.add(0, SHARE, 0, "Share").setIcon(R.drawable.share);
+ menu.add(0, ABOUT, 0, "About").setIcon(R.drawable.about);
+
+ /****
+ * Is this the mechanism to extend with filter effects? Intent intent =
+ * new Intent(null, getIntent().getData());
+ * intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
+ * menu.addIntentOptions( Menu.ALTERNATIVE, 0, new ComponentName(this,
+ * NotesList.class), null, intent, 0, null);
+ *****/
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ super.onPrepareOptionsMenu(menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ mPaint.setXfermode(null);
+ mPaint.setAlpha(0xFF);
+
+ switch (item.getItemId()) {
+ case COLOR_MENU_ID:
+ new ColorPickerDialog(this, this, mPaint.getColor()).show();
+ return true;
+ case ERASE_MENU_ID:
+ mPaint.setColor(bgColor);
+ return true;
+ case CLEAR_ALL:
+ Intent intent = getIntent();
+ overridePendingTransition(0, 0);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
+ finish();
+ overridePendingTransition(0, 0);
+ startActivity(intent);
+ return true;
+ case SAVE:
+ takeScreenshot(true);
+ break;
+ case SHARE:
+ File screenshotPath = takeScreenshot(false);
+ Intent i = new Intent();
+ i.setAction(Intent.ACTION_SEND);
+ i.setType("image/png");
+ i.putExtra(Intent.EXTRA_SUBJECT,
+ getString(anupam.acrylic.R.string.share_title_template));
+ i.putExtra(Intent.EXTRA_TEXT,
+ getString(anupam.acrylic.R.string.share_text_template));
+ i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(screenshotPath));
+ try {
+ startActivity(Intent.createChooser(i,
+ getString(anupam.acrylic.R.string.toolbox_share_title)));
+ } catch (android.content.ActivityNotFoundException ex) {
+ Toast.makeText(this.getApplicationContext(),
+ anupam.acrylic.R.string.no_way_to_share,
+ Toast.LENGTH_LONG).show();
+ }
+ break;
+ case ABOUT:
+ try {
+ AlertDialog.Builder alert = new AlertDialog.Builder(this);
+
+ alert.setTitle("Acrylic Paint - Info");
+
+ String msg1 = "- Acrylic Paint is a coloring tool for kids. Pick your colors and start painting.";
+ String msg2 = "- You can save your creation or directly share it from your device.";
+
+ alert.setMessage(msg1 + "\n" + msg2);
+
+ alert.setPositiveButton("Rate It.",
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int whichButton) {
+
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setData(Uri
+ .parse("market://details?id=anupam.acrylic"));
+ startActivity(intent);
+
+ }
+ });
+
+ alert.setNegativeButton("No, Thanks.",
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int whichButton) {
+ }
+ });
+
+ alert.show();
+ } catch (Exception e) {
+ // TODO: handle exception
+ }
+
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ private File takeScreenshot(boolean showToast) {
+ View v = getWindow().getDecorView();
+
+ v.setDrawingCacheEnabled(true);
+ Bitmap cachedBitmap = v.getDrawingCache();
+ Bitmap copyBitmap = cachedBitmap.copy(Bitmap.Config.RGB_565, true);
+ FileOutputStream output = null;
+ File file = null;
+ try {
+ File path = Places.getScreenshotFolder();
+ Calendar cal = Calendar.getInstance();
+
+ file = new File(path,
+
+ cal.get(Calendar.YEAR) + "_" + (1 + cal.get(Calendar.MONTH)) + "_"
+ + cal.get(Calendar.DAY_OF_MONTH) + "_"
+ + cal.get(Calendar.HOUR_OF_DAY) + "_"
+ + cal.get(Calendar.MINUTE) + "_" + cal.get(Calendar.SECOND)
+ + ".png");
+ output = new FileOutputStream(file);
+ copyBitmap.compress(CompressFormat.PNG, 100, output);
+ } catch (FileNotFoundException e) {
+ file = null;
+ e.printStackTrace();
+ } finally {
+ if (output != null) {
+ try {
+ output.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ if (file != null) {
+ if (showToast)
+ Toast.makeText(getApplicationContext(),
+ "Saved your creation to " + file.getAbsolutePath(),
+ Toast.LENGTH_LONG).show();
+ // sending a broadcast to the media scanner so it will scan the new
+ // screenshot.
+ Intent requestScan = new Intent(
+ Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
+ requestScan.setData(Uri.fromFile(file));
+ sendBroadcast(requestScan);
+
+ return file;
+ } else {
+ return null;
+ }
+ }
+
+ private boolean isFirstTime() {
+ SharedPreferences preferences = getPreferences(MODE_PRIVATE);
+ boolean ranBefore = preferences.getBoolean("RanBefore", false);
+ if (!ranBefore) {
+ // first time
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putBoolean("RanBefore", true);
+ editor.commit();
+ }
+ return !ranBefore;
+ }
+
+ private boolean isSecondTime() {
+ SharedPreferences preferences = getPreferences(MODE_PRIVATE);
+ boolean ranBefore = preferences.getBoolean("SecondRun", true);
+ if (ranBefore) {
+ // seond time
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putBoolean("SecondRun", false);
+ editor.commit();
+ }
+ return !ranBefore;
+ }
+
+ public boolean connectionAvailable() {
+ boolean connected = false;
+ @SuppressWarnings("static-access")
+ ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(getApplicationContext().CONNECTIVITY_SERVICE);
+ if (connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE)
+ .getState() == NetworkInfo.State.CONNECTED
+ || connectivityManager.getNetworkInfo(
+ ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) {
+ connected = true;
+ }
+ return connected;
+ }
+}
diff --git a/Acrylic_Paint/src/anupam/acrylic/GraphicsActivity.java b/Acrylic_Paint/src/anupam/acrylic/GraphicsActivity.java
new file mode 100644
index 0000000..0279ecb
--- /dev/null
+++ b/Acrylic_Paint/src/anupam/acrylic/GraphicsActivity.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package anupam.acrylic;
+
+import android.app.Activity;
+import android.content.pm.ActivityInfo;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+
+class GraphicsActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ this.setRequestedOrientation(
+ ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public void setContentView(View view) {
+ if (false) { // set to true to test Picture
+ ViewGroup vg = new PictureLayout(this);
+ vg.addView(view);
+ view = vg;
+ }
+
+ super.setContentView(view);
+ }
+}
+
diff --git a/Acrylic_Paint/src/anupam/acrylic/PictureLayout.java b/Acrylic_Paint/src/anupam/acrylic/PictureLayout.java
new file mode 100644
index 0000000..16a7cd1
--- /dev/null
+++ b/Acrylic_Paint/src/anupam/acrylic/PictureLayout.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package anupam.acrylic;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Picture;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewParent;
+
+
+public class PictureLayout extends ViewGroup {
+ private final Picture mPicture = new Picture();
+
+ public PictureLayout(Context context) {
+ super(context);
+ }
+
+ public PictureLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public void addView(View child) {
+ if (getChildCount() > 1) {
+ throw new IllegalStateException("PictureLayout can host only one direct child");
+ }
+
+ super.addView(child);
+ }
+
+ @Override
+ public void addView(View child, int index) {
+ if (getChildCount() > 1) {
+ throw new IllegalStateException("PictureLayout can host only one direct child");
+ }
+
+ super.addView(child, index);
+ }
+
+ @Override
+ public void addView(View child, LayoutParams params) {
+ if (getChildCount() > 1) {
+ throw new IllegalStateException("PictureLayout can host only one direct child");
+ }
+
+ super.addView(child, params);
+ }
+
+ @Override
+ public void addView(View child, int index, LayoutParams params) {
+ if (getChildCount() > 1) {
+ throw new IllegalStateException("PictureLayout can host only one direct child");
+ }
+
+ super.addView(child, index, params);
+ }
+
+ @Override
+ protected LayoutParams generateDefaultLayoutParams() {
+ return new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ final int count = getChildCount();
+
+ int maxHeight = 0;
+ int maxWidth = 0;
+
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.getVisibility() != GONE) {
+ measureChild(child, widthMeasureSpec, heightMeasureSpec);
+ }
+ }
+
+ maxWidth += getPaddingLeft() + getPaddingRight();
+ maxHeight += getPaddingTop() + getPaddingBottom();
+
+ Drawable drawable = getBackground();
+ if (drawable != null) {
+ maxHeight = Math.max(maxHeight, drawable.getMinimumHeight());
+ maxWidth = Math.max(maxWidth, drawable.getMinimumWidth());
+ }
+
+ setMeasuredDimension(resolveSize(maxWidth, widthMeasureSpec),
+ resolveSize(maxHeight, heightMeasureSpec));
+ }
+
+ private void drawPict(Canvas canvas, int x, int y, int w, int h,
+ float sx, float sy) {
+ canvas.save();
+ canvas.translate(x, y);
+ canvas.clipRect(0, 0, w, h);
+ canvas.scale(0.5f, 0.5f);
+ canvas.scale(sx, sy, w, h);
+ canvas.drawPicture(mPicture);
+ canvas.restore();
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ protected void dispatchDraw(Canvas canvas) {
+ super.dispatchDraw(mPicture.beginRecording(getWidth(), getHeight()));
+ mPicture.endRecording();
+
+ int x = getWidth()/2;
+ int y = getHeight()/2;
+
+ if (false) {
+ canvas.drawPicture(mPicture);
+ } else {
+ drawPict(canvas, 0, 0, x, y, 1, 1);
+ drawPict(canvas, x, 0, x, y, -1, 1);
+ drawPict(canvas, 0, y, x, y, 1, -1);
+ drawPict(canvas, x, y, x, y, -1, -1);
+ }
+ }
+
+ @Override
+ public ViewParent invalidateChildInParent(int[] location, Rect dirty) {
+ location[0] = getLeft();
+ location[1] = getTop();
+ dirty.set(0, 0, getWidth(), getHeight());
+ return getParent();
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ final int count = super.getChildCount();
+
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.getVisibility() != GONE) {
+ final int childLeft = getPaddingLeft();
+ final int childTop = getPaddingTop();
+ child.layout(childLeft, childTop,
+ childLeft + child.getMeasuredWidth(),
+ childTop + child.getMeasuredHeight());
+
+ }
+ }
+ }
+}
diff --git a/Acrylic_Paint/src/anupam/acrylic/Places.java b/Acrylic_Paint/src/anupam/acrylic/Places.java
new file mode 100644
index 0000000..ab9f34f
--- /dev/null
+++ b/Acrylic_Paint/src/anupam/acrylic/Places.java
@@ -0,0 +1,36 @@
+package anupam.acrylic;
+
+import java.io.File;
+import java.io.IOException;
+
+import android.os.Environment;
+
+public class Places {
+ public static File getScreenshotFolder() {
+ File path = new File(Environment.getExternalStorageDirectory(),
+ "/Acrylic Paint/");
+ path.mkdirs();
+
+ return path;
+ }
+
+ public static File getCameraTempFolder() {
+ File path = new File(Environment.getExternalStorageDirectory(),
+ "/Acrylic Paint/Temp/");
+ path.mkdirs();
+ // this folder should not be scanned
+ File noScanning = new File(path, ".nomedia");
+ if (!noScanning.exists())
+ try {
+ noScanning.createNewFile();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return path;
+ }
+
+ public static File getCameraTempFile() {
+ return new File(getCameraTempFolder(), "temp.jpg");
+ }
+}
diff --git a/Acrylic_Paint/src/anupam/acrylic/Splash.java b/Acrylic_Paint/src/anupam/acrylic/Splash.java
new file mode 100644
index 0000000..9eeaba4
--- /dev/null
+++ b/Acrylic_Paint/src/anupam/acrylic/Splash.java
@@ -0,0 +1,41 @@
+package anupam.acrylic;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.os.Bundle;
+import anupam.acrylic.R;
+
+public class Splash extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ // TODO Auto-generated method stub
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+ this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+
+ Thread t = new Thread() {
+
+ public void run() {
+ try {
+
+ Thread.sleep(3000);
+
+ Intent i = new Intent();
+ i.setClassName("anupam.acrylic",
+ "anupam.acrylic.EasyPaint");
+ startActivity(i);
+ finish();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ };
+ t.start();
+ }
+
+}