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
c03a1a85
Commit
c03a1a85
authored
Dec 16, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bluured and cropped background
parent
fdcdf6b9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
4 deletions
+105
-4
RetrofitModule.kt
...oompark/data/repository/api/retrofit/di/RetrofitModule.kt
+3
-1
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+2
-2
ScreenController.kt
...l/roompark/presentation/screen/albums/ScreenController.kt
+53
-0
ext.kt
...n/java/com/biganto/visual/roompark/util/extensions/ext.kt
+47
-0
albums_screen.xml
app/src/main/res/layout/albums_screen.xml
+0
-1
No files found.
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/di/RetrofitModule.kt
View file @
c03a1a85
...
@@ -33,6 +33,8 @@ private const val TIMEOUT_SECONDS=120L
...
@@ -33,6 +33,8 @@ private const val TIMEOUT_SECONDS=120L
private
const
val
WRITE_SECONDS
=
120L
private
const
val
WRITE_SECONDS
=
120L
private
const
val
READ_SECONDS
=
120L
private
const
val
READ_SECONDS
=
120L
val
INTERCEPT_LOG_LEVEL
=
HttpLoggingInterceptor
.
Level
.
NONE
@Module
@Module
class
RetrofitModule
{
class
RetrofitModule
{
...
@@ -70,7 +72,7 @@ class RetrofitModule{
...
@@ -70,7 +72,7 @@ class RetrofitModule{
.
addInterceptor
(
VersionValidationInterceptor
(
appVersionManager
))
.
addInterceptor
(
VersionValidationInterceptor
(
appVersionManager
))
.
addInterceptor
(
.
addInterceptor
(
HttpLoggingInterceptor
{
Timber
.
tag
(
"OkHttp"
).
d
(
"RetroLogger: $it"
)
}
HttpLoggingInterceptor
{
Timber
.
tag
(
"OkHttp"
).
d
(
"RetroLogger: $it"
)
}
.
setLevel
(
HttpLoggingInterceptor
.
Level
.
BODY
)
.
setLevel
(
INTERCEPT_LOG_LEVEL
)
)
)
.
addInterceptor
{
.
addInterceptor
{
it
.
proceed
(
it
.
proceed
(
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
c03a1a85
...
@@ -30,8 +30,8 @@ class DbModule{
...
@@ -30,8 +30,8 @@ class DbModule{
Timber
.
d
(
"Kotlin store creating.."
)
Timber
.
d
(
"Kotlin store creating.."
)
val
source
=
DatabaseSource
(
context
,
Models
.
DEFAULT
,
"BigantoPerfect"
,
DATABASE_VERSION
)
val
source
=
DatabaseSource
(
context
,
Models
.
DEFAULT
,
"BigantoPerfect"
,
DATABASE_VERSION
)
source
.
setLoggingEnabled
(
true
)
//
source.setLoggingEnabled(true)
source
.
setWriteAheadLoggingEnabled
(
true
)
//
source.setWriteAheadLoggingEnabled(true)
source
.
setTableCreationMode
(
TableCreationMode
.
DROP_CREATE
)
source
.
setTableCreationMode
(
TableCreationMode
.
DROP_CREATE
)
val
store
=
KotlinEntityDataStore
<
Persistable
>(
source
.
configuration
)
val
store
=
KotlinEntityDataStore
<
Persistable
>(
source
.
configuration
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/albums/ScreenController.kt
View file @
c03a1a85
package
com.biganto.visual.roompark.presentation.screen.albums
package
com.biganto.visual.roompark.presentation.screen.albums
import
android.graphics.Bitmap
import
android.graphics.drawable.BitmapDrawable
import
android.graphics.drawable.Drawable
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
androidx.core.os.bundleOf
import
androidx.core.os.bundleOf
...
@@ -14,8 +17,12 @@ import com.biganto.visual.roompark.base.RoomParkMainActivity
...
@@ -14,8 +17,12 @@ import com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.presentation.screen.albums.util.AlbumsHeaderAdapter
import
com.biganto.visual.roompark.presentation.screen.albums.util.AlbumsHeaderAdapter
import
com.biganto.visual.roompark.presentation.screen.favorites.util.AlbumListAdapter
import
com.biganto.visual.roompark.presentation.screen.favorites.util.AlbumListAdapter
import
com.biganto.visual.roompark.util.extensions.scaleCenterCrop
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.squareup.picasso.Picasso
import
com.squareup.picasso.Picasso
import
jp.wasabeef.picasso.transformations.BlurTransformation
import
jp.wasabeef.picasso.transformations.ColorFilterTransformation
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Inject
...
@@ -127,6 +134,52 @@ class AlbumsScreenController :
...
@@ -127,6 +134,52 @@ class AlbumsScreenController :
)
)
}
}
try
{
val
urlToLoadBg
=
viewState
.
list
.
first
{
it
.
albumId
==
viewState
.
selectedAlbumId
}.
previewUrl
Timber
.
d
(
"URL TO LOAD BG $urlToLoadBg"
)
urlToLoadBg
.
let
{
Picasso
.
get
()
.
load
(
it
)
.
transform
(
BlurTransformation
(
activity
,
13
,
2
))
.
transform
(
ColorFilterTransformation
(
0
xCC000000
.
toInt
()))
.
into
(
object
:
com
.
squareup
.
picasso
.
Target
{
override
fun
onPrepareLoad
(
placeHolderDrawable
:
Drawable
?)
{
Timber
.
d
(
"View measures: 1 - "
+
"${nestedScrollView.width} "
+
"/ ${nestedScrollView.height} "
+
"/ ${nestedScrollView.measuredWidth} "
+
"/${nestedScrollView.measuredHeight}"
)
nestedScrollView
.
background
=
placeHolderDrawable
}
override
fun
onBitmapFailed
(
e
:
Exception
?,
errorDrawable
:
Drawable
?)
{
Timber
.
e
(
e
)
}
override
fun
onBitmapLoaded
(
bitmap
:
Bitmap
?,
from
:
Picasso
.
LoadedFrom
?)
{
Timber
.
d
(
"View measures: 2 - "
+
"${nestedScrollView.width} "
+
"/ ${nestedScrollView.height} "
+
"/ ${nestedScrollView.measuredWidth} "
+
"/${nestedScrollView.measuredHeight}"
)
val
croppedBtimpa
=
bitmap
?.
scaleCenterCrop
(
nestedScrollView
)
nestedScrollView
.
background
=
BitmapDrawable
(
activity
?.
resources
,
croppedBtimpa
)
}
})
}
}
catch
(
e
:
java
.
lang
.
Exception
){
Timber
.
e
(
e
)}
}
}
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
AlbumsSelected
){
private
fun
render
(
viewState
:
AlbumsScreenViewState
.
AlbumsSelected
){
...
...
app/src/main/java/com/biganto/visual/roompark/util/extensions/ext.kt
View file @
c03a1a85
package
com.biganto.visual.roompark.util.extensions
package
com.biganto.visual.roompark.util.extensions
import
android.graphics.Bitmap
import
android.graphics.Canvas
import
android.graphics.RectF
import
android.view.View
import
android.view.View
import
timber.log.Timber
import
java.text.DecimalFormat
import
java.text.DecimalFormat
/**
/**
* Created by Vladislav Bogdashkin on 23.10.2019.
* Created by Vladislav Bogdashkin on 23.10.2019.
*/
*/
...
@@ -45,3 +51,44 @@ fun Float.format(fracDigits: Int): String {
...
@@ -45,3 +51,44 @@ fun Float.format(fracDigits: Int): String {
fun
View
.
setGone
(
isGone
:
Boolean
){
fun
View
.
setGone
(
isGone
:
Boolean
){
this
.
visibility
=
if
(
isGone
)
View
.
GONE
else
View
.
VISIBLE
this
.
visibility
=
if
(
isGone
)
View
.
GONE
else
View
.
VISIBLE
}
}
fun
Bitmap
.
scaleCenterCrop
(
viewHolder
:
View
):
Bitmap
{
Timber
.
d
(
"go crpo"
)
val
sourceWidth
=
this
.
width
val
sourceHeight
=
this
.
height
// Compute the scaling factors to fit the new height and width, respectively.
// To cover the final image, the final scaling will be the bigger
// of these two.
val
xScale
=
viewHolder
.
measuredWidth
.
toFloat
()
/
sourceWidth
val
yScale
=
viewHolder
.
measuredHeight
.
toFloat
()
/
sourceHeight
val
scale
=
xScale
.
coerceAtLeast
(
yScale
)
Timber
.
d
(
" left/top $xScale/$yScale"
)
// Now get the size of the source bitmap when scaled
val
scaledWidth
=
scale
*
sourceWidth
val
scaledHeight
=
scale
*
sourceHeight
// Let's find out the upper left coordinates if the scaled bitmap
// should be centered in the new size give by the parameters
val
left
=
(
viewHolder
.
measuredWidth
-
scaledWidth
)
/
2
val
top
=
(
viewHolder
.
measuredHeight
-
scaledHeight
)
/
2
Timber
.
d
(
" left/top $left/$top"
)
// The target rectangle for the new, scaled version of the source bitmap will now
// be
val
targetRect
=
RectF
(
left
,
top
,
left
+
scaledWidth
,
top
+
scaledHeight
)
// Finally, we create a new bitmap of the specified size and draw our new,
// scaled bitmap onto it.
val
dest
=
Bitmap
.
createBitmap
(
viewHolder
.
measuredWidth
,
viewHolder
.
measuredHeight
,
this
.
config
)
val
canvas
=
Canvas
(
dest
)
Timber
.
d
(
" targetRect $targetRect"
)
canvas
.
drawBitmap
(
this
,
null
,
targetRect
,
null
)
return
dest
}
\ No newline at end of file
app/src/main/res/layout/albums_screen.xml
View file @
c03a1a85
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
android:id=
"@+id/container"
android:id=
"@+id/container"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/colorOpacityBackground"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
...
...
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