Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
f0f0ce28
Kaydet (Commit)
f0f0ce28
authored
Mar 17, 2015
tarafından
Tomaž Vajngerl
Kaydeden (comit)
Miklos Vajna
Mar 23, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
android: add comment to many classes and methods
Change-Id: I49d9bd7c702c260ea66ef211edbaf5e106264bb6
üst
a212fc2c
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
294 additions
and
5 deletions
+294
-5
InvalidationHandler.java
...ndroid3/src/java/org/libreoffice/InvalidationHandler.java
+51
-0
LOEvent.java
...rimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
+3
-0
LOKitInputConnectionHandler.java
...src/java/org/libreoffice/LOKitInputConnectionHandler.java
+18
-0
LOKitThread.java
...ntal/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+47
-2
LOKitTileProvider.java
...OAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+72
-2
LibreOfficeMainActivity.java
...id3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+3
-0
TextCursorLayer.java
.../LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
+30
-0
TileIdentifier.java
...l/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java
+12
-0
TileProvider.java
...tal/LOAndroid3/src/java/org/libreoffice/TileProvider.java
+15
-0
TileProviderFactory.java
...ndroid3/src/java/org/libreoffice/TileProviderFactory.java
+3
-0
ToolbarController.java
...OAndroid3/src/java/org/libreoffice/ToolbarController.java
+11
-0
TextSelection.java
.../LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java
+22
-1
TextSelectionHandle.java
...roid3/src/java/org/mozilla/gecko/TextSelectionHandle.java
+3
-0
RenderControllerThread.java
...rc/java/org/mozilla/gecko/gfx/RenderControllerThread.java
+4
-0
No files found.
android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -29,6 +29,10 @@ public class InvalidationHandler implements Document.MessageCallback {
mState
=
OverlayState
.
NONE
;
}
/**
* Sets the tile provider, without this the
* @param tileProvider
*/
public
void
setTileProvider
(
TileProvider
tileProvider
)
{
mTileProvider
=
tileProvider
;
}
...
...
@@ -244,10 +248,19 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
/**
* Trigger a transition to a new overlay state.
* @param next - new state to transition to
*/
public
synchronized
void
changeStateTo
(
OverlayState
next
)
{
changeState
(
mState
,
next
);
}
/**
* Executes a transition from old overlay state to a new overlay state.
* @param previous - old state
* @param next - new state
*/
private
synchronized
void
changeState
(
OverlayState
previous
,
OverlayState
next
)
{
mState
=
next
;
handleGeneralChangeState
(
previous
,
next
);
...
...
@@ -270,6 +283,9 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
/**
* Handle a general transition - executed for all transitions.
*/
private
void
handleGeneralChangeState
(
OverlayState
previous
,
OverlayState
next
)
{
if
(
previous
==
OverlayState
.
NONE
)
{
LOKitShell
.
getToolbarController
().
switchToEditMode
();
...
...
@@ -278,6 +294,9 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
/**
* Handle a transition to OverlayState.NONE state.
*/
private
void
handleNoneState
(
OverlayState
previous
)
{
if
(
previous
==
OverlayState
.
NONE
)
{
return
;
...
...
@@ -293,12 +312,18 @@ public class InvalidationHandler implements Document.MessageCallback {
LibreOfficeMainActivity
.
mAppContext
.
hideSoftKeyboard
();
}
/**
* Handle a transition to OverlayState.SELECTION state.
*/
private
void
handleSelectionState
(
OverlayState
previous
)
{
mTextSelection
.
showHandle
(
TextSelectionHandle
.
HandleType
.
START
);
mTextSelection
.
showHandle
(
TextSelectionHandle
.
HandleType
.
END
);
mTextCursorLayer
.
showSelections
();
}
/**
* Handle a transition to OverlayState.CURSOR state.
*/
private
void
handleCursorState
(
OverlayState
previous
)
{
LibreOfficeMainActivity
.
mAppContext
.
showSoftKeyboard
();
if
(
previous
==
OverlayState
.
TRANSITION
)
{
...
...
@@ -307,6 +332,9 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
/**
* Handle a transition to OverlayState.TRANSITION state.
*/
private
void
handleTransitionState
(
OverlayState
previous
)
{
if
(
previous
==
OverlayState
.
SELECTION
)
{
mTextSelection
.
hideHandle
(
TextSelectionHandle
.
HandleType
.
START
);
...
...
@@ -319,20 +347,43 @@ public class InvalidationHandler implements Document.MessageCallback {
}
}
/**
* Handle a transition to OverlayState.GRAPHIC_SELECTION state.
*/
private
void
handleGraphicSelectionState
(
OverlayState
previous
)
{
mTextCursorLayer
.
showGraphicSelection
();
LibreOfficeMainActivity
.
mAppContext
.
hideSoftKeyboard
();
}
/**
* The current state the overlay is in.
*/
public
OverlayState
getCurrentState
()
{
return
mState
;
}
public
enum
OverlayState
{
/**
* State where the overlay is empty
*/
NONE
,
/**
* In-between state where we need to transition to a new overlay state.
* In this state we properly disable the older state and wait to transition
* to a new state triggered by an invalidation.
*/
TRANSITION
,
/**
* State where we operate with the cursor.
*/
CURSOR
,
/**
* State where we operate the graphic selection.
*/
GRAPHIC_SELECTION
,
/**
* State where we operate the text selection.
*/
SELECTION
}
}
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -18,6 +18,9 @@ import org.mozilla.gecko.gfx.ComposedTileLayer;
import
org.mozilla.gecko.gfx.IntSize
;
import
org.mozilla.gecko.gfx.SubTile
;
/**
* Events and data that is queued and processed by LOKitThread.
*/
public
class
LOEvent
implements
Comparable
<
LOEvent
>
{
public
static
final
int
SIZE_CHANGED
=
1
;
public
static
final
int
CHANGE_PART
=
2
;
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitInputConnectionHandler.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -14,6 +14,9 @@ import android.view.inputmethod.InputConnection;
import
org.mozilla.gecko.gfx.InputConnectionHandler
;
/**
* Implementation of InputConnectionHandler.When a key event happens it is directed to this class which is then directed further to LOKitThread.
*/
public
class
LOKitInputConnectionHandler
implements
InputConnectionHandler
{
private
static
String
LOGTAG
=
LOKitInputConnectionHandler
.
class
.
getSimpleName
();
...
...
@@ -22,29 +25,44 @@ public class LOKitInputConnectionHandler implements InputConnectionHandler {
return
null
;
}
/**
* When key pre-Ime happens.
*/
@Override
public
boolean
onKeyPreIme
(
int
keyCode
,
KeyEvent
event
)
{
LOKitShell
.
sendKeyEvent
(
event
);
return
false
;
}
/**
* When key down event happens.
*/
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
LOKitShell
.
sendKeyEvent
(
event
);
return
false
;
}
/**
* When key long press event happens.
*/
@Override
public
boolean
onKeyLongPress
(
int
keyCode
,
KeyEvent
event
)
{
return
false
;
}
/**
* When key multiple event happens. Key multiple event is triggered when non-ascii characters are entered on soft keyboard
*/
@Override
public
boolean
onKeyMultiple
(
int
keyCode
,
int
repeatCount
,
KeyEvent
event
)
{
LOKitShell
.
sendKeyEvent
(
event
);
return
false
;
}
/**
* When key up event happens.
*/
@Override
public
boolean
onKeyUp
(
int
keyCode
,
KeyEvent
event
)
{
LOKitShell
.
sendKeyEvent
(
event
);
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -16,6 +16,10 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.concurrent.LinkedBlockingQueue
;
/**
* Thread that communicates with LibreOffice through LibreOfficeKit JNI interface. The thread
* consumes events from other threads (maininly the UI thread) and acts accordingly.
*/
public
class
LOKitThread
extends
Thread
{
private
static
final
String
LOGTAG
=
LOKitThread
.
class
.
getSimpleName
();
...
...
@@ -32,6 +36,9 @@ public class LOKitThread extends Thread {
TileProviderFactory
.
initialize
();
}
/**
* Starting point of the thread. Processes events that gather in the queue.
*/
@Override
public
void
run
()
{
while
(
true
)
{
...
...
@@ -45,7 +52,9 @@ public class LOKitThread extends Thread {
}
}
/* Viewport changed, recheck if tiles need to be added / removed */
/**
* Viewport changed, Recheck if tiles need to be added / removed.
*/
private
void
tileReevaluationRequest
(
ComposedTileLayer
composedTileLayer
)
{
if
(
mTileProvider
==
null
)
{
return
;
...
...
@@ -74,7 +83,9 @@ public class LOKitThread extends Thread {
mLayerClient
.
forceRender
();
}
/* Invalidate tiles that intersect the input rect */
/**
* Invalidate tiles that intersect the input rect.
*/
private
void
tileInvalidation
(
RectF
rect
)
{
if
(
mLayerClient
==
null
||
mTileProvider
==
null
)
{
return
;
...
...
@@ -113,6 +124,9 @@ public class LOKitThread extends Thread {
mLayerClient
.
forceRender
();
}
/**
* Reposition the view (zoom and position) when the document is firstly shown. This is document type dependent.
*/
private
void
zoomAndRepositionTheDocument
()
{
if
(
mTileProvider
.
isSpreadsheet
())
{
// Don't do anything for spreadsheets - show at 100%
...
...
@@ -139,6 +153,9 @@ public class LOKitThread extends Thread {
redraw
();
}
/**
* Change part of the document.
*/
private
void
changePart
(
int
partIndex
)
{
LOKitShell
.
showProgressSpinner
();
mTileProvider
.
changePart
(
partIndex
);
...
...
@@ -148,6 +165,10 @@ public class LOKitThread extends Thread {
LOKitShell
.
hideProgressSpinner
();
}
/**
* Handle load document event.
* @param filename - filename where the document is located
*/
private
void
loadDocument
(
String
filename
)
{
if
(
mApplication
==
null
)
{
mApplication
=
LibreOfficeMainActivity
.
mAppContext
;
...
...
@@ -168,6 +189,9 @@ public class LOKitThread extends Thread {
}
}
/**
* Close the currently loaded document.
*/
public
void
closeDocument
()
{
if
(
mTileProvider
!=
null
)
{
mTileProvider
.
close
();
...
...
@@ -175,6 +199,9 @@ public class LOKitThread extends Thread {
}
}
/**
* Process the input event.
*/
private
void
processEvent
(
LOEvent
event
)
{
switch
(
event
.
mType
)
{
case
LOEvent
.
LOAD
:
...
...
@@ -222,6 +249,9 @@ public class LOKitThread extends Thread {
}
}
/**
* Request a change of the handle position.
*/
private
void
changeHandlePosition
(
TextSelectionHandle
.
HandleType
handleType
,
PointF
documentCoordinate
)
{
if
(
handleType
==
TextSelectionHandle
.
HandleType
.
MIDDLE
)
{
mTileProvider
.
setTextSelectionReset
(
documentCoordinate
);
...
...
@@ -245,10 +275,16 @@ public class LOKitThread extends Thread {
mTileProvider
.
sendKeyEvent
(
keyEvent
);
}
/**
* Process swipe left event.
*/
private
void
onSwipeLeft
()
{
mTileProvider
.
onSwipeLeft
();
}
/**
* Process swipe right event.
*/
private
void
onSwipeRight
()
{
mTileProvider
.
onSwipeRight
();
}
...
...
@@ -276,15 +312,24 @@ public class LOKitThread extends Thread {
}
}
/**
* Create thumbnail for the requested document task.
*/
private
void
createThumbnail
(
final
ThumbnailCreator
.
ThumbnailCreationTask
task
)
{
final
Bitmap
bitmap
=
task
.
getThumbnail
(
mTileProvider
);
task
.
applyBitmap
(
bitmap
);
}
/**
* Queue an event.
*/
public
void
queueEvent
(
LOEvent
event
)
{
mEventQueue
.
add
(
event
);
}
/**
* Clear all events in the queue (used when document is closed).
*/
public
void
clearQueue
()
{
mEventQueue
.
clear
();
}
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -48,6 +48,12 @@ public class LOKitTileProvider implements TileProvider {
private
long
objectCreationTime
=
System
.
currentTimeMillis
();
/**
* Initialize LOKit and load the document.
* @param layerClient - layerclient implementation
* @param messageCallback - callback for messages retrieved from LOKit
* @param input - input path of the document
*/
public
LOKitTileProvider
(
GeckoLayerClient
layerClient
,
Document
.
MessageCallback
messageCallback
,
String
input
)
{
mLayerClient
=
layerClient
;
mMessageCallback
=
messageCallback
;
...
...
@@ -89,7 +95,10 @@ public class LOKitTileProvider implements TileProvider {
}
}
public
void
postLoad
()
{
/**
* Triggered after the document is loaded.
*/
private
void
postLoad
()
{
mDocument
.
setMessageCallback
(
mMessageCallback
);
int
parts
=
mDocument
.
getParts
();
...
...
@@ -151,11 +160,18 @@ public class LOKitTileProvider implements TileProvider {
return
(
input
/
dpi
)
*
1440.0f
;
}
/**
* @see TileProvider#getPartsCount()
*/
@Override
public
int
getPartsCount
()
{
return
mDocument
.
getParts
();
}
/**
* @see TileProvider#onSwipeLeft()
*/
@Override
public
void
onSwipeLeft
()
{
if
(
mDocument
.
getDocumentType
()
==
Document
.
DOCTYPE_PRESENTATION
&&
...
...
@@ -164,6 +180,9 @@ public class LOKitTileProvider implements TileProvider {
}
}
/**
* @see TileProvider#onSwipeRight()
*/
@Override
public
void
onSwipeRight
()
{
if
(
mDocument
.
getDocumentType
()
==
Document
.
DOCTYPE_PRESENTATION
&&
...
...
@@ -213,21 +232,33 @@ public class LOKitTileProvider implements TileProvider {
return
true
;
}
/**
* @see TileProvider#getPageWidth()
*/
@Override
public
int
getPageWidth
()
{
return
(
int
)
twipToPixel
(
mWidthTwip
,
mDPI
);
}
/**
* @see TileProvider#getPageHeight()
*/
@Override
public
int
getPageHeight
()
{
return
(
int
)
twipToPixel
(
mHeightTwip
,
mDPI
);
}
/**
* @see TileProvider#isReady()
*/
@Override
public
boolean
isReady
()
{
return
mIsReady
;
}
/**
* @see TileProvider#createTile(float, float, org.mozilla.gecko.gfx.IntSize, float)
*/
@Override
public
CairoImage
createTile
(
float
x
,
float
y
,
IntSize
tileSize
,
float
zoom
)
{
ByteBuffer
buffer
=
DirectBufferAllocator
.
guardedAllocate
(
tileSize
.
width
*
tileSize
.
height
*
4
);
...
...
@@ -239,6 +270,9 @@ public class LOKitTileProvider implements TileProvider {
return
image
;
}
/**
* @see TileProvider#rerenderTile(org.mozilla.gecko.gfx.CairoImage, float, float, org.mozilla.gecko.gfx.IntSize, float)
*/
@Override
public
void
rerenderTile
(
CairoImage
image
,
float
x
,
float
y
,
IntSize
tileSize
,
float
zoom
)
{
if
(
mDocument
!=
null
&&
image
.
getBuffer
()
!=
null
)
{
...
...
@@ -260,6 +294,9 @@ public class LOKitTileProvider implements TileProvider {
}
}
/**
* @see TileProvider#thumbnail(int)
*/
@Override
public
Bitmap
thumbnail
(
int
size
)
{
int
widthPixel
=
getPageWidth
();
...
...
@@ -289,6 +326,9 @@ public class LOKitTileProvider implements TileProvider {
return
bitmap
;
}
/**
* @see TileProvider#close()
*/
@Override
public
void
close
()
{
Log
.
i
(
LOGTAG
,
"Document destroyed: "
+
mInputFile
);
...
...
@@ -298,11 +338,17 @@ public class LOKitTileProvider implements TileProvider {
}
}
/**
* @see TileProvider#isTextDocument()
*/
@Override
public
boolean
isTextDocument
()
{
return
mDocument
!=
null
&&
mDocument
.
getDocumentType
()
==
Document
.
DOCTYPE_TEXT
;
}
/**
* @see TileProvider#isSpreadsheet()
*/
@Override
public
boolean
isSpreadsheet
()
{
return
mDocument
!=
null
&&
mDocument
.
getDocumentType
()
==
Document
.
DOCTYPE_SPREADSHEET
;
...
...
@@ -335,6 +381,9 @@ public class LOKitTileProvider implements TileProvider {
return
0
;
}
/**
* @see TileProvider#sendKeyEvent(android.view.KeyEvent)
*/
@Override
public
void
sendKeyEvent
(
KeyEvent
keyEvent
)
{
if
(
keyEvent
.
getAction
()
==
KeyEvent
.
ACTION_MULTIPLE
)
{
...
...
@@ -357,11 +406,17 @@ public class LOKitTileProvider implements TileProvider {
mDocument
.
postMouseEvent
(
type
,
x
,
y
,
numberOfClicks
);
}
/**
* @see TileProvider#mouseButtonDown(android.graphics.PointF, int)
*/
@Override
public
void
mouseButtonDown
(
PointF
documentCoordinate
,
int
numberOfClicks
)
{
mouseButton
(
Document
.
MOUSE_BUTTON_DOWN
,
documentCoordinate
,
numberOfClicks
);
}
/**
* @see TileProvider#mouseButtonUp(android.graphics.PointF, int)
*/
@Override
public
void
mouseButtonUp
(
PointF
documentCoordinate
,
int
numberOfClicks
)
{
mouseButton
(
Document
.
MOUSE_BUTTON_UP
,
documentCoordinate
,
numberOfClicks
);
...
...
@@ -378,16 +433,25 @@ public class LOKitTileProvider implements TileProvider {
mDocument
.
setTextSelection
(
type
,
x
,
y
);
}
/**
* @see TileProvider#setTextSelectionStart(android.graphics.PointF)
*/
@Override
public
void
setTextSelectionStart
(
PointF
documentCoordinate
)
{
setTextSelection
(
Document
.
SET_TEXT_SELECTION_START
,
documentCoordinate
);
}
/**
* @see TileProvider#setTextSelectionEnd(android.graphics.PointF)
*/
@Override
public
void
setTextSelectionEnd
(
PointF
documentCoordinate
)
{
setTextSelection
(
Document
.
SET_TEXT_SELECTION_END
,
documentCoordinate
);
}
/**
* @see TileProvider#setTextSelectionReset(android.graphics.PointF)
*/
@Override
public
void
setTextSelectionReset
(
PointF
documentCoordinate
)
{
setTextSelection
(
Document
.
SET_TEXT_SELECTION_RESET
,
documentCoordinate
);
...
...
@@ -399,6 +463,9 @@ public class LOKitTileProvider implements TileProvider {
super
.
finalize
();
}
/**
* @see TileProvider#changePart(int)
*/
@Override
public
void
changePart
(
int
partIndex
)
{
if
(
mDocument
==
null
)
...
...
@@ -408,6 +475,9 @@ public class LOKitTileProvider implements TileProvider {
resetDocumentSize
();
}
/**
* @see TileProvider#getCurrentPartNumber()
*/
@Override
public
int
getCurrentPartNumber
()
{
if
(
mDocument
==
null
)
...
...
@@ -417,4 +487,4 @@ public class LOKitTileProvider implements TileProvider {
}
}
/
* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/
/ vim:set shiftwidth=4 softtabstop=4 expandtab:
android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -34,6 +34,9 @@ import java.io.OutputStream;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Main activity of the LibreOffice App. It is started in the UI thread.
*/
public
class
LibreOfficeMainActivity
extends
ActionBarActivity
{
private
static
final
String
LOGTAG
=
"LibreOfficeMainActivity"
;
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -38,6 +38,9 @@ public class TextCursorLayer extends Layer {
}
}
/**
* @see Layer#draw(org.mozilla.gecko.gfx.Layer.RenderContext)
*/
@Override
public
void
draw
(
final
RenderContext
context
)
{
if
(
FloatUtils
.
fuzzyEquals
(
mViewLeft
,
context
.
viewport
.
left
)
...
...
@@ -57,6 +60,9 @@ public class TextCursorLayer extends Layer {
});
}
/**
* Show the cursor at the defined cursor position on the overlay.
*/
public
void
showCursor
()
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
@@ -72,6 +78,9 @@ public class TextCursorLayer extends Layer {
});
}
/**
* Hide the cursor at the defined cursor position on the overlay.
*/
public
void
hideCursor
()
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
@@ -80,6 +89,9 @@ public class TextCursorLayer extends Layer {
});
}
/**
* Position the cursor to the input position on the overlay.
*/
public
void
positionCursor
(
final
RectF
position
)
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
@@ -88,6 +100,9 @@ public class TextCursorLayer extends Layer {
});
}
/**
* Show selections on the overlay.
*/
public
void
showSelections
()
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
@@ -100,6 +115,9 @@ public class TextCursorLayer extends Layer {
});
}
/**
* Hide selections on the overlay.
*/
public
void
hideSelections
()
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
@@ -108,6 +126,9 @@ public class TextCursorLayer extends Layer {
});
}
/**
* Change the list of selections.
*/
public
void
changeSelections
(
final
List
<
RectF
>
selections
)
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
@@ -116,6 +137,9 @@ public class TextCursorLayer extends Layer {
});
}
/**
* Show the graphic selection on the overlay.
*/
public
void
showGraphicSelection
()
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
@@ -124,6 +148,9 @@ public class TextCursorLayer extends Layer {
});
}
/**
* Hide the graphic selection on the overlay.
*/
public
void
hideGraphicSelection
()
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
@@ -132,6 +159,9 @@ public class TextCursorLayer extends Layer {
});
}
/**
* Change the graphic selection rectangle to the input rectangle.
*/
public
void
changeGraphicSelection
(
final
RectF
rectangle
)
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -13,6 +13,9 @@ import android.graphics.RectF;
import
org.mozilla.gecko.gfx.IntSize
;
/**
* Identifies the tile by its position (x and y coordinate on the document), zoom and tile size (currently static)
*/
public
class
TileIdentifier
{
public
final
int
x
;
public
final
int
y
;
...
...
@@ -26,10 +29,16 @@ public class TileIdentifier {
this
.
size
=
size
;
}
/**
* Returns a rectangle of the tiles position in scaled coordinates.
*/
public
RectF
getRectF
()
{
return
new
RectF
(
x
,
y
,
x
+
size
.
width
,
y
+
size
.
height
);
}
/**
* Returns a rectangle of the tiles position in non-scaled coordinates (coordinates as the zoom would be 1).
*/
public
RectF
getCSSRectF
()
{
float
cssX
=
x
/
zoom
;
float
cssY
=
y
/
zoom
;
...
...
@@ -38,6 +47,9 @@ public class TileIdentifier {
return
new
RectF
(
cssX
,
cssY
,
cssX
+
cssSizeW
,
cssY
+
cssSizeH
);
}
/**
* Returns a integer rectangle of the tiles position in non-scaled and rounded coordinates (coordinates as the zoom would be 1).
*/
public
Rect
getCSSRect
()
{
float
cssX
=
x
/
zoom
;
float
cssY
=
y
/
zoom
;
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -17,6 +17,9 @@ import android.view.KeyEvent;
import
org.mozilla.gecko.gfx.CairoImage
;
import
org.mozilla.gecko.gfx.IntSize
;
/**
* Provides the tiles and other document information.
*/
public
interface
TileProvider
{
/**
* Returns the page width in pixels.
...
...
@@ -114,10 +117,22 @@ public interface TileProvider {
*/
void
postUnoCommand
(
String
command
);
/**
* Send text selection start coordinate.
* @param documentCoordinate
*/
void
setTextSelectionStart
(
PointF
documentCoordinate
);
/**
* Send text selection end coordinate.
* @param documentCoordinate
*/
void
setTextSelectionEnd
(
PointF
documentCoordinate
);
/**
* Send text selection reset coordinate.
* @param documentCoordinate
*/
void
setTextSelectionReset
(
PointF
documentCoordinate
);
}
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/TileProviderFactory.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -12,6 +12,9 @@ package org.libreoffice;
import
org.libreoffice.kit.LibreOfficeKit
;
import
org.mozilla.gecko.gfx.GeckoLayerClient
;
/**
* Create a desired instance of TileProvider.
*/
public
class
TileProviderFactory
{
private
static
TileProviderID
currentTileProvider
=
TileProviderID
.
LOKIT
;
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/ToolbarController.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -11,6 +11,9 @@ package org.libreoffice;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.widget.Toolbar
;
/**
* Controls the changes to the toolbar.
*/
public
class
ToolbarController
{
private
final
Toolbar
mToolbar
;
private
final
ActionBar
mActionBar
;
...
...
@@ -21,7 +24,11 @@ public class ToolbarController {
switchToViewMode
();
}
/**
* Change the toolbar to edit mode.
*/
void
switchToEditMode
()
{
// Insure the change is done on UI thread
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
@@ -33,7 +40,11 @@ public class ToolbarController {
});
}
/**
* Change the toolbar to view mode.
*/
void
switchToViewMode
()
{
// Insure the change is done on UI thread
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -18,6 +18,10 @@ import org.mozilla.gecko.util.FloatUtils;
import
static
org
.
mozilla
.
gecko
.
TextSelectionHandle
.
HandleType
.
MIDDLE
;
import
static
org
.
mozilla
.
gecko
.
TextSelectionHandle
.
HandleType
.
START
;
/**
* TextSelection operates the text selection (start, middle and end) handles. It is a Layer implementation
* that intercepts viewport changes and repositions the text handles accordingly.
*/
public
class
TextSelection
extends
Layer
{
private
static
final
String
LOGTAG
=
"GeckoTextSelection"
;
...
...
@@ -40,9 +44,15 @@ public class TextSelection extends Layer {
}
}
/**
* Destroys created resources if any were created.
*/
void
destroy
()
{
}
/**
* Reposition the handles when draw happens.
*/
@Override
public
void
draw
(
final
RenderContext
context
)
{
// cache the relevant values from the context and bail out if they are the same. we do this
...
...
@@ -66,6 +76,9 @@ public class TextSelection extends Layer {
});
}
/**
* Shows the requested handle.
*/
public
void
showHandle
(
final
TextSelectionHandle
.
HandleType
handleType
)
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
@@ -84,6 +97,9 @@ public class TextSelection extends Layer {
});
}
/**
* Get instance of the requested handle type..
*/
private
TextSelectionHandle
getHandle
(
TextSelectionHandle
.
HandleType
handleType
)
{
if
(
handleType
==
START
)
{
return
mStartHandle
;
...
...
@@ -94,6 +110,9 @@ public class TextSelection extends Layer {
}
}
/**
* Hides the requested handle.
*/
public
void
hideHandle
(
final
TextSelectionHandle
.
HandleType
handleType
)
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
@@ -103,7 +122,9 @@ public class TextSelection extends Layer {
});
}
/**
* Position the handle requested handle to the input rectangle (expressed in document coordinates)
*/
public
void
positionHandle
(
final
TextSelectionHandle
.
HandleType
handleType
,
final
RectF
position
)
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
...
...
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelectionHandle.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -21,6 +21,9 @@ import org.libreoffice.R;
import
org.mozilla.gecko.gfx.ImmutableViewportMetrics
;
import
org.mozilla.gecko.gfx.LayerView
;
/**
* Custom image view used for showing the text selection handles.
*/
public
class
TextSelectionHandle
extends
ImageView
implements
View
.
OnTouchListener
{
private
static
final
String
LOGTAG
=
TextSelectionHandle
.
class
.
getSimpleName
();
private
long
mLastTime
=
0
;
...
...
android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/RenderControllerThread.java
Dosyayı görüntüle @
f0f0ce28
...
...
@@ -6,6 +6,10 @@ import java.util.concurrent.LinkedBlockingQueue;
import
javax.microedition.khronos.opengles.GL10
;
/**
* Thread which controls the rendering to OpenGL context. Render commands are queued and
* processed and delegated by this thread.
*/
public
class
RenderControllerThread
extends
Thread
implements
LayerView
.
Listener
{
private
LinkedBlockingQueue
<
RenderCommand
>
queue
=
new
LinkedBlockingQueue
<
RenderCommand
>();
private
GLController
controller
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment