public abstract class

SelectionModel<S>

extends java.lang.Object

 java.lang.Object

↳androidx.pdf.select.SelectionModel<S>

Subclasses:

PdfSelectionModel

Gradle dependencies

compile group: 'androidx.pdf', name: 'pdf-viewer', version: '1.0.0-alpha02'

  • groupId: androidx.pdf
  • artifactId: pdf-viewer
  • version: 1.0.0-alpha02

Artifact androidx.pdf:pdf-viewer:1.0.0-alpha02 it located at Google repository (https://maven.google.com/)

Overview

Stores data relevant to the current selection.

Summary

Fields
protected final Observables.ExposedValue<java.lang.Object>mSelection

Constructors
publicSelectionModel()

Methods
public abstract java.lang.StringgetText()

public ObservableValue<java.lang.Object>selection()

public voidsetSelection(java.lang.Object newSelection)

Synchronous update - the exact selection is already known.

public voidupdateSelectionAsync(SelectionBoundary start, SelectionBoundary stop)

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

protected final Observables.ExposedValue<java.lang.Object> mSelection

Constructors

public SelectionModel()

Methods

public ObservableValue<java.lang.Object> selection()

public abstract java.lang.String getText()

public void setSelection(java.lang.Object newSelection)

Synchronous update - the exact selection is already known.

public void updateSelectionAsync(SelectionBoundary start, SelectionBoundary stop)

Source

/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.pdf.select;

import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.pdf.models.SelectionBoundary;
import androidx.pdf.util.ObservableValue;
import androidx.pdf.util.Observables;
import androidx.pdf.util.Observables.ExposedValue;

/**
 * Stores data relevant to the current selection.
 *
 * @param <S> Type for the model
 */
@RestrictTo(RestrictTo.Scope.LIBRARY)
public abstract class SelectionModel<S> {

    protected final ExposedValue<S> mSelection =
            Observables.newExposedValueWithInitialValue(null);

    /**
     *
     */
    @NonNull
    public ObservableValue<S> selection() {
        return mSelection;
    }

    /**
     *
     */
    @NonNull
    public abstract String getText();

    /** Synchronous update - the exact selection is already known. */
    public void setSelection(S newSelection) {
        mSelection.set(newSelection);
    }

    /**
     *
     */
    public void updateSelectionAsync(@NonNull SelectionBoundary start,
            @NonNull SelectionBoundary stop) {
        throw new UnsupportedOperationException("No support for updating selection");
    }
}