Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
briar
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
675
Issues
675
List
Boards
Labels
Service Desk
Milestones
Merge Requests
11
Merge Requests
11
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
briar
briar
Commits
cd3174a6
Verified
Commit
cd3174a6
authored
May 01, 2019
by
Torsten Grote
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[android] Fix view recycling issue of image previews
parent
9d9bc4ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
24 deletions
+31
-24
briar-android/src/main/java/org/briarproject/briar/android/view/ImagePreviewViewHolder.java
...iarproject/briar/android/view/ImagePreviewViewHolder.java
+31
-24
No files found.
briar-android/src/main/java/org/briarproject/briar/android/view/ImagePreviewViewHolder.java
View file @
cd3174a6
...
...
@@ -18,6 +18,7 @@ import org.briarproject.briar.R;
import
org.briarproject.briar.android.conversation.glide.GlideApp
;
import
static
android
.
view
.
View
.
INVISIBLE
;
import
static
android
.
view
.
View
.
VISIBLE
;
import
static
com
.
bumptech
.
glide
.
load
.
engine
.
DiskCacheStrategy
.
NONE
;
import
static
com
.
bumptech
.
glide
.
load
.
resource
.
bitmap
.
DownsampleStrategy
.
FIT_CENTER
;
import
static
com
.
bumptech
.
glide
.
load
.
resource
.
drawable
.
DrawableTransitionOptions
.
withCrossFade
;
...
...
@@ -38,31 +39,37 @@ class ImagePreviewViewHolder extends ViewHolder {
}
void
bind
(
ImagePreviewItem
item
)
{
if
(
item
.
getItem
()
==
null
)
return
;
// shows progress bar
GlideApp
.
with
(
imageView
)
.
load
(
item
.
getItem
())
.
diskCacheStrategy
(
NONE
)
.
error
(
ERROR_RES
)
.
downsample
(
FIT_CENTER
)
.
transition
(
withCrossFade
())
.
addListener
(
new
RequestListener
<
Drawable
>()
{
@Override
public
boolean
onLoadFailed
(
@Nullable
GlideException
e
,
Object
model
,
Target
<
Drawable
>
target
,
boolean
isFirstResource
)
{
progressBar
.
setVisibility
(
INVISIBLE
);
return
false
;
}
if
(
item
.
getItem
()
==
null
)
{
progressBar
.
setVisibility
(
VISIBLE
);
GlideApp
.
with
(
imageView
)
.
clear
(
imageView
);
}
else
{
GlideApp
.
with
(
imageView
)
.
load
(
item
.
getItem
())
.
diskCacheStrategy
(
NONE
)
.
error
(
ERROR_RES
)
.
downsample
(
FIT_CENTER
)
.
transition
(
withCrossFade
())
.
addListener
(
new
RequestListener
<
Drawable
>()
{
@Override
public
boolean
onLoadFailed
(
@Nullable
GlideException
e
,
Object
model
,
Target
<
Drawable
>
target
,
boolean
isFirstResource
)
{
progressBar
.
setVisibility
(
INVISIBLE
);
return
false
;
}
@Override
public
boolean
onResourceReady
(
Drawable
resource
,
Object
model
,
Target
<
Drawable
>
target
,
DataSource
dataSource
,
boolean
isFirstResource
)
{
progressBar
.
setVisibility
(
INVISIBLE
);
return
false
;
}
})
.
into
(
imageView
);
@Override
public
boolean
onResourceReady
(
Drawable
resource
,
Object
model
,
Target
<
Drawable
>
target
,
DataSource
dataSource
,
boolean
isFirstResource
)
{
progressBar
.
setVisibility
(
INVISIBLE
);
return
false
;
}
})
.
into
(
imageView
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment