use of org.odk.collect.audiorecorder.recording.AudioRecorder in project collect by opendatakit.
the class FormEntryActivity method onCreate.
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
// this issue by including WebViews
if (Build.VERSION.SDK_INT >= 24) {
try {
new WebView(this);
} catch (Exception | Error e) {
// Don't crash if WebView not available
}
}
super.onCreate(savedInstanceState);
Collect.getInstance().getComponent().inject(this);
formsRepository = formsRepositoryProvider.get();
setContentView(R.layout.form_entry);
setupViewModels();
swipeHandler = new SwipeHandler(this, settingsProvider.getUnprotectedSettings());
compositeDisposable.add(eventBus.register(ReadPhoneStatePermissionRxEvent.class).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(event -> {
readPhoneStatePermissionRequestNeeded = true;
}));
errorMessage = null;
questionHolder = findViewById(R.id.questionholder);
initToolbar();
formIndexAnimationHandler = new FormIndexAnimationHandler(this);
menuDelegate = new FormEntryMenuDelegate(this, () -> getAnswers(), formIndexAnimationHandler, formSaveViewModel, formEntryViewModel, audioRecorder, backgroundLocationViewModel, backgroundAudioViewModel, settingsProvider);
nextButton = findViewById(R.id.form_forward_button);
nextButton.setOnClickListener(v -> {
swipeHandler.setBeenSwiped(true);
onSwipeForward();
});
backButton = findViewById(R.id.form_back_button);
backButton.setOnClickListener(v -> {
swipeHandler.setBeenSwiped(true);
onSwipeBackward();
});
if (savedInstanceState == null) {
mediaLoadingFragment = new MediaLoadingFragment();
getSupportFragmentManager().beginTransaction().add(mediaLoadingFragment, TAG_MEDIA_LOADING_FRAGMENT).commit();
} else {
mediaLoadingFragment = (MediaLoadingFragment) getSupportFragmentManager().findFragmentByTag(TAG_MEDIA_LOADING_FRAGMENT);
}
setupFields(savedInstanceState);
loadForm();
}
Aggregations