Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1923,8 +1923,8 @@ public void stateHandler(Object obj){
}

private static final byte PING_BYTE = (byte) 0xB5;
private java.util.concurrent.ScheduledExecutorService pingExec;
private java.util.concurrent.ScheduledFuture<?> pingTask;
private transient java.util.concurrent.ScheduledExecutorService pingExec;
private transient java.util.concurrent.ScheduledFuture<?> pingTask;

public void startPingTask() {
if (pingExec != null && !pingExec.isShutdown()) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.shimmerresearch.driver.ShimmerDevice;

import java.util.List;
import java.util.Objects;

/**
* A simple {@link Fragment} subclass.
Expand Down Expand Up @@ -83,7 +84,7 @@ public void buildShimmersConnectedListView(final List<ShimmerDevice> deviceList,
displayList[i] = nameList[i] + "\n" + macList[i];
}

ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(context, R.layout.simple_list_item_multiple_choice_force_black_text, displayList);
ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_multiple_choice, displayList);

//Set the list of devices to be displayed in the Fragment
setListAdapter(listAdapter);
Expand All @@ -93,7 +94,7 @@ public void buildShimmersConnectedListView(final List<ShimmerDevice> deviceList,
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if(selectedDeviceAddress != null && selectedDeviceAddress == macList[position]){
if(selectedDeviceAddress != null && selectedDeviceAddress.equals(macList[position])){
selectedDeviceAddress = null;
selectedDevicePos = -1;
}
Expand Down Expand Up @@ -137,7 +138,7 @@ public void onResume() {
if(savedListView != null && savedListAdapter != null) {
buildShimmersConnectedListView(shimmerDeviceList, context);
} else {
buildShimmersConnectedListView(null, getActivity().getApplicationContext());
buildShimmersConnectedListView(null, requireActivity());
}
super.onResume();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void buildDeviceConfigList(final ShimmerDevice shimmerDevice, final Conte

// final CharSequence[] cs = listOfKeys.toArray(new CharSequence[listOfKeys.size()]);

expandListAdapter = new DeviceConfigListAdapter(context, listOfKeys, configOptionsMap, shimmerDevice, shimmerDeviceClone);
expandListAdapter = new DeviceConfigListAdapter(requireActivity(), listOfKeys, configOptionsMap, shimmerDevice, shimmerDeviceClone);
expandListView = (ExpandableListView) getView().findViewById(R.id.expandable_listview);
expandListView.setAdapter(expandListAdapter);
expandListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void buildSignalsToPlotList(Context context, final ShimmerService service
//final String[] sensorNames = sensorList.toArray(new String[sensorList.size()]);
final String[] sensorNames = sensorList.toArray(new String[sensorList.size()]);

ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, R.layout.simple_list_item_multiple_choice_force_black_text, android.R.id.text1, sensorNames);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(requireActivity(), android.R.layout.simple_list_item_multiple_choice, android.R.id.text1, sensorNames);
setListAdapter(adapter);
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
updateCheckboxes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
android:textColor="@android:color/black"
android:paddingTop="10dp"
android:paddingBottom="10dp" />
</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public void run(){

}else if(id == R.id.disconnect_all_devices){
mService.disconnectAllDevices();
connectedShimmersListFragment.buildShimmersConnectedListView(null, getApplicationContext());
connectedShimmersListFragment.buildShimmersConnectedListView(null, MainActivity.this);
mViewPager.setCurrentItem(0);
selectedDeviceAddress = null;
selectedDeviceName = null;
Expand Down Expand Up @@ -642,7 +642,7 @@ public void onServiceConnected(ComponentName className, IBinder service) {

//if there is a device connected display it on the fragment
if(connectedShimmersListFragment!=null) {
connectedShimmersListFragment.buildShimmersConnectedListView(mService.getListOfConnectedDevices(), getApplicationContext());
connectedShimmersListFragment.buildShimmersConnectedListView(mService.getListOfConnectedDevices(), MainActivity.this);
}
}

Expand Down Expand Up @@ -780,7 +780,7 @@ public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
if(position < fragmentArrayList.size()){
if(position == 0){
connectedShimmersListFragment.buildShimmersConnectedListView(null, getApplicationContext());
connectedShimmersListFragment.buildShimmersConnectedListView(null, MainActivity.this);
}
return fragmentArrayList.get(position);
}
Expand Down Expand Up @@ -879,11 +879,11 @@ public void handleMessage(Message msg) {
switch (state) {
case CONNECTED:
if(isNumberOfConnectedDevicesChanged()) {
connectedShimmersListFragment.buildShimmersConnectedListView(mService.getListOfConnectedDevices(), getApplicationContext());
connectedShimmersListFragment.buildShimmersConnectedListView(mService.getListOfConnectedDevices(), MainActivity.this);
if (selectedDeviceAddress != null) {
ShimmerDevice mDevice = mService.getShimmer(selectedDeviceAddress);
if (mDevice!=null) {
deviceConfigFragment.buildDeviceConfigList(mDevice, getApplicationContext(), mService.getBluetoothManager());
deviceConfigFragment.buildDeviceConfigList(mDevice, MainActivity.this, mService.getBluetoothManager());
}
}
}
Expand All @@ -910,7 +910,7 @@ public void handleMessage(Message msg) {
}
break;
case SDLOGGING:
connectedShimmersListFragment.buildShimmersConnectedListView(mService.getListOfConnectedDevices(), getApplicationContext());
connectedShimmersListFragment.buildShimmersConnectedListView(mService.getListOfConnectedDevices(), MainActivity.this);
break;
case STREAMING_LOGGED_DATA:
Toast.makeText(getApplicationContext(), "Data Sync: " + shimmerName + " " + macAddress, Toast.LENGTH_SHORT).show();
Expand All @@ -920,7 +920,7 @@ public void handleMessage(Message msg) {
case DISCONNECTED:
isNumberOfConnectedDevicesChanged();
Toast.makeText(getApplicationContext(), "Device disconnected: " + shimmerName + " " + macAddress, Toast.LENGTH_SHORT).show();
connectedShimmersListFragment.buildShimmersConnectedListView(mService.getListOfConnectedDevices(), getApplicationContext()); //to be safe lets rebuild this
connectedShimmersListFragment.buildShimmersConnectedListView(mService.getListOfConnectedDevices(), MainActivity.this); //to be safe lets rebuild this
break;
}
}
Expand Down