Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
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
1783753f
Commit
1783753f
authored
Dec 16, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create picasso async provides method
parent
b715e5e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
8 deletions
+36
-8
AppComponent.kt
...ava/com/biganto/visual/roompark/di/dagger/AppComponent.kt
+4
-0
PicassoModule.kt
...va/com/biganto/visual/roompark/di/dagger/PicassoModule.kt
+27
-0
AlbumListAdapter.kt
...mpark/presentation/screen/albums/util/AlbumListAdapter.kt
+5
-8
No files found.
app/src/main/java/com/biganto/visual/roompark/di/dagger/AppComponent.kt
View file @
1783753f
...
...
@@ -11,6 +11,7 @@ import com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.DevProgressContract
import
com.biganto.visual.roompark.domain.contract.FeedsContract
import
com.squareup.picasso.Picasso
import
dagger.BindsInstance
import
dagger.Component
import
dagger.android.AndroidInjectionModule
...
...
@@ -38,6 +39,7 @@ import javax.inject.Singleton
AndroidInjectionModule
::
class
,
AndroidSupportInjectionModule
::
class
,
// MappingProvider::class,
PicassoModule
::
class
,
ActivityModule
::
class
,
ContractRepositoryModule
::
class
,
AppActivityModule
::
class
])
...
...
@@ -58,6 +60,8 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{
fun
provideAppContext
():
Application
fun
providePicassoAsync
():
Picasso
@Component
.
Factory
interface
Factory
{
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/PicassoModule.kt
0 → 100644
View file @
1783753f
package
com.biganto.visual.roompark.di.dagger
import
android.app.Application
import
com.squareup.picasso.Picasso
import
dagger.Module
import
dagger.Provides
import
java.util.concurrent.Executors
import
javax.inject.Singleton
/**
* Created by Vladislav Bogdashkin on 16.12.2019.
*/
private
const
val
THREAD_POOL_COUNT
=
4
@Module
class
PicassoModule
{
@Provides
@Singleton
fun
providePicassoAsyncSingleton
(
context
:
Application
):
Picasso
{
val
executor
=
Executors
.
newFixedThreadPool
(
THREAD_POOL_COUNT
)
return
Picasso
.
Builder
(
context
)
.
executor
(
executor
)
.
build
()
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/util/AlbumListAdapter.kt
View file @
1783753f
...
...
@@ -13,8 +13,6 @@ import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyc
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import
com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
import
com.google.android.material.textview.MaterialTextView
import
com.squareup.picasso.Picasso
import
java.util.concurrent.Executors
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
...
...
@@ -53,18 +51,17 @@ class PhotosAdapter : CommonRecyclerAdapter<PhotosViewHolder, PhotoModel>() {
override
fun
getVhLayout
():
Int
=
R
.
layout
.
photo_preview_viewholder
}
val
exSercv
=
Executors
.
newFixedThreadPool
(
4
)
val
picoAbuilder
=
Picasso
.
Builder
(
RoomParkApplication
.
component
.
provideAppContext
())
.
executor
(
exSercv
)
.
build
()
class
PhotosViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
PhotoModel
>(
itemView
)
{
@BindView
(
R
.
id
.
photo_preview_imageview
)
lateinit
var
photoPreview
:
RoundedImageView
private
val
picassoAsync
by
lazy
{
return
@lazy
RoomParkApplication
.
component
.
providePicassoAsync
()
}
override
fun
onViewBound
(
model
:
PhotoModel
)
{
model
.
resolutionList
.
lowelest
()
?.
let
{
picoAbuilder
picassoAsync
.
load
(
it
.
url
)
.
centerCrop
()
.
fit
()
...
...
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