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
dc43b61e
Kaydet (Commit)
dc43b61e
authored
Şub 26, 2015
tarafından
Tomaž Vajngerl
Kaydeden (comit)
Miklos Vajna
Mar 02, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
android: create InvalidationHandler outside of LOKitTileProvider
Change-Id: I79bb20ca5a16a2ebdc6ed3f1c97a483173b0762b
üst
5b4fc00b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
34 deletions
+36
-34
InvalidationHandler.java
...ndroid3/src/java/org/libreoffice/InvalidationHandler.java
+27
-28
LOKitThread.java
...ntal/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+4
-1
LOKitTileProvider.java
...OAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+3
-2
TileProviderFactory.java
...ndroid3/src/java/org/libreoffice/TileProviderFactory.java
+2
-3
No files found.
android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
Dosyayı görüntüle @
dc43b61e
...
@@ -13,14 +13,19 @@ import org.mozilla.gecko.TextSelectionHandle;
...
@@ -13,14 +13,19 @@ import org.mozilla.gecko.TextSelectionHandle;
public
class
InvalidationHandler
{
public
class
InvalidationHandler
{
private
static
String
LOGTAG
=
InvalidationHandler
.
class
.
getSimpleName
();
private
static
String
LOGTAG
=
InvalidationHandler
.
class
.
getSimpleName
();
public
InvalidationHandler
()
{
private
TextCursorLayer
mTextCursorLayer
;
private
TextSelection
mTextSelection
;
public
InvalidationHandler
(
LibreOfficeMainActivity
mainActivity
)
{
mTextCursorLayer
=
mainActivity
.
getTextCursorLayer
();
mTextSelection
=
mainActivity
.
getTextSelection
();
}
}
/**
/**
* Processes invalidation message
* Processes invalidation message
*
*
* @param messageID - ID of the message
* @param messageID - ID of the message
* @param payload - additional invalidation message payload
* @param payload
- additional invalidation message payload
*/
*/
public
void
processMessage
(
int
messageID
,
String
payload
)
{
public
void
processMessage
(
int
messageID
,
String
payload
)
{
switch
(
messageID
)
{
switch
(
messageID
)
{
...
@@ -28,6 +33,7 @@ public class InvalidationHandler {
...
@@ -28,6 +33,7 @@ public class InvalidationHandler {
invalidateTiles
(
payload
);
invalidateTiles
(
payload
);
break
;
break
;
case
Document
.
CALLBACK_INVALIDATE_VISIBLE_CURSOR
:
case
Document
.
CALLBACK_INVALIDATE_VISIBLE_CURSOR
:
Log
.
i
(
LOGTAG
,
"Cursor: "
+
payload
);
invalidateCursor
(
payload
);
invalidateCursor
(
payload
);
break
;
break
;
case
Document
.
CALLBACK_INVALIDATE_TEXT_SELECTION
:
case
Document
.
CALLBACK_INVALIDATE_TEXT_SELECTION
:
...
@@ -80,24 +86,23 @@ public class InvalidationHandler {
...
@@ -80,24 +86,23 @@ public class InvalidationHandler {
/**
/**
* Handles the cursor invalidation message
* Handles the cursor invalidation message
*
* @param payload
* @param payload
*/
*/
private
void
invalidateCursor
(
String
payload
)
{
private
void
invalidateCursor
(
String
payload
)
{
RectF
rect
=
convertCallbackMessageStringToRectF
(
payload
);
RectF
rect
=
convertCallbackMessageStringToRectF
(
payload
);
if
(
rect
!=
null
)
{
if
(
rect
!=
null
)
{
RectF
underSelection
=
new
RectF
(
rect
.
centerX
(),
rect
.
bottom
,
rect
.
centerX
(),
rect
.
bottom
);
RectF
underSelection
=
new
RectF
(
rect
.
centerX
(),
rect
.
bottom
,
rect
.
centerX
(),
rect
.
bottom
);
TextSelection
textSelection
=
LibreOfficeMainActivity
.
mAppContext
.
getTextSelection
();
mTextSelection
.
positionHandle
(
TextSelectionHandle
.
HandleType
.
MIDDLE
,
underSelection
);
textSelection
.
positionHandle
(
TextSelectionHandle
.
HandleType
.
MIDDLE
,
underSelection
);
mTextSelection
.
showHandle
(
TextSelectionHandle
.
HandleType
.
MIDDLE
);
textSelection
.
showHandle
(
TextSelectionHandle
.
HandleType
.
MIDDLE
);
mTextCursorLayer
.
positionCursor
(
rect
);
mTextCursorLayer
.
showCursor
();
TextCursorLayer
textCursorLayer
=
LibreOfficeMainActivity
.
mAppContext
.
getTextCursorLayer
();
textCursorLayer
.
positionCursor
(
rect
);
textCursorLayer
.
showCursor
();
}
}
}
}
/**
/**
* Handles the tile invalidation message
* Handles the tile invalidation message
*
* @param payload
* @param payload
*/
*/
private
void
invalidateTiles
(
String
payload
)
{
private
void
invalidateTiles
(
String
payload
)
{
...
@@ -109,51 +114,45 @@ public class InvalidationHandler {
...
@@ -109,51 +114,45 @@ public class InvalidationHandler {
/**
/**
* Handles the selection start invalidation message
* Handles the selection start invalidation message
*
* @param payload
* @param payload
*/
*/
private
void
invalidateSelectionStart
(
String
payload
)
{
private
void
invalidateSelectionStart
(
String
payload
)
{
RectF
rect
=
convertCallbackMessageStringToRectF
(
payload
);
RectF
rect
=
convertCallbackMessageStringToRectF
(
payload
);
if
(
rect
!=
null
)
{
if
(
rect
!=
null
)
{
RectF
underSelection
=
new
RectF
(
rect
.
centerX
(),
rect
.
bottom
,
rect
.
centerX
(),
rect
.
bottom
);
RectF
underSelection
=
new
RectF
(
rect
.
centerX
(),
rect
.
bottom
,
rect
.
centerX
(),
rect
.
bottom
);
TextSelection
textSelection
=
LibreOfficeMainActivity
.
mAppContext
.
getTextSelection
();
mTextSelection
.
positionHandle
(
TextSelectionHandle
.
HandleType
.
START
,
underSelection
);
textSelection
.
positionHandle
(
TextSelectionHandle
.
HandleType
.
START
,
underSelection
);
mTextSelection
.
showHandle
(
TextSelectionHandle
.
HandleType
.
START
);
textSelection
.
showHandle
(
TextSelectionHandle
.
HandleType
.
START
);
mTextSelection
.
hideHandle
(
TextSelectionHandle
.
HandleType
.
MIDDLE
);
mTextCursorLayer
.
hideCursor
();
textSelection
.
hideHandle
(
TextSelectionHandle
.
HandleType
.
MIDDLE
);
TextCursorLayer
textCursorLayer
=
LibreOfficeMainActivity
.
mAppContext
.
getTextCursorLayer
();
textCursorLayer
.
hideCursor
();
}
}
}
}
/**
/**
* Handles the selection end invalidation message
* Handles the selection end invalidation message
*
* @param payload
* @param payload
*/
*/
private
void
invalidateSelectionEnd
(
String
payload
)
{
private
void
invalidateSelectionEnd
(
String
payload
)
{
RectF
rect
=
convertCallbackMessageStringToRectF
(
payload
);
RectF
rect
=
convertCallbackMessageStringToRectF
(
payload
);
if
(
rect
!=
null
)
{
if
(
rect
!=
null
)
{
RectF
underSelection
=
new
RectF
(
rect
.
centerX
(),
rect
.
bottom
,
rect
.
centerX
(),
rect
.
bottom
);
RectF
underSelection
=
new
RectF
(
rect
.
centerX
(),
rect
.
bottom
,
rect
.
centerX
(),
rect
.
bottom
);
TextSelection
textSelection
=
LibreOfficeMainActivity
.
mAppContext
.
getTextSelection
();
mTextSelection
.
positionHandle
(
TextSelectionHandle
.
HandleType
.
END
,
underSelection
);
textSelection
.
positionHandle
(
TextSelectionHandle
.
HandleType
.
END
,
underSelection
);
mTextSelection
.
showHandle
(
TextSelectionHandle
.
HandleType
.
END
);
textSelection
.
showHandle
(
TextSelectionHandle
.
HandleType
.
END
);
mTextSelection
.
hideHandle
(
TextSelectionHandle
.
HandleType
.
MIDDLE
);
mTextCursorLayer
.
hideCursor
();
textSelection
.
hideHandle
(
TextSelectionHandle
.
HandleType
.
MIDDLE
);
TextCursorLayer
textCursorLayer
=
LibreOfficeMainActivity
.
mAppContext
.
getTextCursorLayer
();
textCursorLayer
.
hideCursor
();
}
}
}
}
/**
/**
* Handles the selection invalidation message
* Handles the selection invalidation message
*
* @param payload
* @param payload
*/
*/
private
void
invalidateSelection
(
String
payload
)
{
private
void
invalidateSelection
(
String
payload
)
{
if
(
payload
.
isEmpty
())
{
if
(
payload
.
isEmpty
())
{
TextSelection
textSelection
=
LibreOfficeMainActivity
.
mAppContext
.
getTextSelection
();
mTextSelection
.
hideHandle
(
TextSelectionHandle
.
HandleType
.
START
);
textSelection
.
hideHandle
(
TextSelectionHandle
.
HandleType
.
START
);
mTextSelection
.
hideHandle
(
TextSelectionHandle
.
HandleType
.
END
);
textSelection
.
hideHandle
(
TextSelectionHandle
.
HandleType
.
END
);
}
}
}
}
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
Dosyayı görüntüle @
dc43b61e
...
@@ -24,10 +24,12 @@ public class LOKitThread extends Thread {
...
@@ -24,10 +24,12 @@ public class LOKitThread extends Thread {
private
LibreOfficeMainActivity
mApplication
;
private
LibreOfficeMainActivity
mApplication
;
private
TileProvider
mTileProvider
;
private
TileProvider
mTileProvider
;
private
InvalidationHandler
mInvalidationHandler
;
private
ImmutableViewportMetrics
mViewportMetrics
;
private
ImmutableViewportMetrics
mViewportMetrics
;
private
GeckoLayerClient
mLayerClient
;
private
GeckoLayerClient
mLayerClient
;
public
LOKitThread
()
{
public
LOKitThread
()
{
mInvalidationHandler
=
null
;
TileProviderFactory
.
initialize
();
TileProviderFactory
.
initialize
();
}
}
...
@@ -154,7 +156,8 @@ public class LOKitThread extends Thread {
...
@@ -154,7 +156,8 @@ public class LOKitThread extends Thread {
mLayerClient
=
mApplication
.
getLayerClient
();
mLayerClient
=
mApplication
.
getLayerClient
();
mTileProvider
=
TileProviderFactory
.
create
(
mLayerClient
,
filename
);
mInvalidationHandler
=
new
InvalidationHandler
(
LibreOfficeMainActivity
.
mAppContext
);
mTileProvider
=
TileProviderFactory
.
create
(
mLayerClient
,
mInvalidationHandler
,
filename
);
if
(
mTileProvider
.
isReady
())
{
if
(
mTileProvider
.
isReady
())
{
LOKitShell
.
showProgressSpinner
();
LOKitShell
.
showProgressSpinner
();
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
Dosyayı görüntüle @
dc43b61e
...
@@ -37,12 +37,13 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
...
@@ -37,12 +37,13 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
private
float
mWidthTwip
;
private
float
mWidthTwip
;
private
float
mHeightTwip
;
private
float
mHeightTwip
;
private
InvalidationHandler
mInvalidationHandler
=
new
InvalidationHandler
()
;
private
InvalidationHandler
mInvalidationHandler
;
private
long
objectCreationTime
=
System
.
currentTimeMillis
();
private
long
objectCreationTime
=
System
.
currentTimeMillis
();
public
LOKitTileProvider
(
GeckoLayerClient
layerClient
,
String
input
)
{
public
LOKitTileProvider
(
GeckoLayerClient
layerClient
,
InvalidationHandler
invalidationHandler
,
String
input
)
{
mLayerClient
=
layerClient
;
mLayerClient
=
layerClient
;
mInvalidationHandler
=
invalidationHandler
;
mDPI
=
(
float
)
LOKitShell
.
getDpi
();
mDPI
=
(
float
)
LOKitShell
.
getDpi
();
mTileWidth
=
pixelToTwip
(
TILE_SIZE
,
mDPI
);
mTileWidth
=
pixelToTwip
(
TILE_SIZE
,
mDPI
);
mTileHeight
=
pixelToTwip
(
TILE_SIZE
,
mDPI
);
mTileHeight
=
pixelToTwip
(
TILE_SIZE
,
mDPI
);
...
...
android/experimental/LOAndroid3/src/java/org/libreoffice/TileProviderFactory.java
Dosyayı görüntüle @
dc43b61e
...
@@ -8,7 +8,6 @@ public class TileProviderFactory {
...
@@ -8,7 +8,6 @@ public class TileProviderFactory {
private
static
TileProviderID
currentTileProvider
=
TileProviderID
.
LOKIT
;
private
static
TileProviderID
currentTileProvider
=
TileProviderID
.
LOKIT
;
private
TileProviderFactory
()
{
private
TileProviderFactory
()
{
}
}
public
static
void
initialize
()
{
public
static
void
initialize
()
{
...
@@ -17,9 +16,9 @@ public class TileProviderFactory {
...
@@ -17,9 +16,9 @@ public class TileProviderFactory {
}
}
}
}
public
static
TileProvider
create
(
GeckoLayerClient
layerClient
,
String
filename
)
{
public
static
TileProvider
create
(
GeckoLayerClient
layerClient
,
InvalidationHandler
invalidationHandler
,
String
filename
)
{
if
(
currentTileProvider
==
TileProviderID
.
LOKIT
)
{
if
(
currentTileProvider
==
TileProviderID
.
LOKIT
)
{
return
new
LOKitTileProvider
(
layerClient
,
filename
);
return
new
LOKitTileProvider
(
layerClient
,
invalidationHandler
,
filename
);
}
else
{
}
else
{
return
new
MockTileProvider
(
layerClient
,
filename
);
return
new
MockTileProvider
(
layerClient
,
filename
);
}
}
...
...
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