Open jays95jp opened 7 years ago
@jays95jp have got any other crash rather than this? or it's the only crash at the time of scrolling you have faced?
Palette says..
...
public Builder(Bitmap bitmap) {
if (bitmap == null || bitmap.isRecycled()) {
throw new IllegalArgumentException("Bitmap is not valid");
}
mBitmap = bitmap;
}
...
it will only throw IllegalArgumentException when bitmap is null or recycled, are you recycling the bitmaps somewhere in your code?
@deepaktwr thanks for quick reply no, up to yet that's the only crash which i get. And one popUp open in recycler view when popUp dismiss than visible frame go for load which is already loaded. may be because of popup crash occur but not sure
if you need other info regarding this than please inform me , and please try to solve this crash as soon as possible little urgency :)
Are you recycling the bitmap explicitly somewhere? or let me know if you have made any changes to the library code a/c to your requirements.
@deepaktwr yes i use catch memory which store by Piccaso. i just remove
.memoryPolicy(MemoryPolicy.NO_STORE)
// .networkPolicy(NetworkPolicy.NO_STORE).placeholder()
from all place because after scroll it take too much time to load even one time all images loaded
@jays95jp okay, i will try to solve both of your problems so that you don't need to attach extra code for this explicitly; i'll try to release it before tomorrow with some extra features.
@jays95jp, New version is up. though it does't have some new features like placeholder drawables, which will go in next release. let me know if it has resolve your problem with crash.
compile 'com.github.deepaktwr:bitframe:0.1.4'
@deepaktwr thanks for responding quickly. 👍 i integrate new module if i get any crash than i inform you.
@deepaktwr not get any crash up to this if get any than inform you
@deepaktwr i done get click event in frame image privies , i get that click proper and use FrameType=FRAMED type now i use FrameType=UNFRAMED in recycler view
Are you not getting frame image click events in
@Override
public void imageClicked(ImageType imageType, int imagePosition, String imageLink) {
.
.
.
}
callback method, in FrameCallback? preciously their was a toast which has been removed from the library, but events are still emitting.
yes in this method i don't get click event , some time i get and some time don't
@deepaktwr in public abstract class ImageShades this method call every time but not call get in interface where we pass as argument
protected void imageClicked(ImageType imageType, int imagePosition, String imageLink) {
imageCallback.imageClicked(imageType, imagePosition, imageLink);
}
The FrameCallback you are passing will process imageClicked method from ViewFrame's MyImageCallback inner class. Can you check if MyImageCallback's imageClicked method calling your FrameCallback's imageClicked method?
yes i this method is call when click event fire
static class MyImageCallback implements ImageCallback{
........
@Override
public void imageClicked(ImageType imageType, int imagePosition, String imageLink) {
ViewFrame viewFrame = viewFrameSoftReference.get();
if (viewFrame == null) return;
FrameCallback frameCallback = frameCallbackSoftReference.get();
if (frameCallback == null) return;
int hashCode = (int) viewFrame.getTag(R.id.frame_tag);
if (this.hashCode() != hashCode) return;
Bundle imageBundle = new Bundle();
ImageScrollParcelable imageScrollParcelable = new ImageScrollParcelable();
imageScrollParcelable.setImageType(imageType);
imageScrollParcelable.setImagePosition(imagePosition);
imageScrollParcelable.setImageLink(imageLink);
imageBundle.putParcelable("image_data", imageScrollParcelable);
frameCallback.imageClick(imageType, imagePosition, imageLink);
}
.......
}
Check ViewFrames imageClicked, also can you post your recycler view adapter class implementation where you have passed FrameCallback?
static class MyImageCallback implements ImageCallback{
........
@Override
public void imageClicked(ImageType imageType, int imagePosition, String imageLink) {
ViewFrame viewFrame = viewFrameSoftReference.get();
if (viewFrame == null) return;
FrameCallback frameCallback = frameCallbackSoftReference.get();
if (frameCallback == null) return;
int hashCode = (int) viewFrame.getTag(R.id.frame_tag);
if (this.hashCode() != hashCode) return;
Bundle imageBundle = new Bundle();
ImageScrollParcelable imageScrollParcelable = new ImageScrollParcelable();
imageScrollParcelable.setImageType(imageType);
imageScrollParcelable.setImagePosition(imagePosition);
imageScrollParcelable.setImageLink(imageLink);
imageBundle.putParcelable("image_data", imageScrollParcelable);
//------is it coming here?
frameCallback.imageClick(imageType, imagePosition, imageLink);
}
.......
}
yes
Using dataBinding
public class BindImage {
........................
@BindingAdapter({"multipleImage", "context"})
public static void setAllimage(ViewFrame viewFrame, List
List<BeanImage> beanImages = new ArrayList<>();
allImage.remove(null);
allImage.remove("");
for (String s : allImage) {
//change
BeanBitFrame beanBitFrame = new BeanBitFrame();
beanBitFrame.setWidth(200);
beanBitFrame.setHeight(200);
beanBitFrame.setImageLink(s);
beanBitFrame.setLoaded(true);
beanImages.add(beanBitFrame);
}
viewFrame.showBitFrame(beanImages, new FrameCallback() {
@Override
public void imageClick(ImageType imageType, int imagePosition, String imageLink) {
Log.e("Call onclick listner in frame","Viewframe");
Intent intent = new Intent(context, ImagePreviewActivity.class);
ArrayList<String> strings = new ArrayList<String>();
strings.addAll(allImage);
intent.putExtra(context.getString(R.string.intent_pass_image_array_url), strings);
context.startActivity(intent);
}
@Override
public void frameResult(List<BeanBitFrame> beanBitFrameList) {
}
@Override
public void addMoreClick() {
}
@Override
public void containerAdded(int containerWidth, int containerHeight, boolean isAddInLayout) {
viewFrame.setBackground(null);
}
@Override
public void loadedFrameColors(int lastLoadedFrameColor, int mixedLoadedColor, int inverseMixedLoadedColor) {
}
}, FrameType.FRAMED);
viewFrame.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("Call onclick listner","Viewframe");
// Intent intent = new Intent(context, ImagePreviewActivity.class);
// ArrayList
}
.......... }
Adapter code
private class HolderView extends RecyclerView.ViewHolder {
AdapterDashBoardBinding adapterDashBoardBinding;
HolderView(AdapterDashBoardBinding itemView) {
super(itemView.getRoot());
adapterDashBoardBinding = itemView;
}
public void bind(LoginBean bean, int position) {
.....
// no code related FrameView
}
}
XML <proj.me.bitframe.ViewFrame android:id="@+id/view_frame" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/_5sdp" android:background="@drawable/bg_img_placeholder" android:minHeight="@dimen/_130sdp" android:visibility="@{user.type.equalsIgnoreCase(@string/txt_image) ? View.VISIBLE : View.GONE}" app:context="@{context}" app:imageScaleType="centerCrop" app:multipleImage="@{user.pictures}" app:shouldShowComment="false" tools:visibility="gone" />
@bindingadapter({"multipleImage", "context"})
public static void setAllimage(ViewFrame viewFrame, List allImage, Context context) {
.
.
.
}
will this method executes on every onBindViewHolder call of recycle view adapter?
Check implementation of FrameAdapter in demo, is it kind of similar? As the showBitFrame need to be called on every onBindViewHolder call for, the only loss here would be the calculations, otherwise Picasso will cache those loaded images
@bindingadapter({"multipleImage", "context"})
public static void setAllimage(ViewFrame viewFrame, List allImage, Context context) {
.
.
.
}
yes this method call every time, even when we scroll up and down and if view come than again call this method
@jays95jp please check your adapter implementation, as if
static class MyImageCallback implements ImageCallback{
........
@Override
public void imageClicked(ImageType imageType, int imagePosition, String imageLink) {
ViewFrame viewFrame = viewFrameSoftReference.get();
if (viewFrame == null) return;
FrameCallback frameCallback = frameCallbackSoftReference.get();
if (frameCallback == null) return;
int hashCode = (int) viewFrame.getTag(R.id.frame_tag);
if (this.hashCode() != hashCode) return;
Bundle imageBundle = new Bundle();
ImageScrollParcelable imageScrollParcelable = new ImageScrollParcelable();
imageScrollParcelable.setImageType(imageType);
imageScrollParcelable.setImagePosition(imagePosition);
imageScrollParcelable.setImageLink(imageLink);
imageBundle.putParcelable("image_data", imageScrollParcelable);
//------IS COMING HERE
frameCallback.imageClick(imageType, imagePosition, imageLink);
}
.......
}
then it will invoke your callback method until the last instance to FrameCallback has been changed.
yes, it's taking only one instance. so it's been working perfectly if there is one time on screen but not working if multiple view on screen.
Actually my requirement is not get click for every frame.. so is there way to disable that click ? so that whole view can get simple click.
yes, it's taking only one instance. so it's been working perfectly if there is one time on screen but not working if multiple view on screen.
the last implementation of the library was not appropriate to the AdapterModel, now it is. BTW if there is one time on screen but not working if multiple view on screen what do you meant by this?
Actually my requirement is not get click for every frame.. so is there way to disable that click ? so that whole view can get simple click.
you may create an interface which will invoke one single method from your view frame as well as from the image click implementation for now, though it won't be good to give options for view frame click so every frame image click is given.
the last implementation of the library was not appropriate to the AdapterModel, now it is. BTW if there is one time on screen but not working if multiple view on screen what do you meant by this? if two frame with multiple images at time in screen than if you scroll down and go up than click event not perform
and for now i remove click event from Frame image XMl
@jays95jp, okay, i will also try to find the problem in library implementation if any, will let you know by evening.
ok thanks @deepaktwr for nice support and quick response 💯
@deepaktwr hello, i got one random crash when i scroll fast up and down , or redirect other activity before load frame i put here log
don't get why get this crash sometime.