Fixed some static analysis issues
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.1.0'
|
||||
classpath 'com.android.tools.build:gradle:1.2.3'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
||||
android.library=true
|
||||
@@ -12,7 +12,6 @@ import android.os.Parcelable;
|
||||
* Expanded by Alexandros Schillings
|
||||
*/
|
||||
public final class AdRecord implements Parcelable{
|
||||
|
||||
// 02 # Number of bytes that follow in first AD structure
|
||||
// 01 # Flags AD type
|
||||
// 1A # Flags value 0x1A = 000011010
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ public final class IBeaconManufacturerData {
|
||||
}
|
||||
|
||||
private static String calculateUUIDString(final byte[] uuid){
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
|
||||
for(int i = 0 ; i< uuid.length; i++){
|
||||
if(i == 4){sb.append('-');}
|
||||
|
||||
@@ -14,7 +14,7 @@ import android.util.SparseArray;
|
||||
public class AdRecordUtils {
|
||||
|
||||
public static String getRecordDataAsString(final AdRecord nameRecord) {
|
||||
if(nameRecord == null){return new String();}
|
||||
if(nameRecord == null){return "";}
|
||||
return new String(nameRecord.getData());
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ByteUtils {
|
||||
* @return the string
|
||||
*/
|
||||
public static String byteArrayToHexString(final byte[] array){
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
boolean firstEntry = true;
|
||||
sb.append('[');
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class IBeaconUtils {
|
||||
* Ascertains whether a Manufacturer Data byte array belongs to an iBeacon;
|
||||
*
|
||||
* @param manufacturerData a Bluetooth LE device's raw manufacturerData.
|
||||
* @return
|
||||
* @return true if the manufacturer data belong to an iBeacon
|
||||
*/
|
||||
public static boolean isThisAnIBeacon(final byte[] manufacturerData){
|
||||
if(manufacturerData == null){return false;}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=Google Inc.:Google APIs:19
|
||||
android.library.reference.1=../library
|
||||
+3
-4
@@ -76,7 +76,6 @@ public class DeviceControlActivity extends Activity {
|
||||
|
||||
private boolean mConnected = false;
|
||||
private String mExportString;
|
||||
private BluetoothLeDevice mDevice;
|
||||
|
||||
// Code to manage Service lifecycle.
|
||||
private final ServiceConnection mServiceConnection = new ServiceConnection() {
|
||||
@@ -280,9 +279,9 @@ public class DeviceControlActivity extends Activity {
|
||||
setContentView(R.layout.activity_gatt_services);
|
||||
|
||||
final Intent intent = getIntent();
|
||||
mDevice = intent.getParcelableExtra(EXTRA_DEVICE);
|
||||
mDeviceName = mDevice.getName();
|
||||
mDeviceAddress = mDevice.getAddress();
|
||||
final BluetoothLeDevice device = intent.getParcelableExtra(EXTRA_DEVICE);
|
||||
mDeviceName = device.getName();
|
||||
mDeviceAddress = device.getAddress();
|
||||
|
||||
ButterKnife.inject(this);
|
||||
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
CompanyIdentifierResolver.getCompanyName(iBeaconData.getCompanyIdentifier(), getString(R.string.unknown))
|
||||
+ " (" + hexEncode(iBeaconData.getCompanyIdentifier()) + ")");
|
||||
tvAdvert.setText(iBeaconData.getIBeaconAdvertisement() + " (" + hexEncode( iBeaconData.getIBeaconAdvertisement() ) + ")");
|
||||
tvUUID.setText(iBeaconData.getUUID().toString());
|
||||
tvUUID.setText(iBeaconData.getUUID());
|
||||
tvMajor.setText(iBeaconData.getMajor() + " (" + hexEncode( iBeaconData.getMajor() ) + ")");
|
||||
tvMinor.setText(iBeaconData.getMinor() + " (" + hexEncode( iBeaconData.getMinor() ) + ")");
|
||||
tvTxPower.setText(iBeaconData.getCalibratedTxPower() + " (" + hexEncode( iBeaconData.getCalibratedTxPower() ) + ")");
|
||||
|
||||
@@ -35,7 +35,7 @@ public class MainActivity extends ListActivity {
|
||||
private LeDeviceListAdapter mLeDeviceListAdapter;
|
||||
private BluetoothLeDeviceStore mDeviceStore;
|
||||
|
||||
private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
|
||||
private final BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
|
||||
@Override
|
||||
public void onLeScan(final BluetoothDevice device, final int rssi, final byte[] scanRecord) {
|
||||
|
||||
@@ -121,10 +121,9 @@ public class MainActivity extends ListActivity {
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(final ListView l, final View v, final int position, final long id) {
|
||||
final BluetoothLeDevice device = (BluetoothLeDevice) mLeDeviceListAdapter.getItem(position);
|
||||
final BluetoothLeDevice device = mLeDeviceListAdapter.getItem(position);
|
||||
if (device == null) return;
|
||||
|
||||
|
||||
final Intent intent = new Intent(this, DeviceDetailsActivity.class);
|
||||
intent.putExtra(DeviceDetailsActivity.EXTRA_DEVICE, device);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class LeDeviceListAdapter extends SimpleCursorAdapter {
|
||||
viewHolder.ibeaconDistance = (TextView) view.findViewById(R.id.ibeacon_distance);
|
||||
viewHolder.ibeaconUUID = (TextView) view.findViewById(R.id.ibeacon_uuid);
|
||||
viewHolder.ibeaconTxPower = (TextView) view.findViewById(R.id.ibeacon_tx_power);
|
||||
viewHolder.ibeaconSection = (View) view.findViewById(R.id.ibeacon_section);
|
||||
viewHolder.ibeaconSection = view.findViewById(R.id.ibeacon_section);
|
||||
viewHolder.ibeaconDistanceDescriptor = (TextView) view.findViewById(R.id.ibeacon_distance_descriptor);
|
||||
view.setTag(viewHolder);
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class BluetoothLeDeviceStore {
|
||||
}
|
||||
|
||||
|
||||
private FileWriter generateFile(final File file, final String contents){
|
||||
private static FileWriter generateFile(final File file, final String contents){
|
||||
FileWriter writer = null;
|
||||
try {
|
||||
writer = new FileWriter(file);
|
||||
|
||||
@@ -10,14 +10,13 @@ import android.content.pm.PackageManager;
|
||||
public final class BluetoothUtils {
|
||||
private final Activity mActivity;
|
||||
private final BluetoothAdapter mBluetoothAdapter;
|
||||
private final BluetoothManager mBluetoothManager;
|
||||
|
||||
|
||||
public final static int REQUEST_ENABLE_BT = 2001;
|
||||
|
||||
public BluetoothUtils(final Activity activity){
|
||||
mActivity = activity;
|
||||
mBluetoothManager = (BluetoothManager) mActivity.getSystemService(Context.BLUETOOTH_SERVICE);
|
||||
mBluetoothAdapter = mBluetoothManager.getAdapter();
|
||||
final BluetoothManager btManager = (BluetoothManager) mActivity.getSystemService(Context.BLUETOOTH_SERVICE);
|
||||
mBluetoothAdapter = btManager.getAdapter();
|
||||
}
|
||||
|
||||
public void askUserToEnableBluetoothIfNeeded(){
|
||||
|
||||
Reference in New Issue
Block a user