|
|
|
|
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager; |
|
|
import androidx.recyclerview.widget.LinearLayoutManager; |
|
|
import androidx.recyclerview.widget.RecyclerView; |
|
|
import androidx.recyclerview.widget.RecyclerView; |
|
|
|
|
|
|
|
|
|
|
|
import android.hardware.SensorEvent; |
|
|
import android.hardware.SensorManager; |
|
|
import android.hardware.SensorManager; |
|
|
import android.os.Bundle; |
|
|
import android.os.Bundle; |
|
|
import android.view.View; |
|
|
import android.view.View; |
|
|
|
|
|
|
|
|
public void onChanged(Boolean aBoolean) { |
|
|
public void onChanged(Boolean aBoolean) { |
|
|
if (aBoolean) { |
|
|
if (aBoolean) { |
|
|
mMicrofonViewModel.updateDevice(mMicrofonViewModel.getLocalDeviceUUID(), mMicrofonViewModel.getSystemTimeStamp(), true, "Microfon", (int) mMicrofonViewModel.getAmplitudeInDB()); |
|
|
mMicrofonViewModel.updateDevice(mMicrofonViewModel.getLocalDeviceUUID(), mMicrofonViewModel.getSystemTimeStamp(), true, "Microfon", (int) mMicrofonViewModel.getAmplitudeInDB()); |
|
|
|
|
|
microfonStatusMessage.setText("dB value - detected = " + (int) mMicrofonViewModel.getAmplitudeInDB() + " dB"); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
mMicrofonViewModel.updateDevice(mMicrofonViewModel.getLocalDeviceUUID(), mMicrofonViewModel.getSystemTimeStamp(), false, "Microfon", (int) mMicrofonViewModel.getAmplitudeInDB()); |
|
|
mMicrofonViewModel.updateDevice(mMicrofonViewModel.getLocalDeviceUUID(), mMicrofonViewModel.getSystemTimeStamp(), false, "Microfon", (int) mMicrofonViewModel.getAmplitudeInDB()); |
|
|
|
|
|
if((int) mMicrofonViewModel.getAmplitudeInDB() > 0){ |
|
|
|
|
|
microfonStatusMessage.setText("dB value - no longer detected = " + (int) mMicrofonViewModel.getAmplitudeInDB()+ " dB"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void onResume() { |
|
|
protected void onResume() { |
|
|
super.onResume(); |
|
|
super.onResume(); |