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
f227fe02
Commit
f227fe02
authored
Mar 23, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
layout for share refactored
parent
76e62401
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
16 deletions
+75
-16
ScreenController.kt
...al/roompark/presentation/screen/photo/ScreenController.kt
+58
-0
PhotoViewAdapter.kt
...ompark/presentation/screen/photo/util/PhotoViewAdapter.kt
+2
-0
photo_view_screen.xml
app/src/main/res/layout/photo_view_screen.xml
+14
-16
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/ScreenController.kt
View file @
f227fe02
package
com.biganto.visual.roompark.presentation.screen.photo
import
android.content.Intent
import
android.graphics.Bitmap
import
android.graphics.drawable.Drawable
import
android.net.Uri
import
android.os.Bundle
import
android.view.View
import
android.view.WindowManager
...
...
@@ -14,11 +18,16 @@ import com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.conductor.dialogs.ChooseResolutionDialogController
import
com.biganto.visual.roompark.conductor.dialogs.change_handler.DialogChangeHandler
import
com.biganto.visual.roompark.data.repository.file.FileModule
import
com.biganto.visual.roompark.presentation.screen.photo.util.PhotoPreviewSlider
import
com.biganto.visual.roompark.presentation.screen.photo.util.PhotosAdapter
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bumptech.glide.Glide
import
com.bumptech.glide.request.target.CustomTarget
import
com.bumptech.glide.request.transition.Transition
import
com.google.android.material.textview.MaterialTextView
import
timber.log.Timber
import
java.io.FileOutputStream
import
javax.inject.Inject
...
...
@@ -68,6 +77,55 @@ class PhotoScreenController :
handleBack
()
}
@OnClick
(
R
.
id
.
share_image_button
)
fun
onShareImage
(){
val
img
=
(
photoViewPager
.
adapter
as
PhotosAdapter
)
.
getCurrentItem
(
photoViewPager
.
currentItem
)
.
resolutionList
.
maxBy
{
it
.
resHeight
*
it
.
resWidth
}
?.
url
?:
""
Timber
.
d
(
" sssssssssss $img"
)
Glide
.
with
(
photoViewPager
)
.
asBitmap
()
.
load
(
img
)
.
into
(
object
:
CustomTarget
<
Bitmap
>(){
override
fun
onResourceReady
(
resource
:
Bitmap
,
transition
:
Transition
<
in
Bitmap
>?)
{
Timber
.
d
(
" eeee $img"
)
val
uri
=
writeFile
(
"${img.hashCode()}.jpg"
,
resource
)
Timber
.
d
(
" zzz zz zz $uri"
)
Timber
.
d
(
" zzz zz zz ${Uri.parse(uri)}"
)
val
shareIntent
:
Intent
=
Intent
().
apply
{
action
=
Intent
.
ACTION_SEND
putExtra
(
Intent
.
EXTRA_STREAM
,
Uri
.
parse
(
uri
))
putExtra
(
Intent
.
EXTRA_SUBJECT
,
"subject"
);
putExtra
(
Intent
.
EXTRA_TITLE
,
"room park"
);
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
addFlags
(
Intent
.
FLAG_GRANT_WRITE_URI_PERMISSION
);
type
=
"image/jpeg"
;
}
startActivity
(
Intent
.
createChooser
(
shareIntent
,
resources
?.
getText
(
R
.
string
.
share_house_photo
)))
}
override
fun
onLoadCleared
(
placeholder
:
Drawable
?)
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
})
}
private
fun
writeFile
(
fileName
:
String
?,
bitmap
:
Bitmap
):
String
{
val
f
=
FileModule
.
getDirectory
(
activity
!!
,
FileModule
.
FileDirectory
.
Albums
(
fileName
))
val
outputStream
=
FileOutputStream
(
f
)
outputStream
.
use
{
bitmap
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
100
,
it
)
it
.
flush
()
}
return
f
.
absolutePath
}
override
fun
onAttach
(
view
:
View
)
{
// tempSystemUiFlag = activity?.window?.decorView?.systemUiVisibility
super
.
onAttach
(
view
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/util/PhotoViewAdapter.kt
View file @
f227fe02
...
...
@@ -34,6 +34,8 @@ class PhotosAdapter : CommonRecyclerAdapter<PhotosViewHolder, PhotoModel>() {
fun
indexById
(
id
:
Int
):
Int
=
list
.
indexOfFirst
{
it
.
photoId
==
id
}
fun
getCurrentItem
(
pos
:
Int
)
=
list
[
pos
]
override
val
vhKlazz
=
PhotosViewHolder
::
class
...
...
app/src/main/res/layout/photo_view_screen.xml
View file @
f227fe02
...
...
@@ -52,28 +52,26 @@
app:layout_constraintGuide_end=
"80dp"
/>
<ImageView
android:id=
"@+id/sh
ow_full
_button"
android:layout_width=
"
24
dp"
android:layout_height=
"
24
dp"
android:layout_marginStart=
"
16
dp"
android:layout_marginTop=
"1
6
dp"
a
pp:layout_constraintBottom_toBottomOf=
"parent
"
android:id=
"@+id/sh
are_image
_button"
android:layout_width=
"
40
dp"
android:layout_height=
"
0
dp"
android:layout_marginStart=
"
8
dp"
android:layout_marginTop=
"1
2
dp"
a
ndroid:padding=
"8dp
"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/guideline2"
app:layout_constraintVertical_bias=
"0.0"
app:srcCompat=
"@drawable/iic_full_view"
/>
app:srcCompat=
"@drawable/ic_share"
/>
<ImageView
android:id=
"@+id/choose_size_button"
android:layout_width=
"
24
dp"
android:layout_height=
"
24
dp"
android:layout_marginTop=
"1
6
dp"
android:layout_marginEnd=
"
16
dp"
a
pp:layout_constraintBottom_toBottomOf=
"parent
"
android:layout_width=
"
40
dp"
android:layout_height=
"
0
dp"
android:layout_marginTop=
"1
2
dp"
android:layout_marginEnd=
"
8
dp"
a
ndroid:padding=
"8dp
"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/guideline2"
app:layout_constraintVertical_bias=
"0.0"
app:srcCompat=
"@drawable/iic_full_view"
/>
app:srcCompat=
"@drawable/ic_ratio"
/>
<com.biganto.visual.roompark.presentation.screen.photo.util.PhotoPreviewSlider
android:id=
"@+id/photosPreviewSlider"
...
...
@@ -87,7 +85,7 @@
android:visibility=
"invisible"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/choose_size_button"
app:layout_constraintStart_toEndOf=
"@+id/sh
ow_full
_button"
app:layout_constraintStart_toEndOf=
"@+id/sh
are_image
_button"
app:layout_constraintTop_toTopOf=
"@+id/guideline2"
app:layout_constraintVertical_bias=
"0.0"
/>
...
...
app/src/main/res/values/strings.xml
View file @
f227fe02
...
...
@@ -91,6 +91,7 @@
<string
name=
"estate_type_other_short"
>
ОБ.%s
</string>
<string
name=
"tour_not_allowed"
>
Запуск туров пока недоступен!
</string>
<string
name=
"content_description_close"
>
Close
</string>
<string
name=
"share_house_photo"
>
Поделиться изображением
</string>
<!--endregion-->
</resources>
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