-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fixes #3479: Implement Progress Bar for Zoom Activity #3481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
ba41f3f
8bf1d64
125f8c5
a972bb5
85e00af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package fr.free.nrw.commons.media.zoomControllers.loading; | ||
|
||
import android.graphics.Canvas; | ||
import android.graphics.Paint; | ||
import android.graphics.Rect; | ||
import android.graphics.RectF; | ||
|
||
import com.facebook.drawee.drawable.ProgressBarDrawable; | ||
|
||
public class CircleProgressBarDrawable extends ProgressBarDrawable { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we are using a custom ProgressBar drawable, is this necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Fresco API demands it and the drawable they use in their sample is maybe the one used here, seeing as it has the same error, link I'd prefer to not use it and just have the indeterminate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @neslihanturan i just realised that SimpleDraweeView in the Contributions home page while uploading shows linear progress bar so i think it would be more appropriate to keep linear one for UI consistency, i will change it @macgills i have added the progressbar because if the image size is heavy then it might take some time to load as @neslihanturan elucidated in the issue thread, i will replace circular progressbar with linear one while keeping the indeterminate spinner There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems really confusing as a user that my image is loading twice. I don't mind if the bar is linear or circular but there should only be one loading indication There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @macgills i completely agree with you but the problem is that the
I think the best middle ground is to keep a linear progress bar which is much less intrusive and would fulfill the purpose of showing download progress, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah just stop setting it Gone in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That works, just frustrating this scenario doesn't have better support in fresco. Maybe if we had a good placeholderImage it would feel less weird to me? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @macgills should i change anything else ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll leave final say with @neslihanturan |
||
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | ||
private int mLevel = 0; | ||
private int maxLevel = 10000; | ||
|
||
@Override | ||
protected boolean onLevelChange(int level) { | ||
mLevel = level; | ||
invalidateSelf(); | ||
return true; | ||
} | ||
|
||
@Override | ||
public void draw(Canvas canvas) { | ||
if (getHideWhenZero() && mLevel == 0) { | ||
return; | ||
} | ||
drawBar(canvas, maxLevel, getBackgroundColor()); | ||
drawBar(canvas, mLevel, getColor()); | ||
} | ||
|
||
private void drawBar(Canvas canvas, int level, int color) { | ||
Rect bounds = getBounds(); | ||
RectF rectF = | ||
new RectF( | ||
(float) (bounds.right * .4), | ||
(float) (bounds.bottom * .45), | ||
(float) (bounds.right * .6), | ||
(float) (bounds.bottom * .55)); | ||
mPaint.setColor(color); | ||
mPaint.setStyle(Paint.Style.STROKE); | ||
mPaint.setStrokeWidth(6); | ||
if (level != 0) canvas.drawArc(rectF, 0, (float) (level * 360 / maxLevel), false, mPaint); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes intermediate image is also slowly appears. I think we should also use the progressbar for that phase. What do you think @kbhardwaj123 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neslihanturan actually i inspected this thing and found that if i place a log statement for
onIntermediateImageSet
it won't appear in the logs, i think it would be better if i make the Indeterminate spinner INVISIBLE as soon as Intermediate image is set