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
53f4fbc3
Commit
53f4fbc3
authored
Apr 03, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
styles fix
parent
c70a92c2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
252 additions
and
8 deletions
+252
-8
DownloadTourDialogController.kt
...ctor/dialogs/tour_chooser/DownloadTourDialogController.kt
+125
-0
TourChooserDialogController.kt
...uctor/dialogs/tour_chooser/TourChooserDialogController.kt
+16
-8
horizontal_progress_downloader.xml
app/src/main/res/drawable/horizontal_progress_downloader.xml
+30
-0
download_tour_layout.xml
app/src/main/res/layout-v23/download_tour_layout.xml
+55
-0
strings.xml
app/src/main/res/values/strings.xml
+6
-0
styles.xml
app/src/main/res/values/styles.xml
+20
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/tour_chooser/DownloadTourDialogController.kt
0 → 100644
View file @
53f4fbc3
package
com.biganto.visual.roompark.conductor.dialogs.tour_chooser
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.ImageView
import
android.widget.ProgressBar
import
android.widget.TextView
import
androidx.annotation.LayoutRes
import
androidx.core.os.bundleOf
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.interactor.ToursInteractor
import
com.biganto.visual.roompark.domain.model.TourModel
import
com.biganto.visual.roompark.domain.use_case.DownloadUseCase
import
com.biganto.visual.roomparkvr.data.repository.db.requery.model.TourPreviewEntity
import
com.bluelinelabs.conductor.Controller
import
com.bumptech.glide.Glide
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.disposables.CompositeDisposable
import
jp.wasabeef.glide.transformations.BlurTransformation
import
jp.wasabeef.glide.transformations.ColorFilterTransformation
import
timber.log.Timber
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.04.2019.
*/
internal
const
val
DOWNLOAD_TOUR_ID_KEY
=
"DOWNLOAD_TOUR_ID_KEY"
class
DownloadTourDialogController
:
Controller
{
constructor
(
args
:
Bundle
)
:
super
(
args
)
constructor
(
tourArg
:
TourModel
)
:
super
(
bundleOf
(
DOWNLOAD_TOUR_ID_KEY
to
tourArg
))
lateinit
var
progressBarDownload
:
ProgressBar
lateinit
var
downloaderBg
:
ImageView
lateinit
var
downloadTourTitleText
:
TextView
lateinit
var
cancelDownloadText
:
TextView
private
val
tour
:
TourModel
by
lazy
{
args
.
getParcelable
<
TourModel
>(
DOWNLOAD_TOUR_ID_KEY
)
}
private
var
downloadToken
=
DownloadUseCase
.
CancellationToken
(
false
)
@Inject
lateinit
var
downloader
:
ToursInteractor
private
val
disposables
=
CompositeDisposable
()
override
fun
onDetach
(
view
:
View
)
{
disposables
.
clear
()
super
.
onDetach
(
view
)
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
):
View
{
val
view
=
inflater
.
inflate
(
getLayoutId
(),
container
,
false
)
progressBarDownload
=
view
.
findViewById
(
R
.
id
.
downloadProgress
)
downloaderBg
=
view
.
findViewById
(
R
.
id
.
backgroundDownloader
)
cancelDownloadText
=
view
.
findViewById
(
R
.
id
.
cancelDownloadButton
)
downloadTourTitleText
=
view
.
findViewById
(
R
.
id
.
tourToDownloadTitle
)
// progress.visibility = View.VISIBLE
downloadToken
.
isCancelled
=
true
downloadToken
=
DownloadUseCase
.
CancellationToken
(
false
)
downloadTourTitleText
.
text
=
tour
.
title
Glide
.
with
(
view
)
.
load
(
tour
.
previewUrl
)
.
transform
(
BlurTransformation
(
25
,
1
))
.
transform
(
ColorFilterTransformation
(
0
x99000000
.
toInt
()))
.
into
(
downloaderBg
)
disposables
.
add
(
downloader
.
downloadTour
(
tour
.
tour_id
,
downloadToken
)
.
onErrorReturn
{
Timber
.
e
(
it
);
TourPreviewEntity
()
}
// .onErrorReturn { parseError(it);TourPreviewEntity() }
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
{
model
->
updateProgressBar
(
model
.
downloadedFiles
,
model
.
overallFiles
)
if
(
model
.
overallFiles
==
model
.
downloadedFiles
)
{
Timber
.
w
(
"FINISH DOIWLNLOD"
)
//Start PLayer
}
// activity?.runOnUiThread { startPlayerById(model.id) }
}
,{
error
->
Timber
.
e
(
error
)
// snackbars.showSnackBar("Ошибка во время загрузки тура!")
}
))
// downloadTour(it.tour.tour_id, downloadToken)
view
.
findViewById
<
View
>(
R
.
id
.
close_current_button
).
setOnClickListener
{
handleBack
()
}
return
view
}
private
fun
updateProgressBar
(
curr
:
Int
,
max
:
Int
){
activity
?.
runOnUiThread
{
progressBarDownload
.
max
=
max
progressBarDownload
.
progress
=
curr
}
}
@LayoutRes
fun
getLayoutId
()
=
R
.
layout
.
photo_viewer
override
fun
handleBack
():
Boolean
{
return
router
.
popCurrentController
()
}
}
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/tour_chooser/TourChooserDialogController.kt
View file @
53f4fbc3
...
@@ -4,16 +4,21 @@ import android.os.Bundle
...
@@ -4,16 +4,21 @@ import android.os.Bundle
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.ImageView
import
androidx.annotation.LayoutRes
import
androidx.annotation.LayoutRes
import
androidx.recyclerview.widget.DividerItemDecoration
import
androidx.recyclerview.widget.DividerItemDecoration
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
butterknife.BindView
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.conductor.dialogs.change_handler.DialogChangeHandler
import
com.biganto.visual.roompark.domain.model.TourModel
import
com.biganto.visual.roompark.domain.model.TourModel
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import
com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import
com.bluelinelabs.conductor.Controller
import
com.bluelinelabs.conductor.Controller
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.google.android.material.textview.MaterialTextView
import
com.google.android.material.textview.MaterialTextView
import
io.reactivex.disposables.CompositeDisposable
import
io.reactivex.disposables.CompositeDisposable
import
timber.log.Timber
import
timber.log.Timber
...
@@ -65,14 +70,10 @@ class ChooseTourDialogController : Controller {
...
@@ -65,14 +70,10 @@ class ChooseTourDialogController : Controller {
detachDisposable
.
add
(
detachDisposable
.
add
(
(
recyclerView
.
adapter
as
TourChooserAdapter
).
onItemClicked
.
subscribe
{
(
recyclerView
.
adapter
as
TourChooserAdapter
).
onItemClicked
.
subscribe
{
Timber
.
d
(
"gonna shit : $it"
)
Timber
.
d
(
"gonna shit : $it"
)
// router.replaceTopController(RouterTransaction.with(
router
.
replaceTopController
(
RouterTransaction
.
with
(
DownloadTourDialogController
(
it
))
// PhotoDialogController(
.
popChangeHandler
(
DialogChangeHandler
())
// it.url
.
pushChangeHandler
(
DialogChangeHandler
())
// )
)
// )
// .popChangeHandler(DialogChangeHandler())
// .pushChangeHandler(DialogChangeHandler())
// )
})
})
view
.
findViewById
<
View
>(
R
.
id
.
close_current_button
).
setOnClickListener
{
handleBack
()
}
view
.
findViewById
<
View
>(
R
.
id
.
close_current_button
).
setOnClickListener
{
handleBack
()
}
...
@@ -97,11 +98,18 @@ internal class TourChooserAdapter:CommonRecyclerAdapter<TourChooserViewHolder,To
...
@@ -97,11 +98,18 @@ internal class TourChooserAdapter:CommonRecyclerAdapter<TourChooserViewHolder,To
internal
class
TourChooserViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
TourModel
>(
itemView
){
internal
class
TourChooserViewHolder
(
itemView
:
View
)
:
CommonViewHolder
<
TourModel
>(
itemView
){
@BindView
(
R
.
id
.
tour_preview_imageView
)
lateinit
var
tourPreview
:
ImageView
@BindView
(
R
.
id
.
tour_name
)
@BindView
(
R
.
id
.
tour_name
)
lateinit
var
tourName
:
MaterialTextView
lateinit
var
tourName
:
MaterialTextView
override
fun
onViewBound
(
model
:
TourModel
)
{
override
fun
onViewBound
(
model
:
TourModel
)
{
tourName
.
text
=
model
.
title
tourName
.
text
=
model
.
title
Glide
.
with
(
tourPreview
)
.
load
(
model
.
previewUrl
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
)
.
into
(
tourPreview
)
}
}
}
}
app/src/main/res/drawable/horizontal_progress_downloader.xml
0 → 100644
View file @
53f4fbc3
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@android:id/background"
>
<shape>
<corners
android:radius=
"2dip"
/>
<solid
android:color=
"#33000000"
/>
</shape>
</item>
<item
android:id=
"@android:id/secondaryProgress"
>
<clip>
<shape>
<corners
android:radius=
"2dip"
/>
<solid
android:color=
"#ccFFFFFF"
/>
</shape>
</clip>
</item>
<item
android:id=
"@android:id/progress"
>
<clip>
<shape>
<corners
android:radius=
"2dip"
/>
<solid
android:color=
"#FFFFFFFF"
/>
</shape>
</clip>
</item>
</layer-list>
\ No newline at end of file
app/src/main/res/layout-v23/download_tour_layout.xml
0 → 100644
View file @
53f4fbc3
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:id=
"@+id/download_container"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:id=
"@+id/backgroundDownloader"
android:scaleType=
"centerCrop"
android:background=
"#A62B2727"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:id=
"@+id/downloadingTitle"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginEnd=
"32dp"
android:layout_marginStart=
"32dp"
android:gravity=
"center_horizontal"
android:textAlignment=
"center"
style=
"@style/NoticeTextDownloader"
app:layout_constraintTop_toTopOf=
"parent"
android:layout_marginTop=
"32dp"
android:layout_marginBottom=
"32dp"
app:layout_constraintBottom_toBottomOf=
"@+id/backgroundDownloader"
app:layout_constraintVertical_bias=
"0.32999998"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/tourToDownloadTitle"
app:layout_constraintTop_toBottomOf=
"@+id/downloadingTitle"
app:layout_constraintStart_toStartOf=
"parent"
android:layout_marginStart=
"32dp"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginEnd=
"32dp"
style=
"@style/TitleTextDownloader"
/>
<ProgressBar
style=
"?android:attr/progressBarStyleHorizontal"
android:layout_width=
"0dp"
android:layout_height=
"4dp"
android:id=
"@+id/downloadProgress"
app:layout_constraintTop_toBottomOf=
"@+id/tourToDownloadTitle"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginStart=
"150dp"
android:layout_marginEnd=
"150dp"
android:progressDrawable=
"@drawable/horizontal_progress_downloader"
android:layout_marginTop=
"8dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/cancelDownloadButton"
app:layout_constraintTop_toBottomOf=
"@+id/downloadProgress"
android:layout_marginTop=
"16dp"
app:layout_constraintStart_toStartOf=
"parent"
android:layout_marginStart=
"32dp"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginEnd=
"32dp"
android:layout_marginBottom=
"32dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintVertical_bias=
"0.24000001"
style=
"@style/CancelTextDownloader"
android:padding=
"4dp"
android:paddingStart=
"8dp"
android:paddingEnd=
"8dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
53f4fbc3
...
@@ -96,4 +96,10 @@
...
@@ -96,4 +96,10 @@
<string
name=
"subscribe_error_message"
>
Ошибка! Подписаться не удалось!
</string>
<string
name=
"subscribe_error_message"
>
Ошибка! Подписаться не удалось!
</string>
<!--endregion-->
<!--endregion-->
<string
name=
"download_tour_title_text"
>
Скачивается тур
</string>
<string
name=
"download_tour_cancel_text"
>
Отмена
</string>
</resources>
</resources>
app/src/main/res/values/styles.xml
View file @
53f4fbc3
...
@@ -424,4 +424,24 @@
...
@@ -424,4 +424,24 @@
//endregion
//endregion
<style
name=
"NoticeTextDownloader"
parent=
"Default_TextView"
>
<item
name=
"android:textColor"
>
@color/colorNoticeText
</item>
<item
name=
"android:text"
>
@string/download_tour_title_text
</item>
</style>
<style
name=
"TitleTextDownloader"
parent=
"Default_TextView"
>
<!-- <item name="android:textColor">@color/def</item>-->
</style>
<style
name=
"BubbleTitleText"
parent=
"Header_TextView.Main_Header"
>
</style>
<style
name=
"CancelTextDownloader"
parent=
"Default_TextView"
>
<item
name=
"android:textColor"
>
@color/colorError
</item>
<item
name=
"android:text"
>
@string/download_tour_cancel_text
</item>
</style>
</resources>
</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