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
de08b6cb
Commit
de08b6cb
authored
Jul 28, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update to global url usage
parent
2bc434e7
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
114 additions
and
35 deletions
+114
-35
build.gradle
app/build.gradle
+3
-9
RoomParkApplication.kt
...a/com/biganto/visual/roompark/base/RoomParkApplication.kt
+0
-3
utils.kt
...o/visual/roompark/conductor/dialogs/tour_chooser/utils.kt
+2
-1
RawData.kt
...isual/roompark/data/repository/api/biganto/raw/RawData.kt
+5
-0
File.kt
.../visual/roompark/data/repository/db/requrey/model/File.kt
+36
-7
TourPreview.kt
.../roompark/data/repository/db/requrey/model/TourPreview.kt
+2
-0
FileModule.kt
...iganto/visual/roompark/data/repository/file/FileModule.kt
+7
-2
TourDownloadService.kt
...ual/roompark/data/service/download/TourDownloadService.kt
+46
-5
build.gradle
build.gradle
+1
-1
gradle.properties
gradle.properties
+12
-7
No files found.
app/build.gradle
View file @
de08b6cb
...
@@ -71,16 +71,11 @@ android {
...
@@ -71,16 +71,11 @@ android {
}
}
}
}
aaptOptions
{
applicationVariants
.
all
{
variant
->
noCompress
'.unity3d'
,
'.ress'
,
'.resource'
,
'.obb'
if
(
variant
.
name
.
contains
(
"release"
))
{
variant
.
outputs
.
each
{
output
->
output
.
outputFileName
=
new
File
(
"Expeditor_v"
)
}
}
}
}
task
renameBundle
(
type:
Copy
)
{
task
renameBundle
(
type:
Copy
)
{
from
"$buildDir/outputs/bundle/release"
from
"$buildDir/outputs/bundle/release"
into
"../../"
into
"../../"
...
@@ -226,7 +221,6 @@ dependencies {
...
@@ -226,7 +221,6 @@ dependencies {
//RxKotlin
//RxKotlin
implementation
(
"io.reactivex.rxjava2:rxkotlin:$rxKotlinVersion"
)
implementation
(
"io.reactivex.rxjava2:rxkotlin:$rxKotlinVersion"
)
//Arch Lifecycle
//Arch Lifecycle
implementation
'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation
'androidx.lifecycle:lifecycle-extensions:2.2.0'
...
...
app/src/main/java/com/biganto/visual/roompark/base/RoomParkApplication.kt
View file @
de08b6cb
...
@@ -78,8 +78,5 @@ class RoomParkApplication : DaggerApplication() {
...
@@ -78,8 +78,5 @@ class RoomParkApplication : DaggerApplication() {
private
class
CrashlyticsTree
:
Timber
.
Tree
()
{
private
class
CrashlyticsTree
:
Timber
.
Tree
()
{
override
fun
log
(
priority
:
Int
,
tag
:
String
?,
message
:
String
,
throwable
:
Throwable
?)
{
override
fun
log
(
priority
:
Int
,
tag
:
String
?,
message
:
String
,
throwable
:
Throwable
?)
{
if
(
priority
==
Log
.
VERBOSE
||
priority
==
Log
.
DEBUG
)
return
if
(
priority
==
Log
.
VERBOSE
||
priority
==
Log
.
DEBUG
)
return
// Crashlytics.log(priority, tag, message)
// throwable?.let { Crashlytics.logException(it) }
}
}
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/tour_chooser/utils.kt
View file @
de08b6cb
...
@@ -7,6 +7,7 @@ import com.biganto.visual.roompark.data.repository.file.FileModule
...
@@ -7,6 +7,7 @@ import com.biganto.visual.roompark.data.repository.file.FileModule
import
com.biganto.visual.roompark.domain.model.TourModel
import
com.biganto.visual.roompark.domain.model.TourModel
import
com.biganto.visual.roompark.player.BigantoPlayerActivity
import
com.biganto.visual.roompark.player.BigantoPlayerActivity
import
com.biganto.visual.roompark.player.unity_utils.LoadTourConfig
import
com.biganto.visual.roompark.player.unity_utils.LoadTourConfig
import
java.io.File
/**
/**
* Created by Vladislav Bogdashkin on 07.04.2020.
* Created by Vladislav Bogdashkin on 07.04.2020.
...
@@ -22,7 +23,7 @@ fun startPlayer(context:Context,tour: TourModel)
...
@@ -22,7 +23,7 @@ fun startPlayer(context:Context,tour: TourModel)
val
tourConfig
=
LoadTourConfig
(
val
tourConfig
=
LoadTourConfig
(
tour
.
tour_id
.
toInt
(),
tour
.
tour_id
.
toInt
(),
tour
.
targetResolution
,
tour
.
targetResolution
,
FileModule
.
assetsDirectory
(
context
),
FileModule
.
assetsDirectory
(
context
)
.
plus
(
File
.
separator
).
plus
(
tour
.
footageUri
)
,
tour
.
metaPredict
,
tour
.
metaPredict
,
tour
.
previewUrl
,
tour
.
previewUrl
,
context
.
resources
?.
getBoolean
(
R
.
bool
.
isTablet
)
?.
not
()
?:
true
,
context
.
resources
?.
getBoolean
(
R
.
bool
.
isTablet
)
?.
not
()
?:
true
,
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/biganto/raw/RawData.kt
View file @
de08b6cb
...
@@ -8,6 +8,11 @@ import java.util.*
...
@@ -8,6 +8,11 @@ import java.util.*
*/
*/
data class
LiteTourMetaRaw
(
val
baseurl
:
String
,
val
tour_baseurl
:
String
)
data class
ErrorRaw
(
data class
ErrorRaw
(
val
code
:
Int
,
val
code
:
Int
,
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/File.kt
View file @
de08b6cb
package
com.biganto.visual.roompark.data.repository.db.requrey.model
package
com.biganto.visual.roompark.data.repository.db.requrey.model
import
com.biganto.visual.roompark.data.repository.api.biganto.IBigantoMobileApi.Companion.BASE_URL
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.LiteTourMetaRaw
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.TourFileRaw
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.TourFileRaw
import
com.biganto.visual.roompark.data.repository.db.requrey.RevisionString
import
com.biganto.visual.roompark.data.repository.db.requrey.RevisionString
import
com.biganto.visual.roompark.data.repository.db.requrey.utils.RevisionStringConverter
import
com.biganto.visual.roompark.data.repository.db.requrey.utils.RevisionStringConverter
import
com.biganto.visual.roompark.data.repository.file.FileModule
import
io.requery.*
import
io.requery.*
import
java.io.File
/**
/**
* Created by Vladislav Bogdashkin on 15.06.2018.
* Created by Vladislav Bogdashkin on 15.06.2018.
*/
*/
val
domainPredicthMatcher
=
"^(http|https)://"
.
toRegex
()
fun
toInitialName
(
fullPath
:
String
)
=
fullPath
.
hashCode
().
toString
()
@Entity
@Entity
interface
File
:
Persistable
{
interface
File
:
Persistable
{
// @get:Key
// @get:Key
...
@@ -21,21 +28,43 @@ interface File :Persistable {
...
@@ -21,21 +28,43 @@ interface File :Persistable {
val
downloadedSize
:
Long
val
downloadedSize
:
Long
@get
:
Nullable
@get
:
Nullable
val
isDownloaded
:
Boolean
val
isDownloaded
:
Boolean
@get
:
Nullable
// @get:ForeignKey(references = Skybox::class)
val
destination
:
String
// @get:ManyToOne(cascade = arrayOf(CascadeAction.NONE))
// var skyboxId:Skybox?
}
}
fun
fromRaw
(
raw
:
TourFileRaw
):
FileEntity
{
fun
fromRaw
(
raw
:
TourFileRaw
,
meta
:
LiteTourMetaRaw
):
FileEntity
{
val
entity
=
FileEntity
()
val
entity
=
FileEntity
()
entity
.
setDownloaded
(
false
)
entity
.
setDownloaded
(
false
)
entity
.
setDownloadedSize
(
0L
)
entity
.
setDownloadedSize
(
0L
)
entity
.
setTotalSize
(
raw
.
size
)
entity
.
setTotalSize
(
raw
.
size
)
entity
.
setUri
(
RevisionString
(
raw
.
url
.
substring
(
raw
.
url
.
indexOf
(
"asset"
))))
var
fileUri
=
raw
.
url
domainPredicthMatcher
.
containsMatchIn
(
raw
.
url
)
val
bui
=
raw
.
url
.
indexOf
(
meta
.
baseurl
)
if
(
bui
>=
0
)
fileUri
=
toInitialName
(
meta
.
baseurl
)
.
plus
(
File
.
separator
)
.
plus
(
raw
.
url
.
removeRange
(
0
,
bui
+
meta
.
baseurl
.
length
))
val
tui
=
raw
.
url
.
indexOf
(
meta
.
tour_baseurl
)
if
(
tui
>=
0
)
fileUri
=
toInitialName
(
meta
.
tour_baseurl
)
.
plus
(
File
.
separator
)
.
plus
(
raw
.
url
.
removeRange
(
0
,
tui
+
meta
.
tour_baseurl
.
length
))
entity
.
setUri
(
RevisionString
(
FileModule
.
assetsLocalPath
(
fileUri
)))
entity
.
setDestination
(
if
(
domainPredicthMatcher
.
containsMatchIn
(
raw
.
url
))
raw
.
url
else
BASE_URL
+
raw
.
url
)
return
entity
return
entity
}
}
fun
fromRaw
(
raw
:
List
<
TourFileRaw
>):
List
<
FileEntity
>
=
List
(
raw
.
size
)
{
index
->
fromRaw
(
raw
[
index
])
}
\ No newline at end of file
fun
fromRaw
(
raw
:
List
<
TourFileRaw
>,
meta
:
LiteTourMetaRaw
):
List
<
FileEntity
>
=
List
(
raw
.
size
)
{
index
->
fromRaw
(
raw
[
index
],
meta
)
}
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/TourPreview.kt
View file @
de08b6cb
...
@@ -60,6 +60,8 @@ interface TourPreview :Persistable {
...
@@ -60,6 +60,8 @@ interface TourPreview :Persistable {
@get
:
Convert
(
RevisionStringConverter
::
class
)
@get
:
Convert
(
RevisionStringConverter
::
class
)
val
metaFileEntityId
:
RevisionString
?
val
metaFileEntityId
:
RevisionString
?
val
tourBaseUrl
:
String
?
val
footageBaseUrl
:
String
?
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/file/FileModule.kt
View file @
de08b6cb
...
@@ -127,10 +127,15 @@ class FileModule @Inject constructor(val context: Application) {
...
@@ -127,10 +127,15 @@ class FileModule @Inject constructor(val context: Application) {
File
(
context
.
filesDir
.
absolutePath
.
plus
(
dirType
.
dir
))
File
(
context
.
filesDir
.
absolutePath
.
plus
(
dirType
.
dir
))
fun
assetsDirectory
(
context
:
Context
):
String
=
fun
assetsDirectory
(
context
:
Context
):
String
=
getDirectory
(
context
,
FileDirectory
.
ToursDir
(
"biganto"
)).
absolutePath
getDirectory
(
context
,
FileDirectory
.
ToursDir
(
BIGANTO_TOURS_FOLDER
)).
absolutePath
fun
assetsFile
(
context
:
Context
):
File
=
fun
assetsFile
(
context
:
Context
):
File
=
getDirectory
(
context
,
FileDirectory
.
ToursDir
(
"biganto"
))
getDirectory
(
context
,
FileDirectory
.
ToursDir
(
BIGANTO_TOURS_FOLDER
))
fun
assetsLocalPath
(
uri
:
String
):
String
=
FileDirectory
.
ToursDir
(
BIGANTO_TOURS_FOLDER
).
dir
.
plus
(
File
.
separator
).
plus
(
uri
)
private
const
val
BIGANTO_TOURS_FOLDER
=
"biganto"
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/service/download/TourDownloadService.kt
View file @
de08b6cb
...
@@ -9,17 +9,21 @@ import androidx.core.math.MathUtils.clamp
...
@@ -9,17 +9,21 @@ import androidx.core.math.MathUtils.clamp
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.data.repository.api.biganto.IBigantoApi
import
com.biganto.visual.roompark.data.repository.api.biganto.IBigantoApi
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.LiteTourMetaRaw
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.RevisionString
import
com.biganto.visual.roompark.data.repository.db.requrey.RevisionString
import
com.biganto.visual.roompark.data.repository.db.requrey.model.FileEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.FileEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.TourFileJunctionEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.TourFileJunctionEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.fromRaw
import
com.biganto.visual.roompark.data.repository.db.requrey.model.fromRaw
import
com.biganto.visual.roompark.data.repository.db.requrey.model.toInitialName
import
com.biganto.visual.roompark.data.repository.file.FileModule
import
com.biganto.visual.roompark.data.repository.file.FileModule
import
com.biganto.visual.roompark.data.service.lifecycle.ForegroundLifecycleObserver
import
com.biganto.visual.roompark.data.service.lifecycle.ForegroundLifecycleObserver
import
com.biganto.visual.roompark.data.service.notification.INotificationCenter
import
com.biganto.visual.roompark.data.service.notification.INotificationCenter
import
com.biganto.visual.roompark.domain.use_case.TOUR_IDS_TO_DOWNLOAD_KEY
import
com.biganto.visual.roompark.domain.use_case.TOUR_IDS_TO_DOWNLOAD_KEY
import
com.biganto.visual.roomparkvr.data.repository.db.requery.model.DownloadState
import
com.biganto.visual.roomparkvr.data.repository.db.requery.model.DownloadState
import
com.biganto.visual.roomparkvr.data.repository.db.requery.model.TourPreviewEntity
import
com.biganto.visual.roomparkvr.data.repository.db.requery.model.TourPreviewEntity
import
com.google.gson.Gson
import
com.google.gson.JsonParser
import
com.jakewharton.rxrelay2.PublishRelay
import
com.jakewharton.rxrelay2.PublishRelay
import
io.reactivex.BackpressureStrategy
import
io.reactivex.BackpressureStrategy
import
io.reactivex.Flowable
import
io.reactivex.Flowable
...
@@ -282,7 +286,9 @@ class DownloadManagerService @Inject constructor(
...
@@ -282,7 +286,9 @@ class DownloadManagerService @Inject constructor(
.
flatMap
{
raw
->
.
flatMap
{
raw
->
var
downloadedSize
=
0L
var
downloadedSize
=
0L
var
totalSize
=
0L
var
totalSize
=
0L
val
fileEntities
=
raw
.
files
.
map
(
::
fromRaw
)
val
meta
=
getLocalMeta
(
tour
)
val
fileEntities
=
fromRaw
(
raw
.
files
,
meta
)
mergeFiles
(
fileEntities
)
mergeFiles
(
fileEntities
)
val
jlist
=
db
.
getTourFilesJunction
(
tour
.
id
).
toList
()
val
jlist
=
db
.
getTourFilesJunction
(
tour
.
id
).
toList
()
...
@@ -561,12 +567,33 @@ class DownloadManagerService @Inject constructor(
...
@@ -561,12 +567,33 @@ class DownloadManagerService @Inject constructor(
api
.
getTourMetaAsString
(
tour
.
id
)
api
.
getTourMetaAsString
(
tour
.
id
)
.
map
{
meta
->
.
map
{
meta
->
tour
.
apply
{
tour
.
apply
{
val
metaUri
=
RevisionString
(
"$META_PREDICTION${tour.id}$META_FILE_TYPE"
)
try
{
setMetaFileEntityId
(
metaUri
)
fileModule
.
saveFileToDisk
(
fileModule
.
getFile
(
metaUri
.
uri
()),
meta
)
val
jMeta
=
JsonParser
().
parse
(
meta
).
asJsonArray
.
first
()
val
metaLite
=
Gson
().
fromJson
(
jMeta
,
LiteTourMetaRaw
::
class
.
java
)
val
metaUri
=
RevisionString
(
"$META_PREDICTION${tour.id}$META_FILE_TYPE"
)
setMetaFileEntityId
(
metaUri
)
setFootageBaseUrl
(
toInitialName
(
metaLite
.
baseurl
))
setTourBaseUrl
(
toInitialName
(
metaLite
.
tour_baseurl
))
fileModule
.
saveFileToDisk
(
fileModule
.
getAssetFile
(
File
.
separator
.
plus
(
tour
.
footageBaseUrl
)
.
plus
(
metaUri
.
uri
())
)
,
meta
)
}
catch
(
e
:
Exception
)
{
Timber
.
e
(
e
)
}
}
}
}
}
.
flatMap
{
db
.
upsertTourPreview
(
it
)
}
.
flatMap
{
db
.
upsertTourPreview
(
it
)
}
.
map
{
tour
.
id
}
.
map
{
tour
.
id
}
.
onErrorReturn
{
.
onErrorReturn
{
setTourStatus
(
tour
.
id
,
DownloadState
.
Crushed
)
setTourStatus
(
tour
.
id
,
DownloadState
.
Crushed
)
...
@@ -576,6 +603,20 @@ class DownloadManagerService @Inject constructor(
...
@@ -576,6 +603,20 @@ class DownloadManagerService @Inject constructor(
//#endregion oldMethod
//#endregion oldMethod
private
fun
getLocalMeta
(
tour
:
TourPreviewEntity
):
LiteTourMetaRaw
{
return
Gson
().
fromJson
(
JsonParser
().
parse
(
fileModule
.
getAssetFile
(
"/${tour.footageBaseUrl}"
.
plus
(
"/${tour.metaFileEntityId?.uri()}"
)
).
readText
()
).
asJsonArray
.
first
()
,
LiteTourMetaRaw
::
class
.
java
)
}
private
fun
refreshGallery
(
file
:
File
)
{
private
fun
refreshGallery
(
file
:
File
)
{
MediaScannerConnection
.
scanFile
(
context
,
arrayOf
(
file
.
path
),
null
MediaScannerConnection
.
scanFile
(
context
,
arrayOf
(
file
.
path
),
null
)
)
...
...
build.gradle
View file @
de08b6cb
...
@@ -15,7 +15,7 @@ buildscript {
...
@@ -15,7 +15,7 @@ buildscript {
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath
"org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath
"org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath
'com.google.gms:google-services:4.3.3'
classpath
'com.google.gms:google-services:4.3.3'
classpath
'com.google.firebase:firebase-crashlytics-gradle:2.
0.0-beta03
'
classpath
'com.google.firebase:firebase-crashlytics-gradle:2.
1.0
'
// NOTE: Do not place your application dependencies here; they belong
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// in the individual module build.gradle files
...
...
gradle.properties
View file @
de08b6cb
...
@@ -6,16 +6,21 @@
...
@@ -6,16 +6,21 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs
=
-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
kotlin.code.style
=
official
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.enableD8
=
true
# org.gradle.jvmargs=-Xmx1536m
org.gradle.jvmargs
=
-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.daemon
=
true
org.gradle.parallel
=
true
org.gradle.configureondemand
=
true
org.gradle.caching
=
true
android.enableBuildScriptClasspathCheck
=
false
android.useAndroidX
=
true
android.useAndroidX
=
true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier
=
true
android.enableJetifier
=
true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style
=
official
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