1414
1515import java .io .IOException ;
1616import java .net .URI ;
17+ import java .util .ArrayList ;
1718import java .util .List ;
1819
1920/**
@@ -30,6 +31,7 @@ public class TNImageView {
3031 private float oldDist = 1f ;
3132 private float d = 0f ;
3233 private float newRot = 0f ;
34+ private List <ImageView > imageList = new ArrayList <>();
3335
3436
3537 public ImageView makeRotatableScalable (ImageView imageView ){
@@ -46,6 +48,16 @@ public ImageView makeRotatableScalable(ImageView imageView){
4648 public boolean onTouch (View v , MotionEvent event ) {
4749 final ImageView view = (ImageView ) v ;
4850
51+ if (!imageList .isEmpty ()) {
52+ for (ImageView i : imageList ) {
53+
54+ if (i == view ) {
55+ view .bringToFront ();
56+ view .getRootView ().invalidate ();
57+ }
58+ }
59+ }
60+
4961 ((BitmapDrawable ) view .getDrawable ()).setAntiAlias (true );
5062 switch (event .getAction () & MotionEvent .ACTION_MASK ) {
5163 case MotionEvent .ACTION_DOWN :
@@ -178,6 +190,7 @@ public void addTNImageViewsWithUri(Context context, List<Uri> uriList, RelativeL
178190 layoutParams .bottomMargin = 250 - 500 ;
179191 layoutParams .rightMargin = 250 - 500 ;
180192 image .setLayoutParams (layoutParams );
193+ imageList .add (image );
181194 makeRotatableScalable (image );
182195 relativeLayout .addView (image , layoutParams );
183196 }
@@ -195,6 +208,7 @@ public void addTNImageViewsWithBitmap(Context context, List<Bitmap> bitmapList,
195208 layoutParams .bottomMargin = 250 - 500 ;
196209 layoutParams .rightMargin = 250 - 500 ;
197210 image .setLayoutParams (layoutParams );
211+ imageList .add (image );
198212 makeRotatableScalable (image );
199213 relativeLayout .addView (image , layoutParams );
200214 }
0 commit comments