controller-detector

Detect and recognize input controllers (HID) and receive feedback based on connectivity changes.

Лицензия

Лицензия

Категории

Категории

IDE Инструменты разработки
Группа

Группа

com.aptoide.pt
Идентификатор

Идентификатор

controller-detector
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

controller-detector
Detect and recognize input controllers (HID) and receive feedback based on connectivity changes.
Ссылка на сайт

Ссылка на сайт

https://github.com/gmartinsribeiro/controller-detector
Система контроля версий

Система контроля версий

https://github.com/gmartinsribeiro/controller-detector

Скачать controller-detector

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.aptoide.pt/controller-detector/ -->
<dependency>
    <groupId>com.aptoide.pt</groupId>
    <artifactId>controller-detector</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.aptoide.pt/controller-detector/
implementation 'com.aptoide.pt:controller-detector:1.0.0'
// https://jarcasting.com/artifacts/com.aptoide.pt/controller-detector/
implementation ("com.aptoide.pt:controller-detector:1.0.0")
'com.aptoide.pt:controller-detector:aar:1.0.0'
<dependency org="com.aptoide.pt" name="controller-detector" rev="1.0.0">
  <artifact name="controller-detector" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.aptoide.pt', module='controller-detector', version='1.0.0')
)
libraryDependencies += "com.aptoide.pt" % "controller-detector" % "1.0.0"
[com.aptoide.pt/controller-detector "1.0.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.android.support » appcompat-v7 jar 24.0.0

Модули Проекта

Данный проект не имеет модулей.

Controller Detector

alt tag

Detect and recognize input controllers (HID) and receive feedback based on connectivity changes.

Installation

You can easily install this module using JCenter or Maven, by adding the following dependency to your build.gradle file:

dependencies {
 compile 'com.aptoide.pt:controller-detector:1.0.0'
 //...
}

Usage

Apart from this section, a complete example can be downloaded from this repo.

You need to create a InputDeviceConnector object and implement ControllerListener interface. For InputDeviceConnector you also need to:

  • Implement startDetectingDevices() to start detecting controllers (e.g. onCreate).
  • Implement stopDetectingDevices() to stop detecting controllers (e.g. onDestroy).
public class MainActivity extends AppCompatActivity implements ControllerListener {
    private InputDeviceConnector connector;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // ...
        connector = new InputDeviceConnector(getApplicationContext(), this);
        connector.startDetectingDevices();
        // ...
    }

    @Override
    protected void onDestroy(){
        super.onDestroy();
        // ...
        connector.stopDetectingDevices();
        // ...
    }
    
    @Override
    public void onControllerChange(DeviceController controller) {
        // ...
    }

    @Override
    public void onControllerConnect(DeviceController controller) {
        // ...
    }

    @Override
    public void onControllerDisconnect(int id) {
        // ...
    }
}

Notice onControllerDisconnect only an id is passed since the Device has been disconnected. This is the same id that you retrieve from DeviceController.getDevice().getId().

DeviceController

DeviceController defines two useful attributes that you can retrieve: an InputDevice and a DeviceInputType (enum).

For InputDevice you can read further here.

For DeviceInputType, it defines the following values: DPAD, GAMEPAD, KEYBOARD, MOUSE, STYLUS, TOUCHPAD, TOUCHSCREEN, TRACKBALL, TVREMOTE, UNRECOGNIZED

Tested Devices

An analysis of several devices was made in order to check the correctness of the recognition algorithm. This analysis and the list of confirmed supported devices is here.

Версии библиотеки

Версия
1.0.0