Closed Gianluca19 closed 4 years ago
Hi Mitch, can you help me?
Hi Mitch, can you help me?
Hey, So it's only distorted when the app first starts? After an initial image is taken, everything is fine?
yes, before taking the picture, what I see is distorted. after the shot I see correctly.
ps
then there are other errors (if I select pen even if I draw with the finger you don't see anything. if I select stikers and then a smile, then it doesn't move if I drag it and resize it ... but I'll talk about this later)
Unfortunately I'm unable to reproduce on the devices I have available. You'll have to look into it yourself.
But during the investigations I did find some other bugs (the ones you mentioned about the pen drawing).
Something must have changed since I made the course. I will look into it.
Looks like it wasn't a bug. There was just something commented out in the onTouch method of Camera2Fragment.
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:{
startX = motionEvent.getX();
startY = motionEvent.getY();
break;
}
case MotionEvent.ACTION_UP:{
float endX = motionEvent.getX();
float endY = motionEvent.getY();
if (isAClick(startX, endX, startY, endY)) {
if(view.getId() == R.id.texture && view.getId() != R.id.stillshot){
Log.d(TAG, "onTouch: MANUAL FOCUS.");
startManualFocus(view, motionEvent);
}
}
break;
}
case MotionEvent.ACTION_MOVE:{
break;
}
}
// if(mIsImageAvailable){
// Log.d(TAG, "onTouch: sending touch event to DrawableImageView");
// return mStillshotImageView.touchEvent(motionEvent);
// }
// else{
// Log.d(TAG, "onTouch: ZOOM.");
// return mTextureView.onTouch(motionEvent);
// }
return true;
}
Should be
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:{
startX = motionEvent.getX();
startY = motionEvent.getY();
break;
}
case MotionEvent.ACTION_UP:{
float endX = motionEvent.getX();
float endY = motionEvent.getY();
if (isAClick(startX, endX, startY, endY)) {
if(view.getId() == R.id.texture && view.getId() != R.id.stillshot){
Log.d(TAG, "onTouch: MANUAL FOCUS.");
startManualFocus(view, motionEvent);
}
}
break;
}
case MotionEvent.ACTION_MOVE:{
break;
}
}
if(mIsImageAvailable){
Log.d(TAG, "onTouch: sending touch event to DrawableImageView");
return mStillshotImageView.touchEvent(motionEvent);
}
else{
Log.d(TAG, "onTouch: ZOOM.");
return mTextureView.onTouch(motionEvent);
}
// return true;
}
the preview you see in the dispaly before shooting is deformed compared to reality. after shot the image is instead well proportioned.
Screenshot before shot
Screenshot after shot
Phone tets results
04-04 23:46:34.094 3693-3693/codingwithmitch.com.phonetest W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable