Commit 71e93548 authored by Martin Pollet's avatar Martin Pollet

Visualisation for effects, closes #39, CI only for CLJS

parent 7906b09d
Pipeline #162 passed with stage
in 4 minutes and 48 seconds
......@@ -5,7 +5,7 @@ variables:
ANDROID_SDK_TOOLS: "4333796"
before_script:
# Leiningen
### Leiningen
- wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
- chmod a+x lein
- export LEIN_ROOT=1
......@@ -13,26 +13,26 @@ before_script:
build:
script:
# compile CLJS
### compile CLJS
- npm install
- lein prod-build
# download Android SDK
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
- unzip -d android-sdk-linux android-sdk.zip
- echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
# compile Android apk
- cd android
- ./gradlew assembleRelease
artifacts:
paths:
- android/app/build/outputs/apk/release/app-release-unsigned.apk
### download Android SDK
#- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
#- unzip -d android-sdk-linux android-sdk.zip
#- echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
#- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
#- echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
#- export ANDROID_HOME=$PWD/android-sdk-linux
#- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
#- set +o pipefail
#- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
#- set -o pipefail
### compile Android apk
#- cd android
#- ./gradlew assembleRelease
#artifacts:
#paths:
#- android/app/build/outputs/apk/release/app-release-unsigned.apk
test:
script:
......
......@@ -10,6 +10,8 @@
"./images/clojure.png",
"./images/react-native.png",
"./images/light-switch.png",
"./images/rgb.png",
"./images/transparent.png",
"react-navigation",
"react-navigation-stack",
"react-native-vector-icons/MaterialCommunityIcons",
......
......@@ -15,6 +15,7 @@
(def scroll-view (adapt-react-class (.-ScrollView ReactNative)))
(def image (adapt-react-class (.-Image ReactNative)))
(def image-background (adapt-react-class (.-ImageBackground ReactNative)))
(def touchable-highlight (adapt-react-class (.-TouchableHighlight ReactNative)))
......
......@@ -15,6 +15,10 @@
(def COLOR_TEMP_WARM_DUO 2700)
(def COLOR_TEMP_COLD 6500)
(def rgb-img (js/require "./images/rgb.png"))
(def transparent-img (js/require "./images/transparent.png"))
(defn- correct-shown-color [value]
(if (< value 10) 0
(+ (* (/ (- 255 START_COLOR) 255) value) START_COLOR)
......@@ -49,18 +53,21 @@
(let [items (filter shelly/has-onoff? switches)]
(when (not-empty items)
(let [settings (subscribe [:settings])
color (:color @settings)
show-color? (:color @settings)
size c/DEFAULT_HEIGHT
icons (map-indexed
(fn [idx {:keys [state]}]
[icon {:key idx
:name (case (:ison state)
(println state)
[rn/image-background {:key idx
:source (if (and show-color? (< 0 (:effect state))) rgb-img transparent-img)
:style {:width size
:background-color (if show-color? (state2rgba state) "white")}}
[icon {:name (case (:ison state)
true "lightbulb-on"
false "lightbulb-off"
"alert-outline")
:color "grey" :size size
:style {:background-color (if color (state2rgba state) "white")}}
])
:color "grey" :size size}
]])
items)
]
[rn/view {:flex-direction "row" :height size}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment