|
|
@@ -6,6 +6,7 @@ import androidx.lifecycle.ViewModelProvider; |
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager; |
|
|
|
import androidx.recyclerview.widget.RecyclerView; |
|
|
|
|
|
|
|
import android.hardware.SensorEvent; |
|
|
|
import android.hardware.SensorManager; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.view.View; |
|
|
@@ -88,15 +89,22 @@ public class AudiodetectionActivity extends AppCompatActivity { |
|
|
|
public void onChanged(Boolean aBoolean) { |
|
|
|
if (aBoolean) { |
|
|
|
mMicrofonViewModel.updateDevice(mMicrofonViewModel.getLocalDeviceUUID(), mMicrofonViewModel.getSystemTimeStamp(), true, "Microfon", (int) mMicrofonViewModel.getAmplitudeInDB()); |
|
|
|
microfonStatusMessage.setText("dB value - detected = " + (int) mMicrofonViewModel.getAmplitudeInDB() + " dB"); |
|
|
|
} |
|
|
|
else { |
|
|
|
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 |
|
|
|
protected void onResume() { |
|
|
|
super.onResume(); |