use of androidx.activity.ComponentActivity in project collect by opendatakit.
the class InternalRecordingRequesterTest method setup.
@Before
public void setup() {
ComponentActivity activity = Robolectric.buildActivity(ComponentActivity.class).get();
when(audioRecorder.getCurrentSession()).thenReturn(new MutableLiveData<>(null));
requester = new InternalRecordingRequester(activity, audioRecorder, permissionsProvider, mock(FormEntryViewModel.class));
permissionsProvider.setPermissionGranted(true);
}
use of androidx.activity.ComponentActivity in project collect by opendatakit.
the class BaseSelectListWidget method setUpSearchBox.
private void setUpSearchBox() {
ComponentActivity activity = (ComponentActivity) getContext();
SearchQueryViewModel searchQueryViewModel = new ViewModelProvider(activity).get(SearchQueryViewModel.class);
binding.choicesSearchBox.setVisibility(View.VISIBLE);
binding.choicesSearchBox.setTextSize(TypedValue.COMPLEX_UNIT_DIP, getAnswerFontSize());
binding.choicesSearchBox.addTextChangedListener(new TextWatcher() {
private String oldText = "";
@Override
public void afterTextChanged(Editable s) {
if (!s.toString().equals(oldText)) {
recyclerViewAdapter.getFilter().filter(s.toString());
searchQueryViewModel.setQuery(getFormEntryPrompt().getIndex().toString(), s.toString());
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
oldText = s.toString();
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
binding.choicesSearchBox.setText(searchQueryViewModel.getQuery(getFormEntryPrompt().getIndex().toString()));
}
Aggregations