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
9f85323d
Commit
9f85323d
authored
Mar 23, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
share url
parent
f227fe02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
40 deletions
+13
-40
ScreenController.kt
...al/roompark/presentation/screen/photo/ScreenController.kt
+13
-40
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/photo/ScreenController.kt
View file @
9f85323d
...
@@ -2,8 +2,6 @@ package com.biganto.visual.roompark.presentation.screen.photo
...
@@ -2,8 +2,6 @@ package com.biganto.visual.roompark.presentation.screen.photo
import
android.content.Intent
import
android.content.Intent
import
android.graphics.Bitmap
import
android.graphics.Bitmap
import
android.graphics.drawable.Drawable
import
android.net.Uri
import
android.os.Bundle
import
android.os.Bundle
import
android.view.View
import
android.view.View
import
android.view.WindowManager
import
android.view.WindowManager
...
@@ -22,9 +20,6 @@ import com.biganto.visual.roompark.data.repository.file.FileModule
...
@@ -22,9 +20,6 @@ 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.PhotoPreviewSlider
import
com.biganto.visual.roompark.presentation.screen.photo.util.PhotosAdapter
import
com.biganto.visual.roompark.presentation.screen.photo.util.PhotosAdapter
import
com.bluelinelabs.conductor.RouterTransaction
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
com.google.android.material.textview.MaterialTextView
import
timber.log.Timber
import
timber.log.Timber
import
java.io.FileOutputStream
import
java.io.FileOutputStream
...
@@ -79,41 +74,19 @@ class PhotoScreenController :
...
@@ -79,41 +74,19 @@ class PhotoScreenController :
@OnClick
(
R
.
id
.
share_image_button
)
@OnClick
(
R
.
id
.
share_image_button
)
fun
onShareImage
(){
fun
onShareImage
(){
val
imgUrl
=
val
img
=
(
photoViewPager
.
adapter
as
PhotosAdapter
)
(
photoViewPager
.
adapter
as
PhotosAdapter
)
.
getCurrentItem
(
photoViewPager
.
currentItem
)
.
getCurrentItem
(
photoViewPager
.
currentItem
)
.
resolutionList
.
resolutionList
.
maxBy
{
it
.
resHeight
*
it
.
resWidth
}
.
maxBy
{
it
.
resHeight
*
it
.
resWidth
}
?.
url
?:
""
?.
url
?:
""
Timber
.
d
(
" sssssssssss $img"
)
val
shareIntent
=
Intent
()
Glide
.
with
(
photoViewPager
)
shareIntent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
)
.
asBitmap
()
shareIntent
.
action
=
Intent
.
ACTION_SEND
.
load
(
img
)
shareIntent
.
type
=
"text/plain"
.
into
(
object
:
CustomTarget
<
Bitmap
>(){
shareIntent
.
putExtra
(
Intent
.
EXTRA_TEXT
,
imgUrl
)
override
fun
onResourceReady
(
resource
:
Bitmap
,
transition
:
Transition
<
in
Bitmap
>?)
{
startActivity
(
shareIntent
)
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
{
private
fun
writeFile
(
fileName
:
String
?,
bitmap
:
Bitmap
):
String
{
...
...
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