androidx.databinding.ObservableBoolean Java Examples

The following examples show how to use androidx.databinding.ObservableBoolean. 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: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public void onChanged(ObservableBoolean o) {
    String aUrl = url.getValue().toString();
    isUrlBarButtonsVisible.postValue(new ObservableBoolean(
            !isFocused.getValue().get() &&
                    !isLibraryVisible.getValue().get() &&
                    !UrlUtils.isContentFeed(getApplication(), aUrl) &&
                    !UrlUtils.isPrivateAboutPage(getApplication(), aUrl) &&
                    (URLUtil.isHttpUrl(aUrl) || URLUtil.isHttpsUrl(aUrl)) &&
                    (
                            (SettingsStore.getInstance(getApplication()).getTrackingProtectionLevel() != ContentBlocking.EtpLevel.NONE) ||
                            isPopUpAvailable.getValue().get() ||
                            isDrmUsed.getValue().get() ||
                            isWebXRUsed.getValue().get()
                    )
    ));
}
 
Example #2
Source File: ErrorViewHolder.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public ErrorViewHolder(@NonNull ItemErrorDialogBinding binding, ObservableBoolean sharing,
                       FlowableProcessor<Pair<Boolean, D2Error>> processor) {
    super(binding.getRoot());
    this.binding = binding;
    this.sharing = sharing;
    this.processor = processor;
}
 
Example #3
Source File: DataSetTableAdapter.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void initializeRows(Boolean accessDataWrite) {
    rows.add(EDITTEXT, new EditTextRow(layoutInflater, processor, new ObservableBoolean(accessDataWrite), (TableView) getTableView(), currentTableScale));
    rows.add(BUTTON, new FileCellRow(layoutInflater, processor, currentTableScale));
    rows.add(CHECKBOX, new RadioButtonRow(layoutInflater, processor, accessDataWrite, currentTableScale));
    rows.add(SPINNER, new SpinnerCellRow(layoutInflater, processor, accessDataWrite, processorOptionSet, currentTableScale));
    rows.add(COORDINATES, new CoordinateRow(layoutInflater, processor, accessDataWrite, currentTableScale));
    rows.add(TIME, new DateTimeRow(layoutInflater, processor, TIME, true, accessDataWrite, currentTableScale));
    rows.add(DATE, new DateTimeRow(layoutInflater, processor, DATE, true, accessDataWrite, currentTableScale));
    rows.add(DATETIME, new DateTimeRow(layoutInflater, processor, DATETIME, true, accessDataWrite, currentTableScale));
    rows.add(AGEVIEW, new AgeRow(layoutInflater, processor, accessDataWrite, currentTableScale));
    rows.add(YES_NO, new RadioButtonRow(layoutInflater, processor, accessDataWrite, currentTableScale));
    rows.add(ORG_UNIT, new OrgUnitRow(null, layoutInflater, processor, true, ProgramStageSectionRenderingType.LISTING.name())); //TODO: TABLE SCALE
    rows.add(IMAGE, new ImageRow(layoutInflater, processor, true, ProgramStageSectionRenderingType.LISTING.name()));
    rows.add(UNSUPPORTED, new UnsupportedRow(layoutInflater, processor));
}
 
Example #4
Source File: TrayViewModel.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void onChanged(ObservableBoolean observableBoolean) {
    boolean shouldShow = shouldBeVisible.getValue().get() && !isKeyboardVisible.getValue().get();
    if (shouldShow != isVisible.getValue().get()) {
        isVisible.setValue(new ObservableBoolean(shouldShow));
    }
}
 
Example #5
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void onChanged(ObservableBoolean o) {
    if (isFullscreen.getValue().get() || isResizeMode.getValue().get() || !isWindowVisible.getValue().get()) {
        isTopBarVisible.postValue(new ObservableBoolean(false));

    } else {
        if (isOnlyWindow.getValue().get()) {
            isTopBarVisible.postValue(new ObservableBoolean(isPrivateSession.getValue().get()));

        } else {
            isTopBarVisible.postValue(new ObservableBoolean(true));
        }
    }
}
 
Example #6
Source File: TrayViewModel.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
public TrayViewModel(@NonNull Application application) {
    super(application);

    isMaxWindows = new MutableLiveData<>(new ObservableBoolean(true));
    shouldBeVisible = new MutableLiveData<>(new ObservableBoolean(true));
    isKeyboardVisible = new MutableLiveData<>(new ObservableBoolean(false));
    downloadsNumber = new MutableLiveData<>(new ObservableInt(0));
    isVisible = new MediatorLiveData<>();
    isVisible.addSource(shouldBeVisible, mIsVisibleObserver);
    isVisible.addSource(isKeyboardVisible, mIsVisibleObserver);
    isVisible.setValue(new ObservableBoolean(false));
}
 
Example #7
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void onChanged(ObservableBoolean o) {
    if (isFullscreen.getValue().get() || isResizeMode.getValue().get() || isActiveWindow.getValue().get()) {
        isTitleBarVisible.postValue(new ObservableBoolean(false));

    } else {
        isTitleBarVisible.postValue(new ObservableBoolean(isWindowVisible.getValue().get() && !isOnlyWindow.getValue().get()));
    }
}
 
