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
39fc8480
Commit
39fc8480
authored
Mar 13, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Plain Diff
gMerge branch 'feature/ui_response' into develop
parents
e0531ec9
159bd2a0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
10 deletions
+62
-10
PhotoDialogController.kt
...conductor/dialogs/change_handler/PhotoDialogController.kt
+35
-4
CamsLIstAdapter.kt
...ompark/presentation/screen/feeds/utils/CamsLIstAdapter.kt
+1
-0
ScreenController.kt
.../roompark/presentation/screen/web_cam/ScreenController.kt
+15
-6
photo_viewer.xml
app/src/main/res/layout/photo_viewer.xml
+9
-0
webcam_screen.xml
app/src/main/res/layout/webcam_screen.xml
+2
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/change_handler/PhotoDialogController.kt
View file @
39fc8480
package
com.biganto.visual.roompark.conductor.dialogs.change_handler
import
android.content.pm.ActivityInfo
import
android.graphics.Bitmap
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.ProgressBar
import
androidx.annotation.LayoutRes
import
androidx.core.os.bundleOf
import
androidx.recyclerview.widget.RecyclerView
import
com.biganto.visual.roompark.R
import
com.bluelinelabs.conductor.Controller
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.DataSource
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.bumptech.glide.load.engine.GlideException
import
com.bumptech.glide.request.RequestListener
import
com.bumptech.glide.request.target.Target
import
com.github.chrisbanes.photoview.PhotoView
import
com.google.android.material.snackbar.Snackbar
/**
...
...
@@ -33,17 +40,41 @@ class PhotoDialogController : Controller {
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
):
View
{
val
view
=
inflater
.
inflate
(
getLayoutId
(),
container
,
false
)
val
progress
=
view
.
findViewById
<
ProgressBar
>(
R
.
id
.
photo_load_progress_bar
)
progress
.
visibility
=
View
.
VISIBLE
activity
?.
requestedOrientation
=
ActivityInfo
.
SCREEN_ORIENTATION_USER_LANDSCAPE
args
.
getString
(
PHOTO_URL_KEY
)
?.
let
{
val
photoView
=
view
.
findViewById
<
PhotoView
>(
R
.
id
.
photo_frame
)
Glide
.
with
(
photoView
)
.
asBitmap
()
.
load
(
it
)
// .thumbnail(model.resolutionList.lowelest()?.let { thumb ->
// Glide.with(photoPreview).load(thumb.url).diskCacheStrategy(DiskCacheStrategy.ALL)
// .centerCrop()
// })
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
addListener
(
object
:
RequestListener
<
Bitmap
>{
override
fun
onLoadFailed
(
e
:
GlideException
?,
model
:
Any
?,
target
:
Target
<
Bitmap
>?,
isFirstResource
:
Boolean
):
Boolean
{
progress
.
visibility
=
View
.
INVISIBLE
Snackbar
.
make
(
view
,
"Ошибка при загрузке!"
,
Snackbar
.
LENGTH_SHORT
)
return
false
}
override
fun
onResourceReady
(
resource
:
Bitmap
?,
model
:
Any
?,
target
:
Target
<
Bitmap
>?,
dataSource
:
DataSource
?,
isFirstResource
:
Boolean
):
Boolean
{
progress
.
visibility
=
View
.
INVISIBLE
return
false
}
})
.
into
(
photoView
)
}
return
view
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/utils/CamsLIstAdapter.kt
View file @
39fc8480
...
...
@@ -28,6 +28,7 @@ class CamListViewHolder(itemView: View) : CommonViewHolder<WebCamModel>(itemView
override
fun
onViewBound
(
model
:
WebCamModel
)
{
camTitle
.
text
=
model
.
title
camStatus
.
text
=
if
(
model
.
streams
.
isNullOrEmpty
())
"ОФФЛАЙН"
else
"ОНЛАЙН"
itemView
.
isEnabled
=
!
model
.
streams
.
isNullOrEmpty
()
camStatusIcon
.
visibility
=
if
(
model
.
streams
.
isNullOrEmpty
())
View
.
GONE
else
View
.
VISIBLE
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/web_cam/ScreenController.kt
View file @
39fc8480
package
com.biganto.visual.roompark.presentation.screen.web_cam
import
android.content.pm.ActivityInfo
import
android.net.Uri
import
android.os.Bundle
import
android.view.View
import
android.view.WindowManager
import
androidx.core.os.bundleOf
import
butterknife.BindView
import
com.biganto.visual.roompark.R
...
...
@@ -23,7 +25,6 @@ import com.google.android.exoplayer2.trackselection.DefaultTrackSelector
import
com.google.android.exoplayer2.ui.PlayerView
import
com.google.android.exoplayer2.upstream.DefaultBandwidthMeter
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
import
timber.log.Timber
import
javax.inject.Inject
...
...
@@ -50,6 +51,10 @@ class WebCamScreenController :
override
fun
onViewBound
(
v
:
View
)
{
activity
?.
window
?.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_FULLSCREEN
)
activity
?.
requestedOrientation
=
ActivityInfo
.
SCREEN_ORIENTATION_USER_LANDSCAPE
toolBar
.
setToolbar
()
bottomNavigationController
.
hide
()
}
...
...
@@ -77,6 +82,12 @@ class WebCamScreenController :
}
}
override
fun
handleBack
():
Boolean
{
activity
?.
window
?.
clearFlags
(
WindowManager
.
LayoutParams
.
FLAG_FULLSCREEN
)
activity
?.
requestedOrientation
=
ActivityInfo
.
SCREEN_ORIENTATION_USER_PORTRAIT
return
super
.
handleBack
()
}
private
fun
render
(
viewState
:
WebCamScreenViewState
.
Idle
){
}
...
...
@@ -155,19 +166,17 @@ class WebCamScreenController :
playerView
.
player
=
player
val
sourceUrl
=
viewState
.
camList
.
first
{
it
.
index
==
viewState
.
selectedCamIndex
}.
streams
.
first
().
hls
val
sourceUrl
=
viewState
.
camList
.
first
{
it
.
index
==
viewState
.
selectedCamIndex
}
.
streams
.
last
().
hls
// var rtmpUrl = viewState.camList.first{it.index == viewState.selectedCamIndex}.streams
// .first().rtmp
// rtmpUrl = "rtmp://room-park.ru:1935/cam2-360/stream"
// Timber.d("source url : ${Uri.parse(rtmpUrl)}")
val
mediaSource
=
buildMediaSource
(
Uri
.
parse
(
sourceUrl
))
// val mediaSource = buildRtmps(Uri.parse(rtmpUrl))
Timber
.
d
(
"source url : ${Uri.parse(sourceUrl)}"
)
Timber
.
d
(
"mediaSource : $mediaSource"
)
player
.
prepare
(
mediaSource
,
true
,
true
)
player
.
playWhenReady
=
true
Timber
.
d
(
" after all: ${player.playbackState}"
)
// player.seekToDefaultPosition()
}
...
...
app/src/main/res/layout/photo_viewer.xml
View file @
39fc8480
...
...
@@ -9,4 +9,13 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<ProgressBar
android:id=
"@+id/photo_load_progress_bar"
style=
"?android:attr/progressBarStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:indeterminate=
"true"
android:layout_gravity=
"center"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/webcam_screen.xml
View file @
39fc8480
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/linearLayout9"
android:background=
"#FF000000"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<com.google.android.exoplayer2.ui.PlayerView
android:id=
"@+id/webCamPlayerView"
android:background=
"#FF000000"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
...
...
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