├── .classpath
├── .project
├── AndroidManifest.xml
├── README.md
├── assets
├── blackberry
│ └── apk2bar.prefs
└── oauth_consumer.properties
├── ic_launcher-web.png
├── libs
├── android-support-v4.jar
├── revmob-6.9.8.jar
├── signpost-commonshttp4-1.2.1.1.jar
├── signpost-core-1.2.1.1.jar
├── twitter4j-core-4.0.2.jar
└── twitter4j-media-support-4.0.2.jar
├── lint.xml
├── proguard-project.txt
├── project.properties
├── res
├── drawable
│ └── ic_launcher.png
├── layout
│ ├── activity_main.xml
│ └── test_item_1.xml
└── values
│ ├── dimens.xml
│ └── strings.xml
└── src
└── com
└── amitsid
└── dynamicaddimageview
├── ImageEntity.java
├── Items.java
├── MainActivity.java
├── MultiTouchController.java
├── MultiTouchEntity.java
├── MyAbsoluteLayout.java
├── PhotoSortrView.java
└── Utils.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
11 | * public class MyMTView extends View implements
12 | * MultiTouchObjectCanvas {
13 | *
14 | * private MultiTouchController
15 | * multiTouchController = new MultiTouchController(this);
16 | *
17 | * // Pass touch events to the MT controller
18 | * public boolean onTouchEvent(MotionEvent event) {
19 | * return multiTouchController.onTouchEvent(event);
20 | * }
21 | *
22 | * // ... then implement the MultiTouchObjectCanvas interface here,
23 | * // see details in the comments of that interface.
24 | * }
25 | *
26 | *
27 | * Changelog:
28 | * 2010-06-09 v1.5.1 Some API changes to make it possible to
29 | * selectively update or not update scale / rotation.
30 | * Fixed anisotropic zoom. Cleaned up rotation code.
31 | * Added more comments. Better var names. (LH)
32 | * 2010-06-09 v1.4 Added ability to track pinch rotation (Mickael
33 | * Despesse, author of "Face Frenzy") and anisotropic pinch-zoom (LH)
34 | * 2010-06-09 v1.3.3 Bugfixes for Android-2.1; added optional debug info (LH)
35 | * 2010-06-09 v1.3 Ported to Android-2.2 (handle ACTION_POINTER_* actions);
36 | * fixed several bugs; refactoring; documentation (LH)
37 | * 2010-05-17 v1.2.1 Dual-licensed under Apache and GPL licenses
38 | * 2010-02-18 v1.2 Support for compilation under Android 1.5/1.6 using
39 | * introspection (mmin, author of handyCalc)
40 | * 2010-01-08 v1.1.1 Bugfixes to Cyanogen's patch that only showed up in more
41 | * complex uses of controller (LH)
42 | * 2010-01-06 v1.1 Modified for official level 5 MT API (Cyanogen)
43 | * 2009-01-25 v1.0 Original MT controller, released for hacked G1 kernel (LH)
44 | *
45 | * Planned features:
46 | * - Add inertia (flick-pinch-zoom or flick-scroll)
47 | *
48 | * Known usages:
49 | * - Mickael Despesse's "Face Frenzy" face distortion app,
50 | * to be published to the Market soon
51 | * - Yuan Chin's fork of ADW Launcher to support multitouch
52 | * - David Byrne's fractal viewing app Fractoid
53 | * - mmin's handyCalc calculator
54 | * - My own "MultiTouch Visualizer 2" in the Market
55 | * - Formerly: The browser in cyanogenmod (and before that, JesusFreke),
56 | * and other firmwares like dwang5. This usage has been
57 | * replaced with official pinch/zoom in Maps, Browser and Gallery[3D] as of API level 5.
58 | *
59 | * License:
60 | * Dual-licensed under the Apache License v2 and the GPL v2.
61 | */
62 |
63 | import java.lang.reflect.Method;
64 |
65 | import android.util.Log;
66 | import android.view.MotionEvent;
67 |
68 | /**
69 | * A class that simplifies the implementation of multitouch in applications.
70 | * Subclass this and read the fields here as needed in subclasses.
71 | *
72 | * @author Luke Hutchison
73 | */
74 | public class MultiTouchControllerXML attributes
See {@link 37 | * android.R.styleable#ViewGroup ViewGroup Attributes}, {@link 38 | * android.R.styleable#View View Attributes}
39 | * 40 | *Note: This class is a clone of AbsoluteLayout, which is now deprecated. 41 | */ 42 | 43 | @RemoteView 44 | public class MyAbsoluteLayout extends ViewGroup { 45 | public MyAbsoluteLayout(Context context) { 46 | super(context); 47 | } 48 | 49 | public MyAbsoluteLayout(Context context, AttributeSet attrs) { 50 | super(context, attrs); 51 | } 52 | 53 | public MyAbsoluteLayout(Context context, AttributeSet attrs, 54 | int defStyle) { 55 | super(context, attrs, defStyle); 56 | } 57 | 58 | @Override 59 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 60 | int count = getChildCount(); 61 | 62 | int maxHeight = 0; 63 | int maxWidth = 0; 64 | 65 | // Find out how big everyone wants to be 66 | measureChildren(widthMeasureSpec, heightMeasureSpec); 67 | 68 | // Find rightmost and bottom-most child 69 | for (int i = 0; i < count; i++) { 70 | View child = getChildAt(i); 71 | if (child.getVisibility() != GONE) { 72 | int childRight; 73 | int childBottom; 74 | 75 | MyAbsoluteLayout.LayoutParams lp 76 | = (MyAbsoluteLayout.LayoutParams) child.getLayoutParams(); 77 | 78 | childRight = lp.x + child.getMeasuredWidth(); 79 | childBottom = lp.y + child.getMeasuredHeight(); 80 | 81 | maxWidth = Math.max(maxWidth, childRight); 82 | maxHeight = Math.max(maxHeight, childBottom); 83 | } 84 | } 85 | 86 | // Account for padding too 87 | maxWidth += getPaddingLeft () + getPaddingRight (); 88 | maxHeight += getPaddingTop () + getPaddingBottom (); 89 | /* original 90 | maxWidth += mPaddingLeft + mPaddingRight; 91 | maxHeight += mPaddingTop + mPaddingBottom; 92 | */ 93 | 94 | // Check against minimum height and width 95 | maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight()); 96 | maxWidth = Math.max(maxWidth, getSuggestedMinimumWidth()); 97 | 98 | setMeasuredDimension(resolveSize(maxWidth, widthMeasureSpec), 99 | resolveSize(maxHeight, heightMeasureSpec)); 100 | } 101 | 102 | /** 103 | * Returns a set of layout parameters with a width of 104 | * {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT}, 105 | * a height of {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} 106 | * and with the coordinates (0, 0). 107 | */ 108 | @Override 109 | protected ViewGroup.LayoutParams generateDefaultLayoutParams() { 110 | return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0, 0); 111 | } 112 | 113 | @Override 114 | protected void onLayout(boolean changed, int l, int t, 115 | int r, int b) { 116 | int count = getChildCount(); 117 | 118 | int paddingL = getPaddingLeft (); 119 | int paddingT = getPaddingTop (); 120 | for (int i = 0; i < count; i++) { 121 | View child = getChildAt(i); 122 | if (child.getVisibility() != GONE) { 123 | 124 | MyAbsoluteLayout.LayoutParams lp = 125 | (MyAbsoluteLayout.LayoutParams) child.getLayoutParams(); 126 | 127 | int childLeft = paddingL + lp.x; 128 | int childTop = paddingT + lp.y; 129 | /* 130 | int childLeft = mPaddingLeft + lp.x; 131 | int childTop = mPaddingTop + lp.y; 132 | */ 133 | child.layout(childLeft, childTop, 134 | childLeft + child.getMeasuredWidth(), 135 | childTop + child.getMeasuredHeight()); 136 | 137 | } 138 | } 139 | } 140 | 141 | @Override 142 | public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) { 143 | return new MyAbsoluteLayout.LayoutParams(getContext(), attrs); 144 | } 145 | 146 | // Override to allow type-checking of LayoutParams. 147 | @Override 148 | protected boolean checkLayoutParams(ViewGroup.LayoutParams p) { 149 | return p instanceof MyAbsoluteLayout.LayoutParams; 150 | } 151 | 152 | @Override 153 | protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { 154 | return new LayoutParams(p); 155 | } 156 | 157 | /** 158 | * Per-child layout information associated with MyAbsoluteLayout. 159 | * See 160 | * {@link android.R.styleable#MyAbsoluteLayout_Layout Absolute Layout Attributes} 161 | * for a list of all child view attributes that this class supports. 162 | */ 163 | public static class LayoutParams extends ViewGroup.LayoutParams { 164 | /** 165 | * The horizontal, or X, location of the child within the view group. 166 | */ 167 | public int x; 168 | /** 169 | * The vertical, or Y, location of the child within the view group. 170 | */ 171 | public int y; 172 | 173 | /** 174 | * Creates a new set of layout parameters with the specified width, 175 | * height and location. 176 | * 177 | * @param width the width, either {@link #MATCH_PARENT}, 178 | {@link #WRAP_CONTENT} or a fixed size in pixels 179 | * @param height the height, either {@link #MATCH_PARENT}, 180 | {@link #WRAP_CONTENT} or a fixed size in pixels 181 | * @param x the X location of the child 182 | * @param y the Y location of the child 183 | */ 184 | public LayoutParams(int width, int height, int x, int y) { 185 | super(width, height); 186 | this.x = x; 187 | this.y = y; 188 | } 189 | 190 | /** 191 | * Creates a new set of layout parameters. The values are extracted from 192 | * the supplied attributes set and context. The XML attributes mapped 193 | * to this set of layout parameters are: 194 | * 195 | *
layout_x
: the X location of the childlayout_y
: the Y location of the child