Skip to content

Commit

Permalink
Working android project (#335)
Browse files Browse the repository at this point in the history
* Set compatibility to JavaVersion.VERSION_1_8

* SDL java files from 154ad6faa944a022daba8d5852833d312872e21d

* Do not load shared SDL2 lib

---------

Co-authored-by: WojtaZam <[email protected]>
  • Loading branch information
wambrozewicz and WojtaZam authored Dec 3, 2024
1 parent c313e45 commit 3998c8b
Show file tree
Hide file tree
Showing 8 changed files with 1,161 additions and 1,092 deletions.
6 changes: 6 additions & 0 deletions dev/android-project/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ android {
}
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildTypes {
release {
minifyEnabled false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ public HIDDeviceBLESteamController(HIDDeviceManager manager, BluetoothDevice dev
mHandler = new Handler(Looper.getMainLooper());

mGatt = connectGatt();
final HIDDeviceBLESteamController finalThis = this;
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
finalThis.checkConnectionForChromebookIssue();
}
}, CHROMEBOOK_CONNECTION_CHECK_INTERVAL);
// final HIDDeviceBLESteamController finalThis = this;
// mHandler.postDelayed(new Runnable() {
// @Override
// public void run() {
// finalThis.checkConnectionForChromebookIssue();
// }
// }, CHROMEBOOK_CONNECTION_CHECK_INTERVAL);
}

public String getIdentifier() {
Expand All @@ -186,7 +186,7 @@ public BluetoothGatt getGatt() {
// Because on Chromebooks we show up as a dual-mode device, it will attempt to connect TRANSPORT_AUTO, which will use TRANSPORT_BREDR instead
// of TRANSPORT_LE. Let's force ourselves to connect low energy.
private BluetoothGatt connectGatt(boolean managed) {
if (Build.VERSION.SDK_INT >= 23) {
if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) {
try {
return mDevice.connectGatt(mManager.getContext(), managed, this, TRANSPORT_LE);
} catch (Exception e) {
Expand Down Expand Up @@ -470,7 +470,7 @@ public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristi
// Only register controller with the native side once it has been fully configured
if (!isRegistered()) {
Log.v(TAG, "Registering Steam Controller with ID: " + getId());
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0);
mManager.HIDDeviceConnected(getId(), getIdentifier(), getVendorId(), getProductId(), getSerialNumber(), getVersion(), getManufacturerName(), getProductName(), 0, 0, 0, 0);
setRegistered();
}
}
Expand Down Expand Up @@ -564,6 +564,11 @@ public String getProductName() {
return "Steam Controller";
}

@Override
public UsbDevice getDevice() {
return null;
}

@Override
public boolean open() {
return true;
Expand Down
Loading

0 comments on commit 3998c8b

Please sign in to comment.