Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Added colored buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmayer-dev committed Jun 12, 2022
1 parent fb1113c commit fac6988
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
18 changes: 15 additions & 3 deletions Macro Deck Client.Android/Assets/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ function connect(url) {
var labels = document.getElementsByClassName("label");
for (var i = 0; i < actionButtons.length; i++) {
actionButtons[i].style.backgroundImage = '';
actionButtons[i].classList.toggle("btn-secondary", true);
labels[i].style.backgroundImage = '';
}

Expand Down Expand Up @@ -163,7 +164,13 @@ function connect(url) {
button.style.backgroundImage = 'url(data:image/gif;base64,' + icon.IconBase64 + ')';
} else if (this.buttons[i].IconBase64) {
button.style.backgroundImage = 'url(data:image/gif;base64,' + this.buttons[i].IconBase64 + ')';
}
}

button.classList.toggle("btn-secondary", !this.buttons[i].BackgroundColorHex);

if (this.buttons[i].BackgroundColorHex) {
button.style.backgroundColor = this.buttons[i].BackgroundColorHex;
}
}

if (label) {
Expand Down Expand Up @@ -215,6 +222,12 @@ function connect(url) {
} else {
button.style.backgroundImage = '';
}

button.classList.toggle("btn-secondary", !obj.Buttons[0].BackgroundColorHex);

if (obj.Buttons[0].BackgroundColorHex) {
button.style.backgroundColor = obj.Buttons[0].BackgroundColorHex;
}
}

var label = document.getElementById("label_" + obj.Buttons[0].Position_Y + "_" + obj.Buttons[0].Position_X);
Expand Down Expand Up @@ -268,9 +281,8 @@ function generateGrid(columns, rows) {
column.setAttribute("id", "col_" + i + "_" + j);
column.classList.add("col");
column.classList.add("blockBox");
var button = document.createElement("button");
var button = document.createElement("div");
button.classList.add("action-button");
button.classList.add("btn");
button.classList.toggle("btn-secondary", buttonBackground);
button.setAttribute("id", i + "_" + j);
$(button).bind('touchstart', function() {
Expand Down
2 changes: 1 addition & 1 deletion Macro Deck Client.Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="231" android:versionName="2.3.1-beta" package="com.suchbyte.macrodeck" android:installLocation="auto">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="240" android:versionName="2.4.0-beta" package="com.suchbyte.macrodeck" android:installLocation="auto">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30" />
<application android:label="Macro Deck" android:theme="@style/MainTheme" android:usesCleartextTraffic="true" android:icon="@mipmap/launcher_foreground"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
2 changes: 1 addition & 1 deletion Macro Deck Client/Macro Deck Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<Version>2.3.1-beta</Version>
<Version>2.4.0-beta</Version>
<Authors>Manuel Mayer</Authors>
<ApplicationIcon>Macro Deck 2021.ico</ApplicationIcon>
<RootNamespace>SuchByte.MacroDeck</RootNamespace>
Expand Down

0 comments on commit fac6988

Please sign in to comment.