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
003a62fb
Kaydet (Commit)
003a62fb
authored
Mar 10, 2015
tarafından
Tomaž Vajngerl
Kaydeden (comit)
Miklos Vajna
Mar 16, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
android: add graphic selection to TextCursorLayer{View}
Change-Id: I13d26dd8b38d0b6817f3d0dbcb8a063fef559c2a
üst
a14d2925
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
5 deletions
+84
-5
TextCursorLayer.java
.../LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
+24
-0
TextCursorView.java
...l/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
+60
-5
No files found.
android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
Dosyayı görüntüle @
003a62fb
...
@@ -107,4 +107,28 @@ public class TextCursorLayer extends Layer {
...
@@ -107,4 +107,28 @@ public class TextCursorLayer extends Layer {
}
}
});
});
}
}
public
void
showGraphicSelection
()
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
mCursorView
.
showGraphicSelection
();
}
});
}
public
void
hideGraphicSelection
()
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
mCursorView
.
hideGraphicSelection
();
}
});
}
public
void
changeGraphicSelection
(
final
RectF
rectangle
)
{
LOKitShell
.
getMainHandler
().
post
(
new
Runnable
()
{
public
void
run
()
{
mCursorView
.
changeGraphicSelection
(
rectangle
);
}
});
}
}
}
android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
Dosyayı görüntüle @
003a62fb
...
@@ -28,16 +28,22 @@ public class TextCursorView extends View {
...
@@ -28,16 +28,22 @@ public class TextCursorView extends View {
private
boolean
mInitialized
=
false
;
private
boolean
mInitialized
=
false
;
private
RectF
mCursorPosition
=
new
RectF
();
private
RectF
mCursorPosition
=
new
RectF
();
private
RectF
mCursorScaledPosition
=
new
RectF
();
private
RectF
mCursorScaledPosition
=
new
RectF
();
private
Paint
mCursorPaint
=
new
Paint
();
private
int
mCursorAlpha
=
0
;
private
int
mCursorAlpha
=
0
;
private
boolean
mCursorVisible
;
private
List
<
RectF
>
mSelections
=
new
ArrayList
<
RectF
>();
private
List
<
RectF
>
mSelections
=
new
ArrayList
<
RectF
>();
private
List
<
RectF
>
mScaledSelections
=
new
ArrayList
<
RectF
>();
private
List
<
RectF
>
mScaledSelections
=
new
ArrayList
<
RectF
>();
private
Paint
mCursorPaint
=
new
Paint
();
private
Paint
mSelectionPaint
=
new
Paint
();
private
Paint
mSelectionPaint
=
new
Paint
();
private
boolean
mCursorVisible
;
private
boolean
mSelectionsVisible
;
private
boolean
mSelectionsVisible
;
private
RectF
mGraphicSelection
=
new
RectF
();
private
RectF
mGraphicScaledSelection
=
new
RectF
();
private
Paint
mGraphicSelectionPaint
=
new
Paint
();
private
Paint
mGraphicHandleFillPaint
=
new
Paint
();
private
float
mRadius
=
20.0f
;
private
boolean
mGraphicSelectionVisible
;
public
TextCursorView
(
Context
context
)
{
public
TextCursorView
(
Context
context
)
{
super
(
context
);
super
(
context
);
initialize
();
initialize
();
...
@@ -59,13 +65,20 @@ public class TextCursorView extends View {
...
@@ -59,13 +65,20 @@ public class TextCursorView extends View {
mCursorPaint
.
setColor
(
Color
.
BLACK
);
mCursorPaint
.
setColor
(
Color
.
BLACK
);
mCursorPaint
.
setAlpha
(
0xFF
);
mCursorPaint
.
setAlpha
(
0xFF
);
mCursorVisible
=
false
;
mCursorVisible
=
false
;
mSelectionPaint
.
setColor
(
Color
.
BLUE
);
mSelectionPaint
.
setColor
(
Color
.
BLUE
);
mSelectionPaint
.
setAlpha
(
50
);
mSelectionPaint
.
setAlpha
(
50
);
mSelectionsVisible
=
false
;
mSelectionsVisible
=
false
;
mGraphicSelectionPaint
.
setStyle
(
Paint
.
Style
.
STROKE
);
mGraphicSelectionPaint
.
setColor
(
Color
.
BLACK
);
mGraphicSelectionPaint
.
setStrokeWidth
(
2
);
mGraphicHandleFillPaint
.
setStyle
(
Paint
.
Style
.
FILL
);
mGraphicHandleFillPaint
.
setColor
(
Color
.
WHITE
);
mGraphicSelectionVisible
=
false
;
mInitialized
=
true
;
mInitialized
=
true
;
}
}
}
}
...
@@ -78,6 +91,7 @@ public class TextCursorView extends View {
...
@@ -78,6 +91,7 @@ public class TextCursorView extends View {
}
}
mCursorPosition
=
position
;
mCursorPosition
=
position
;
ImmutableViewportMetrics
metrics
=
layerView
.
getViewportMetrics
();
ImmutableViewportMetrics
metrics
=
layerView
.
getViewportMetrics
();
repositionWithViewport
(
metrics
.
viewportRectLeft
,
metrics
.
viewportRectTop
,
metrics
.
zoomFactor
);
repositionWithViewport
(
metrics
.
viewportRectLeft
,
metrics
.
viewportRectTop
,
metrics
.
zoomFactor
);
}
}
...
@@ -95,6 +109,19 @@ public class TextCursorView extends View {
...
@@ -95,6 +109,19 @@ public class TextCursorView extends View {
repositionWithViewport
(
metrics
.
viewportRectLeft
,
metrics
.
viewportRectTop
,
metrics
.
zoomFactor
);
repositionWithViewport
(
metrics
.
viewportRectLeft
,
metrics
.
viewportRectTop
,
metrics
.
zoomFactor
);
}
}
public
void
changeGraphicSelection
(
RectF
rectangle
)
{
LayerView
layerView
=
LOKitShell
.
getLayerView
();
if
(
layerView
==
null
)
{
Log
.
e
(
LOGTAG
,
"Can't position selections because layerView is null"
);
return
;
}
mGraphicSelection
=
rectangle
;
ImmutableViewportMetrics
metrics
=
layerView
.
getViewportMetrics
();
repositionWithViewport
(
metrics
.
viewportRectLeft
,
metrics
.
viewportRectTop
,
metrics
.
zoomFactor
);
}
public
void
repositionWithViewport
(
float
x
,
float
y
,
float
zoom
)
{
public
void
repositionWithViewport
(
float
x
,
float
y
,
float
zoom
)
{
mCursorScaledPosition
=
RectUtils
.
scale
(
mCursorPosition
,
zoom
);
mCursorScaledPosition
=
RectUtils
.
scale
(
mCursorPosition
,
zoom
);
mCursorScaledPosition
.
offset
(-
x
,
-
y
);
mCursorScaledPosition
.
offset
(-
x
,
-
y
);
...
@@ -106,6 +133,9 @@ public class TextCursorView extends View {
...
@@ -106,6 +133,9 @@ public class TextCursorView extends View {
scaledSelection
.
offset
(-
x
,
-
y
);
scaledSelection
.
offset
(-
x
,
-
y
);
mScaledSelections
.
add
(
scaledSelection
);
mScaledSelections
.
add
(
scaledSelection
);
}
}
mGraphicScaledSelection
=
RectUtils
.
scale
(
mGraphicSelection
,
zoom
);
mGraphicScaledSelection
.
offset
(-
x
,
-
y
);
invalidate
();
invalidate
();
}
}
...
@@ -120,6 +150,20 @@ public class TextCursorView extends View {
...
@@ -120,6 +150,20 @@ public class TextCursorView extends View {
canvas
.
drawRect
(
selection
,
mSelectionPaint
);
canvas
.
drawRect
(
selection
,
mSelectionPaint
);
}
}
}
}
if
(
mGraphicSelectionVisible
)
{
canvas
.
drawRect
(
mGraphicScaledSelection
,
mGraphicSelectionPaint
);
canvas
.
drawCircle
(
mGraphicScaledSelection
.
left
,
mGraphicScaledSelection
.
top
,
mRadius
,
mGraphicHandleFillPaint
);
canvas
.
drawCircle
(
mGraphicScaledSelection
.
left
,
mGraphicScaledSelection
.
top
,
mRadius
,
mGraphicSelectionPaint
);
canvas
.
drawCircle
(
mGraphicScaledSelection
.
right
,
mGraphicScaledSelection
.
top
,
mRadius
,
mGraphicHandleFillPaint
);
canvas
.
drawCircle
(
mGraphicScaledSelection
.
right
,
mGraphicScaledSelection
.
top
,
mRadius
,
mGraphicSelectionPaint
);
canvas
.
drawCircle
(
mGraphicScaledSelection
.
left
,
mGraphicScaledSelection
.
bottom
,
mRadius
,
mGraphicHandleFillPaint
);
canvas
.
drawCircle
(
mGraphicScaledSelection
.
left
,
mGraphicScaledSelection
.
bottom
,
mRadius
,
mGraphicSelectionPaint
);
canvas
.
drawCircle
(
mGraphicScaledSelection
.
right
,
mGraphicScaledSelection
.
bottom
,
mRadius
,
mGraphicHandleFillPaint
);
canvas
.
drawCircle
(
mGraphicScaledSelection
.
right
,
mGraphicScaledSelection
.
bottom
,
mRadius
,
mGraphicSelectionPaint
);
}
}
}
private
Runnable
cursorAnimation
=
new
Runnable
()
{
private
Runnable
cursorAnimation
=
new
Runnable
()
{
...
@@ -151,4 +195,14 @@ public class TextCursorView extends View {
...
@@ -151,4 +195,14 @@ public class TextCursorView extends View {
mSelectionsVisible
=
false
;
mSelectionsVisible
=
false
;
invalidate
();
invalidate
();
}
}
public
void
showGraphicSelection
()
{
mGraphicSelectionVisible
=
true
;
invalidate
();
}
public
void
hideGraphicSelection
()
{
mGraphicSelectionVisible
=
false
;
invalidate
();
}
}
}
\ No newline at end of file
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