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
b8c2ade6
Kaydet (Commit)
b8c2ade6
authored
Tem 04, 2012
tarafından
Iain Billett
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use page thumbnails for icons.
Change-Id: I5df6341e5d1d8d775d2676d4ef5a52a528c6615c
üst
731332e6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
58 deletions
+91
-58
file_explorer_grid_item.xml
...ibreOffice4Android/res/layout/file_explorer_grid_item.xml
+2
-2
file_grid.xml
...experimental/LibreOffice4Android/res/layout/file_grid.xml
+1
-0
styles.xml
...id/experimental/LibreOffice4Android/res/values/styles.xml
+5
-0
DocumentLoader.java
...e4Android/src/org/libreoffice/android/DocumentLoader.java
+26
-19
FileUtilities.java
...eOffice4Android/src/org/libreoffice/ui/FileUtilities.java
+23
-19
GridItemAdapter.java
...ffice4Android/src/org/libreoffice/ui/GridItemAdapter.java
+34
-18
No files found.
android/experimental/LibreOffice4Android/res/layout/file_explorer_grid_item.xml
Dosyayı görüntüle @
b8c2ade6
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
<ImageView
<ImageView
android:id=
"@+id/grid_item_image"
android:id=
"@+id/grid_item_image"
android:layout_width=
"
5
0dp"
android:layout_width=
"
10
0dp"
android:layout_height=
"
75
dp"
android:layout_height=
"
142
dp"
android:paddingTop=
"15dp"
android:paddingTop=
"15dp"
android:paddingBottom=
"10dp"
android:paddingBottom=
"10dp"
android:layout_gravity=
"center"
>
android:layout_gravity=
"center"
>
...
...
android/experimental/LibreOffice4Android/res/layout/file_grid.xml
Dosyayı görüntüle @
b8c2ade6
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
android:verticalSpacing=
"10dp"
android:verticalSpacing=
"10dp"
android:horizontalSpacing=
"10dp"
android:horizontalSpacing=
"10dp"
android:stretchMode=
"columnWidth"
android:stretchMode=
"columnWidth"
android:background=
"#ffeeeeee"
android:gravity=
"center"
>
android:gravity=
"center"
>
</GridView>
</GridView>
...
...
android/experimental/LibreOffice4Android/res/values/styles.xml
Dosyayı görüntüle @
b8c2ade6
...
@@ -9,4 +9,8 @@
...
@@ -9,4 +9,8 @@
<item
name=
"android:background"
>
#bb000000
</item>
<item
name=
"android:background"
>
#bb000000
</item>
</style>
</style>
<style
name=
"grayBackground"
>
<item
name=
"android:background"
>
#dd000000
</item>
</style>
</resources>
</resources>
\ No newline at end of file
android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java
Dosyayı görüntüle @
b8c2ade6
...
@@ -107,8 +107,8 @@ public class DocumentLoader
...
@@ -107,8 +107,8 @@ public class DocumentLoader
// We pre-render this many pages preceding and succeeding the currently
// We pre-render this many pages preceding and succeeding the currently
// viewed one, i.e. the total number of rendered pages kept is
// viewed one, i.e. the total number of rendered pages kept is
// PAGECACHE_PLUSMINUS*2+1.
// PAGECACHE_PLUSMINUS*2+1.
private
static
final
int
PAGECACHE_PLUSMINUS
=
2
;
private
static
int
PAGECACHE_PLUSMINUS
=
2
;
private
static
final
int
PAGECACHE_SIZE
=
PAGECACHE_PLUSMINUS
*
2
+
1
;
private
static
int
PAGECACHE_SIZE
=
PAGECACHE_PLUSMINUS
*
2
+
1
;
long
timingOverhead
;
long
timingOverhead
;
XComponentContext
context
;
XComponentContext
context
;
...
@@ -157,7 +157,6 @@ public class DocumentLoader
...
@@ -157,7 +157,6 @@ public class DocumentLoader
flipper
.
setOutAnimation
(
outToLeft
);
flipper
.
setOutAnimation
(
outToLeft
);
flipper
.
showNext
();
flipper
.
showNext
();
((
PageViewer
)
flipper
.
getChildAt
((
flipper
.
getDisplayedChild
()
+
PAGECACHE_PLUSMINUS
)
%
PAGECACHE_SIZE
)).
display
(((
PageViewer
)
flipper
.
getCurrentView
()).
currentPageNumber
+
PAGECACHE_PLUSMINUS
);
((
PageViewer
)
flipper
.
getChildAt
((
flipper
.
getDisplayedChild
()
+
PAGECACHE_PLUSMINUS
)
%
PAGECACHE_SIZE
)).
display
(((
PageViewer
)
flipper
.
getCurrentView
()).
currentPageNumber
+
PAGECACHE_PLUSMINUS
);
return
true
;
return
true
;
}
else
if
(
event2
.
getX
()
-
event1
.
getX
()
>
120
)
{
}
else
if
(
event2
.
getX
()
-
event1
.
getX
()
>
120
)
{
...
@@ -491,8 +490,11 @@ public class DocumentLoader
...
@@ -491,8 +490,11 @@ public class DocumentLoader
void
display
(
int
number
)
void
display
(
int
number
)
{
{
Log
.
i
(
TAG
,
"PageViewer display("
+
number
+
")"
);
Log
.
i
(
TAG
,
"PageViewer display("
+
number
+
")"
);
if
(
number
>=
0
)
if
(
number
>=
0
){
waitView
=
new
TextView
(
DocumentLoader
.
this
);
waitView
.
setText
(
"Page "
+
(
number
+
1
)
+
", wait..."
);
waitView
.
setText
(
"Page "
+
(
number
+
1
)
+
", wait..."
);
addView
(
waitView
,
0
,
matchParent
);
}
currentPageNumber
=
number
;
currentPageNumber
=
number
;
state
=
PageState
.
NONEXISTENT
;
state
=
PageState
.
NONEXISTENT
;
...
@@ -520,7 +522,6 @@ public class DocumentLoader
...
@@ -520,7 +522,6 @@ public class DocumentLoader
waitView
.
setGravity
(
Gravity
.
CENTER
);
waitView
.
setGravity
(
Gravity
.
CENTER
);
waitView
.
setBackgroundColor
(
Color
.
WHITE
);
waitView
.
setBackgroundColor
(
Color
.
WHITE
);
waitView
.
setTextColor
(
Color
.
BLACK
);
waitView
.
setTextColor
(
Color
.
BLACK
);
addView
(
waitView
,
0
,
matchParent
);
display
(
number
);
display
(
number
);
}
}
...
@@ -719,8 +720,9 @@ public class DocumentLoader
...
@@ -719,8 +720,9 @@ public class DocumentLoader
//flipper = new ViewFlipper(this);
//flipper = new ViewFlipper(this);
flipper
=
(
ViewFlipper
)
findViewById
(
R
.
id
.
page_flipper
);
flipper
=
(
ViewFlipper
)
findViewById
(
R
.
id
.
page_flipper
);
matchParent
=
new
ViewGroup
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
);
matchParent
=
new
ViewGroup
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
);
flipper
.
removeViewAt
(
0
);
flipper
.
removeViewAt
(
0
);
currentPage
=
0
;
currentPage
=
0
;
openPageWithPrefetching
(
currentPage
);
openPageWithPrefetching
(
currentPage
);
/*
/*
...
@@ -923,7 +925,8 @@ public class DocumentLoader
...
@@ -923,7 +925,8 @@ public class DocumentLoader
}
}
}
}
protected
void
onDestroy
(){
protected
void
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
//Save the thumbnail of the first page as the grid image.
//Save the thumbnail of the first page as the grid image.
// Could easily make a new (larger) thumb but recycling
// Could easily make a new (larger) thumb but recycling
...
@@ -974,23 +977,27 @@ public class DocumentLoader
...
@@ -974,23 +977,27 @@ public class DocumentLoader
* load page && fill cache
* load page && fill cache
* if page is */
* if page is */
public
void
openPageWithPrefetching
(
int
number
){
public
void
openPageWithPrefetching
(
int
number
){
//as a first draft clear an refill "cache" on load.
//as a first draft clear an refill "cache" on load.
//should move views where "cache window" overlaps
//should move views where "cache window" overlaps
Log
.
i
(
TAG
,
Integer
.
toString
(
pageCount
)
);
flipper
.
removeAllViews
();
//
flipper.removeAllViews();
flipper
.
addView
(
new
PageViewer
(
number
),
0
,
matchParent
);
flipper
.
addView
(
new
PageViewer
(
number
),
0
,
matchParent
);
for
(
int
i
=
0
;
i
<
PAGECACHE_PLUSMINUS
;
i
++){
for
(
int
i
=
0
;
i
<
PAGECACHE_PLUSMINUS
;
i
++){
if
(
number
+
i
+
1
>=
0
&&
number
+
i
+
1
<
pageCount
){
//pageCount will always be correctly defined when this is called (famous last words)
if
(
number
+
i
+
1
>=
0
&&
number
+
i
+
1
<
pageCount
){
//pageCount will always be defined when this is called (famous last words)
flipper
.
addView
(
new
PageViewer
(
number
+
i
+
1
),
i
+
1
,
matchParent
);
flipper
.
addView
(
new
PageViewer
(
number
+
i
+
1
),
i
+
1
,
matchParent
);
}
}
else
{
flipper
.
addView
(
new
PageViewer
(
pageCount
-
1
),
i
+
1
,
matchParent
);
}
}
}
for
(
int
i
=
0
;
i
<
PAGECACHE_PLUSMINUS
;
i
++){
for
(
int
i
=
0
;
i
<
PAGECACHE_PLUSMINUS
;
i
++){
if
(
number
-
i
+
1
>=
0
&&
number
-
i
+
1
<
pageCount
){
if
(
number
-
i
+
1
>=
0
&&
number
-
i
+
1
<
pageCount
){
flipper
.
addView
(
new
PageViewer
(
number
-
(
i
+
1
)),
PAGECACHE_PLUSMINUS
+
i
+
1
,
matchParent
);
flipper
.
addView
(
new
PageViewer
(
number
-
(
i
+
1
)),
PAGECACHE_PLUSMINUS
+
i
+
1
,
matchParent
);
}
}
else
{
flipper
.
addView
(
new
PageViewer
(
0
),
PAGECACHE_PLUSMINUS
+
i
+
1
,
matchParent
);
}
}
}
}
}
}
}
...
...
android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java
Dosyayı görüntüle @
b8c2ade6
...
@@ -93,29 +93,33 @@ public class FileUtilities {
...
@@ -93,29 +93,33 @@ public class FileUtilities {
// Filter by mode, and/or in future by filename/wildcard
// Filter by mode, and/or in future by filename/wildcard
static
private
boolean
doAccept
(
String
filename
,
int
byMode
,
String
byFilename
)
static
private
boolean
doAccept
(
String
filename
,
int
byMode
,
String
byFilename
)
{
{
android
.
util
.
Log
.
d
(
"debug"
,
"doAccept : "
+
filename
+
" mode "
+
byMode
+
" byFilename "
+
byFilename
);
android
.
util
.
Log
.
d
(
"debug"
,
"doAccept : "
+
filename
+
" mode "
+
byMode
+
" byFilename "
+
byFilename
);
if
(
byMode
==
ALL
&&
byFilename
==
""
)
if
(
byMode
==
ALL
&&
byFilename
==
""
){
return
true
;
if
(
filename
.
startsWith
(
"."
)){
//ignore hidden files
// check extension
return
false
;
if
(
byMode
!=
ALL
)
{
}
if
(
mExtnMap
.
get
(
getExtension
(
filename
))
!=
byMode
)
return
true
;
return
false
;
}
}
// check extension
if
(
byFilename
!=
""
)
{
if
(
byMode
!=
ALL
)
{
// FIXME return false on a non-match
if
(
mExtnMap
.
get
(
getExtension
(
filename
))
!=
byMode
)
}
return
false
;
return
true
;
}
if
(
byFilename
!=
""
)
{
// FIXME return false on a non-match
}
return
true
;
}
}
static
FileFilter
getFileFilter
(
final
int
mode
)
static
FileFilter
getFileFilter
(
final
int
mode
)
{
{
return
new
FileFilter
()
{
return
new
FileFilter
()
{
public
boolean
accept
(
File
pathname
)
{
public
boolean
accept
(
File
pathname
)
{
if
(
pathname
.
isDirectory
())
if
(
pathname
.
isDirectory
())
return
true
;
return
true
;
return
doAccept
(
pathname
.
getName
(),
mode
,
""
);
return
doAccept
(
pathname
.
getName
(),
mode
,
""
);
}
}
};
};
}
}
static
FilenameFilter
getFilenameFilter
(
final
int
mode
)
static
FilenameFilter
getFilenameFilter
(
final
int
mode
)
...
...
android/experimental/LibreOffice4Android/src/org/libreoffice/ui/GridItemAdapter.java
Dosyayı görüntüle @
b8c2ade6
...
@@ -10,6 +10,7 @@ package org.libreoffice.ui;
...
@@ -10,6 +10,7 @@ package org.libreoffice.ui;
import
org.libreoffice.R
;
import
org.libreoffice.R
;
import
java.io.File
;
import
java.io.File
;
import
android.content.Context
;
import
android.content.Context
;
...
@@ -20,6 +21,8 @@ import android.view.ViewGroup;
...
@@ -20,6 +21,8 @@ import android.view.ViewGroup;
import
android.widget.BaseAdapter
;
import
android.widget.BaseAdapter
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Bitmap
;
public
class
GridItemAdapter
extends
BaseAdapter
{
public
class
GridItemAdapter
extends
BaseAdapter
{
Context
mContext
;
Context
mContext
;
...
@@ -77,24 +80,37 @@ public class GridItemAdapter extends BaseAdapter{
...
@@ -77,24 +80,37 @@ public class GridItemAdapter extends BaseAdapter{
// 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
);
// set value into textview
// set value into textview
TextView
textView
=
(
TextView
)
gridView
TextView
textView
=
(
TextView
)
gridView
.
findViewById
(
R
.
id
.
grid_item_label
);
.
findViewById
(
R
.
id
.
grid_item_label
);
textView
.
setText
(
filePaths
[
position
].
getName
());
textView
.
setText
(
filePaths
[
position
].
getName
());
// set image based on selected text
// set image based on selected text
ImageView
imageView
=
(
ImageView
)
gridView
ImageView
imageView
=
(
ImageView
)
gridView
.
findViewById
(
R
.
id
.
grid_item_image
);
.
findViewById
(
R
.
id
.
grid_item_image
);
if
(
filePaths
[
position
].
isDirectory
()
)
// Is a folder
if
(
filePaths
[
position
].
isDirectory
()
)
// Is a folder
{
{
// Eventually have thumbnails of each sub file on a black circle
// Eventually have thumbnails of each sub file on a black circle
// For now just a folder icon
// For now just a folder icon
imageView
.
setImageResource
(
R
.
drawable
.
folder
);
imageView
.
setImageResource
(
R
.
drawable
.
folder
);
}
}
else
else
{
{
switch
(
FileUtilities
.
getType
(
filePaths
[
position
].
getName
()))
File
thumbnailFile
=
new
File
(
filePaths
[
position
].
getParent
()
,
"."
{
+
filePaths
[
position
].
getName
().
split
(
"[.]"
)[
0
]
+
".png"
);
case
FileUtilities
.
DOC
:
BitmapFactory
factory
=
new
BitmapFactory
();
Bitmap
thumb
=
factory
.
decodeFile
(
thumbnailFile
.
getAbsolutePath
()
);
if
(
thumb
!=
null
){
Log
.
i
(
"GRID"
,
"true"
);
}
else
{
Log
.
i
(
"GRID"
,
thumbnailFile
.
getAbsolutePath
()
);
}
switch
(
FileUtilities
.
getType
(
filePaths
[
position
].
getName
()))
{
case
FileUtilities
.
DOC
:
if
(
thumb
!=
null
){
imageView
.
setImageBitmap
(
thumb
);
break
;
}
imageView
.
setImageResource
(
R
.
drawable
.
writer
);
imageView
.
setImageResource
(
R
.
drawable
.
writer
);
break
;
break
;
case
FileUtilities
.
CALC
:
case
FileUtilities
.
CALC
:
...
...
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