Kaydet (Commit) 907fdbfc authored tarafından Siqi Liu's avatar Siqi Liu Kaydeden (comit) Miklos Vajna

add getPartsCount() to TileProvider

Change-Id: I8f1f61110d06333bc1140caf13d9e96e669fc231
üst 2ee313fa
...@@ -10,6 +10,7 @@ import org.libreoffice.kit.DirectBufferAllocator; ...@@ -10,6 +10,7 @@ import org.libreoffice.kit.DirectBufferAllocator;
import org.libreoffice.kit.Document; import org.libreoffice.kit.Document;
import org.libreoffice.kit.LibreOfficeKit; import org.libreoffice.kit.LibreOfficeKit;
import org.libreoffice.kit.Office; import org.libreoffice.kit.Office;
import org.libreoffice.R;
import org.mozilla.gecko.TextSelection; import org.mozilla.gecko.TextSelection;
import org.mozilla.gecko.TextSelectionHandle; import org.mozilla.gecko.TextSelectionHandle;
...@@ -19,6 +20,7 @@ import org.mozilla.gecko.gfx.GeckoLayerClient; ...@@ -19,6 +20,7 @@ import org.mozilla.gecko.gfx.GeckoLayerClient;
import org.mozilla.gecko.gfx.IntSize; import org.mozilla.gecko.gfx.IntSize;
import org.mozilla.gecko.gfx.LayerView; import org.mozilla.gecko.gfx.LayerView;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
/** /**
...@@ -146,20 +148,23 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback ...@@ -146,20 +148,23 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
return (input / dpi) * 1440.0f; return (input / dpi) * 1440.0f;
} }
@Override
public int getPartsCount() {
return mDocument.getParts();
}
@Override @Override
public void onSwipeLeft() { public void onSwipeLeft() {
Log.d(LOGTAG, "onSwipeLeft received"); if (mDocument.getDocumentType() == Document.DOCTYPE_PRESENTATION &&
if (mDocument.getDocumentType() == Document.DOCTYPE_PRESENTATION getCurrentPartNumber() < getPartsCount()-1) {
&& getCurrentPartNumber() < mDocument.getParts()-1) {
LOKitShell.sendChangePartEvent(getCurrentPartNumber()+1); LOKitShell.sendChangePartEvent(getCurrentPartNumber()+1);
} }
} }
@Override @Override
public void onSwipeRight() { public void onSwipeRight() {
Log.d(LOGTAG, "onSwipeRight received"); if (mDocument.getDocumentType() == Document.DOCTYPE_PRESENTATION &&
if (mDocument.getDocumentType() == Document.DOCTYPE_PRESENTATION getCurrentPartNumber() > 0) {
&& getCurrentPartNumber() > 0) {
LOKitShell.sendChangePartEvent(getCurrentPartNumber()-1); LOKitShell.sendChangePartEvent(getCurrentPartNumber()-1);
} }
} }
......
...@@ -128,6 +128,11 @@ public class MockTileProvider implements TileProvider { ...@@ -128,6 +128,11 @@ public class MockTileProvider implements TileProvider {
return 0; return 0;
} }
@Override
public int getPartsCount() {
return 0;
}
@Override @Override
public void onSwipeLeft() { public void onSwipeLeft() {
} }
......
...@@ -43,6 +43,11 @@ public interface TileProvider { ...@@ -43,6 +43,11 @@ public interface TileProvider {
*/ */
int getCurrentPartNumber(); int getCurrentPartNumber();
/**
* Get the total number of parts.
*/
int getPartsCount();
Bitmap thumbnail(int size); Bitmap thumbnail(int size);
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment