io.reactivex.processors.FlowableProcessor Java Examples

The following examples show how to use io.reactivex.processors.FlowableProcessor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DateTimeHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
DateTimeHolder(ViewDataBinding binding, FlowableProcessor<RowAction> processor, boolean isSearchMode, MutableLiveData<String> currentSelection) {
    super(binding);
    this.processor = processor;
    this.isSearchMode = isSearchMode;
    this.currentUid = currentSelection;

    if (binding instanceof FormTimeTextBinding) {
        ((FormTimeTextBinding) binding).timeView.setDateListener(this);
        ((FormTimeTextBinding) binding).timeView.setActivationListener(() ->
                setSelectedBackground(isSearchMode));
    }

    if (binding instanceof FormDateTextBinding) {
        ((FormDateTextBinding) binding).dateView.setDateListener(this);
        ((FormDateTextBinding) binding).dateView.setActivationListener(() ->
                setSelectedBackground(isSearchMode));
    }

    if (binding instanceof FormDateTimeTextBinding) {
        ((FormDateTimeTextBinding) binding).dateTimeView.setDateListener(this);
        ((FormDateTimeTextBinding) binding).dateTimeView.setActivationListener(() ->
                setSelectedBackground(isSearchMode));
    }
}
 
Example #2
Source File: DateTimeHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
DateTimeHolder(ViewDataBinding binding, FlowableProcessor<RowAction> processor) {
    super(binding);
    this.disposable = new CompositeDisposable();
    this.processor = processor;

    if (binding instanceof TableTimeTextBinding) {
        ((TableTimeTextBinding) binding).timeView.setDateListener(this);
    }

    if (binding instanceof TableDateTextBinding) {
        ((TableDateTextBinding) binding).dateView.setDateListener(this);
    }

    if (binding instanceof TableDateTimeTextBinding) {
        ((TableDateTimeTextBinding) binding).dateTimeView.setDateListener(this);
    }

}
 
Example #3
Source File: ImageRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public ImageHolder onCreate(@NonNull ViewGroup parent, int count, FlowableProcessor<String> imageSelector) {
    FormImageBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.form_image, parent, false);
    Integer height = null;
    if (renderType.equals(ProgramStageSectionRenderingType.SEQUENTIAL.name())) {
        height = parent.getMeasuredHeight() / (count > 2 ? 3 : count);
    } else if (renderType.equals(ProgramStageSectionRenderingType.MATRIX.name())) {
        height = parent.getMeasuredHeight() / (count > 2 ? 2 : count);
    }

    View rootView = binding.getRoot();
    if (height != null) {
        ViewGroup.LayoutParams layoutParams = rootView.getLayoutParams();
        layoutParams.height = height;
        rootView.setLayoutParams(layoutParams);
    }

    return new ImageHolder(binding, processor, isBackgroundTransparent, renderType, rootView, imageSelector);
}
 
Example #4
Source File: AgeHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
AgeHolder(FormAgeCustomBinding binding, FlowableProcessor<RowAction> processor, boolean isSearchMode, MutableLiveData<String> currentSelection) {
    super(binding);
    this.binding = binding;
    this.currentUid = currentSelection;

    binding.customAgeview.setAgeChangedListener(ageDate -> {
                if (ageViewModel.value() == null || !Objects.equals(ageViewModel.value(), ageDate == null ? null : DateUtils.databaseDateFormat().format(ageDate))) {
                    processor.onNext(RowAction.create(ageViewModel.uid(), ageDate == null ? null : DateUtils.uiDateFormat().format(ageDate), getAdapterPosition()));
                    clearBackground(isSearchMode);
                }
            }
    );

    binding.customAgeview.setActivationListener(() -> setSelectedBackground(isSearchMode));

}
 
Example #5
Source File: SpinnerHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
SpinnerHolder(FormOptionSetBinding binding, FlowableProcessor<RowAction> processor, boolean isSearchMode, MutableLiveData<String> currentSelection) {
    super(binding);
    this.binding = binding;
    this.isSearchMode = isSearchMode;
    this.currentUid = currentSelection;

    binding.optionSetView.setOnSelectedOptionListener((optionName, optionCode) -> {
        processor.onNext(
                RowAction.create(viewModel.uid(), isSearchMode ? optionName + "_os_" + optionCode : optionCode, true, optionCode, optionName, getAdapterPosition())
        );
        if (isSearchMode)
            viewModel.withValue(optionName);
        clearBackground(isSearchMode);
    });

    binding.optionSetView.setActivationListener(() -> setSelectedBackground(isSearchMode));

}
 
