public double getProgress() { if (completed) return 1; if (pn == null) return 0; return pn.getGlobalProgress(); }
/** * Called from native code to update progress of ongoing recognition passes. * * @param percent Percent complete * @param left Left bound of word bounding box * @param right Right bound of word bounding box * @param top Top bound of word bounding box * @param bottom Bottom bound of word bounding box */ private void onProgressValues( final int percent, final int left, final int right, final int top, final int bottom) { if (progressNotifier != null) { ProgressValues pv = new ProgressValues(percent, left, right, top, bottom); progressNotifier.onProgressValues(pv); } }
/** * Reads a byte from the <code>buffer</code>, and refills it as necessary. * * @return The next byte from the input stream. * @throws IOException if there is no more data available. */ public byte readByte() throws IOException { // Buffer depleted ? if (head == tail) { head = 0; // Refill. tail = input.read(buffer, head, bufSize); if (tail == -1) { // No more data available. throw new IOException("No more data is available"); } if (notifier != null) { notifier.noteBytesRead(tail); } } return buffer[head++]; }
/** * Called from native code to update progress of ongoing recognition passes. * * @param percent Percent complete * @param left Left bound of word bounding box * @param right Right bound of word bounding box * @param top Top bound of word bounding box * @param bottom Bottom bound of word bounding box * @param textLeft Left bound of text bounding box * @param textRight Right bound of text bounding box * @param textTop Top bound of text bounding box * @param textBottom Bottom bound of text bounding box */ protected void onProgressValues( final int percent, final int left, final int right, final int top, final int bottom, final int textLeft, final int textRight, final int textTop, final int textBottom) { if (progressNotifier != null) { Rect wordRect = new Rect(left, textTop - top, right, textTop - bottom); Rect textRect = new Rect(textLeft, textBottom, textRight, textTop); ProgressValues pv = new ProgressValues(percent, wordRect, textRect); progressNotifier.onProgressValues(pv); } }