diff options
author | Iain Billett <iainbillett@gmail.com> | 2012-07-04 11:38:27 +0100 |
---|---|---|
committer | Iain Billett <iainbillett@gmail.com> | 2012-07-04 18:38:24 +0100 |
commit | 731332e6cc4156eb851ae31bf33504d0d312d658 (patch) | |
tree | db8085313d6aa459f5c53ef8c590825162799aad /android | |
parent | 7e7eafb19feb832e7acf3be7f2dca589addce0d0 (diff) |
Moved headers in xml files. Save page 1 thumbnail in onDestroy.
Change-Id: I7586c6475a8e717f3db24a31dca2b1e31068edc2
Diffstat (limited to 'android')
8 files changed, 39 insertions, 7 deletions
diff --git a/android/experimental/LibreOffice4Android/res/layout/document_viewer.xml b/android/experimental/LibreOffice4Android/res/layout/document_viewer.xml index 0fe5db9bc11e..62f5556cb148 100644 --- a/android/experimental/LibreOffice4Android/res/layout/document_viewer.xml +++ b/android/experimental/LibreOffice4Android/res/layout/document_viewer.xml @@ -1,10 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- This file is part of the LibreOffice project. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. --> -<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" diff --git a/android/experimental/LibreOffice4Android/res/layout/file_explorer_grid_item.xml b/android/experimental/LibreOffice4Android/res/layout/file_explorer_grid_item.xml index bddbeece052e..58b94018c71a 100644 --- a/android/experimental/LibreOffice4Android/res/layout/file_explorer_grid_item.xml +++ b/android/experimental/LibreOffice4Android/res/layout/file_explorer_grid_item.xml @@ -1,10 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- This file is part of the LibreOffice project. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. --> -<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/android/experimental/LibreOffice4Android/res/layout/file_grid.xml b/android/experimental/LibreOffice4Android/res/layout/file_grid.xml index 70259fe47ee8..05edc0469096 100644 --- a/android/experimental/LibreOffice4Android/res/layout/file_grid.xml +++ b/android/experimental/LibreOffice4Android/res/layout/file_grid.xml @@ -1,10 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- This file is part of the LibreOffice project. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. --> -<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/android/experimental/LibreOffice4Android/res/layout/file_list.xml b/android/experimental/LibreOffice4Android/res/layout/file_list.xml index 06ca50d24cb9..6fe21b605744 100644 --- a/android/experimental/LibreOffice4Android/res/layout/file_list.xml +++ b/android/experimental/LibreOffice4Android/res/layout/file_list.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- This file is part of the LibreOffice project. @@ -5,7 +6,6 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. --> -<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/android/experimental/LibreOffice4Android/res/layout/file_list_item.xml b/android/experimental/LibreOffice4Android/res/layout/file_list_item.xml index eb170c68dc4e..07a6f4264211 100644 --- a/android/experimental/LibreOffice4Android/res/layout/file_list_item.xml +++ b/android/experimental/LibreOffice4Android/res/layout/file_list_item.xml @@ -1,10 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- This file is part of the LibreOffice project. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. --> -<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="48dp" diff --git a/android/experimental/LibreOffice4Android/res/layout/main.xml b/android/experimental/LibreOffice4Android/res/layout/main.xml index 079a77d8b81c..75768c36b200 100644 --- a/android/experimental/LibreOffice4Android/res/layout/main.xml +++ b/android/experimental/LibreOffice4Android/res/layout/main.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- This file is part of the LibreOffice project. @@ -5,7 +6,6 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. --> -<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" diff --git a/android/experimental/LibreOffice4Android/res/layout/navigation_grid_item.xml b/android/experimental/LibreOffice4Android/res/layout/navigation_grid_item.xml index d53c3c9cfad1..8b305e1deba6 100644 --- a/android/experimental/LibreOffice4Android/res/layout/navigation_grid_item.xml +++ b/android/experimental/LibreOffice4Android/res/layout/navigation_grid_item.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> <!-- This file is part of the LibreOffice project. @@ -5,7 +6,6 @@ License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. --> -<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="150dp" android:layout_height="150dp" diff --git a/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java b/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java index cd1dfd40f4c6..7842b4301b40 100644 --- a/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java +++ b/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java @@ -28,6 +28,7 @@ // "3" into a parameter below. package org.libreoffice.android; + import org.libreoffice.R; import android.app.Activity; @@ -87,6 +88,7 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.view.XRenderable; +import java.io.*; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -591,6 +593,10 @@ public class DocumentLoader } } + Bitmap getBitmap(){ + return bm; + } + ThumbnailView(int number , int widthInDp , int heightInDp) { super(DocumentLoader.this); @@ -917,6 +923,32 @@ 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 bmp = ( (ThumbnailView)ll.getChildAt( 0 ) ).getBitmap(); + File file = new File(extras.getString("input")); + Log.i(TAG ,"onDestroy " + extras.getString("input")); + File dir = file.getParentFile(); + String[] nameComponents = file.getName().split("[.]"); + for(String str : nameComponents){ + Log.i(TAG,"onDestroy " + str); + } + File thumbnailFile = new File( dir , "." + file.getName().split("[.]")[0] + ".png"); + try { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + bmp.compress(Bitmap.CompressFormat.JPEG, 40, bytes); + thumbnailFile.createNewFile(); + FileOutputStream fo = new FileOutputStream( thumbnailFile ); + fo.write(bytes.toByteArray()); + } catch (IOException e) { + // TODO: handle exception + } + } + @Override public boolean onTouchEvent(MotionEvent event) { |