Example #6
Source File: CoordinateHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@SuppressLint("CheckResult")
CoordinateHolder(CustomFormCoordinateBinding binding, FlowableProcessor<RowAction> processor, boolean isSearchMode, MutableLiveData<String> currentSelection) {
    super(binding);
    this.binding = binding;
    this.currentUid = currentSelection;

    binding.formCoordinates.setCurrentLocationListener(geometry -> {
                closeKeyboard(binding.formCoordinates);
                processor.onNext(
                        RowAction.create(model.uid(),
                                geometry == null ? null : geometry.coordinates(),
                                getAdapterPosition(),
                                model.featureType().name()));
                clearBackground(isSearchMode);
            }
    );
    binding.formCoordinates.setMapListener(
            (CoordinatesView.OnMapPositionClick) binding.formCoordinates.getContext()
    );

    binding.formCoordinates.setActivationListener(() -> setSelectedBackground(isSearchMode));

}
 
Example #7
Source File: OrgUnitHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
OrgUnitHolder(FragmentManager fm, ViewDataBinding binding, FlowableProcessor<RowAction> processor) {
    super(binding);
    compositeDisposable = new CompositeDisposable();
    this.editText = binding.getRoot().findViewById(R.id.input_editText);
    this.inputLayout = binding.getRoot().findViewById(R.id.input_layout);
    this.description = binding.getRoot().findViewById(R.id.descriptionLabel);

    this.editText.setOnClickListener(view -> {
        editText.setEnabled(false);
        orgUnitDialog = new OrgUnitDialog()
                .setTitle(model.label())
                .setMultiSelection(false)
                .setPossitiveListener(data -> {
                    processor.onNext(RowAction.create(model.uid(), orgUnitDialog.getSelectedOrgUnit(), model.dataElement(), model.categoryOptionCombo(),model.catCombo(), model.row(), model.column()));
                    this.editText.setText(orgUnitDialog.getSelectedOrgUnitName());
                    orgUnitDialog.dismiss();
                    editText.setEnabled(true);
                })
                .setNegativeListener(data -> {
                    orgUnitDialog.dismiss();
                    editText.setEnabled(true);
                });
        if (!orgUnitDialog.isAdded())
            orgUnitDialog.show(fm, model.label());
    });
}
 
Example #8
Source File: EditTextRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public EditTextRow(@NonNull LayoutInflater layoutInflater, @NonNull FlowableProcessor<RowAction> processor, boolean isBgTransparent, boolean isLongText) {
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.renderType = null;
    this.isSearchMode = true;
    this.isLongText = isLongText;
    this.currentSelection = null;
}
 
Example #9
Source File: OrgUnitHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
OrgUnitHolder(FormOrgUnitBinding binding, FlowableProcessor<RowAction> processor, boolean isSearchMode, MutableLiveData<String> currentSelection) {
    super(binding);
    this.binding = binding;
    this.currentUid = currentSelection;

    binding.orgUnitView.setListener(orgUnitUid -> {
        processor.onNext(RowAction.create(model.uid(), orgUnitUid, getAdapterPosition()));
    });

    binding.orgUnitView.setActivationListener(() -> setSelectedBackground(isSearchMode));
}
 
Example #10
Source File: EditTextCustomHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
EditTextCustomHolder(FormEditTextCustomBinding binding, FlowableProcessor<RowAction> processor, boolean isSearchMode, MutableLiveData<String> currentSelection) {
    super(binding);
    this.binding = binding;
    this.processor = processor;
    this.isSearchMode = isSearchMode;
    this.currentUid = currentSelection;

    binding.customEdittext.setFocusChangedListener((v, hasFocus) -> {
        if (!hasFocus) {
            clearBackground(isSearchMode);
        }

        if (isSearchMode || (!hasFocus && editTextModel != null && editTextModel.editable())) {
            if (isSearchMode || valueHasChanged()) {
                sendAction();
            }
            closeKeyboard(binding.customEdittext.getEditText());
        }
        validateRegex();
    });
    binding.customEdittext.setOnEditorActionListener((v, actionId, event) -> {
        binding.customEdittext.getEditText().clearFocus();
        sendAction();
        closeKeyboard(binding.customEdittext.getEditText());
        return true;
    });

    binding.customEdittext.setActivationListener(() -> {
        setSelectedBackground(isSearchMode);
        binding.customEdittext.getEditText().setFocusable(true);
        binding.customEdittext.getEditText().setFocusableInTouchMode(true);
        binding.customEdittext.getEditText().requestFocus();
        openKeyboard(binding.customEdittext.getEditText());
        if (isSearchMode) {
            sendAction();
        }
    });
}
 
Example #11
Source File: FileRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public FileRow(@NonNull LayoutInflater layoutInflater, @NonNull FlowableProcessor<RowAction> processor
        , boolean isBgTransparent, String renderType, MutableLiveData<String> currentSelection) {
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.renderType = renderType;
    this.currentSelection = currentSelection;
}
 
Example #12
Source File: FileRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public FileRow(@NonNull LayoutInflater layoutInflater, @NonNull FlowableProcessor<RowAction> processor, boolean isBgTransparent) {
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.renderType = null;
    isSearchMode = true;
    this.currentSelection = null;
}
 
Example #13
Source File: PictureHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public PictureHolder(
        PictureView.OnIntentSelected onIntentSelected,
        CustomFormPictureBinding binding,
        FlowableProcessor<RowAction> processor, boolean isSearchMode) {
    super(binding);
    this.processor = processor;
    this.binding = binding;
    this.binding.formPictures.setOnIntentSelected(onIntentSelected);
    this.binding.formPictures.setOnImageListener((file, value, uid) -> {
        if (value != null)
            this.binding.formPictures.setTextSelected(binding.getRoot().getContext().getString(R.string.image_selected));
        processor.onNext(
                RowAction.create(uid, file != null ? file.getPath() : null, getAdapterPosition()));
    });
}
 
Example #14
Source File: DateTimeRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public DateTimeRow(LayoutInflater layoutInflater, FlowableProcessor<RowAction> processor, int viewType, boolean isBgTransparent, boolean accessDataWrite, ObservableField<DataSetTableAdapter.TableScale> currentTableScale) {
    this.processor = processor;
    this.inflater = layoutInflater;
    this.viewType = viewType;
    this.isBgTransparent = isBgTransparent;
    this.accessDataWrite = accessDataWrite;
    this.tableScale = currentTableScale;
}
 
Example #15
Source File: PictureRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public PictureRow(
        @NonNull FragmentManager fragmentManager,
        @NonNull LayoutInflater layoutInflater,
        @NonNull FlowableProcessor<RowAction> processor,
        boolean isBgTransparent) {
    this.fm = fragmentManager;
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.renderType = null;
    this.isSearchMode = true;
}
 
Example #16
Source File: PictureRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public PictureRow(
        @NonNull FragmentManager fragmentManager,
        @NonNull LayoutInflater layoutInflater,
        @NonNull FlowableProcessor<RowAction> processor,
        boolean isBgTransparent, String renderType) {
    this.fm = fragmentManager;
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.renderType = renderType;
}
 
Example #17
Source File: AgeRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public AgeRow(LayoutInflater layoutInflater, FlowableProcessor<RowAction> processor, boolean isBgTransparent) {
    this.inflater = layoutInflater;
    this.isBgTransparent = isBgTransparent;
    this.processor = processor;
    this.renderType = null;
    this.isSearchMode = true;
    this.currentSelection = null;
}
 
Example #18
Source File: SectionRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public SectionRow(LayoutInflater layoutInflater,
                  ObservableField<String> selectedSection,
                  FlowableProcessor<String> sectionProcessor) {
    this.inflater = layoutInflater;
    this.selectedSection = selectedSection;
    this.sectionProcessor = sectionProcessor;
}
 
Example #19
Source File: SpinnerRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public SpinnerRow(LayoutInflater layoutInflater, @NonNull FlowableProcessor<RowAction> processor, FlowableProcessor<Trio<String, String, Integer>> processorOptionSet, boolean isBackgroundTransparent) {
    this.processor = processor;
    this.isBackgroundTransparent = isBackgroundTransparent;
    this.renderType = null;
    this.inflater = layoutInflater;
    this.isSearchMode = true;
    this.currentSelection = null;
}
 
Example #20
Source File: EditTextRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public EditTextRow(@NonNull LayoutInflater layoutInflater, @NonNull FlowableProcessor<RowAction> processor,
                   boolean isBgTransparent, String renderType, boolean isLongText, MutableLiveData<String> currentSelection) {
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.renderType = renderType;
    this.isLongText = isLongText;
    this.currentSelection = currentSelection;
}
 