Example #8
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void onChanged(ObservableBoolean o) {
    isLibraryVisible.postValue(new ObservableBoolean(
            isBookmarksVisible.getValue().get() ||
                    isHistoryVisible.getValue().get() ||
                    isDownloadsVisible.getValue().get()
            ));

    // We use this to force dispatch a title bar and navigation bar URL refresh when library is opened
    url.postValue(url.getValue());
}
 
Example #9
Source File: SettingsViewModel.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
public SettingsViewModel(@NonNull Application application) {
    super(application);

    isTrackingProtectionEnabled = new MutableLiveData<>(new ObservableBoolean(false));
    isDRMEnabled = new MutableLiveData<>(new ObservableBoolean(false));
    isPopupBlockingEnabled = new MutableLiveData<>(new ObservableBoolean(false));
    isWebXREnabled = new MutableLiveData<>(new ObservableBoolean(false));
    propsVersionName = new MutableLiveData<>();
    props = new MutableLiveData<>(Collections.emptyMap());
    isWhatsNewVisible = new MutableLiveData<>(new ObservableBoolean(false));

    propsVersionName.observeForever(props -> isWhatsNewVisible());
    props.observeForever(versionName -> isWhatsNewVisible());
}
 
Example #10
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void onChanged(ObservableBoolean o) {
    isUrlBarIconsVisible.postValue(new ObservableBoolean(
            !isLibraryVisible.getValue().get() &&
                    (isLoading.getValue().get() ||
                            isInsecureVisible.getValue().get())
    ));
}
 
Example #11
Source File: LibraryViewModel.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
public LibraryViewModel(@NonNull Application application) {
    super(application);

    isLoading = new MutableLiveData<>(new ObservableBoolean(false));
    isEmpty = new MutableLiveData<>(new ObservableBoolean(false));
    isNarrow = new MutableLiveData<>(new ObservableBoolean(false));
}
 
Example #12
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
@NonNull
public MutableLiveData<ObservableBoolean> getCanGoBack() {
    return canGoBack;
}
 
Example #13
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
@NonNull
public MutableLiveData<ObservableBoolean> getIsDrmUsed() {
    return isDrmUsed;
}
 
Example #14
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public void setCanGoBack(boolean canGoBack) {
    this.canGoBack.postValue(new ObservableBoolean(canGoBack));
}
 
Example #15
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
@NonNull
public MutableLiveData<ObservableBoolean> getIsInVRVideo() {
    return isInVRVideo;
}
 
Example #16
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public void setIsInVRVideo(boolean isInVRVideo) {
    this.isInVRVideo.postValue(new ObservableBoolean(isInVRVideo));
}
 
Example #17
Source File: SettingsViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public MutableLiveData<ObservableBoolean> getIsDrmEnabled() {
    return isDRMEnabled;
}
 
Example #18
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public void setAutoEnteredVRVideo(boolean autoEnteredVRVideo) {
    this.autoEnteredVRVideo.postValue(new ObservableBoolean(autoEnteredVRVideo));
}
 
Example #19
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public void setIsTrackingEnabled(boolean isTrackingEnabled) {
    this.isTrackingEnabled.postValue(new ObservableBoolean(isTrackingEnabled));
}
 
Example #20
Source File: SettingsViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public MutableLiveData<ObservableBoolean> getIsTrackingProtectionEnabled() {
    return isTrackingProtectionEnabled;
}
 
Example #21
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public void setCanGoForward(boolean canGoForward) {
    this.canGoForward.postValue(new ObservableBoolean(canGoForward));
}
 
Example #22
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
@NonNull
public MutableLiveData<ObservableBoolean> getCanGoForward() {
    return canGoForward;
}
 
Example #23
Source File: SettingsViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public MutableLiveData<ObservableBoolean> getIsWebXREnabled() {
    return isWebXREnabled;
}
 
Example #24
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
@NonNull
public MutableLiveData<ObservableBoolean> getIsWebXRBlocked() {
    return isWebXRBlocked;
}
 
Example #25
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public void setIsWebXRUsed(boolean used) {
    this.isWebXRUsed.postValue(new ObservableBoolean(used));
}
 
Example #26
Source File: TrayViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public void setIsVisible(boolean isVisible) {
    this.isVisible.setValue(new ObservableBoolean(isVisible));
}
 
Example #27
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public void setIsUrlEmpty(boolean isUrlEmpty) {
    this.isUrlEmpty.postValue(new ObservableBoolean(isUrlEmpty));
}
 
Example #28
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
@NonNull
public MutableLiveData<ObservableBoolean> getIsUrlEmpty() {
    return isUrlEmpty;
}
 
Example #29
Source File: WindowViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public void setIsFocused(boolean isFocused) {
    this.isFocused.postValue(new ObservableBoolean(isFocused));
}
 
Example #30
Source File: TrayViewModel.java    From FirefoxReality with Mozilla Public License 2.0 4 votes vote down vote up
public void setIsMaxWindows(boolean isMaxWindows) {
    this.isMaxWindows.setValue(new ObservableBoolean(isMaxWindows));
}