Java 7-ness
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
def versionMajor = 0
|
||||
def versionMinor = 0
|
||||
def versionPatch = 3
|
||||
def androidVersionCode = 3
|
||||
final def versionMajor = 0
|
||||
final def versionMinor = 0
|
||||
final def versionPatch = 3
|
||||
final def androidVersionCode = 3
|
||||
|
||||
def targetSdk = rootProject.targetSdkVersion;
|
||||
def minSdkRed = rootProject.minSdkVersion;
|
||||
final def targetSdk = rootProject.targetSdkVersion;
|
||||
final def minSdkRed = rootProject.minSdkVersion;
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.compileSdkVersion
|
||||
buildToolsVersion rootProject.buildToolsVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion minSdkRed
|
||||
targetSdkVersion targetSdk
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DeviceControlActivity extends Activity {
|
||||
TextView mDataAsArray;
|
||||
private BluetoothGattCharacteristic mNotifyCharacteristic;
|
||||
private BluetoothLeService mBluetoothLeService;
|
||||
private List<List<BluetoothGattCharacteristic>> mGattCharacteristics = new ArrayList<List<BluetoothGattCharacteristic>>();
|
||||
private List<List<BluetoothGattCharacteristic>> mGattCharacteristics = new ArrayList<>();
|
||||
// If a given GATT characteristic is selected, check for supported features. This sample
|
||||
// demonstrates 'Read' and 'Notify' features. See
|
||||
// http://d.android.com/reference/android/bluetooth/BluetoothGatt.html for the complete
|
||||
@@ -177,26 +177,26 @@ public class DeviceControlActivity extends Activity {
|
||||
String uuid = null;
|
||||
final String unknownServiceString = getResources().getString(R.string.unknown_service);
|
||||
final String unknownCharaString = getResources().getString(R.string.unknown_characteristic);
|
||||
final List<Map<String, String>> gattServiceData = new ArrayList<Map<String, String>>();
|
||||
final List<List<Map<String, String>>> gattCharacteristicData = new ArrayList<List<Map<String, String>>>();
|
||||
mGattCharacteristics = new ArrayList<List<BluetoothGattCharacteristic>>();
|
||||
final List<Map<String, String>> gattServiceData = new ArrayList<>();
|
||||
final List<List<Map<String, String>>> gattCharacteristicData = new ArrayList<>();
|
||||
mGattCharacteristics = new ArrayList<>();
|
||||
|
||||
// Loops through available GATT Services.
|
||||
for (final BluetoothGattService gattService : gattServices) {
|
||||
final Map<String, String> currentServiceData = new HashMap<String, String>();
|
||||
final Map<String, String> currentServiceData = new HashMap<>();
|
||||
uuid = gattService.getUuid().toString();
|
||||
currentServiceData.put(LIST_NAME, GattAttributeResolver.getAttributeName(uuid, unknownServiceString));
|
||||
currentServiceData.put(LIST_UUID, uuid);
|
||||
gattServiceData.add(currentServiceData);
|
||||
|
||||
final List<Map<String, String>> gattCharacteristicGroupData = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> gattCharacteristicGroupData = new ArrayList<>();
|
||||
final List<BluetoothGattCharacteristic> gattCharacteristics = gattService.getCharacteristics();
|
||||
final List<BluetoothGattCharacteristic> charas = new ArrayList<BluetoothGattCharacteristic>();
|
||||
final List<BluetoothGattCharacteristic> charas = new ArrayList<>();
|
||||
|
||||
// Loops through available Characteristics.
|
||||
for (final BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {
|
||||
charas.add(gattCharacteristic);
|
||||
final Map<String, String> currentCharaData = new HashMap<String, String>();
|
||||
final Map<String, String> currentCharaData = new HashMap<>();
|
||||
uuid = gattCharacteristic.getUuid().toString();
|
||||
currentCharaData.put(LIST_NAME, GattAttributeResolver.getAttributeName(uuid, unknownCharaString));
|
||||
currentCharaData.put(LIST_UUID, uuid);
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BluetoothLeDeviceStore {
|
||||
|
||||
|
||||
public BluetoothLeDeviceStore() {
|
||||
mDeviceMap = new HashMap<String, BluetoothLeDevice>();
|
||||
mDeviceMap = new HashMap<>();
|
||||
}
|
||||
|
||||
public void addDevice(final BluetoothLeDevice device) {
|
||||
@@ -45,14 +45,14 @@ public class BluetoothLeDeviceStore {
|
||||
}
|
||||
|
||||
public EasyObjectCursor<BluetoothLeDevice> getDeviceCursor() {
|
||||
return new EasyObjectCursor<BluetoothLeDevice>(
|
||||
return new EasyObjectCursor<>(
|
||||
BluetoothLeDevice.class,
|
||||
getDeviceList(),
|
||||
"address");
|
||||
}
|
||||
|
||||
public List<BluetoothLeDevice> getDeviceList() {
|
||||
final List<BluetoothLeDevice> methodResult = new ArrayList<BluetoothLeDevice>(mDeviceMap.values());
|
||||
final List<BluetoothLeDevice> methodResult = new ArrayList<>(mDeviceMap.values());
|
||||
|
||||
Collections.sort(methodResult, new Comparator<BluetoothLeDevice>() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user