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
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
Show 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 {
}
}
applicationVariants
.
all
{
variant
->
if
(
variant
.
name
.
contains
(
"release"
))
{
variant
.
outputs
.
each
{
output
->
output
.
outputFileName
=
new
File
(
"Expeditor_v"
)
}
}
aaptOptions
{
noCompress
'.unity3d'
,
'.ress'
,
'.resource'
,
'.obb'
}
task
renameBundle
(
type:
Copy
)
{
from
"$buildDir/outputs/bundle/release"
into
"../../"
...
...
@@ -226,7 +221,6 @@ dependencies {
//RxKotlin
implementation
(
"io.reactivex.rxjava2:rxkotlin:$rxKotlinVersion"
)
//Arch Lifecycle
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() {
private
class
CrashlyticsTree
:
Timber
.
Tree
()
{
override
fun
log
(
priority
:
Int
,
tag
:
String
?,
message
:
String
,
throwable
:
Throwable
?)
{
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
import
com.biganto.visual.roompark.domain.model.TourModel
import
com.biganto.visual.roompark.player.BigantoPlayerActivity
import
com.biganto.visual.roompark.player.unity_utils.LoadTourConfig
import
java.io.File
/**
* Created by Vladislav Bogdashkin on 07.04.2020.
...
...
@@ -22,7 +23,7 @@ fun startPlayer(context:Context,tour: TourModel)
val
tourConfig
=
LoadTourConfig
(
tour
.
tour_id
.
toInt
(),
tour
.
targetResolution
,
FileModule
.
assetsDirectory
(
context
),
FileModule
.
assetsDirectory
(
context
)
.
plus
(
File
.
separator
).
plus
(
tour
.
footageUri
)
,
tour
.
metaPredict
,
tour
.
previewUrl
,
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.*
*/
data class
LiteTourMetaRaw
(
val
baseurl
:
String
,
val
tour_baseurl
:
String
)
data class
ErrorRaw
(
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
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.db.requrey.RevisionString
import
com.biganto.visual.roompark.data.repository.db.requrey.utils.RevisionStringConverter
import
com.biganto.visual.roompark.data.repository.file.FileModule
import
io.requery.*
import
java.io.File
/**
* Created by Vladislav Bogdashkin on 15.06.2018.
*/
val
domainPredicthMatcher
=
"^(http|https)://"
.
toRegex
()
fun
toInitialName
(
fullPath
:
String
)
=
fullPath
.
hashCode
().
toString
()
@Entity
interface
File
:
Persistable
{
// @get:Key
...
...
@@ -21,21 +28,43 @@ interface File :Persistable {
val
downloadedSize
:
Long
@get
:
Nullable
val
isDownloaded
:
Boolean
// @get:ForeignKey(references = Skybox::class)
// @get:ManyToOne(cascade = arrayOf(CascadeAction.NONE))
// var skyboxId:Skybox?
@get
:
Nullable
val
destination
:
String
}
fun
fromRaw
(
raw
:
TourFileRaw
):
FileEntity
{
fun
fromRaw
(
raw
:
TourFileRaw
,
meta
:
LiteTourMetaRaw
):
FileEntity
{
val
entity
=
FileEntity
()
entity
.
setDownloaded
(
false
)
entity
.
setDownloadedSize
(
0L
)
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
}
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 {
@get
:
Convert
(
RevisionStringConverter
::
class
)
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) {
File
(
context
.
filesDir
.
absolutePath
.
plus
(
dirType
.
dir
))
fun
assetsDirectory
(
context
:
Context
):
String
=
getDirectory
(
context
,
FileDirectory
.
ToursDir
(
"biganto"
)).
absolutePath
getDirectory
(
context
,
FileDirectory
.
ToursDir
(
BIGANTO_TOURS_FOLDER
)).
absolutePath
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
import
com.biganto.visual.roompark.R
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.raw.LiteTourMetaRaw
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.model.FileEntity
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.toInitialName
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.notification.INotificationCenter
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.TourPreviewEntity
import
com.google.gson.Gson
import
com.google.gson.JsonParser
import
com.jakewharton.rxrelay2.PublishRelay
import
io.reactivex.BackpressureStrategy
import
io.reactivex.Flowable
...
...
@@ -282,7 +286,9 @@ class DownloadManagerService @Inject constructor(
.
flatMap
{
raw
->
var
downloadedSize
=
0L
var
totalSize
=
0L
val
fileEntities
=
raw
.
files
.
map
(
::
fromRaw
)
val
meta
=
getLocalMeta
(
tour
)
val
fileEntities
=
fromRaw
(
raw
.
files
,
meta
)
mergeFiles
(
fileEntities
)
val
jlist
=
db
.
getTourFilesJunction
(
tour
.
id
).
toList
()
...
...
@@ -561,9 +567,30 @@ class DownloadManagerService @Inject constructor(
api
.
getTourMetaAsString
(
tour
.
id
)
.
map
{
meta
->
tour
.
apply
{
try
{
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
)
fileModule
.
saveFileToDisk
(
fileModule
.
getFile
(
metaUri
.
uri
()),
meta
)
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
)
}
...
...
@@ -576,6 +603,20 @@ class DownloadManagerService @Inject constructor(
//#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
)
{
MediaScannerConnection
.
scanFile
(
context
,
arrayOf
(
file
.
path
),
null
)
...
...
build.gradle
View file @
de08b6cb
...
...
@@ -15,7 +15,7 @@ buildscript {
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath
"org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
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
// in the individual module build.gradle files
...
...
gradle.properties
View file @
de08b6cb
...
...
@@ -6,16 +6,21 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs
=
-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# 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
# 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
# https://developer.android.com/topic/libraries/support-library/androidx-rn
kotlin.code.style
=
official
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
# Automatically convert third-party libraries to use AndroidX
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