summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorSiqi Liu <me@siqi.fr>2015-04-23 12:53:51 +0200
committerSiqi Liu <me@siqi.fr>2015-04-23 15:31:14 +0200
commitc9baf39df68afc17adcf4fe23245912e57ff5477 (patch)
treee4d61b6529a1b17957ad2afb79fd8d80a5ab4553 /android
parent3c8ad51e358003ec056555bd498352f84c23212a (diff)
formatting for consistancy across Java code
Change-Id: I7bde4c9c024dfe7a18c92a36069433f044fc89bc
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/ui/FolderIconView.java122
1 files changed, 61 insertions, 61 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/FolderIconView.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/FolderIconView.java
index b0211b13ac25..c689ba1a91c8 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/FolderIconView.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/FolderIconView.java
@@ -35,7 +35,7 @@ public class FolderIconView extends View{
private File dir;
- public FolderIconView(Context context ) {
+ public FolderIconView(Context context) {
super(context);
initialisePaints();
}
@@ -48,86 +48,86 @@ public class FolderIconView extends View{
initialisePaints();
}
- private void initialisePaints(){
+ private void initialisePaints() {
mPaintBlack = new Paint();
- mPaintBlack.setColor( Color.DKGRAY );//Can also use parseColor( String "#aarrggbb")
- mPaintBlack.setAntiAlias( true );
+ mPaintBlack.setColor(Color.DKGRAY);//Can also use parseColor(String "#aarrggbb")
+ mPaintBlack.setAntiAlias(true);
mPaintGray = new Paint();
- mPaintGray.setColor( Color.GRAY );//Can also use parseColor( String "#aarrggbb")
- mPaintGray.setAntiAlias( true );
+ mPaintGray.setColor(Color.GRAY);//Can also use parseColor(String "#aarrggbb")
+ mPaintGray.setAntiAlias(true);
mPaintShadow = new Paint();
- mPaintShadow.setColor( Color.parseColor( "#88888888") );
- mPaintShadow.setAntiAlias( true );
+ mPaintShadow.setColor(Color.parseColor("#88888888"));
+ mPaintShadow.setAntiAlias(true);
}
- public void setDir( File dir ){
+ public void setDir(File dir) {
this.dir = dir;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
- Log.d( TAG, "onDraw");
+ Log.d(TAG, "onDraw");
//float width = (float)canvas.getWidth();
//float height = (float)canvas.getHeight();
- float width = (float)this.getWidth();
- float height = (float)this.getHeight();
+ float width = (float) this.getWidth();
+ float height = (float) this.getHeight();
float centerX = width*0.5f;// centered on horz axis
float centerY = height*0.5f;
- float outerRadius = 0.8f*0.5f* width;
- float innerRadius = 0.7f*0.5f* width;
+ float outerRadius = 0.8f*0.5f*width;
+ float innerRadius = 0.7f*0.5f*width;
float thumbHeight = outerRadius*1.25f;
float thumbWidth = thumbHeight*(float)(1/Math.sqrt(2));
float DZx = 0.2f*outerRadius;
float DZy = 0.2f*outerRadius;
- //Bitmap blankPage = BitmapFactory.decodeResource( getResources() , R.drawable.page );
- Log.i( TAG , Float.toString( width ) + " X " + Float.toString( height ) );
- canvas.drawCircle( centerX , centerY , outerRadius , mPaintGray );
- canvas.drawCircle( centerX , centerY , innerRadius , mPaintBlack );
+ //Bitmap blankPage = BitmapFactory.decodeResource(getResources(), R.drawable.page);
+ Log.i(TAG, Float.toString(width) + "x" + Float.toString(height));
+ canvas.drawCircle(centerX, centerY, outerRadius, mPaintGray);
+ canvas.drawCircle(centerX, centerY, innerRadius, mPaintBlack);
//Either get thumbs from directory or use generic page images
//For now just get the first 4 thumbs -> add some checks later
- if( dir == null )
+ if (dir == null)
return;//TODO
File[] contents = dir.listFiles();//TODO consider filtering thumbs to match grid.
- if( contents == null )
+ if (contents == null)
// dir is not a directory,
// or user does not have permissions to read it
return;
Stack<Bitmap> thumbs = new Stack<Bitmap>();
BitmapFactory factory = new BitmapFactory();
- for( File file : contents ){
- if( !FileUtilities.isThumbnail(file) )
+ for (File file : contents) {
+ if (!FileUtilities.isThumbnail(file))
continue;
- thumbs.push( factory.decodeFile( file.getAbsolutePath() ) );//TODO switch to push for semantics
- if( thumbs.size() > 3 )
+ thumbs.push(factory.decodeFile(file.getAbsolutePath()));//TODO switch to push for semantics
+ if (thumbs.size() > 3)
break;
}
- /*while( thumbs.size() < 4 ){// padd out with blanks?
- thumbs.push( blankPage );
+ /*while(thumbs.size() < 4) {// padd out with blanks?
+ thumbs.push(blankPage);
}*/
- Log.i( TAG, Integer.toString( thumbs.size() ) );
+ Log.i(TAG, Integer.toString(thumbs.size()));
//should handle empty folders better
// options:
// don't show?
// show generic LO icons for writer etc
// Show a generic blank page icon
- if( thumbs.isEmpty() )
+ if (thumbs.isEmpty())
return;
/*float left = centerX ;//+ 0.25f*outerRadius;
float top = centerY - 0.5f*outerRadius;
float right = left + thumbs.get(0).getWidth()*0.4f;
float bottom = top + thumbs.get(0).getHeight()*0.4f;
- RectF dest = new RectF( left, top , right , bottom );
+ RectF dest = new RectF(left, top, right, bottom);
RectF shadowBox = new RectF(dest);
- shadowBox.inset( -1 , -1 );
+ shadowBox.inset(-1, -1);
int size = thumbs.size();
- for( int i = 1 ; i <= size ; i++ ){
- canvas.drawRect( shadowBox , mPaintShadow);
- canvas.drawBitmap( thumbs.pop() , null , dest , null);
- dest.offset( -outerRadius*0.2f , outerRadius*0.1f );
- shadowBox.offset( -outerRadius*0.2f , outerRadius*0.1f );
+ for (int i = 1; i <= size; i++) {
+ canvas.drawRect(shadowBox, mPaintShadow);
+ canvas.drawBitmap(thumbs.pop(), null, dest, null);
+ dest.offset(-outerRadius*0.2f, outerRadius*0.1f);
+ shadowBox.offset(-outerRadius*0.2f, outerRadius*0.1f);
}*/
float left;
float top;
@@ -136,7 +136,7 @@ public class FolderIconView extends View{
RectF dest;
RectF shadowBox;
int size;
- switch( thumbs.size() ){
+ switch(thumbs.size()) {
case 0:
break;
case 1:
@@ -144,26 +144,26 @@ public class FolderIconView extends View{
top = centerY - 0.5f*thumbHeight;
right = left + thumbWidth;
bottom = top + thumbHeight;
- dest = new RectF( left, top , right , bottom );
+ dest = new RectF(left, top, right, bottom);
shadowBox = new RectF(dest);
- shadowBox.inset( -1 , -1 );
- canvas.drawRect( shadowBox , mPaintShadow);
- canvas.drawBitmap( thumbs.pop() , null , dest , null);
+ shadowBox.inset(-1, -1);
+ canvas.drawRect(shadowBox, mPaintShadow);
+ canvas.drawBitmap(thumbs.pop(), null, dest, null);
break;
case 2:
left = centerX - 0.5f*thumbWidth + 0.5f*DZx;
top = centerY - 0.5f*thumbHeight - 0.5f*DZy;
right = left + thumbWidth;
bottom = top + thumbHeight;
- dest = new RectF( left, top , right , bottom );
+ dest = new RectF(left, top, right, bottom);
shadowBox = new RectF(dest);
- shadowBox.inset( -1 , -1 );
+ shadowBox.inset(-1, -1);
size = thumbs.size();
- for( int i = 1 ; i <= size ; i++ ){
- canvas.drawRect( shadowBox , mPaintShadow);
- canvas.drawBitmap( thumbs.pop() , null , dest , null);
- dest.offset( -DZx , DZy );
- shadowBox.offset( -DZx , DZy );
+ for (int i = 1; i <= size; i++) {
+ canvas.drawRect(shadowBox, mPaintShadow);
+ canvas.drawBitmap(thumbs.pop(), null, dest, null);
+ dest.offset(-DZx, DZy);
+ shadowBox.offset(-DZx, DZy);
}
break;
case 3:
@@ -171,15 +171,15 @@ public class FolderIconView extends View{
top = centerY - 0.5f*thumbHeight - DZy;
right = left + thumbWidth;
bottom = top + thumbHeight;
- dest = new RectF( left, top , right , bottom );
+ dest = new RectF(left, top, right, bottom);
shadowBox = new RectF(dest);
- shadowBox.inset( -1 , -1 );
+ shadowBox.inset(-1, -1);
size = thumbs.size();
- for( int i = 1 ; i <= size ; i++ ){
- canvas.drawRect( shadowBox , mPaintShadow);
- canvas.drawBitmap( thumbs.pop() , null , dest , null);
- dest.offset( -DZx , DZy );
- shadowBox.offset( -DZx , DZy );
+ for (int i = 1; i <= size; i++) {
+ canvas.drawRect(shadowBox, mPaintShadow);
+ canvas.drawBitmap(thumbs.pop(), null, dest, null);
+ dest.offset(-DZx, DZy);
+ shadowBox.offset(-DZx, DZy);
}
break;
case 4:
@@ -187,15 +187,15 @@ public class FolderIconView extends View{
top = centerY - 0.5f*thumbHeight - 1.5f*DZy;
right = left + thumbWidth;
bottom = top + thumbHeight;
- dest = new RectF( left, top , right , bottom );
+ dest = new RectF(left, top, right, bottom);
shadowBox = new RectF(dest);
- shadowBox.inset( -1 , -1 );
+ shadowBox.inset(-1, -1);
size = thumbs.size();
- for( int i = 1 ; i <= size ; i++ ){
- canvas.drawRect( shadowBox , mPaintShadow);
- canvas.drawBitmap( thumbs.pop() , null , dest , null);
- dest.offset( -DZx , DZy );
- shadowBox.offset( -DZx , DZy );
+ for (int i = 1; i <= size; i++) {
+ canvas.drawRect(shadowBox, mPaintShadow);
+ canvas.drawBitmap(thumbs.pop(), null, dest, null);
+ dest.offset(-DZx, DZy);
+ shadowBox.offset(-DZx, DZy);
}
break;
default: