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
12fff840
Kaydet (Commit)
12fff840
authored
Tem 31, 2012
tarafından
Iain Billett
Kaydeden (comit)
Michael Meeks
Agu 07, 2012
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Async loading of thumbnails.
Change-Id: I385f5fce8b332b2b9eaa5e6c4dc58516f4cfa9b8
üst
779baa05
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
62 deletions
+73
-62
file_explorer_grid_item.xml
...ibreOffice4Android/res/layout/file_explorer_grid_item.xml
+1
-0
GridItemAdapter.java
...ffice4Android/src/org/libreoffice/ui/GridItemAdapter.java
+5
-2
LibreOfficeUIActivity.java
...Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java
+67
-60
No files found.
android/experimental/LibreOffice4Android/res/layout/file_explorer_grid_item.xml
Dosyayı görüntüle @
12fff840
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
android:layout_height=
"142dp"
android:layout_height=
"142dp"
android:paddingTop=
"15dp"
android:paddingTop=
"15dp"
android:paddingBottom=
"10dp"
android:paddingBottom=
"10dp"
android:scaleType=
"fitStart"
android:layout_gravity=
"center"
>
android:layout_gravity=
"center"
>
</ImageView>
</ImageView>
...
...
android/experimental/LibreOffice4Android/src/org/libreoffice/ui/GridItemAdapter.java
Dosyayı görüntüle @
12fff840
...
@@ -59,7 +59,7 @@ public class GridItemAdapter extends BaseAdapter{
...
@@ -59,7 +59,7 @@ public class GridItemAdapter extends BaseAdapter{
return
null
;
//filePaths[ position ];
return
null
;
//filePaths[ position ];
}
}
public
long
getItemId
(
int
arg0
)
{
public
long
getItemId
(
int
position
)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
return
0
;
return
0
;
}
}
...
@@ -72,10 +72,10 @@ public class GridItemAdapter extends BaseAdapter{
...
@@ -72,10 +72,10 @@ public class GridItemAdapter extends BaseAdapter{
View
gridView
;
View
gridView
;
if
(
convertView
==
null
)
{
if
(
convertView
==
null
)
{
gridView
=
new
View
(
mContext
);
}
else
{
}
else
{
gridView
=
(
View
)
convertView
;
gridView
=
(
View
)
convertView
;
}
}
gridView
=
new
View
(
mContext
);
// get layout from mobile.xml
// get layout from mobile.xml
gridView
=
inflater
.
inflate
(
R
.
layout
.
file_explorer_grid_item
,
null
);
gridView
=
inflater
.
inflate
(
R
.
layout
.
file_explorer_grid_item
,
null
);
...
@@ -135,4 +135,7 @@ public class GridItemAdapter extends BaseAdapter{
...
@@ -135,4 +135,7 @@ public class GridItemAdapter extends BaseAdapter{
return
gridView
;
return
gridView
;
}
}
public
void
update
(){
this
.
notifyDataSetChanged
();
}
}
}
android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java
Dosyayı görüntüle @
12fff840
...
@@ -215,7 +215,7 @@ public class LibreOfficeUIActivity extends SherlockActivity implements ActionBar
...
@@ -215,7 +215,7 @@ public class LibreOfficeUIActivity extends SherlockActivity implements ActionBar
fileNames
[
i
]
=
filePaths
[
i
].
getName
();
fileNames
[
i
]
=
filePaths
[
i
].
getName
();
if
(
!
FileUtilities
.
hasThumbnail
(
filePaths
[
i
]
)
)
if
(
!
FileUtilities
.
hasThumbnail
(
filePaths
[
i
]
)
)
{
{
//
new ThumbnailGenerator( filePaths[ i ] );
new
ThumbnailGenerator
(
filePaths
[
i
]
);
}
}
}
}
if
(
viewMode
==
GRID_VIEW
){
if
(
viewMode
==
GRID_VIEW
){
...
@@ -485,6 +485,11 @@ public class LibreOfficeUIActivity extends SherlockActivity implements ActionBar
...
@@ -485,6 +485,11 @@ public class LibreOfficeUIActivity extends SherlockActivity implements ActionBar
return
true
;
return
true
;
}
}
private
int
dpToPx
(
int
dp
){
final
float
scale
=
getApplicationContext
().
getResources
().
getDisplayMetrics
().
density
;
return
(
int
)
(
dp
*
scale
+
0.5f
);
}
class
ListItemAdapter
implements
ListAdapter
{
class
ListItemAdapter
implements
ListAdapter
{
private
Context
mContext
;
private
Context
mContext
;
private
File
[]
filePaths
;
private
File
[]
filePaths
;
...
@@ -633,64 +638,11 @@ class ListItemAdapter implements ListAdapter{
...
@@ -633,64 +638,11 @@ class ListItemAdapter implements ListAdapter{
ThumbnailGenerator
(
File
file
){
ThumbnailGenerator
(
File
file
){
this
.
file
=
file
;
this
.
file
=
file
;
try
{
long
t0
=
System
.
currentTimeMillis
();
long
t1
=
System
.
currentTimeMillis
();
timingOverhead
=
t1
-
t0
;
Bootstrap
.
setup
(
LibreOfficeUIActivity
.
this
);
Bootstrap
.
putenv
(
"SAL_LOG=yes"
);
// Load a lot of shlibs here explicitly in advance because that
// makes debugging work better, sigh
Bootstrap
.
dlopen
(
"libvcllo.so"
);
Bootstrap
.
dlopen
(
"libmergedlo.so"
);
Bootstrap
.
dlopen
(
"libswdlo.so"
);
Bootstrap
.
dlopen
(
"libswlo.so"
);
// Log.i(TAG, "Sleeping NOW");
// Thread.sleep(20000);
context
=
com
.
sun
.
star
.
comp
.
helper
.
Bootstrap
.
defaultBootstrap_InitialComponentContext
();
Log
.
i
(
TAG
,
"context is"
+
(
context
!=
null
?
" not"
:
""
)
+
" null"
);
mcf
=
context
.
getServiceManager
();
Log
.
i
(
TAG
,
"mcf is"
+
(
mcf
!=
null
?
" not"
:
""
)
+
" null"
);
String
input
=
file
.
getAbsolutePath
();
String
input
=
file
.
getAbsolutePath
();
if
(
input
==
null
)
if
(
input
==
null
)
input
=
"/assets/test1.odt"
;
input
=
"/assets/test1.odt"
;
// We need to fake up an argv, and the argv[0] even needs to
// point to some file name that we can pretend is the "program".
// setCommandArgs() will prefix argv[0] with the app's data
// directory.
String
[]
argv
=
{
"lo-document-loader"
,
input
};
Bootstrap
.
setCommandArgs
(
argv
);
Bootstrap
.
initVCL
();
Object
desktop
=
mcf
.
createInstanceWithContext
(
"com.sun.star.frame.Desktop"
,
context
);
Log
.
i
(
TAG
,
"desktop is"
+
(
desktop
!=
null
?
" not"
:
""
)
+
" null"
);
Bootstrap
.
initUCBHelper
();
componentLoader
=
(
XComponentLoader
)
UnoRuntime
.
queryInterface
(
XComponentLoader
.
class
,
desktop
);
Log
.
i
(
TAG
,
"componentLoader is"
+
(
componentLoader
!=
null
?
" not"
:
""
)
+
" null"
);
// Load the wanted document
// Load the wanted document
new
DocumentLoadTask
().
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
,
"file://"
+
input
);
new
DocumentLoadTask
().
executeOnExecutor
(
AsyncTask
.
SERIAL_EXECUTOR
,
"file://"
+
input
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
System
.
err
);
}
}
}
class
DocumentLoadTask
class
DocumentLoadTask
...
@@ -781,13 +733,67 @@ class ListItemAdapter implements ListAdapter{
...
@@ -781,13 +733,67 @@ class ListItemAdapter implements ListAdapter{
return
null
;
return
null
;
}
}
protected
void
onPreExecute
(){
protected
void
onPreExecute
()
//TODO put doc loading & set-up here?
{
try
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
System
.
err
);
}
}
}
protected
Integer
doInBackground
(
String
...
params
)
protected
Integer
doInBackground
(
String
...
params
)
{
{
try
{
try
{
long
t0
=
System
.
currentTimeMillis
();
long
t1
=
System
.
currentTimeMillis
();
timingOverhead
=
t1
-
t0
;
Bootstrap
.
setup
(
LibreOfficeUIActivity
.
this
);
Bootstrap
.
putenv
(
"SAL_LOG=yes"
);
// Load a lot of shlibs here explicitly in advance because that
// makes debugging work better, sigh
Bootstrap
.
dlopen
(
"libvcllo.so"
);
Bootstrap
.
dlopen
(
"libmergedlo.so"
);
Bootstrap
.
dlopen
(
"libswdlo.so"
);
Bootstrap
.
dlopen
(
"libswlo.so"
);
// Log.i(TAG, "Sleeping NOW");
// Thread.sleep(20000);
context
=
com
.
sun
.
star
.
comp
.
helper
.
Bootstrap
.
defaultBootstrap_InitialComponentContext
();
Log
.
i
(
TAG
,
"context is"
+
(
context
!=
null
?
" not"
:
""
)
+
" null"
);
mcf
=
context
.
getServiceManager
();
Log
.
i
(
TAG
,
"mcf is"
+
(
mcf
!=
null
?
" not"
:
""
)
+
" null"
);
// We need to fake up an argv, and the argv[0] even needs to
// point to some file name that we can pretend is the "program".
// setCommandArgs() will prefix argv[0] with the app's data
// directory.
String
[]
argv
=
{
"lo-document-loader"
,
file
.
getAbsolutePath
()
};
Bootstrap
.
setCommandArgs
(
argv
);
Bootstrap
.
initVCL
();
Object
desktop
=
mcf
.
createInstanceWithContext
(
"com.sun.star.frame.Desktop"
,
context
);
Log
.
i
(
TAG
,
"desktop is"
+
(
desktop
!=
null
?
" not"
:
""
)
+
" null"
);
Bootstrap
.
initUCBHelper
();
componentLoader
=
(
XComponentLoader
)
UnoRuntime
.
queryInterface
(
XComponentLoader
.
class
,
desktop
);
Log
.
i
(
TAG
,
"componentLoader is"
+
(
componentLoader
!=
null
?
" not"
:
""
)
+
" null"
);
String
url
=
params
[
0
];
String
url
=
params
[
0
];
Log
.
i
(
TAG
,
"Attempting to load "
+
url
);
Log
.
i
(
TAG
,
"Attempting to load "
+
url
);
...
@@ -802,9 +808,9 @@ class ListItemAdapter implements ListAdapter{
...
@@ -802,9 +808,9 @@ class ListItemAdapter implements ListAdapter{
loadProps
[
2
].
Name
=
"Preview"
;
loadProps
[
2
].
Name
=
"Preview"
;
loadProps
[
2
].
Value
=
new
Boolean
(
true
);
loadProps
[
2
].
Value
=
new
Boolean
(
true
);
long
t0
=
System
.
currentTimeMillis
();
t0
=
System
.
currentTimeMillis
();
doc
=
componentLoader
.
loadComponentFromURL
(
url
,
"_blank"
,
0
,
loadProps
);
doc
=
componentLoader
.
loadComponentFromURL
(
url
,
"_blank"
,
0
,
loadProps
);
long
t1
=
System
.
currentTimeMillis
();
t1
=
System
.
currentTimeMillis
();
Log
.
i
(
TAG
,
"Loading took "
+
((
t1
-
t0
)-
timingOverhead
)
+
" ms"
);
Log
.
i
(
TAG
,
"Loading took "
+
((
t1
-
t0
)-
timingOverhead
)
+
" ms"
);
Object
toolkitService
=
mcf
.
createInstanceWithContext
Object
toolkitService
=
mcf
.
createInstanceWithContext
...
@@ -844,8 +850,8 @@ class ListItemAdapter implements ListAdapter{
...
@@ -844,8 +850,8 @@ class ListItemAdapter implements ListAdapter{
}
}
protected
void
onPostExecute
(
Integer
result
){
protected
void
onPostExecute
(
Integer
result
){
int
widthInPx
=
120
;
int
widthInPx
=
dpToPx
(
100
)
;
int
heightInPx
=
120
;
int
heightInPx
=
dpToPx
(
(
int
)(
100
*
Math
.
sqrt
(
2
)
)
)
;
ByteBuffer
bb
=
renderPage
(
0
,
widthInPx
,
heightInPx
);
ByteBuffer
bb
=
renderPage
(
0
,
widthInPx
,
heightInPx
);
Bitmap
bm
=
Bitmap
.
createBitmap
(
widthInPx
,
heightInPx
,
Bitmap
.
Config
.
ARGB_8888
);
Bitmap
bm
=
Bitmap
.
createBitmap
(
widthInPx
,
heightInPx
,
Bitmap
.
Config
.
ARGB_8888
);
bm
.
copyPixelsFromBuffer
(
bb
);
bm
.
copyPixelsFromBuffer
(
bb
);
...
@@ -860,6 +866,7 @@ class ListItemAdapter implements ListAdapter{
...
@@ -860,6 +866,7 @@ class ListItemAdapter implements ListAdapter{
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
// TODO: handle exception
// TODO: handle exception
}
}
(
(
GridItemAdapter
)
gv
.
getAdapter
()
).
update
();
}
}
}
}
...
...
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