Android-x86
Fork
捐款

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-apps-FileManager: 提交

packages/apps/FileManager


Commit MetaInfo

修訂950829ea9667768af1110aa18f37c4d4086e8c25 (tree)
時間2009-11-03 18:49:22
作者Chih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

update to version 1.1.0. (r2363)

Change Summary

差異

--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -16,11 +16,34 @@
1616 -->
1717 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
1818 package="org.openintents.filemanager"
19- android:versionName="1.0.1-rc1"
20- android:versionCode="2">
21- <!-- History: 1.0.0 [1]: 2008-12-10
22- 1.0.1 [2]: 2009-01-16 -->
19+ android:versionName="1.1.0"
20+ android:versionCode="5">
21+ <!-- History:
22+ [5] 1.1.0: 2009-10-30
23+ [4] 1.1.0-rc1: 2009-10-24
24+ [3] 1.0.2: 2009-10-15
25+ [2] 1.0.1: 2009-01-16
26+ [1] 1.0.0: 2008-12-10
27+ -->
28+
29+
30+ <uses-sdk android:minSdkVersion="2"
31+ android:targetSdkVersion="4"
32+
33+ />
34+
35+<supports-screens android:smallScreens="true"
36+ android:normalScreens="true"
37+ android:largeScreens="true"
38+/>
39+
40+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
2341 <application android:icon="@drawable/ic_launcher_folder" android:label="@string/app_name">
42+
43+ <!-- aTrackDog metadata -->
44+ <meta-data android:name="com.a0soft.gphone.aTrackDog.testVersion"
45+ android:value="4" />
46+
2447 <meta-data android:name="org.openintents.metadata.COMMENTS"
2548 android:value="@string/about_comments" />
2649 <meta-data android:name="org.openintents.metadata.COPYRIGHT"
@@ -80,4 +103,4 @@
80103 </activity> -->
81104 <provider android:name=".FileManagerProvider" android:authorities="org.openintents.filemanager"></provider>
82105 </application>
83-</manifest>
\ No newline at end of file
106+</manifest>
--- a/readme.txt
+++ b/readme.txt
@@ -22,16 +22,21 @@ To obtain the current release, visit
2222 http://www.openintents.org
2323
2424 ---------------------------------------------------------
25-release: 1.0.1
26-date: 2008-12-??
27-- Added support for following extensions:
25+release: 1.1.0
26+date: 2009-10-30
27+- display file size.
28+- show thumbnails for images.
29+- copy files.
30+- handle GET_CONTENT action.
31+- added support for all WebKit extensions.
32+- added support for following extensions:
2833 .amr, .3gp
29-- Added support for upper case or mixed case letter
34+- added support for upper case or mixed case letter
3035 extensions (like .png and .PNG)
31-- Fix for send files via MMS.
36+- fix for send files via MMS.
3237 - support for OI About.
3338 - encode file URIs properly
34-- translations: French, German
39+- translations: Chinese, French, German, Japanese, Spanish
3540
3641 ---------------------------------------------------------
3742 release: 1.0.0
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -21,7 +21,8 @@
2121
2222 <!-- Automatically filled in by Launchpad: -->
2323 <string name="about_translators">Launchpad Contributions:
24- Peli https://launchpad.net/~peli0101</string>
24+ Peli https://launchpad.net/~peli0101
25+ marco.jahn https://launchpad.net/~accounts+launchpad-net</string>
2526
2627 <string name="about_comments">OI Dateimanager ist ein offener Dateimanager, der nahtlos mit anderen Anwendungen zusammenarbeitet.</string>
2728 <string name="about_website_label">OI Dateimanager auf OpenIntents</string>
@@ -37,7 +38,7 @@
3738 <string name="menu_send">Senden</string>
3839 <string name="menu_open">Öffnen</string>
3940 <string name="menu_move">Verschieben</string>
40- <string name="menu_copy">Copy</string>
41+ <string name="menu_copy">Kopie</string>
4142
4243 <string name="create_new_folder">Neuen Ordner erstellen</string>
4344 <string name="folder_name">Name des Ordners</string>
@@ -50,14 +51,14 @@
5051 <string name="folder_renamed">Ordner umbenannt.</string>
5152 <string name="file_moved">Datei verschoben.</string>
5253 <string name="folder_moved">Ordner verschoben.</string>
53- <string name="file_copied">File copied.</string>
54+ <string name="file_copied">Datei kopiert.</string>
5455 <string name="move_title">Ordner zum Verschieben auswählen</string>
5556 <string name="move_button">Hierher verschieben</string>
56- <string name="copy_title">Select folder to copy to</string>
57- <string name="copy_button">Copy here</string>
58-
59- <string name="copied_file_name">Copy of %s</string>
60- <string name="copied_file_name_2">Copy %d of %s</string>
57+ <string name="copy_title">Wählen Sie Zielverzeichnis für den Kopiervorgang</string>
58+ <string name="copy_button">Hierher kopieren</string>
59+
60+ <string name="copied_file_name">Kopie von %s</string>
61+ <string name="copied_file_name_2">%d von %s kopiert</string>
6162
6263 <string name="error_creating_new_folder">Neuer Ordner konnte nicht erstellt werden.</string>
6364 <string name="error_deleting_file">Datei konnte nicht gelöscht werden.</string>
@@ -66,7 +67,7 @@
6667 <string name="error_renaming_folder">Ordner konnte nicht umbenannt werden.</string>
6768 <string name="error_moving_file">Datei konnte nicht verschoben werden.</string>
6869 <string name="error_moving_folder">Ordner konnte nicht verschoben werden.</string>
69- <string name="error_copying_file">Could not copy file.</string>
70+ <string name="error_copying_file">Datei kann nicht kopiert werden.</string>
7071 <string name="error_file_does_not_exists">Datei existiert nicht.</string>
7172
7273 <string name="send_not_available">Keine Anwendung zum Senden vorhanden.</string>
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -21,9 +21,10 @@
2121
2222 <!-- Automatically filled in by Launchpad: -->
2323 <string name="about_translators">Launchpad Contributions:
24+ DiegoJ https://launchpad.net/~diegojromerolopez
2425 miwie https://launchpad.net/~mw-miwie</string>
2526
26- <string name="about_comments">OI File Manager is an open file manager that seamlessly cooperates with other applications.</string>
27+ <string name="about_comments">OI File Manager es un gestor abierto de archivos que cooperar fluidamente con otras aplicaciones.</string>
2728 <string name="about_website_label">OI File Manager en OpenIntents</string>
2829
2930 <!-- ***************************
@@ -37,7 +38,7 @@
3738 <string name="menu_send">Enviar</string>
3839 <string name="menu_open">Abrir</string>
3940 <string name="menu_move">Mover</string>
40- <string name="menu_copy">Copy</string>
41+ <string name="menu_copy">Copiar</string>
4142
4243 <string name="create_new_folder">Crear nueva carpeta</string>
4344 <string name="folder_name">Nombre de carpeta</string>
@@ -50,14 +51,14 @@
5051 <string name="folder_renamed">Carpeta cambiado de nombre.</string>
5152 <string name="file_moved">Fichero movido.</string>
5253 <string name="folder_moved">Carpeta movido.</string>
53- <string name="file_copied">File copied.</string>
54+ <string name="file_copied">Archivo copiado.</string>
5455 <string name="move_title">Seleccionar carpeta de destino</string>
5556 <string name="move_button">Mover acá</string>
56- <string name="copy_title">Select folder to copy to</string>
57- <string name="copy_button">Copy here</string>
57+ <string name="copy_title">Seleccione carpeta a copiar a</string>
58+ <string name="copy_button">Copiar aquí</string>
5859
59- <string name="copied_file_name">Copy of %s</string>
60- <string name="copied_file_name_2">Copy %d of %s</string>
60+ <string name="copied_file_name">Copia de %s</string>
61+ <string name="copied_file_name_2">Copia %d de %s</string>
6162
6263 <string name="error_creating_new_folder">No se puede crear la carpeta nueva.</string>
6364 <string name="error_deleting_file">No se puede borrar el fichero.</string>
@@ -66,7 +67,7 @@
6667 <string name="error_renaming_folder">No se puede cambiar de nombre de la carpeta.</string>
6768 <string name="error_moving_file">No se puede mover el fichero.</string>
6869 <string name="error_moving_folder">No se puede mover la carpeta.</string>
69- <string name="error_copying_file">Could not copy file.</string>
70+ <string name="error_copying_file">No se pudo copiar el archivo.</string>
7071 <string name="error_file_does_not_exists">El archivo no existe.</string>
7172
7273 <string name="send_not_available">Aplicación no disponible para enviar.</string>
@@ -83,10 +84,7 @@
8384 <string name="eula_refuse">Cancelar</string>
8485
8586 <!-- Update -->
86- <string name="update_box_text">Please check manually for updates or install OI Update
87-for automatic notifications.
88-Current version: %s
89- </string>
87+ <string name="update_box_text">Por favor, compruebe manualmente las actualizaciones o instale OI Update para notificaciones automáticas. Versión actual: %s</string>
9088 <string name="update_check_now">Comprobar ahora.</string>
9189 <string name="update_get_updater">Obtenga el Actualizador de OI</string>
9290 <string name="update_error">Descarga aplicación no disponible.</string>
@@ -94,7 +92,7 @@ Current version: %s
9492
9593 <!-- About -->
9694 <string name="about">Sobre</string>
97- <string name="aboutapp_not_available">Version %s\n\nNo compatible extension available to display full info (contact, credits, license).</string>
95+ <string name="aboutapp_not_available">La versión %s\nNo es compatible con el complemento disponible para mostrar información completa (contacto, créditos, licencia).</string>
9896 <string name="aboutapp_get">Obtenga Acerca de OI</string>
9997
10098
--- a/res/values-nl/strings.xml
+++ b/res/values-nl/strings.xml
@@ -21,6 +21,7 @@
2121
2222 <!-- Automatically filled in by Launchpad: -->
2323 <string name="about_translators">Launchpad Contributions:
24+ Simon de Vlieger https://launchpad.net/~ikanobori
2425 pjv https://launchpad.net/~pjv</string>
2526
2627 <string name="about_comments">OI File Manager is an open file manager that seamlessly cooperates with other applications.</string>
@@ -37,7 +38,7 @@
3738 <string name="menu_send">Verzenden</string>
3839 <string name="menu_open">Openen</string>
3940 <string name="menu_move">Verplaatsen</string>
40- <string name="menu_copy">Copy</string>
41+ <string name="menu_copy">Kopieer</string>
4142
4243 <string name="create_new_folder">Nieuwe map aanmaken</string>
4344 <string name="folder_name">Naam van de map</string>
@@ -50,14 +51,14 @@
5051 <string name="folder_renamed">Map hernoemd.</string>
5152 <string name="file_moved">Bestand verplaatst.</string>
5253 <string name="folder_moved">Map verplaatst.</string>
53- <string name="file_copied">File copied.</string>
54- <string name="move_title">Select folder to move to</string>
55- <string name="move_button">Move here</string>
56- <string name="copy_title">Select folder to copy to</string>
57- <string name="copy_button">Copy here</string>
54+ <string name="file_copied">Bestand gekopieerd.</string>
55+ <string name="move_title">Kies map om naartoe te verplaatsen</string>
56+ <string name="move_button">Hierheen verplaatsen</string>
57+ <string name="copy_title">Kies map om naartoe te kopiëren</string>
58+ <string name="copy_button">Kopieer hier</string>
5859
59- <string name="copied_file_name">Copy of %s</string>
60- <string name="copied_file_name_2">Copy %d of %s</string>
60+ <string name="copied_file_name">Kopie van %s</string>
61+ <string name="copied_file_name_2">Kopie %d van %s</string>
6162
6263 <string name="error_creating_new_folder">Could not create new folder.</string>
6364 <string name="error_deleting_file">Could not delete file.</string>
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -23,13 +23,13 @@
2323 <string name="about_translators">Launchpad Contributions:
2424 Swandle https://launchpad.net/~swandle</string>
2525
26- <string name="about_comments">OI文件管理是一个开源的文件管理软件,它可以与其它应用程序进行无缝整合。</string>
27- <string name="about_website_label">OpenIntents的文件管理</string>
26+ <string name="about_comments">OI文件管理器是一个开源的文件管理软件,它可以与其它应用程序进行无缝整合。</string>
27+ <string name="about_website_label">开放组件的OI文件管理器</string>
2828
2929 <!-- ***************************
3030 Applicatio-specific strings
3131 *************************** -->
32- <string name="app_name">OI文件管理</string>
32+ <string name="app_name">OI文件管理器</string>
3333
3434 <string name="menu_new_folder">新建文件夹</string>
3535 <string name="menu_delete">删除</string>
@@ -43,10 +43,10 @@
4343 <string name="folder_name">文件夹名</string>
4444 <string name="file_name">文件夹名</string>
4545 <string name="this_folder_is_empty">该文件夹为空</string>
46- <string name="really_delete">你真要删除 %s 吗?</string>
46+ <string name="really_delete">确实要删除 %s 吗?</string>
4747 <string name="file_deleted">文件已删除</string>
4848 <string name="folder_deleted">文件夹已删除</string>
49- <string name="file_renamed">文件重命名</string>
49+ <string name="file_renamed">文件已重命名</string>
5050 <string name="folder_renamed">文件夹已重命名</string>
5151 <string name="file_moved">文件已移动</string>
5252 <string name="folder_moved">文件夹已移动</string>
--- a/res/values/strings_not_for_translation.xml
+++ b/res/values/strings_not_for_translation.xml
@@ -48,10 +48,13 @@
4848 *************************** -->
4949 <!-- Update -->
5050 <string name="update_app_url">market://search?q=pname:org.openintents.filemanager</string>
51+ <string name="update_app_developer_url">http://www.openintents.org/en/node/159</string><!-- 159 = OI File Manager -->
5152 <string name="update_checker_url">market://search?q=pname:org.openintents.updatechecker</string>
53+ <string name="update_checker_developer_url">http://www.openintents.org/en/node/203</string><!-- 203 = OI Update -->
5254
5355 <!-- About -->
5456 <string name="aboutapp_market_uri">market://search?q=pname:org.openintents.about</string>
57+ <string name="aboutapp_developer_uri">http://www.openintents.org/en/node/202</string><!-- 202 = OI About -->
5558
5659 <!-- ***************************
5760 Preferences
--- a/res/xml/mimetypes.xml
+++ b/res/xml/mimetypes.xml
@@ -22,7 +22,7 @@
2222 <type extension=".jpeg" mimetype="image/jpeg" />
2323 <type extension=".bmp" mimetype="image/bmp" />
2424
25- <!-- Autio types -->
25+ <!-- Audio types -->
2626 <type extension=".mp3" mimetype="audio/mp3" />
2727 <type extension=".wav" mimetype="audio/wav" />
2828 <type extension=".ogg" mimetype="audio/x-ogg" />
@@ -53,4 +53,4 @@
5353 <!-- Android specific -->
5454 <type extension=".apk" mimetype="application/vnd.android.package-archive" />
5555
56-</MimeTypes>
56+</MimeTypes>
\ No newline at end of file
--- a/src/org/openintents/distribution/AboutDialog.java
+++ b/src/org/openintents/distribution/AboutDialog.java
@@ -27,7 +27,7 @@ import android.content.Intent;
2727 /**
2828 * About dialog
2929 *
30- * @version 2009-01-16
30+ * @version 2009-02-04
3131 * @author Peli
3232 *
3333 */
@@ -38,7 +38,8 @@ public class AboutDialog extends GetFromMarketDialog {
3838 super(context,
3939 RD.string.aboutapp_not_available,
4040 RD.string.aboutapp_get,
41- RD.string.aboutapp_market_uri);
41+ RD.string.aboutapp_market_uri,
42+ RD.string.aboutapp_developer_uri);
4243
4344 String version = VersionUtils.getVersionNumber(context);
4445 String name = VersionUtils.getApplicationName(context);
--- a/src/org/openintents/distribution/GetFromMarketDialog.java
+++ b/src/org/openintents/distribution/GetFromMarketDialog.java
@@ -10,16 +10,23 @@ import android.net.Uri;
1010 import android.util.Log;
1111 import android.widget.Toast;
1212
13+/**
14+ * @version 2009-02-04
15+ * @author Peli
16+ *
17+ */
1318 public class GetFromMarketDialog extends AlertDialog implements OnClickListener {
1419 private static final String TAG = "StartSaveActivity";
1520
1621 Context mContext;
1722 int mMarketUri;
23+ int mDeveloperUri;
1824
19- public GetFromMarketDialog(Context context, int message, int buttontext, int market_uri) {
25+ public GetFromMarketDialog(Context context, int message, int buttontext, int market_uri, int developer_uri) {
2026 super(context);
2127 mContext = context;
2228 mMarketUri = market_uri;
29+ mDeveloperUri = developer_uri;
2330
2431 //setTitle(context.getText(R.string.menu_edit_tags));
2532 setMessage(mContext.getText(message));
@@ -33,7 +40,11 @@ public class GetFromMarketDialog extends AlertDialog implements OnClickListener
3340
3441 Intent intent = new Intent(Intent.ACTION_VIEW);
3542 intent.setData(uri);
36- GetFromMarketDialog.startSaveActivity(mContext, intent);
43+
44+ uri= Uri.parse(mContext.getString(mDeveloperUri));
45+ Intent intent2 = new Intent(Intent.ACTION_VIEW);
46+ intent2.setData(uri);
47+ startSaveActivity(mContext, intent, intent2);
3748 }
3849
3950 }
@@ -44,15 +55,21 @@ public class GetFromMarketDialog extends AlertDialog implements OnClickListener
4455 *
4556 * @param context
4657 * @param intent
58+ * @param intent2 Alternative intent to call, if the first is not reachable
4759 */
48- public static void startSaveActivity(Context context, Intent intent) {
60+ public static void startSaveActivity(Context context, Intent intent, Intent intent2) {
4961 try {
5062 context.startActivity(intent);
5163 } catch (ActivityNotFoundException e) {
52- Toast.makeText(context,
53- RD.string.update_error,
54- Toast.LENGTH_SHORT).show();
5564 Log.e(TAG, "Error starting activity.", e);
65+ try {
66+ context.startActivity(intent2);
67+ } catch (ActivityNotFoundException e2) {
68+ Toast.makeText(context,
69+ RD.string.update_error,
70+ Toast.LENGTH_SHORT).show();
71+ Log.e(TAG, "Error starting second activity.", e2);
72+ }
5673 }
5774 }
58-}
75+}
\ No newline at end of file
--- a/src/org/openintents/distribution/RD.java
+++ b/src/org/openintents/distribution/RD.java
@@ -32,8 +32,10 @@ public class RD {
3232 public static final int update_box_text = R.string.update_box_text;
3333 public static final int update_check_now = R.string.update_check_now;
3434 public static final int update_app_url = R.string.update_app_url;
35+ public static final int update_app_developer_url = R.string.update_app_developer_url;
3536 public static final int update_get_updater = R.string.update_get_updater;
3637 public static final int update_checker_url = R.string.update_checker_url;
38+ public static final int update_checker_developer_url = R.string.update_checker_developer_url;
3739 public static final int update_error = R.string.update_error;
3840
3941 ///////////////////////////////////////
@@ -41,6 +43,8 @@ public class RD {
4143 public static final int aboutapp_not_available = R.string.aboutapp_not_available;
4244 public static final int aboutapp_get = R.string.aboutapp_get;
4345 public static final int aboutapp_market_uri = R.string.aboutapp_market_uri;
46+ public static final int aboutapp_developer_uri = R.string.aboutapp_developer_uri;
47+
4448 }
4549
4650 public class raw {
--- a/src/org/openintents/distribution/UpdateMenu.java
+++ b/src/org/openintents/distribution/UpdateMenu.java
@@ -16,8 +16,6 @@
1616
1717 package org.openintents.distribution;
1818
19-// Version Nov 12, 2008
20-
2119 import android.app.AlertDialog.Builder;
2220 import android.content.ActivityNotFoundException;
2321 import android.content.Context;
@@ -32,11 +30,26 @@ import android.view.Menu;
3230 import android.view.MenuItem;
3331 import android.widget.Toast;
3432
33+/**
34+ * @version 2009-10-23: support Market and aTrackDog
35+ * @version 2009-02-04
36+ * @author Peli
37+ *
38+ */
3539 public class UpdateMenu {
3640
3741 private static final String TAG = "UpdateMenu";
3842
39- public static final String UPDATE_CHECKER = "org.openintents.updatechecker";
43+ /**
44+ * If any of the following applications is installed,
45+ * there is no need for a manual "Update" menu entry.
46+ */
47+ public static final String[] UPDATE_CHECKER = new String[]
48+ {
49+ "org.openintents.updatechecker", // OI Update
50+ "com.android.vending", // Google's Android Market
51+ "com.a0soft.gphone.aTrackDog" // aTrackDog
52+ };
4053
4154 /**
4255 * Adds a menu item for update only if update checker is not installed.
@@ -52,19 +65,26 @@ public class UpdateMenu {
5265 public static MenuItem addUpdateMenu(Context context, Menu menu, int groupId,
5366 int itemId, int order, int titleRes) {
5467 PackageInfo pi = null;
55- try {
56- pi = context.getPackageManager().getPackageInfo(
57- UPDATE_CHECKER, 0);
58- } catch (NameNotFoundException e) {
59- // ignore
60- }
61- if (pi == null) {
62- return menu.add(groupId, itemId, order, titleRes).setIcon(
63- android.R.drawable.ic_menu_info_details).setShortcut('9',
64- 'u');
65- } else {
66- return null;
68+
69+ // Test for existence of all known update checker applications.
70+ for (int i = 0; i < UPDATE_CHECKER.length; i++) {
71+ try {
72+ pi = context.getPackageManager().getPackageInfo(
73+ UPDATE_CHECKER[i], 0);
74+ } catch (NameNotFoundException e) {
75+ // ignore
76+ }
77+ if (pi != null) {
78+ // At least one kind of update checker exists,
79+ // so there is no need to add a menu item.
80+ return null;
81+ }
6782 }
83+
84+ // If we reach this point, we add a menu item for manual update.
85+ return menu.add(groupId, itemId, order, titleRes).setIcon(
86+ android.R.drawable.ic_menu_info_details).setShortcut('9',
87+ 'u');
6888 }
6989
7090
@@ -81,40 +101,25 @@ public class UpdateMenu {
81101 e.printStackTrace();
82102 }
83103 final Intent intent = new Intent(Intent.ACTION_VIEW);
104+ final Intent intent2 = new Intent(Intent.ACTION_VIEW);
84105 new Builder(context).setMessage(context.getString(RD.string.update_box_text, version))
85106 .setPositiveButton(RD.string.update_check_now, new OnClickListener(){
86107
87108 public void onClick(DialogInterface arg0, int arg1) {
88109 intent.setData(Uri.parse(context.getString(RD.string.update_app_url)));
89- startSaveActivity(context, intent);
110+ intent2.setData(Uri.parse(context.getString(RD.string.update_app_developer_url)));
111+ GetFromMarketDialog.startSaveActivity(context, intent, intent2);
90112 }
91113
92114 }).setNegativeButton(RD.string.update_get_updater, new OnClickListener(){
93115
94116 public void onClick(DialogInterface dialog, int which) {
95117 intent.setData(Uri.parse(context.getString(RD.string.update_checker_url)));
96- startSaveActivity(context, intent);
118+ intent2.setData(Uri.parse(context.getString(RD.string.update_checker_developer_url)));
119+ GetFromMarketDialog.startSaveActivity(context, intent, intent2);
97120 }
98121
99122 }).show();
100123 }
101-
102- /**
103- * Start an activity but prompt a toast if activity is not found
104- * (instead of crashing).
105- *
106- * @param context
107- * @param intent
108- */
109- private static void startSaveActivity(Context context, Intent intent) {
110- try {
111- context.startActivity(intent);
112- } catch (ActivityNotFoundException e) {
113- Toast.makeText(context,
114- RD.string.update_error,
115- Toast.LENGTH_SHORT).show();
116- Log.e(TAG, "Error starting activity.", e);
117- }
118- }
119124
120125 }
--- a/src/org/openintents/filemanager/DirectoryScanner.java
+++ b/src/org/openintents/filemanager/DirectoryScanner.java
@@ -6,6 +6,7 @@ import java.util.ArrayList;
66 import java.util.Collections;
77 import java.util.List;
88
9+import org.openintents.filemanager.util.FileUtils;
910 import org.openintents.filemanager.util.MimeTypes;
1011
1112 import android.content.Context;
@@ -13,6 +14,7 @@ import android.content.Intent;
1314 import android.content.pm.PackageManager;
1415 import android.content.pm.ResolveInfo;
1516 import android.graphics.drawable.Drawable;
17+import android.net.Uri;
1618 import android.os.Handler;
1719 import android.os.Message;
1820 import android.os.SystemClock;
@@ -43,12 +45,13 @@ public class DirectoryScanner extends Thread {
4345
4446
4547
46- DirectoryScanner(File directory, Context context, Handler handler, MimeTypes mimeTypes) {
48+ DirectoryScanner(File directory, Context context, Handler handler, MimeTypes mimeTypes, String sdCardPath) {
4749 super("Directory Scanner");
4850 currentDirectory = directory;
4951 this.context = context;
5052 this.handler = handler;
5153 this.mMimeTypes = mimeTypes;
54+ this.mSdCardPath = sdCardPath;
5255 }
5356
5457 private void clearData() {
@@ -129,7 +132,7 @@ public class DirectoryScanner extends Thread {
129132
130133 String mimetype = mMimeTypes.getMimeType(fileName);
131134
132- currentIcon = getDrawableForMimetype(mimetype);
135+ currentIcon = getDrawableForMimetype(currentFile, mimetype);
133136 if (currentIcon == null) {
134137 currentIcon = genericFileIcon;
135138 }
@@ -204,17 +207,36 @@ public class DirectoryScanner extends Thread {
204207 * @param mimetype
205208 * @return
206209 */
207- Drawable getDrawableForMimetype(String mimetype) {
210+ Drawable getDrawableForMimetype(File file, String mimetype) {
211+ if (mimetype == null) {
212+ return null;
213+ }
214+
208215 PackageManager pm = context.getPackageManager();
209216
217+ Uri data = FileUtils.getUri(file);
218+
210219 Intent intent = new Intent(Intent.ACTION_VIEW);
211- intent.setType(mimetype);
220+ //intent.setType(mimetype);
212221
222+ // Let's probe the intent exactly in the same way as the VIEW action
223+ // is performed in FileManagerActivity.openFile(..)
224+ intent.setDataAndType(data, mimetype);
225+
213226 final List<ResolveInfo> lri = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
214227
215228 if (lri != null && lri.size() > 0) {
229+ //Log.i(TAG, "lri.size()" + lri.size());
230+
216231 // return first element
217- final ResolveInfo ri = lri.get(0);
232+ int index = 0;
233+
234+ // Actually first element should be "best match",
235+ // but it seems that more recently installed applications
236+ // could be even better match.
237+ index = lri.size()-1;
238+
239+ final ResolveInfo ri = lri.get(index);
218240 return ri.loadIcon(pm);
219241 }
220242
--- a/src/org/openintents/filemanager/FileManagerActivity.java
+++ b/src/org/openintents/filemanager/FileManagerActivity.java
@@ -626,7 +626,7 @@ public class FileManagerActivity extends ListActivity {
626626 mProgressBar.setVisibility(View.GONE);
627627 setListAdapter(null);
628628
629- mDirectoryScanner = new DirectoryScanner(currentDirectory, this, currentHandler, mMimeTypes);
629+ mDirectoryScanner = new DirectoryScanner(currentDirectory, this, currentHandler, mMimeTypes, mSdCardPath);
630630 mDirectoryScanner.start();
631631
632632
@@ -906,17 +906,23 @@ public class FileManagerActivity extends ListActivity {
906906 menu.add(0, MENU_RENAME, 0, R.string.menu_rename);
907907 menu.add(0, MENU_DELETE, 0, R.string.menu_delete);
908908
909- Uri data = Uri.fromFile(file);
910- Intent intent = new Intent(null, data);
911- String type = mMimeTypes.getMimeType(file.getName());
909+ //if (!file.isDirectory()) {
910+ Uri data = Uri.fromFile(file);
911+ Intent intent = new Intent(null, data);
912+ String type = mMimeTypes.getMimeType(file.getName());
912913
913- intent.setDataAndType(data, type);
914+ intent.setDataAndType(data, type);
915+ //intent.addCategory(Intent.CATEGORY_SELECTED_ALTERNATIVE);
914916
915-// Log.v(TAG, "Data=" + data);
916-// Log.v(TAG, "Type=" + type);
917-
918- menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0,
919- new ComponentName(this, FileManagerActivity.class), null, intent, 0, null);
917+ Log.v(TAG, "Data=" + data);
918+ Log.v(TAG, "Type=" + type);
919+
920+ if (type != null) {
921+ // Add additional options for the MIME type of the selected file.
922+ menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0,
923+ new ComponentName(this, FileManagerActivity.class), null, intent, 0, null);
924+ }
925+ //}
920926 }
921927
922928 @Override
Show on old repository browser