finalised things that could be final
This commit is contained in:
+12
-12
@@ -81,7 +81,7 @@ public class DeviceControlActivity extends Activity {
|
||||
// Code to manage Service lifecycle.
|
||||
private final ServiceConnection mServiceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName componentName, IBinder service) {
|
||||
public void onServiceConnected(final ComponentName componentName, final IBinder service) {
|
||||
mBluetoothLeService = ((BluetoothLeService.LocalBinder) service).getService();
|
||||
if (!mBluetoothLeService.initialize()) {
|
||||
Log.e(TAG, "Unable to initialize Bluetooth");
|
||||
@@ -92,7 +92,7 @@ public class DeviceControlActivity extends Activity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName componentName) {
|
||||
public void onServiceDisconnected(final ComponentName componentName) {
|
||||
mBluetoothLeService = null;
|
||||
}
|
||||
};
|
||||
@@ -105,7 +105,7 @@ public class DeviceControlActivity extends Activity {
|
||||
// this can be a result of read or notification operations.
|
||||
private final BroadcastReceiver mGattUpdateReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) {
|
||||
mConnected = true;
|
||||
@@ -138,7 +138,7 @@ public class DeviceControlActivity extends Activity {
|
||||
// list of supported characteristic features.
|
||||
private final ExpandableListView.OnChildClickListener servicesListClickListner = new ExpandableListView.OnChildClickListener() {
|
||||
@Override
|
||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
||||
public boolean onChildClick(final ExpandableListView parent, final View v, final int groupPosition, final int childPosition, final long id) {
|
||||
if (mGattCharacteristics != null) {
|
||||
final BluetoothGattCharacteristic characteristic = mGattCharacteristics.get(groupPosition).get(childPosition);
|
||||
final int charaProp = characteristic.getProperties();
|
||||
@@ -169,7 +169,7 @@ public class DeviceControlActivity extends Activity {
|
||||
mDataAsString.setText(R.string.no_data);
|
||||
}
|
||||
|
||||
private void generateExportString(List<BluetoothGattService> gattServices){
|
||||
private void generateExportString(final List<BluetoothGattService> gattServices){
|
||||
final String unknownServiceString = getResources().getString(R.string.unknown_service);
|
||||
final String unknownCharaString = getResources().getString(R.string.unknown_characteristic);
|
||||
final StringBuilder exportBuilder = new StringBuilder();
|
||||
@@ -187,7 +187,7 @@ public class DeviceControlActivity extends Activity {
|
||||
exportBuilder.append('\n');
|
||||
|
||||
String uuid = null;
|
||||
for (BluetoothGattService gattService : gattServices) {
|
||||
for (final BluetoothGattService gattService : gattServices) {
|
||||
uuid = gattService.getUuid().toString();
|
||||
|
||||
exportBuilder.append(GattAttributeResolver.getAttributeName(uuid, unknownServiceString));
|
||||
@@ -221,7 +221,7 @@ public class DeviceControlActivity extends Activity {
|
||||
// Demonstrates how to iterate through the supported GATT Services/Characteristics.
|
||||
// In this sample, we populate the data structure that is bound to the ExpandableListView
|
||||
// on the UI.
|
||||
private void displayGattServices(List<BluetoothGattService> gattServices) {
|
||||
private void displayGattServices(final List<BluetoothGattService> gattServices) {
|
||||
if (gattServices == null) return;
|
||||
generateExportString(gattServices);
|
||||
|
||||
@@ -233,7 +233,7 @@ public class DeviceControlActivity extends Activity {
|
||||
mGattCharacteristics = new ArrayList<List<BluetoothGattCharacteristic>>();
|
||||
|
||||
// Loops through available GATT Services.
|
||||
for (BluetoothGattService gattService : gattServices) {
|
||||
for (final BluetoothGattService gattService : gattServices) {
|
||||
final Map<String, String> currentServiceData = new HashMap<String, String>();
|
||||
uuid = gattService.getUuid().toString();
|
||||
currentServiceData.put(LIST_NAME, GattAttributeResolver.getAttributeName(uuid, unknownServiceString));
|
||||
@@ -275,7 +275,7 @@ public class DeviceControlActivity extends Activity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_gatt_services);
|
||||
|
||||
@@ -298,7 +298,7 @@ public class DeviceControlActivity extends Activity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.gatt_services, menu);
|
||||
if (mConnected) {
|
||||
menu.findItem(R.id.menu_connect).setVisible(false);
|
||||
@@ -325,7 +325,7 @@ public class DeviceControlActivity extends Activity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
switch(item.getItemId()) {
|
||||
case R.id.menu_connect:
|
||||
mBluetoothLeService.connect(mDeviceAddress);
|
||||
@@ -402,7 +402,7 @@ public class DeviceControlActivity extends Activity {
|
||||
return intentFilter;
|
||||
}
|
||||
|
||||
private static String tryString(String string, String fallback){
|
||||
private static String tryString(final String string, final String fallback){
|
||||
if(string == null){
|
||||
return fallback;
|
||||
} else{
|
||||
|
||||
+15
-15
@@ -28,7 +28,7 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
|
||||
private BluetoothLeDevice mDevice;
|
||||
|
||||
private void appendAdRecordView(MergeAdapter adapter, String title, AdRecord record){
|
||||
private void appendAdRecordView(final MergeAdapter adapter, final String title, final AdRecord record){
|
||||
final LinearLayout lt = (LinearLayout) getLayoutInflater().inflate(R.layout.list_item_view_adrecord, null);
|
||||
final TextView tvString = (TextView) lt.findViewById(R.id.data_as_string);
|
||||
final TextView tvArray = (TextView) lt.findViewById(R.id.data_as_array);
|
||||
@@ -41,7 +41,7 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
adapter.addView(lt);
|
||||
}
|
||||
|
||||
private void appendDeviceInfo(MergeAdapter adapter, BluetoothLeDevice device){
|
||||
private void appendDeviceInfo(final MergeAdapter adapter, final BluetoothLeDevice device){
|
||||
final LinearLayout lt = (LinearLayout) getLayoutInflater().inflate(R.layout.list_item_view_device_info, null);
|
||||
final TextView tvName = (TextView) lt.findViewById(R.id.deviceName);
|
||||
final TextView tvAddress = (TextView) lt.findViewById(R.id.deviceAddress);
|
||||
@@ -56,7 +56,7 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
adapter.addView(lt);
|
||||
}
|
||||
|
||||
private void appendHeader(MergeAdapter adapter, String title){
|
||||
private void appendHeader(final MergeAdapter adapter, final String title){
|
||||
final LinearLayout lt = (LinearLayout) getLayoutInflater().inflate(R.layout.list_item_view_header, null);
|
||||
final TextView tvTitle = (TextView) lt.findViewById(R.id.title);
|
||||
tvTitle.setText(title);
|
||||
@@ -64,7 +64,7 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
adapter.addView(lt);
|
||||
}
|
||||
|
||||
private void appendIBeaconInfo(MergeAdapter adapter, IBeaconManufacturerData iBeaconData){
|
||||
private void appendIBeaconInfo(final MergeAdapter adapter, final IBeaconManufacturerData iBeaconData){
|
||||
final LinearLayout lt = (LinearLayout) getLayoutInflater().inflate(R.layout.list_item_view_ibeacon_details, null);
|
||||
final TextView tvCompanyId = (TextView) lt.findViewById(R.id.companyId);
|
||||
final TextView tvAdvert = (TextView) lt.findViewById(R.id.advertisement);
|
||||
@@ -85,7 +85,7 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
adapter.addView(lt);
|
||||
}
|
||||
|
||||
private void appendRssiInfo(MergeAdapter adapter, BluetoothLeDevice device){
|
||||
private void appendRssiInfo(final MergeAdapter adapter, final BluetoothLeDevice device){
|
||||
final LinearLayout lt = (LinearLayout) getLayoutInflater().inflate(R.layout.list_item_view_rssi_info, null);
|
||||
final TextView tvFirstTimestamp = (TextView) lt.findViewById(R.id.firstTimestamp);
|
||||
final TextView tvFirstRssi = (TextView) lt.findViewById(R.id.firstRssi);
|
||||
@@ -102,11 +102,11 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
adapter.addView(lt);
|
||||
}
|
||||
|
||||
private void appendSimpleText(MergeAdapter adapter, byte data[]){
|
||||
private void appendSimpleText(final MergeAdapter adapter, final byte[] data){
|
||||
appendSimpleText(adapter, ByteUtils.byteArrayToHexString(data));
|
||||
}
|
||||
|
||||
private void appendSimpleText(MergeAdapter adapter, String data){
|
||||
private void appendSimpleText(final MergeAdapter adapter, final String data){
|
||||
final LinearLayout lt = (LinearLayout) getLayoutInflater().inflate(R.layout.list_item_view_textview, null);
|
||||
final TextView tvData = (TextView) lt.findViewById(R.id.data);
|
||||
|
||||
@@ -116,16 +116,16 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
}
|
||||
|
||||
|
||||
private String formatRssi(double rssi){
|
||||
private String formatRssi(final double rssi){
|
||||
return getString(R.string.formatter_db, String.valueOf(rssi));
|
||||
}
|
||||
|
||||
private String formatRssi(int rssi){
|
||||
private String formatRssi(final int rssi){
|
||||
return getString(R.string.formatter_db, String.valueOf(rssi));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_details);
|
||||
ButterKnife.inject(this);
|
||||
@@ -136,13 +136,13 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.details, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_connect:
|
||||
|
||||
@@ -156,7 +156,7 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
return true;
|
||||
}
|
||||
|
||||
private void pupulateDetails(BluetoothLeDevice device) {
|
||||
private void pupulateDetails(final BluetoothLeDevice device) {
|
||||
final MergeAdapter adapter = new MergeAdapter();
|
||||
|
||||
if(device == null){
|
||||
@@ -196,11 +196,11 @@ public class DeviceDetailsActivity extends ListActivity{
|
||||
getListView().setAdapter(adapter);
|
||||
}
|
||||
|
||||
private static String formatTime(long time){
|
||||
private static String formatTime(final long time){
|
||||
return TimeFormatter.getIsoDateTime(time);
|
||||
}
|
||||
|
||||
private static String hexEncode(int integer){
|
||||
private static String hexEncode(final int integer){
|
||||
return "0x" + Integer.toHexString(integer).toUpperCase(Locale.US);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class MainActivity extends ListActivity {
|
||||
|
||||
private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
|
||||
@Override
|
||||
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
|
||||
public void onLeScan(final BluetoothDevice device, final int rssi, final byte[] scanRecord) {
|
||||
|
||||
final BluetoothLeDevice deviceLe = new BluetoothLeDevice(device, rssi, scanRecord, System.currentTimeMillis());
|
||||
mDeviceStore.addDevice(deviceLe);
|
||||
@@ -53,7 +53,7 @@ public class MainActivity extends ListActivity {
|
||||
}
|
||||
};
|
||||
|
||||
private void updateItemCount(int count){
|
||||
private void updateItemCount(final int count){
|
||||
mTvItemCount.setText(
|
||||
getString(
|
||||
R.string.formatter_item_count,
|
||||
@@ -79,14 +79,14 @@ public class MainActivity extends ListActivity {
|
||||
.setTitle(R.string.menu_about)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {}
|
||||
public void onClick(final DialogInterface dialog, final int id) {}
|
||||
})
|
||||
.setView(textView)
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
ButterKnife.inject(this);
|
||||
@@ -98,7 +98,7 @@ public class MainActivity extends ListActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
if (!mScanner.isScanning()) {
|
||||
menu.findItem(R.id.menu_stop).setVisible(false);
|
||||
@@ -120,7 +120,7 @@ public class MainActivity extends ListActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
protected void onListItemClick(final ListView l, final View v, final int position, final long id) {
|
||||
final BluetoothLeDevice device = (BluetoothLeDevice) mLeDeviceListAdapter.getItem(position);
|
||||
if (device == null) return;
|
||||
|
||||
@@ -132,7 +132,7 @@ public class MainActivity extends ListActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_scan:
|
||||
startScan();
|
||||
|
||||
@@ -18,7 +18,7 @@ public class LeDeviceListAdapter extends SimpleCursorAdapter {
|
||||
private final LayoutInflater mInflator;
|
||||
private final Activity mActivity;
|
||||
|
||||
public LeDeviceListAdapter(Activity activity, EasyObjectCursor<BluetoothLeDevice> cursor) {
|
||||
public LeDeviceListAdapter(final Activity activity, final EasyObjectCursor<BluetoothLeDevice> cursor) {
|
||||
super(activity, R.layout.list_item_device, cursor, new String[0], new int[0], 0);
|
||||
mInflator = activity.getLayoutInflater();
|
||||
mActivity = activity;
|
||||
@@ -31,18 +31,18 @@ public class LeDeviceListAdapter extends SimpleCursorAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BluetoothLeDevice getItem(int i){
|
||||
public BluetoothLeDevice getItem(final int i){
|
||||
return getCursor().getItem(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
public long getItemId(final int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
ViewHolder viewHolder;
|
||||
public View getView(final int i, View view, final ViewGroup viewGroup) {
|
||||
final ViewHolder viewHolder;
|
||||
// General ListView optimization code.
|
||||
if (view == null) {
|
||||
view = mInflator.inflate(R.layout.list_item_device, null);
|
||||
|
||||
+8
-8
@@ -31,7 +31,7 @@ public class BluetoothLeDeviceStore {
|
||||
mDeviceMap = new HashMap<String, BluetoothLeDevice>();
|
||||
}
|
||||
|
||||
public void addDevice(BluetoothLeDevice device){
|
||||
public void addDevice(final BluetoothLeDevice device){
|
||||
if(mDeviceMap.containsKey(device.getAddress())){
|
||||
mDeviceMap.get(device.getAddress()).updateRssiReading(device.getTimestamp(), device.getRssi());
|
||||
} else {
|
||||
@@ -44,19 +44,19 @@ public class BluetoothLeDeviceStore {
|
||||
}
|
||||
|
||||
|
||||
private FileWriter generateFile(File file, String contents){
|
||||
private FileWriter generateFile(final File file, final String contents){
|
||||
FileWriter writer = null;
|
||||
try {
|
||||
writer = new FileWriter(file);
|
||||
writer.append(contents);
|
||||
writer.flush();
|
||||
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class BluetoothLeDeviceStore {
|
||||
Collections.sort(methodResult, new Comparator<BluetoothLeDevice>() {
|
||||
|
||||
@Override
|
||||
public int compare(BluetoothLeDevice arg0, BluetoothLeDevice arg1) {
|
||||
public int compare(final BluetoothLeDevice arg0, final BluetoothLeDevice arg1) {
|
||||
return arg0.getAddress().compareToIgnoreCase(arg1.getAddress());
|
||||
}
|
||||
});
|
||||
@@ -104,7 +104,7 @@ public class BluetoothLeDeviceStore {
|
||||
sb.append(CsvWriterHelper.addStuff("accuracy"));
|
||||
sb.append('\n');
|
||||
|
||||
for(BluetoothLeDevice device : list){
|
||||
for(final BluetoothLeDevice device : list){
|
||||
sb.append(CsvWriterHelper.addStuff(device.getAddress()));
|
||||
sb.append(CsvWriterHelper.addStuff(device.getName()));
|
||||
sb.append(CsvWriterHelper.addStuff(TimeFormatter.getIsoDateTime(device.getFirstTimestamp())));
|
||||
@@ -152,7 +152,7 @@ public class BluetoothLeDeviceStore {
|
||||
}
|
||||
|
||||
|
||||
public void shareDataAsEmail(Context context){
|
||||
public void shareDataAsEmail(final Context context){
|
||||
final long timeInMillis = System.currentTimeMillis();
|
||||
|
||||
final String to = null;
|
||||
@@ -175,7 +175,7 @@ public class BluetoothLeDeviceStore {
|
||||
i.putExtra(Intent.EXTRA_TEXT, message);
|
||||
context.startActivity(Intent.createChooser(i, context.getString(R.string.exporter_email_device_list_picker_text)));
|
||||
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ public class BluetoothLeService extends Service {
|
||||
// connection change and services discovered.
|
||||
private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
|
||||
@Override
|
||||
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
|
||||
String intentAction;
|
||||
public void onConnectionStateChange(final BluetoothGatt gatt, final int status, final int newState) {
|
||||
final String intentAction;
|
||||
if (newState == BluetoothProfile.STATE_CONNECTED) {
|
||||
intentAction = ACTION_GATT_CONNECTED;
|
||||
mConnectionState = STATE_CONNECTED;
|
||||
@@ -80,7 +80,7 @@ public class BluetoothLeService extends Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
|
||||
public void onServicesDiscovered(final BluetoothGatt gatt, final int status) {
|
||||
if (status == BluetoothGatt.GATT_SUCCESS) {
|
||||
broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);
|
||||
} else {
|
||||
@@ -89,14 +89,14 @@ public class BluetoothLeService extends Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
|
||||
public void onCharacteristicRead(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic, final int status) {
|
||||
if (status == BluetoothGatt.GATT_SUCCESS) {
|
||||
broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||
public void onCharacteristicChanged(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic) {
|
||||
broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
|
||||
}
|
||||
};
|
||||
@@ -126,12 +126,12 @@ public class BluetoothLeService extends Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
public IBinder onBind(final Intent intent) {
|
||||
return mBinder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUnbind(Intent intent) {
|
||||
public boolean onUnbind(final Intent intent) {
|
||||
// After using a given device, you should make sure that BluetoothGatt.close() is called
|
||||
// such that resources are cleaned up properly. In this particular example, close() is
|
||||
// invoked when the UI is disconnected from the Service.
|
||||
@@ -243,7 +243,7 @@ public class BluetoothLeService extends Service {
|
||||
*
|
||||
* @param characteristic The characteristic to read from.
|
||||
*/
|
||||
public void readCharacteristic(BluetoothGattCharacteristic characteristic) {
|
||||
public void readCharacteristic(final BluetoothGattCharacteristic characteristic) {
|
||||
if (mBluetoothAdapter == null || mBluetoothGatt == null) {
|
||||
Log.w(TAG, "BluetoothAdapter not initialized");
|
||||
return;
|
||||
@@ -257,7 +257,7 @@ public class BluetoothLeService extends Service {
|
||||
* @param characteristic Characteristic to act on.
|
||||
* @param enabled If true, enable notification. False otherwise.
|
||||
*/
|
||||
public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic, boolean enabled) {
|
||||
public void setCharacteristicNotification(final BluetoothGattCharacteristic characteristic, final boolean enabled) {
|
||||
if (mBluetoothAdapter == null || mBluetoothGatt == null) {
|
||||
Log.w(TAG, "BluetoothAdapter not initialized");
|
||||
return;
|
||||
|
||||
@@ -10,7 +10,7 @@ public class BluetoothLeScanner {
|
||||
private final BluetoothUtils mBluetoothUtils;
|
||||
private boolean mScanning;
|
||||
|
||||
public BluetoothLeScanner(BluetoothAdapter.LeScanCallback leScanCallback, BluetoothUtils bluetoothUtils){
|
||||
public BluetoothLeScanner(final BluetoothAdapter.LeScanCallback leScanCallback, final BluetoothUtils bluetoothUtils){
|
||||
mHandler = new Handler();
|
||||
mLeScanCallback = leScanCallback;
|
||||
mBluetoothUtils = bluetoothUtils;
|
||||
|
||||
@@ -14,7 +14,7 @@ public final class BluetoothUtils {
|
||||
|
||||
public final static int REQUEST_ENABLE_BT = 2001;
|
||||
|
||||
public BluetoothUtils(Activity activity){
|
||||
public BluetoothUtils(final Activity activity){
|
||||
mActivity = activity;
|
||||
mBluetoothManager = (BluetoothManager) mActivity.getSystemService(Context.BLUETOOTH_SERVICE);
|
||||
mBluetoothAdapter = mBluetoothManager.getAdapter();
|
||||
|
||||
@@ -2,15 +2,15 @@ package uk.co.alt236.btlescan.util;
|
||||
|
||||
public class CsvWriterHelper {
|
||||
private static final String QUOTE = "\"";
|
||||
public static String addStuff(Integer text){
|
||||
public static String addStuff(final Integer text){
|
||||
return QUOTE + text + QUOTE + ",";
|
||||
}
|
||||
|
||||
public static String addStuff(Long text){
|
||||
public static String addStuff(final Long text){
|
||||
return QUOTE + text + QUOTE + ",";
|
||||
}
|
||||
|
||||
public static String addStuff(boolean value){
|
||||
public static String addStuff(final boolean value){
|
||||
return QUOTE + value + QUOTE + ",";
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ public class TimeFormatter {
|
||||
private final static String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS zzz";
|
||||
private final static SimpleDateFormat ISO_FORMATTER = new UtcDateFormatter(ISO_FORMAT, Locale.US);
|
||||
|
||||
public static String getIsoDateTime(Date date){
|
||||
public static String getIsoDateTime(final Date date){
|
||||
return ISO_FORMATTER.format(date);
|
||||
}
|
||||
|
||||
public static String getIsoDateTime(long millis){
|
||||
public static String getIsoDateTime(final long millis){
|
||||
return getIsoDateTime(new Date(millis));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,18 +42,18 @@ public class UtcDateFormatter extends java.text.SimpleDateFormat{
|
||||
private static final TimeZone TIME_ZONE_UTC = TimeZone.getTimeZone(TIME_ZONE_STRING);
|
||||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
public UtcDateFormatter(String template){
|
||||
public UtcDateFormatter(final String template){
|
||||
super(template);
|
||||
super.setTimeZone(TIME_ZONE_UTC);
|
||||
}
|
||||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
public UtcDateFormatter(String template, DateFormatSymbols symbols){
|
||||
public UtcDateFormatter(final String template, final DateFormatSymbols symbols){
|
||||
super(template, symbols);
|
||||
super.setTimeZone(TIME_ZONE_UTC);
|
||||
}
|
||||
|
||||
public UtcDateFormatter(String template, Locale locale){
|
||||
public UtcDateFormatter(final String template, final Locale locale){
|
||||
super(template, locale);
|
||||
super.setTimeZone(TIME_ZONE_UTC);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class UtcDateFormatter extends java.text.SimpleDateFormat{
|
||||
* @see java.text.DateFormat#setTimeZone(java.util.TimeZone)
|
||||
*/
|
||||
@Override
|
||||
public void setTimeZone(TimeZone timezone){
|
||||
public void setTimeZone(final TimeZone timezone){
|
||||
throw new UnsupportedOperationException("This SimpleDateFormat can only be in " + TIME_ZONE_STRING);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user