Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Code Cleanup #12

Merged
merged 10 commits into from
Jul 19, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix spelling
  • Loading branch information
aferditamuriqi committed Jul 19, 2018
commit a7d6984449d7724c7a384f3f9dfe217c08a358f8
10 changes: 5 additions & 5 deletions r2-shared/src/main/java/org/readium/r2/shared/Contributor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import java.io.Serializable

class Contributor : JSONable, Serializable {

var multilangName:MultilangString = MultilangString()
var multilanguageName:MultilanguageString = MultilanguageString()
var sortAs: String? = null
var roles: MutableList<String> = mutableListOf()
var links: MutableList<Link> = mutableListOf()
var identifier: String? = null

var name: String? = null
get() = multilangName.singleString
get() = multilanguageName.singleString

override fun getJSON() : JSONObject{
val obj = JSONObject()
Expand All @@ -38,7 +38,7 @@ fun parseContributors(contributors: Any) : List<Contributor> {
when (contributors) {
is String -> {
val c = Contributor()
c.multilangName.singleString = contributors
c.multilanguageName.singleString = contributors
result.add(c)
}
is JSONObject -> {
Expand All @@ -59,10 +59,10 @@ fun parseContributor(cDict: JSONObject) : Contributor {

if (cDict.has("name")){
if (cDict.get("name") is String) {
c.multilangName.singleString = cDict.getString("name")
c.multilanguageName.singleString = cDict.getString("name")
} else if (cDict.get("name") is JSONObject) {
val array = cDict.getJSONObject("name")
c.multilangName.multiString = array as MutableMap<String, String>
c.multilanguageName.multiString = array as MutableMap<String, String>
}

}
Expand Down
2 changes: 1 addition & 1 deletion r2-shared/src/main/java/org/readium/r2/shared/Link.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Link : JSONable, Serializable {
/// Indicate the bitrate for the link resource.
var bitrate: Int? = null

// The underlaying nodes in a tree structure of Links
// The underlying nodes in a tree structure of Links
var children: MutableList<Link> = mutableListOf()
// The MediaOverlays associated to the resource of the Link
var mediaOverlays: MediaOverlays? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package org.readium.r2.shared

class MediaOverlays(var nodes: MutableList<MediaOverlayNode> = mutableListOf()){
class MediaOverlays(private var nodes: MutableList<MediaOverlayNode> = mutableListOf()){

fun clip(id: String) : Clip {
val clip: Clip
Expand Down
10 changes: 5 additions & 5 deletions r2-shared/src/main/java/org/readium/r2/shared/Metadata.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import java.util.*

class Metadata : Serializable {
/// The structure used for the serialisation.
var multilangTitle: MultilangString? = null
var multilanguageTitle: MultilanguageString? = null
/// The title of the publication.
var title: String = ""
get() = multilangTitle?.singleString ?: ""
get() = multilanguageTitle?.singleString ?: ""

var languages: MutableList<String> = mutableListOf()
lateinit var identifier: String
Expand Down Expand Up @@ -52,7 +52,7 @@ class Metadata : Serializable {

var duration: Int? = null

fun titleForLang(key: String) : String? = multilangTitle?.multiString?.get(key)
fun titleForLang(key: String) : String? = multilanguageTitle?.multiString?.get(key)

fun writeJSON() : JSONObject{
val obj = JSONObject()
Expand Down Expand Up @@ -86,8 +86,8 @@ class Metadata : Serializable {
fun parseMetadata(metadataDict:JSONObject) : Metadata {
val m = Metadata()
if (metadataDict.has("title")) {
m.multilangTitle = MultilangString()
m.multilangTitle?.singleString = metadataDict.getString("title")
m.multilanguageTitle = MultilanguageString()
m.multilanguageTitle?.singleString = metadataDict.getString("title")
}
if (metadataDict.has("identifier")) {
m.identifier = metadataDict.getString("identifier")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package org.readium.r2.shared

import java.io.Serializable

class MultilangString : Serializable{
class MultilanguageString : Serializable{

var singleString: String? = null
var multiString: MutableMap<String, String> = mutableMapOf()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Enumerable(var index: Int, private val values: List<String>, ref: String,
class Incremental(var value: Float,
val min: Float,
val max: Float,
val step: Float,
private val step: Float,
private val suffix: String,
ref: String,
name: String) :
Expand Down Expand Up @@ -66,15 +66,15 @@ class UserProperties : Serializable {

val properties: MutableList<UserProperty> = mutableListOf()

fun addIncrementable(nValue: Float, min: Float, max: Float, step: Float, suffix: String, ref: String, name: String) {
fun addIncremental(nValue: Float, min: Float, max: Float, step: Float, suffix: String, ref: String, name: String) {
properties.add(Incremental(nValue, min, max, step, suffix, ref, name))
}

fun addSwitchable(onValue: String, offValue: String, on: Boolean, ref: String, name: String) {
properties.add(Switchable(onValue, offValue, on, ref, name))
}

fun addEnumeratable(index: Int, values: List<String>, ref: String, name: String) {
fun addEnumerable(index: Int, values: List<String>, ref: String, name: String) {
properties.add(Enumerable(index, values, ref, name))
}

Expand Down