Example #21
Source File: OptionSetRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public OptionSetRow(LayoutInflater layoutInflater, FlowableProcessor<RowAction> processor,
                    boolean isBgTransparent, String renderType, MutableLiveData<String> currentFocusUid) {
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.currentSelection = currentFocusUid;
    this.renderType = renderType;

}
 
Example #22
Source File: SpinnerRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public SpinnerRow(LayoutInflater layoutInflater, @NonNull FlowableProcessor<RowAction> processor,
                  FlowableProcessor<Trio<String, String, Integer>> processorOptionSet, boolean isBackgroundTransparent, String renderType,
                  MutableLiveData<String> currentSelection) {
    this.processor = processor;
    this.isBackgroundTransparent = isBackgroundTransparent;
    this.renderType = renderType;
    this.inflater = layoutInflater;
    this.currentSelection = currentSelection;
}
 
Example #23
Source File: AgeRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public AgeRow(LayoutInflater layoutInflater, FlowableProcessor<RowAction> processor,
              boolean isBgTransparent, String renderType, MutableLiveData<String> currentSelection) {
    this.inflater = layoutInflater;
    this.isBgTransparent = isBgTransparent;
    this.processor = processor;
    this.renderType = renderType;
    this.currentSelection = currentSelection;
}
 
Example #24
Source File: OrgUnitRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public OrgUnitRow(FragmentManager fm, LayoutInflater layoutInflater, FlowableProcessor<RowAction> processor,
                  boolean isBgTransparent, String renderType, MutableLiveData<String> currentSelection) {
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.fm = fm;
    this.renderType = renderType;
    this.currentSelection = currentSelection;
}
 
Example #25
Source File: OrgUnitRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public OrgUnitRow(FragmentManager fm, LayoutInflater layoutInflater, FlowableProcessor<RowAction> processor,
                  boolean isBgTransparent) {
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.fm = fm;
    this.renderType = null;
    this.isSearchMode = true;
    this.currentSelection = null;
}
 
Example #26
Source File: RadioButtonHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
RadioButtonHolder(FormYesNoBinding binding, FlowableProcessor<RowAction> processor, boolean isSearchMode, MutableLiveData<String> currentSelection) {
    super(binding);
    currentUid = currentSelection;
    this.binding = binding;
    this.processor = processor;
    this.isSearchMode = isSearchMode;

    binding.customYesNo.setActivationListener(() -> setSelectedBackground(isSearchMode));
}
 
Example #27
Source File: RadioButtonRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public RadioButtonRow(LayoutInflater layoutInflater, @NonNull FlowableProcessor<RowAction> processor, boolean isBgTransparent, String renderType,
                      MutableLiveData<String> currentSelection) {
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.renderType = renderType;
    this.currentSelection = currentSelection;
}
 
Example #28
Source File: RadioButtonRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public RadioButtonRow(LayoutInflater layoutInflater, @NonNull FlowableProcessor<RowAction> processor, boolean isBgTransparent) {
    this.inflater = layoutInflater;
    this.processor = processor;
    this.isBgTransparent = isBgTransparent;
    this.renderType = null;
    this.isSearchMode = true;
    this.currentSelection = null;
}
 
Example #29
Source File: ImageHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public ImageHolder(FormImageBinding mBinding, FlowableProcessor<RowAction> processor, boolean isBackgroundTransparent, String renderType, View rootView, FlowableProcessor<String> imageSelector) {
    super(mBinding);
    this.processor = processor;
    this.binding = mBinding;
    this.disposable = new CompositeDisposable();

    if (imageSelector != null)
        disposable.add(imageSelector
                .debounce(1000, TimeUnit.MILLISECONDS, Schedulers.io())
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(selectedValue -> {

                }, Timber::d));

    itemView.setOnClickListener(v -> {

        if (isEditable) {
            String value = null;
            String[] uids = model.uid().split("\\.");
            value = model.label();

            if (imageSelector != null)
                imageSelector.onNext(value);
            processor.onNext(RowAction.create(uids[0], value, "", "","", 0, 0));

        }
    });

}
 
Example #30
Source File: DateTimeRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public DateTimeRow(LayoutInflater layoutInflater, @NonNull FlowableProcessor<RowAction> processor, int viewType, boolean isBgTransparent) {
    this.processor = processor;
    this.inflater = layoutInflater;
    this.viewType = viewType;
    this.isBgTransparent = isBgTransparent;
    this.renderType = null;
    this.isSearchMode = true;
    this.currentSelection = null;
}