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
e40f2678
Kaydet (Commit)
e40f2678
authored
Agu 15, 2012
tarafından
Iain Billett
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added soft shadow around thumbnails.
Change-Id: I09926356c54e566a26b9fc944f61d3944dbd4ce0
üst
6078a319
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
23 deletions
+62
-23
DocumentLoader.java
...e4Android/src/org/libreoffice/android/DocumentLoader.java
+27
-5
GridItemAdapter.java
...ffice4Android/src/org/libreoffice/ui/GridItemAdapter.java
+8
-2
LibreOfficeUIActivity.java
...Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java
+27
-16
No files found.
android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java
Dosyayı görüntüle @
e40f2678
...
...
@@ -35,6 +35,10 @@ import android.app.Activity;
import
android.graphics.Bitmap
;
import
android.graphics.Matrix
;
import
android.graphics.Color
;
import
android.graphics.BitmapFactory
;
import
android.graphics.BlurMaskFilter
;
import
android.graphics.Canvas
;
import
android.graphics.Paint
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.util.Log
;
...
...
@@ -91,6 +95,7 @@ import com.sun.star.view.XRenderable;
import
java.io.*
;
import
java.nio.ByteBuffer
;
import
java.nio.IntBuffer
;
import
java.nio.ByteOrder
;
import
java.util.ArrayList
;
...
...
@@ -1050,10 +1055,6 @@ public class DocumentLoader
protected
void
onDestroy
()
{
super
.
onDestroy
();
//Save the thumbnail of the first page as the grid image.
// Could easily make a new (larger) thumb but recycling
// should be faster & more efficient, better for the environment ;-)
//ll = (LinearLayout)findViewById( R.id.navigator);
Bitmap
bmpAlpha
=
(
(
ThumbnailView
)
ll
.
getChildAt
(
0
)
).
getBitmap
();
//For now use these 3 lines to turn the bitmap right way up.
...
...
@@ -1061,13 +1062,34 @@ public class DocumentLoader
m
.
preScale
(
1.0f
,
-
1.0f
);
Bitmap
bmp
=
Bitmap
.
createBitmap
(
bmpAlpha
,
0
,
0
,
bmpAlpha
.
getWidth
(),
bmpAlpha
.
getHeight
(),
m
,
true
);
BlurMaskFilter
blurFilter
=
new
BlurMaskFilter
(
3
,
BlurMaskFilter
.
Blur
.
OUTER
);
Paint
shadowPaint
=
new
Paint
();
shadowPaint
.
setMaskFilter
(
blurFilter
);
int
[]
offsetXY
=
new
int
[
2
];
Bitmap
shadowImage
=
bmp
.
extractAlpha
(
shadowPaint
,
offsetXY
);
Bitmap
shadowImage32
=
shadowImage
.
copy
(
Bitmap
.
Config
.
ARGB_8888
,
true
);
ByteBuffer
pxBuffer
=
ByteBuffer
.
allocate
(
shadowImage32
.
getByteCount
()
);
IntBuffer
intPxBuffer
=
IntBuffer
.
allocate
(
shadowImage32
.
getByteCount
()/
4
);
shadowImage32
.
copyPixelsToBuffer
(
pxBuffer
);
for
(
int
i
=
0
;
i
<
shadowImage32
.
getByteCount
()/
4
;
i
++
){
int
pxA
=
(
int
)(
pxBuffer
.
get
(
i
*
4
+
3
)
);
//TODO make sure byte0 is A
intPxBuffer
.
put
(
i
,
Color
.
argb
(
(
int
)(
pxA
*
0.25f
)
,
0
,
0
,
0
)
);
}
shadowImage32
.
copyPixelsFromBuffer
(
intPxBuffer
);
Canvas
c
=
new
Canvas
(
shadowImage32
);
c
.
drawBitmap
(
bmp
,
-
offsetXY
[
0
],
-
offsetXY
[
1
],
null
);
File
file
=
new
File
(
extras
.
getString
(
"input"
));
Log
.
i
(
TAG
,
"onDestroy "
+
extras
.
getString
(
"input"
));
File
dir
=
file
.
getParentFile
();
File
thumbnailFile
=
new
File
(
dir
,
"."
+
file
.
getName
().
split
(
"[.]"
)[
0
]
+
".png"
);
try
{
Log
.
i
(
TAG
,
Integer
.
toString
(
shadowImage32
.
getWidth
()
-
bmp
.
getWidth
()
)
);
ByteArrayOutputStream
bytes
=
new
ByteArrayOutputStream
();
bmp
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
40
,
bytes
);
shadowImage32
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
40
,
bytes
);
thumbnailFile
.
createNewFile
();
FileOutputStream
fo
=
new
FileOutputStream
(
thumbnailFile
);
fo
.
write
(
bytes
.
toByteArray
());
...
...
android/experimental/LibreOffice4Android/src/org/libreoffice/ui/GridItemAdapter.java
Dosyayı görüntüle @
e40f2678
...
...
@@ -12,6 +12,8 @@ import org.libreoffice.R;
import
java.io.File
;
import
java.nio.ByteBuffer
;
import
java.nio.IntBuffer
;
import
android.content.Context
;
import
android.util.Log
;
...
...
@@ -23,18 +25,22 @@ import android.widget.ImageView;
import
android.widget.TextView
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Bitmap
;
import
android.graphics.BlurMaskFilter
;
import
android.graphics.Canvas
;
import
android.graphics.Paint
;
import
android.graphics.Color
;
public
class
GridItemAdapter
extends
BaseAdapter
{
Context
mContext
;
File
[]
filePaths
;
File
currentDirectory
;
String
tag
=
"GridItemAdapter"
;
String
TAG
=
"GridItemAdapter"
;
public
GridItemAdapter
(
Context
mContext
,
File
[]
filePaths
)
{
this
.
mContext
=
mContext
;
this
.
filePaths
=
filePaths
;
for
(
File
fn
:
filePaths
){
Log
.
d
(
tag
,
fn
.
getName
());
Log
.
d
(
TAG
,
fn
.
getName
());
}
}
...
...
android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java
Dosyayı görüntüle @
e40f2678
...
...
@@ -20,11 +20,6 @@ import java.text.SimpleDateFormat;
import
java.util.Date
;
import
java.util.prefs.Preferences
;
//import android.app.ActionBar;
//import android.view.Menu;
//import android.view.MenuInflater;
//import android.view.MenuItem;
import
com.actionbarsherlock.app.ActionBar
;
import
com.actionbarsherlock.view.Menu
;
import
com.actionbarsherlock.view.MenuItem
;
...
...
@@ -33,6 +28,10 @@ import com.actionbarsherlock.app.SherlockActivity;
import
android.graphics.drawable.BitmapDrawable
;
import
android.os.Build
;
import
android.graphics.Shader.TileMode
;
import
android.graphics.BlurMaskFilter
;
import
android.graphics.Canvas
;
import
android.graphics.Paint
;
import
android.graphics.Color
;
import
android.app.ActionBar.OnNavigationListener
;
import
android.app.Activity
;
...
...
@@ -81,6 +80,7 @@ import com.sun.star.view.XRenderable;
import
java.io.*
;
import
java.nio.ByteBuffer
;
import
java.nio.IntBuffer
;
import
java.nio.ByteOrder
;
public
class
LibreOfficeUIActivity
extends
SherlockActivity
implements
ActionBar
.
OnNavigationListener
{
...
...
@@ -734,16 +734,6 @@ class ListItemAdapter implements ListAdapter{
return
null
;
}
protected
void
onPreExecute
()
{
try
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
System
.
err
);
}
}
protected
Integer
doInBackground
(
String
...
params
)
{
try
{
...
...
@@ -869,11 +859,32 @@ class ListItemAdapter implements ListAdapter{
Matrix
m
=
new
Matrix
();
m
.
preScale
(
1.0f
,
-
1.0f
);
Bitmap
bmp
=
Bitmap
.
createBitmap
(
bm
,
0
,
0
,
bm
.
getWidth
(),
bm
.
getHeight
(),
m
,
true
);
BlurMaskFilter
blurFilter
=
new
BlurMaskFilter
(
3
,
BlurMaskFilter
.
Blur
.
OUTER
);
Paint
shadowPaint
=
new
Paint
();
shadowPaint
.
setMaskFilter
(
blurFilter
);
int
[]
offsetXY
=
new
int
[
2
];
Bitmap
shadowImage
=
bmp
.
extractAlpha
(
shadowPaint
,
offsetXY
);
Bitmap
shadowImage32
=
shadowImage
.
copy
(
Bitmap
.
Config
.
ARGB_8888
,
true
);
ByteBuffer
pxBuffer
=
ByteBuffer
.
allocate
(
shadowImage32
.
getByteCount
()
);
IntBuffer
intPxBuffer
=
IntBuffer
.
allocate
(
shadowImage32
.
getByteCount
()/
4
);
shadowImage32
.
copyPixelsToBuffer
(
pxBuffer
);
for
(
int
i
=
0
;
i
<
shadowImage32
.
getByteCount
()/
4
;
i
++
){
int
pxA
=
(
int
)(
pxBuffer
.
get
(
i
*
4
+
3
)
);
intPxBuffer
.
put
(
i
,
Color
.
argb
(
(
int
)(
pxA
*
0.25f
)
,
0
,
0
,
0
)
);
}
shadowImage32
.
copyPixelsFromBuffer
(
intPxBuffer
);
//Draw the image onto the shadow bitmap.
Canvas
c
=
new
Canvas
(
shadowImage32
);
c
.
drawBitmap
(
bmp
,
-
offsetXY
[
0
],
-
offsetXY
[
1
],
null
);
File
dir
=
file
.
getParentFile
();
File
thumbnailFile
=
new
File
(
dir
,
"."
+
file
.
getName
().
split
(
"[.]"
)[
0
]
+
".png"
);
try
{
ByteArrayOutputStream
bytes
=
new
ByteArrayOutputStream
();
bmp
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
40
,
bytes
);
shadowImage32
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
40
,
bytes
);
thumbnailFile
.
createNewFile
();
FileOutputStream
fo
=
new
FileOutputStream
(
thumbnailFile
);
fo
.
write
(
bytes
.
toByteArray
());
...
...
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