Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
ec6d3fc0
Commit
ec6d3fc0
authored
Mar 10, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove glide from photo
parent
23fc8814
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
47 deletions
+20
-47
ScreenController.kt
...al/roompark/presentation/screen/photo/ScreenController.kt
+1
-1
PhotoViewAdapter.kt
...ompark/presentation/screen/photo/util/PhotoViewAdapter.kt
+19
-46
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/ScreenController.kt
View file @
ec6d3fc0
...
...
@@ -46,7 +46,7 @@ class PhotoScreenController :
private
fun
bindRecycler
()
{
photoViewPager
.
isNestedScrollingEnabled
=
false
photoViewPager
.
offscreenPageLimit
=
2
photoViewPager
.
offscreenPageLimit
=
1
photoViewPager
.
adapter
=
PhotosAdapter
()
setVewPager
()
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/util/PhotoViewAdapter.kt
View file @
ec6d3fc0
...
...
@@ -11,10 +11,11 @@ import com.biganto.visual.roompark.domain.model.PhotoModel
import
com.biganto.visual.roompark.domain.model.PhotoResolutionModel
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.github.chrisbanes.photoview.PhotoView
import
com.google.android.material.textview.MaterialTextView
import
timber.log.Timber
import
javax.security.auth.callback.Callback
import
kotlin.math.absoluteValue
/**
...
...
@@ -64,54 +65,26 @@ class PhotosViewHolder(itemView: View) : CommonViewHolder<PhotoModel>(itemView)
description
.
visibility
=
if
(
model
.
description
!=
null
)
View
.
VISIBLE
else
View
.
GONE
model
.
description
?.
let
{
description
.
text
=
it
}
model
.
resolutionList
.
lowelest
()
?.
let
{
picassoAsync
.
load
(
it
.
url
)
.
centerCrop
()
.
fit
()
.
into
(
photoPreview
,
object
:
Callback
,
com
.
squareup
.
picasso
.
Callback
{
override
fun
onSuccess
()
{
model
.
resolutionList
.
onEach
{
Timber
.
d
(
"val ensure: ${it.resWidth} : ${it.resHeight}"
)
}
.
minBy
{
((
windowSize
.
x
-
it
.
resWidth
+
.
1f
).
absoluteValue
+
(
windowSize
.
y
-
it
.
resHeight
+
.
1f
).
absoluteValue
)
}
?.
let
{
photo
->
Timber
.
d
(
"val: ${photo.resWidth} : ${photo.resHeight}"
)
picassoAsync
.
load
(
photo
.
url
)
.
centerCrop
()
.
fit
()
.
into
(
photoPreview
)
}
}
override
fun
onError
(
e
:
Exception
?)
{
model
.
resolutionList
.
onEach
{
Timber
.
d
(
"val ensure: ${it.resWidth} : ${it.resHeight}"
)
}
.
minBy
{
((
windowSize
.
x
-
it
.
resWidth
+
.
1f
).
absoluteValue
+
(
windowSize
.
y
-
it
.
resHeight
+
.
1f
).
absoluteValue
)
}
?.
let
{
Timber
.
d
(
"val: ${it.resWidth} : ${it.resHeight}"
)
picassoAsync
.
load
(
it
.
url
)
.
centerCrop
()
.
fit
()
.
into
(
photoPreview
)
}
}
})
}
model
.
resolutionList
.
minBy
{
((
windowSize
.
x
-
it
.
resWidth
+
.
1f
).
absoluteValue
+
(
windowSize
.
y
-
it
.
resHeight
+
.
1f
).
absoluteValue
)
}
?.
let
{
photo
->
Timber
.
d
(
"val: ${photo.resWidth} : ${photo.resHeight}"
)
Glide
.
with
(
photoPreview
)
.
load
(
photo
.
url
)
.
thumbnail
(
model
.
resolutionList
.
lowelest
()
?.
let
{
thumb
->
Glide
.
with
(
photoPreview
).
load
(
thumb
.
url
).
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
})
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
into
(
photoPreview
)
}
}
}
private
fun
List
<
PhotoResolutionModel
>.
lowelest
()
=
this
.
minBy
{
it
.
resWidth
*
it
.
resHeight
}
\ No newline at end of file
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