Skip to content

Commit

Permalink
Merge pull request #4 from remibettan/merge-android-branch
Browse files Browse the repository at this point in the history
Spacing and checking support before setting preset
  • Loading branch information
arilowen authored Jan 13, 2020
2 parents a553adf + 7ef38d9 commit e39e9be
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void saveFileToExternalDir(final String fileName, byte[] data) {
File file = new File(getExternalStorageDir() + File.separator + fileName);
FileOutputStream fos = new FileOutputStream(file);
fos.write(data);
Log.i(TAG, "saveFileToExternalDir: file " + fileName + "saved successfully");
Log.i(TAG, "saveFileToExternalDir: file " + fileName + " saved successfully");
} catch (Exception e) {
Log.e(TAG, "saveFileToExternalDir: failed to create a file " + fileName, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,34 +266,39 @@ public void onRadioButtonClicked(View view) {
return;
List<Sensor> sensors = device.querySensors();
for(Sensor s : sensors){
if(!s.supports(Option.EMITTER_ENABLED))
continue;
switch(view.getId()) {
case R.id.radio_no_projector:{
setOption(s, Option.EMITTER_ENABLED, 0);
break;
}
case R.id.radio_laser:{
setOption(s, Option.EMITTER_ENABLED, 1);
break;
}
case R.id.radio_laser_auto:{
setOption(s, Option.EMITTER_ENABLED, 2);
break;
}
case R.id.radio_led:{
setOption(s, Option.EMITTER_ENABLED, 3);
break;
if(s.supports(Option.EMITTER_ENABLED)) {
switch(view.getId()) {
case R.id.radio_no_projector:{
setOption(s, Option.EMITTER_ENABLED, 0);
break;
}
case R.id.radio_laser:{
setOption(s, Option.EMITTER_ENABLED, 1);
break;
}
case R.id.radio_laser_auto:{
setOption(s, Option.EMITTER_ENABLED, 2);
break;
}
case R.id.radio_led:{
setOption(s, Option.EMITTER_ENABLED, 3);
break;
}
}
case R.id.radio_custom:{
setOption(s, Option.HARDWARE_PRESET, 0);
break;
}
case R.id.radio_burst:{
setOption(s, Option.HARDWARE_PRESET, 2);
break;
}
if(s.supports(Option.HARDWARE_PRESET)) {
switch(view.getId()) {
case R.id.radio_custom:{
setOption(s, Option.HARDWARE_PRESET, 0);
break;
}
case R.id.radio_burst:{
setOption(s, Option.HARDWARE_PRESET, 2);
break;
}
}
}

}
} catch(Exception e){
Log.e(TAG, "Failed to set controls: " + e.getMessage());
Expand Down

0 comments on commit e39e9be

Please sign in to comment.