diff --git a/app/build.gradle b/app/build.gradle index 57949d5e1..83850c092 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -86,6 +86,7 @@ android { enableSplit = false } } + namespace 'org.xbmc.kore' compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/app/src/debug/AndroidManifest.xml b/app/src/debug/AndroidManifest.xml index 4819c3390..00dea88a6 100644 --- a/app/src/debug/AndroidManifest.xml +++ b/app/src/debug/AndroidManifest.xml @@ -1,8 +1,7 @@ + xmlns:tools="http://schemas.android.com/tools"> + xmlns:tools="http://schemas.android.com/tools"> diff --git a/app/src/main/java/org/xbmc/kore/eventclient/PacketBUTTON.java b/app/src/main/java/org/xbmc/kore/eventclient/PacketBUTTON.java index 3738711c7..2bf8bdfab 100644 --- a/app/src/main/java/org/xbmc/kore/eventclient/PacketBUTTON.java +++ b/app/src/main/java/org/xbmc/kore/eventclient/PacketBUTTON.java @@ -17,15 +17,16 @@ */ package org.xbmc.kore.eventclient; + /** * XBMC Event Client Class - * + *

* A button packet send a key press or release event to XBMC - * @author Stefan Agner * + * @author Stefan Agner */ public class PacketBUTTON extends Packet { - + protected final static byte BT_USE_NAME = 0x01; protected final static byte BT_DOWN = 0x02; protected final static byte BT_UP = 0x04; @@ -36,122 +37,122 @@ public class PacketBUTTON extends Packet { protected final static byte BT_AXIS = (byte)0x80; protected final static byte BT_AXISSINGLE = (byte)0x100; - /** - * A button packet send a key press or release event to XBMC - * @param code raw button code (default: 0) - * @param repeat this key press should repeat until released (default: 1) - * Note that queued pressed cannot repeat. - * @param down if this is 1, it implies a press event, 0 implies a release - * event. (default: 1) - * @param queue a queued key press means that the button event is - * executed just once after which the next key press is processed. - * It can be used for macros. Currently there is no support for - * time delays between queued presses. (default: 0) - * @param amount unimplemented for now; in the future it will be used for - * specifying magnitude of analog key press events - * @param axis Axis - */ - public PacketBUTTON(short code, boolean repeat, boolean down, boolean queue, short amount, byte axis) - { - super(PT_BUTTON); - String map_name = ""; - String button_name = ""; - short flags = 0; - appendPayload(code, map_name, button_name, repeat, down, queue, amount, axis, flags); - } - - /** - * A button packet send a key press or release event to XBMC - * @param map_name a combination of map_name and button_name refers to a - * mapping in the user's Keymap.xml or Lircmap.xml. - * map_name can be one of the following: - *

    - *
  • "KB" => standard keyboard map ( section )
  • - *
  • "XG" => xbox gamepad map ( section )
  • - *
  • "R1" => xbox remote map ( section )
  • - *
  • "R2" => xbox universal remote map ( section )
  • - *
  • "LI:devicename" => LIRC remote map where 'devicename' is the - * actual device's name
- * @param button_name a button name defined in the map specified in map_name. - * For example, if map_name is "KB" refering to the section in Keymap.xml - * then, valid button_names include "printscreen", "minus", "x", etc. - * @param repeat this key press should repeat until released (default: 1) - * Note that queued pressed cannot repeat. - * @param down if this is 1, it implies a press event, 0 implies a release - * event. (default: 1) - * @param queue a queued key press means that the button event is - * executed just once after which the next key press is processed. - * It can be used for macros. Currently there is no support for - * time delays between queued presses. (default: 0) - * @param amount unimplemented for now; in the future it will be used for - * specifying magnitude of analog key press events - * @param axis Axis - */ - public PacketBUTTON(String map_name, String button_name, boolean repeat, boolean down, boolean queue, short amount, byte axis) - { - super(PT_BUTTON); - short code = 0; - short flags = BT_USE_NAME; - appendPayload(code, map_name, button_name, repeat, down, queue, amount, axis, flags); - } - - /** - * Appends Payload for a Button Packet (this method is used by the different Constructors of this Packet) - * @param code raw button code (default: 0) - * @param map_name a combination of map_name and button_name refers to a - * mapping in the user's Keymap.xml or Lircmap.xml. - * map_name can be one of the following: - *
    - *
  • "KB" => standard keyboard map ( section )
  • - *
  • "XG" => xbox gamepad map ( section )
  • - *
  • "R1" => xbox remote map ( section )
  • - *
  • "R2" => xbox universal remote map ( section )
  • - *
  • "LI:devicename" => LIRC remote map where 'devicename' is the - * actual device's name
- * @param button_name a button name defined in the map specified in map_name. - * For example, if map_name is "KB" refering to the section in Keymap.xml - * then, valid button_names include "printscreen", "minus", "x", etc. - * @param repeat this key press should repeat until released (default: 1) - * Note that queued pressed cannot repeat. - * @param down if this is 1, it implies a press event, 0 implies a release - * event. (default: 1) - * @param queue a queued key press means that the button event is - * executed just once after which the next key press is processed. - * It can be used for macros. Currently there is no support for - * time delays between queued presses. (default: 0) - * @param amount unimplemented for now; in the future it will be used for - * specifying magnitude of analog key press events - * @param axis Axis - * @param flags Packet specific flags - */ - private void appendPayload(short code, String map_name, String button_name, boolean repeat, boolean down, boolean queue, short amount, byte axis, short flags) - { - if(amount>0) - flags |= BT_USE_AMOUNT; - else - amount = 0; - - if(down) + /** + * A button packet send a key press or release event to XBMC + * + * @param code raw button code (default: 0) + * @param repeat this key press should repeat until released (default: 1) + * Note that queued pressed cannot repeat. + * @param down if this is 1, it implies a press event, 0 implies a release + * event. (default: 1) + * @param queue a queued key press means that the button event is + * executed just once after which the next key press is processed. + * It can be used for macros. Currently there is no support for + * time delays between queued presses. (default: 0) + * @param amount unimplemented for now; in the future it will be used for + * specifying magnitude of analog key press events + * @param axis Axis + */ + public PacketBUTTON(short code, boolean repeat, boolean down, boolean queue, short amount, byte axis) { + super(PT_BUTTON); + String map_name = ""; + String button_name = ""; + short flags = 0; + appendPayload(code, map_name, button_name, repeat, down, queue, amount, axis, flags); + } + + /** + * A button packet send a key press or release event to XBMC + * + * @param map_name a combination of map_name and button_name refers to a + * mapping in the user's Keymap.xml or Lircmap.xml. + * map_name can be one of the following: + *
    + *
  • "KB" => standard keyboard map ( section )
  • + *
  • "XG" => xbox gamepad map ( section )
  • + *
  • "R1" => xbox remote map ( section )
  • + *
  • "R2" => xbox universal remote map ( section )
  • + *
  • "LI:devicename" => LIRC remote map where 'devicename' is the + * actual device's name
+ * @param button_name a button name defined in the map specified in map_name. + * For example, if map_name is "KB" refering to the section in Keymap.xml + * then, valid button_names include "printscreen", "minus", "x", etc. + * @param repeat this key press should repeat until released (default: 1) + * Note that queued pressed cannot repeat. + * @param down if this is 1, it implies a press event, 0 implies a release + * event. (default: 1) + * @param queue a queued key press means that the button event is + * executed just once after which the next key press is processed. + * It can be used for macros. Currently there is no support for + * time delays between queued presses. (default: 0) + * @param amount unimplemented for now; in the future it will be used for + * specifying magnitude of analog key press events + * @param axis Axis + */ + public PacketBUTTON(String map_name, String button_name, boolean repeat, boolean down, boolean queue, short amount, byte axis) { + super(PT_BUTTON); + short code = 0; + short flags = BT_USE_NAME; + appendPayload(code, map_name, button_name, repeat, down, queue, amount, axis, flags); + } + + /** + * Appends Payload for a Button Packet (this method is used by the different Constructors of this Packet) + * + * @param code raw button code (default: 0) + * @param map_name a combination of map_name and button_name refers to a + * mapping in the user's Keymap.xml or Lircmap.xml. + * map_name can be one of the following: + *
    + *
  • "KB" => standard keyboard map ( section )
  • + *
  • "XG" => xbox gamepad map ( section )
  • + *
  • "R1" => xbox remote map ( section )
  • + *
  • "R2" => xbox universal remote map ( section )
  • + *
  • "LI:devicename" => LIRC remote map where 'devicename' is the + * actual device's name
+ * @param button_name a button name defined in the map specified in map_name. + * For example, if map_name is "KB" refering to the section in Keymap.xml + * then, valid button_names include "printscreen", "minus", "x", etc. + * @param repeat this key press should repeat until released (default: 1) + * Note that queued pressed cannot repeat. + * @param down if this is 1, it implies a press event, 0 implies a release + * event. (default: 1) + * @param queue a queued key press means that the button event is + * executed just once after which the next key press is processed. + * It can be used for macros. Currently there is no support for + * time delays between queued presses. (default: 0) + * @param amount unimplemented for now; in the future it will be used for + * specifying magnitude of analog key press events + * @param axis Axis + * @param flags Packet specific flags + */ + private void appendPayload(short code, String map_name, String button_name, boolean repeat, boolean down, boolean queue, short amount, byte axis, short flags) { + if (amount > 0) + flags |= BT_USE_AMOUNT; + else + amount = 0; + + if (down) flags |= BT_DOWN; else flags |= BT_UP; - - if(!repeat) + + if (!repeat) flags |= BT_NO_REPEAT; - - if(queue) + + if (queue) flags |= BT_QUEUE; - - if(axis == 1) + + if (axis == 1) flags |= BT_AXISSINGLE; else if (axis == 2) flags |= BT_AXIS; - - appendPayload(code); - appendPayload(flags); - appendPayload(amount); - appendPayload(map_name); - appendPayload(button_name); - } + + appendPayload(code); + appendPayload(flags); + appendPayload(amount); + appendPayload(map_name); + appendPayload(button_name); + } } diff --git a/build.gradle b/build.gradle index 2938208ae..bbdec9a2e 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.2.2' + classpath 'com.android.tools.build:gradle:7.4.2' // NOTE: Do not place your application dependencies here; // they belong in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e5897b..8049c684f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists