diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 89c5195..dc9c91b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,9 +11,8 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - - + diff --git a/app/src/main/java/com/app/trymosaic/customView1/DataModel.java b/app/src/main/java/com/app/trymosaic/DataModel.java similarity index 98% rename from app/src/main/java/com/app/trymosaic/customView1/DataModel.java rename to app/src/main/java/com/app/trymosaic/DataModel.java index 7795c5d..2de8e79 100644 --- a/app/src/main/java/com/app/trymosaic/customView1/DataModel.java +++ b/app/src/main/java/com/app/trymosaic/DataModel.java @@ -1,4 +1,4 @@ -package com.app.trymosaic.customView1; +package com.app.trymosaic; import android.app.Activity; import android.graphics.Bitmap; diff --git a/app/src/main/java/com/app/trymosaic/customView1/MainActivity.java b/app/src/main/java/com/app/trymosaic/MainActivity.java similarity index 95% rename from app/src/main/java/com/app/trymosaic/customView1/MainActivity.java rename to app/src/main/java/com/app/trymosaic/MainActivity.java index 30ecd1f..95ea126 100644 --- a/app/src/main/java/com/app/trymosaic/customView1/MainActivity.java +++ b/app/src/main/java/com/app/trymosaic/MainActivity.java @@ -1,15 +1,11 @@ -package com.app.trymosaic.customView1; +package com.app.trymosaic; import androidx.appcompat.app.AppCompatActivity; import androidx.databinding.DataBindingUtil; -import android.graphics.Color; import android.os.Bundle; -import android.view.MotionEvent; import android.widget.Toast; -import com.app.trymosaic.R; -import com.app.trymosaic.customView1.Draw; import com.app.trymosaic.databinding.ActivityMainBinding; import com.matrixdev.mosaic.ItemChooseInterface; @@ -19,9 +15,6 @@ public class MainActivity extends AppCompatActivity { ActivityMainBinding binding; - private Draw draw; - private float mx, my; - private float curX, curY; private ArrayList models; private Runnable onImageLoad; @@ -30,8 +23,6 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding= DataBindingUtil.setContentView(this, R.layout.activity_main); - - initUI(); } diff --git a/app/src/main/java/com/app/trymosaic/customView1/Draw.java b/app/src/main/java/com/app/trymosaic/customView1/Draw.java deleted file mode 100644 index 1307812..0000000 --- a/app/src/main/java/com/app/trymosaic/customView1/Draw.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.app.trymosaic.customView1; - - -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.view.View; - - -public class Draw extends View { - Paint paint = new Paint(); - - public Draw(Context context) { - super(context); - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - // Compute the height required to render the view - // Assume Width will always be MATCH_PARENT. - int width = MeasureSpec.getSize(widthMeasureSpec); - int height = 3000 + 50; // Since 3000 is bottom of last Rect to be drawn added and 50 for padding. - setMeasuredDimension(width, height); - } - - @Override - public void onDraw(Canvas canvas) { - - paint.setColor(Color.GREEN); - canvas.drawRect(30, 30, 90, 200, paint); - paint.setColor(Color.BLUE); - - canvas.drawLine(100, 20, 100, 1900, paint); - - paint.setColor(Color.GREEN); - canvas.drawRect(200, 2000, 400, 3000, paint); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/app/trymosaic/customView1/Keypaint.java b/app/src/main/java/com/app/trymosaic/customView1/Keypaint.java deleted file mode 100644 index c805564..0000000 --- a/app/src/main/java/com/app/trymosaic/customView1/Keypaint.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.app.trymosaic.customView1; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.view.View; - -import com.app.trymosaic.R; - -public class Keypaint extends View { - Paint p; - - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - p=new Paint(); - Bitmap b= BitmapFactory.decodeResource(getResources(), R.drawable.usability_testing_prototype); - p.setColor(Color.RED); - canvas.drawBitmap(b, 50, 50, p); - } - - public Keypaint(Context context) { - super(context); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/app/trymosaic/customView1/Main2Activity.java b/app/src/main/java/com/app/trymosaic/customView1/Main2Activity.java deleted file mode 100644 index 3f3e990..0000000 --- a/app/src/main/java/com/app/trymosaic/customView1/Main2Activity.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.app.trymosaic.customView1; - -import androidx.appcompat.app.AppCompatActivity; - -import android.os.Bundle; - -import com.app.trymosaic.R; - -public class Main2Activity extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main2); - - } -} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index b9f97b3..d682a87 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -5,7 +5,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".customView1.MainActivity"> + tools:context=".MainActivity"> - - - \ No newline at end of file diff --git a/mosaic/src/main/java/com/matrixdev/mosaic/MosaicView.java b/mosaic/src/main/java/com/matrixdev/mosaic/MosaicView.java index 7aa8398..70200d9 100644 --- a/mosaic/src/main/java/com/matrixdev/mosaic/MosaicView.java +++ b/mosaic/src/main/java/com/matrixdev/mosaic/MosaicView.java @@ -80,23 +80,8 @@ public MosaicView(Context context, AttributeSet attrs) { placeholder = createPlaceholder(dpToPx(100),dpToPx(100),Color.WHITE); TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.MosaicView); -// draw = context.getResources().obtainTypedArray(R.array.random_imgs); -// -// bitmapObjectClasses.clear(); -// for (int i = 0; i < draw.length(); i++) { -// Bitmap bitmap = BitmapFactory.decodeResource(getResources(), draw.getResourceId(i, -1)); -// random = new Random().nextInt(70); -// Log.d("-----RANDOM", "" + random); -// bitmap = addRoundCorners(bitmap, random); -// BitmapObjectClass bitmapObjectClass = new BitmapObjectClass(); -// -// bitmapObjectClass.setBitmap(bitmap); -// bitmapObjectClasses.add(bitmapObjectClass); -// } -// + attributes.recycle(); -// totalCompanies = draw.length(); -// draw.recycle(); } public MosaicView(Context context, Drawable mCustomImage) { @@ -337,63 +322,6 @@ public void onFinish() { } }); - -// touchHandler.setOnTouchListener(new OnTouchListener() { -// @Override -// public boolean onTouch(View view, MotionEvent motionEvent) { -// for (int i = 0; i < bitmapObjectClasses.size(); i++) { -// if (bitmapObjectClasses.get(i).getLeft() <= motionEvent.getX()+hscroll.getScrollX() && -// bitmapObjectClasses.get(i).getRight() >= motionEvent.getX()+hscroll.getScrollX() && -// bitmapObjectClasses.get(i).getTop() <= motionEvent.getY()+vScroll.getScrollY() && -// bitmapObjectClasses.get(i).getBottom() >= motionEvent.getY()+vScroll.getScrollY()) { -// Log.d("Suuceess", "" + motionEvent.getAction()); -// switch (motionEvent.getAction()) { -// case (MotionEvent.ACTION_DOWN): -// hscroll.setBlocked(true); -// vScroll.setBlocked(true); -// touchX = motionEvent.getX()+hscroll.getScrollX(); -// touchY = motionEvent.getY()+vScroll.getScrollY(); -// invalidate(); -// Log.d("------", "Action was DOWN"); -// } -// } -// } -//// switch (motionEvent.getAction()) { -//// case (MotionEvent.ACTION_MOVE): -//// if(touchX!=0) { -//// -//// }else{ -////// motionEvent.setLocation(motionEvent.getX()+hscroll.getScrollX(),motionEvent.getY()+vScroll.getScrollY()); -//// } -//// break; -//// case (MotionEvent.ACTION_UP): -//// touchX = 0; -//// touchY = 0; -//// Log.d("-----ACTION_UP", "dssf"); -//// invalidate(); -//// case MotionEvent.ACTION_CANCEL: -//// touchX = 0; -//// touchY = 0; -//// Log.d("-----ACTION_CAncel", "cancel"); -////// invalidate(); -//// } -//// if(touchX!=0) -// -// Log.d("-----",""+motionEvent); -//// singleTapGesture.onTouchEvent(motionEvent); -//// motionEvent.setLocation(2654,2667); -// if(touchX!=0) { -// motionEvent.setLocation(motionEvent.getX()+hscroll.getScrollX(),motionEvent.getY()+vScroll.getScrollY()); -// return true; -// }else { -//// hscroll.setBlocked(false); -//// vScroll.setBlocked(false); -// return false; -// } -// } -// }); - - } public static Bitmap createPlaceholder(int width, int height, int color) { @@ -598,4 +526,12 @@ public void onResourceReady(Bitmap resource, Transition transiti totalCompanies = objects.size(); invalidate(); } + + public Bitmap getPlaceholder() { + return placeholder; + } + + public void setPlaceholder(Bitmap placeholder) { + this.placeholder = placeholder; + } } \ No newline at end of file