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
3c537a2e
Commit
3c537a2e
authored
Mar 23, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/share_photo' into develop
parents
ffdb56e4
197e7c5e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
16 deletions
+48
-16
ScreenController.kt
...al/roompark/presentation/screen/photo/ScreenController.kt
+31
-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 @
3c537a2e
package
com.biganto.visual.roompark.presentation.screen.photo
import
android.content.Intent
import
android.graphics.Bitmap
import
android.os.Bundle
import
android.view.View
import
android.view.WindowManager
...
...
@@ -14,11 +16,13 @@ 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.google.android.material.textview.MaterialTextView
import
timber.log.Timber
import
java.io.FileOutputStream
import
javax.inject.Inject
...
...
@@ -68,6 +72,33 @@ class PhotoScreenController :
handleBack
()
}
@OnClick
(
R
.
id
.
share_image_button
)
fun
onShareImage
(){
val
imgUrl
=
(
photoViewPager
.
adapter
as
PhotosAdapter
)
.
getCurrentItem
(
photoViewPager
.
currentItem
)
.
resolutionList
.
maxBy
{
it
.
resHeight
*
it
.
resWidth
}
?.
url
?:
""
val
shareIntent
=
Intent
()
shareIntent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
)
shareIntent
.
action
=
Intent
.
ACTION_SEND
shareIntent
.
type
=
"text/plain"
shareIntent
.
putExtra
(
Intent
.
EXTRA_TEXT
,
imgUrl
)
startActivity
(
shareIntent
)
}
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 @
3c537a2e
...
...
@@ -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 @
3c537a2e
...
...
@@ -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 @
3c537a2e
...
...
@@ -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