-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e902edf
commit 016118a
Showing
16 changed files
with
195 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 16 additions & 1 deletion
17
app/src/main/java/io/github/pedalpi/displayview/resume/TitleView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
package io.github.pedalpi.displayview.resume | ||
|
||
import android.app.Activity | ||
import android.widget.TextView | ||
import com.github.salomonbrys.kotson.get | ||
import com.github.salomonbrys.kotson.string | ||
import com.google.gson.JsonElement | ||
import io.github.pedalpi.displayview.R | ||
|
||
class TitleView | ||
|
||
class TitleView(activity: Activity) { | ||
private var number: TextView = activity.findViewById(R.id.resumePedalboardNumber) as TextView | ||
private var name: TextView = activity.findViewById(R.id.resumePedalboardName) as TextView | ||
|
||
fun update(index: Int, pedalboard: JsonElement) { | ||
number.text = if (index < 10) "0$index" else "$index" | ||
name.text = pedalboard["name"].string | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
app/src/main/java/io/github/pedalpi/displayview/resume/effectview/EffectsGridItemDTO.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
package io.github.pedalpi.displayview.resume.effectview | ||
|
||
import com.github.salomonbrys.kotson.bool | ||
import com.github.salomonbrys.kotson.get | ||
import com.github.salomonbrys.kotson.string | ||
import com.google.gson.JsonElement | ||
|
||
class EffectsGridItemDTO(val index : Int, private val effect: JsonElement, private val plugin: JsonElement) { | ||
val name = "$index - ${plugin["name"].string}" | ||
|
||
val active: Boolean | ||
get() = effect["active"].bool | ||
|
||
val name = plugin["name"].string | ||
|
||
lateinit var viewHolder: EffectsGridItemAdapter.ViewHolder | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 40 additions & 4 deletions
44
app/src/main/java/io/github/pedalpi/displayview/resume/paramview/ParamsGridItemDTO.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,47 @@ | ||
package io.github.pedalpi.displayview.resume.paramview | ||
|
||
import com.github.salomonbrys.kotson.get | ||
import com.github.salomonbrys.kotson.string | ||
import com.github.salomonbrys.kotson.* | ||
import com.google.gson.JsonElement | ||
|
||
class ParamsGridItemDTO(val index : Int, private val param: JsonElement, private val plugin: JsonElement) { | ||
val name = "$index - ${plugin["name"].string}" | ||
|
||
class ParamsGridItemDTO(val index : Int, val param: JsonElement, val plugin: JsonElement) { | ||
|
||
enum class ParamType { | ||
COMBOBOX, | ||
KNOB, | ||
TOGGLE | ||
} | ||
|
||
lateinit var viewHolder: ParamsGridItemAdapter.ParamsGridItemViewHolder | ||
|
||
val name: String = plugin["name"].string | ||
var value: Number | ||
get() = param["value"].number | ||
set(value) { | ||
param["value"] = value | ||
} | ||
|
||
val minimum: Double = param["minimum"].double | ||
val maximum: Double = param["maximum"].double | ||
|
||
private val properties = plugin["properties"].array.map { value -> value.string } | ||
|
||
val type : ParamType = when { | ||
properties.contains("enumeration") -> ParamType.COMBOBOX | ||
properties.contains("toggled") -> ParamType.TOGGLE | ||
else -> ParamType.KNOB | ||
} | ||
|
||
val percent: Int | ||
get() = calculatePercent(value.toDouble()) | ||
|
||
private fun calculatePercent(current: Double): Int { | ||
return ((current - minimum) * 100 / (maximum - minimum)).toInt() | ||
} | ||
|
||
fun calculateValue(progress: Int): Double { | ||
return (progress * maximum + (100 - progress) * minimum) / 100.0 | ||
} | ||
|
||
val options: List<String> = plugin["scalePoints"].array.map { data -> data["label"].string } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.