packages/apps/FileManager
修訂 | 950829ea9667768af1110aa18f37c4d4086e8c25 (tree) |
---|---|
時間 | 2009-11-03 18:49:22 |
作者 | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
update to version 1.1.0. (r2363)
@@ -16,11 +16,34 @@ | ||
16 | 16 | --> |
17 | 17 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
18 | 18 | 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"/> | |
23 | 41 | <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 | + | |
24 | 47 | <meta-data android:name="org.openintents.metadata.COMMENTS" |
25 | 48 | android:value="@string/about_comments" /> |
26 | 49 | <meta-data android:name="org.openintents.metadata.COPYRIGHT" |
@@ -80,4 +103,4 @@ | ||
80 | 103 | </activity> --> |
81 | 104 | <provider android:name=".FileManagerProvider" android:authorities="org.openintents.filemanager"></provider> |
82 | 105 | </application> |
83 | -</manifest> | |
\ No newline at end of file | ||
106 | +</manifest> |
@@ -22,16 +22,21 @@ To obtain the current release, visit | ||
22 | 22 | http://www.openintents.org |
23 | 23 | |
24 | 24 | --------------------------------------------------------- |
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: | |
28 | 33 | .amr, .3gp |
29 | -- Added support for upper case or mixed case letter | |
34 | +- added support for upper case or mixed case letter | |
30 | 35 | extensions (like .png and .PNG) |
31 | -- Fix for send files via MMS. | |
36 | +- fix for send files via MMS. | |
32 | 37 | - support for OI About. |
33 | 38 | - encode file URIs properly |
34 | -- translations: French, German | |
39 | +- translations: Chinese, French, German, Japanese, Spanish | |
35 | 40 | |
36 | 41 | --------------------------------------------------------- |
37 | 42 | release: 1.0.0 |
@@ -21,7 +21,8 @@ | ||
21 | 21 | |
22 | 22 | <!-- Automatically filled in by Launchpad: --> |
23 | 23 | <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> | |
25 | 26 | |
26 | 27 | <string name="about_comments">OI Dateimanager ist ein offener Dateimanager, der nahtlos mit anderen Anwendungen zusammenarbeitet.</string> |
27 | 28 | <string name="about_website_label">OI Dateimanager auf OpenIntents</string> |
@@ -37,7 +38,7 @@ | ||
37 | 38 | <string name="menu_send">Senden</string> |
38 | 39 | <string name="menu_open">Öffnen</string> |
39 | 40 | <string name="menu_move">Verschieben</string> |
40 | - <string name="menu_copy">Copy</string> | |
41 | + <string name="menu_copy">Kopie</string> | |
41 | 42 | |
42 | 43 | <string name="create_new_folder">Neuen Ordner erstellen</string> |
43 | 44 | <string name="folder_name">Name des Ordners</string> |
@@ -50,14 +51,14 @@ | ||
50 | 51 | <string name="folder_renamed">Ordner umbenannt.</string> |
51 | 52 | <string name="file_moved">Datei verschoben.</string> |
52 | 53 | <string name="folder_moved">Ordner verschoben.</string> |
53 | - <string name="file_copied">File copied.</string> | |
54 | + <string name="file_copied">Datei kopiert.</string> | |
54 | 55 | <string name="move_title">Ordner zum Verschieben auswählen</string> |
55 | 56 | <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> | |
61 | 62 | |
62 | 63 | <string name="error_creating_new_folder">Neuer Ordner konnte nicht erstellt werden.</string> |
63 | 64 | <string name="error_deleting_file">Datei konnte nicht gelöscht werden.</string> |
@@ -66,7 +67,7 @@ | ||
66 | 67 | <string name="error_renaming_folder">Ordner konnte nicht umbenannt werden.</string> |
67 | 68 | <string name="error_moving_file">Datei konnte nicht verschoben werden.</string> |
68 | 69 | <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> | |
70 | 71 | <string name="error_file_does_not_exists">Datei existiert nicht.</string> |
71 | 72 | |
72 | 73 | <string name="send_not_available">Keine Anwendung zum Senden vorhanden.</string> |
@@ -21,9 +21,10 @@ | ||
21 | 21 | |
22 | 22 | <!-- Automatically filled in by Launchpad: --> |
23 | 23 | <string name="about_translators">Launchpad Contributions: |
24 | + DiegoJ https://launchpad.net/~diegojromerolopez | |
24 | 25 | miwie https://launchpad.net/~mw-miwie</string> |
25 | 26 | |
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> | |
27 | 28 | <string name="about_website_label">OI File Manager en OpenIntents</string> |
28 | 29 | |
29 | 30 | <!-- *************************** |
@@ -37,7 +38,7 @@ | ||
37 | 38 | <string name="menu_send">Enviar</string> |
38 | 39 | <string name="menu_open">Abrir</string> |
39 | 40 | <string name="menu_move">Mover</string> |
40 | - <string name="menu_copy">Copy</string> | |
41 | + <string name="menu_copy">Copiar</string> | |
41 | 42 | |
42 | 43 | <string name="create_new_folder">Crear nueva carpeta</string> |
43 | 44 | <string name="folder_name">Nombre de carpeta</string> |
@@ -50,14 +51,14 @@ | ||
50 | 51 | <string name="folder_renamed">Carpeta cambiado de nombre.</string> |
51 | 52 | <string name="file_moved">Fichero movido.</string> |
52 | 53 | <string name="folder_moved">Carpeta movido.</string> |
53 | - <string name="file_copied">File copied.</string> | |
54 | + <string name="file_copied">Archivo copiado.</string> | |
54 | 55 | <string name="move_title">Seleccionar carpeta de destino</string> |
55 | 56 | <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> | |
58 | 59 | |
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> | |
61 | 62 | |
62 | 63 | <string name="error_creating_new_folder">No se puede crear la carpeta nueva.</string> |
63 | 64 | <string name="error_deleting_file">No se puede borrar el fichero.</string> |
@@ -66,7 +67,7 @@ | ||
66 | 67 | <string name="error_renaming_folder">No se puede cambiar de nombre de la carpeta.</string> |
67 | 68 | <string name="error_moving_file">No se puede mover el fichero.</string> |
68 | 69 | <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> | |
70 | 71 | <string name="error_file_does_not_exists">El archivo no existe.</string> |
71 | 72 | |
72 | 73 | <string name="send_not_available">Aplicación no disponible para enviar.</string> |
@@ -83,10 +84,7 @@ | ||
83 | 84 | <string name="eula_refuse">Cancelar</string> |
84 | 85 | |
85 | 86 | <!-- 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> | |
90 | 88 | <string name="update_check_now">Comprobar ahora.</string> |
91 | 89 | <string name="update_get_updater">Obtenga el Actualizador de OI</string> |
92 | 90 | <string name="update_error">Descarga aplicación no disponible.</string> |
@@ -94,7 +92,7 @@ Current version: %s | ||
94 | 92 | |
95 | 93 | <!-- About --> |
96 | 94 | <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> | |
98 | 96 | <string name="aboutapp_get">Obtenga Acerca de OI</string> |
99 | 97 | |
100 | 98 |
@@ -21,6 +21,7 @@ | ||
21 | 21 | |
22 | 22 | <!-- Automatically filled in by Launchpad: --> |
23 | 23 | <string name="about_translators">Launchpad Contributions: |
24 | + Simon de Vlieger https://launchpad.net/~ikanobori | |
24 | 25 | pjv https://launchpad.net/~pjv</string> |
25 | 26 | |
26 | 27 | <string name="about_comments">OI File Manager is an open file manager that seamlessly cooperates with other applications.</string> |
@@ -37,7 +38,7 @@ | ||
37 | 38 | <string name="menu_send">Verzenden</string> |
38 | 39 | <string name="menu_open">Openen</string> |
39 | 40 | <string name="menu_move">Verplaatsen</string> |
40 | - <string name="menu_copy">Copy</string> | |
41 | + <string name="menu_copy">Kopieer</string> | |
41 | 42 | |
42 | 43 | <string name="create_new_folder">Nieuwe map aanmaken</string> |
43 | 44 | <string name="folder_name">Naam van de map</string> |
@@ -50,14 +51,14 @@ | ||
50 | 51 | <string name="folder_renamed">Map hernoemd.</string> |
51 | 52 | <string name="file_moved">Bestand verplaatst.</string> |
52 | 53 | <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> | |
58 | 59 | |
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> | |
61 | 62 | |
62 | 63 | <string name="error_creating_new_folder">Could not create new folder.</string> |
63 | 64 | <string name="error_deleting_file">Could not delete file.</string> |
@@ -23,13 +23,13 @@ | ||
23 | 23 | <string name="about_translators">Launchpad Contributions: |
24 | 24 | Swandle https://launchpad.net/~swandle</string> |
25 | 25 | |
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> | |
28 | 28 | |
29 | 29 | <!-- *************************** |
30 | 30 | Applicatio-specific strings |
31 | 31 | *************************** --> |
32 | - <string name="app_name">OI文件管理</string> | |
32 | + <string name="app_name">OI文件管理器</string> | |
33 | 33 | |
34 | 34 | <string name="menu_new_folder">新建文件夹</string> |
35 | 35 | <string name="menu_delete">删除</string> |
@@ -43,10 +43,10 @@ | ||
43 | 43 | <string name="folder_name">文件夹名</string> |
44 | 44 | <string name="file_name">文件夹名</string> |
45 | 45 | <string name="this_folder_is_empty">该文件夹为空</string> |
46 | - <string name="really_delete">你真要删除 %s 吗?</string> | |
46 | + <string name="really_delete">确实要删除 %s 吗?</string> | |
47 | 47 | <string name="file_deleted">文件已删除</string> |
48 | 48 | <string name="folder_deleted">文件夹已删除</string> |
49 | - <string name="file_renamed">文件重命名</string> | |
49 | + <string name="file_renamed">文件已重命名</string> | |
50 | 50 | <string name="folder_renamed">文件夹已重命名</string> |
51 | 51 | <string name="file_moved">文件已移动</string> |
52 | 52 | <string name="folder_moved">文件夹已移动</string> |
@@ -48,10 +48,13 @@ | ||
48 | 48 | *************************** --> |
49 | 49 | <!-- Update --> |
50 | 50 | <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 --> | |
51 | 52 | <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 --> | |
52 | 54 | |
53 | 55 | <!-- About --> |
54 | 56 | <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 --> | |
55 | 58 | |
56 | 59 | <!-- *************************** |
57 | 60 | Preferences |
@@ -22,7 +22,7 @@ | ||
22 | 22 | <type extension=".jpeg" mimetype="image/jpeg" /> |
23 | 23 | <type extension=".bmp" mimetype="image/bmp" /> |
24 | 24 | |
25 | - <!-- Autio types --> | |
25 | + <!-- Audio types --> | |
26 | 26 | <type extension=".mp3" mimetype="audio/mp3" /> |
27 | 27 | <type extension=".wav" mimetype="audio/wav" /> |
28 | 28 | <type extension=".ogg" mimetype="audio/x-ogg" /> |
@@ -53,4 +53,4 @@ | ||
53 | 53 | <!-- Android specific --> |
54 | 54 | <type extension=".apk" mimetype="application/vnd.android.package-archive" /> |
55 | 55 | |
56 | -</MimeTypes> | |
56 | +</MimeTypes> | |
\ No newline at end of file |
@@ -27,7 +27,7 @@ import android.content.Intent; | ||
27 | 27 | /** |
28 | 28 | * About dialog |
29 | 29 | * |
30 | - * @version 2009-01-16 | |
30 | + * @version 2009-02-04 | |
31 | 31 | * @author Peli |
32 | 32 | * |
33 | 33 | */ |
@@ -38,7 +38,8 @@ public class AboutDialog extends GetFromMarketDialog { | ||
38 | 38 | super(context, |
39 | 39 | RD.string.aboutapp_not_available, |
40 | 40 | RD.string.aboutapp_get, |
41 | - RD.string.aboutapp_market_uri); | |
41 | + RD.string.aboutapp_market_uri, | |
42 | + RD.string.aboutapp_developer_uri); | |
42 | 43 | |
43 | 44 | String version = VersionUtils.getVersionNumber(context); |
44 | 45 | String name = VersionUtils.getApplicationName(context); |
@@ -10,16 +10,23 @@ import android.net.Uri; | ||
10 | 10 | import android.util.Log; |
11 | 11 | import android.widget.Toast; |
12 | 12 | |
13 | +/** | |
14 | + * @version 2009-02-04 | |
15 | + * @author Peli | |
16 | + * | |
17 | + */ | |
13 | 18 | public class GetFromMarketDialog extends AlertDialog implements OnClickListener { |
14 | 19 | private static final String TAG = "StartSaveActivity"; |
15 | 20 | |
16 | 21 | Context mContext; |
17 | 22 | int mMarketUri; |
23 | + int mDeveloperUri; | |
18 | 24 | |
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) { | |
20 | 26 | super(context); |
21 | 27 | mContext = context; |
22 | 28 | mMarketUri = market_uri; |
29 | + mDeveloperUri = developer_uri; | |
23 | 30 | |
24 | 31 | //setTitle(context.getText(R.string.menu_edit_tags)); |
25 | 32 | setMessage(mContext.getText(message)); |
@@ -33,7 +40,11 @@ public class GetFromMarketDialog extends AlertDialog implements OnClickListener | ||
33 | 40 | |
34 | 41 | Intent intent = new Intent(Intent.ACTION_VIEW); |
35 | 42 | 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); | |
37 | 48 | } |
38 | 49 | |
39 | 50 | } |
@@ -44,15 +55,21 @@ public class GetFromMarketDialog extends AlertDialog implements OnClickListener | ||
44 | 55 | * |
45 | 56 | * @param context |
46 | 57 | * @param intent |
58 | + * @param intent2 Alternative intent to call, if the first is not reachable | |
47 | 59 | */ |
48 | - public static void startSaveActivity(Context context, Intent intent) { | |
60 | + public static void startSaveActivity(Context context, Intent intent, Intent intent2) { | |
49 | 61 | try { |
50 | 62 | context.startActivity(intent); |
51 | 63 | } catch (ActivityNotFoundException e) { |
52 | - Toast.makeText(context, | |
53 | - RD.string.update_error, | |
54 | - Toast.LENGTH_SHORT).show(); | |
55 | 64 | 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 | + } | |
56 | 73 | } |
57 | 74 | } |
58 | -} | |
75 | +} | |
\ No newline at end of file |
@@ -32,8 +32,10 @@ public class RD { | ||
32 | 32 | public static final int update_box_text = R.string.update_box_text; |
33 | 33 | public static final int update_check_now = R.string.update_check_now; |
34 | 34 | 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; | |
35 | 36 | public static final int update_get_updater = R.string.update_get_updater; |
36 | 37 | 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; | |
37 | 39 | public static final int update_error = R.string.update_error; |
38 | 40 | |
39 | 41 | /////////////////////////////////////// |
@@ -41,6 +43,8 @@ public class RD { | ||
41 | 43 | public static final int aboutapp_not_available = R.string.aboutapp_not_available; |
42 | 44 | public static final int aboutapp_get = R.string.aboutapp_get; |
43 | 45 | 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 | + | |
44 | 48 | } |
45 | 49 | |
46 | 50 | public class raw { |
@@ -16,8 +16,6 @@ | ||
16 | 16 | |
17 | 17 | package org.openintents.distribution; |
18 | 18 | |
19 | -// Version Nov 12, 2008 | |
20 | - | |
21 | 19 | import android.app.AlertDialog.Builder; |
22 | 20 | import android.content.ActivityNotFoundException; |
23 | 21 | import android.content.Context; |
@@ -32,11 +30,26 @@ import android.view.Menu; | ||
32 | 30 | import android.view.MenuItem; |
33 | 31 | import android.widget.Toast; |
34 | 32 | |
33 | +/** | |
34 | + * @version 2009-10-23: support Market and aTrackDog | |
35 | + * @version 2009-02-04 | |
36 | + * @author Peli | |
37 | + * | |
38 | + */ | |
35 | 39 | public class UpdateMenu { |
36 | 40 | |
37 | 41 | private static final String TAG = "UpdateMenu"; |
38 | 42 | |
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 | + }; | |
40 | 53 | |
41 | 54 | /** |
42 | 55 | * Adds a menu item for update only if update checker is not installed. |
@@ -52,19 +65,26 @@ public class UpdateMenu { | ||
52 | 65 | public static MenuItem addUpdateMenu(Context context, Menu menu, int groupId, |
53 | 66 | int itemId, int order, int titleRes) { |
54 | 67 | 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 | + } | |
67 | 82 | } |
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'); | |
68 | 88 | } |
69 | 89 | |
70 | 90 |
@@ -81,40 +101,25 @@ public class UpdateMenu { | ||
81 | 101 | e.printStackTrace(); |
82 | 102 | } |
83 | 103 | final Intent intent = new Intent(Intent.ACTION_VIEW); |
104 | + final Intent intent2 = new Intent(Intent.ACTION_VIEW); | |
84 | 105 | new Builder(context).setMessage(context.getString(RD.string.update_box_text, version)) |
85 | 106 | .setPositiveButton(RD.string.update_check_now, new OnClickListener(){ |
86 | 107 | |
87 | 108 | public void onClick(DialogInterface arg0, int arg1) { |
88 | 109 | 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); | |
90 | 112 | } |
91 | 113 | |
92 | 114 | }).setNegativeButton(RD.string.update_get_updater, new OnClickListener(){ |
93 | 115 | |
94 | 116 | public void onClick(DialogInterface dialog, int which) { |
95 | 117 | 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); | |
97 | 120 | } |
98 | 121 | |
99 | 122 | }).show(); |
100 | 123 | } |
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 | - } | |
119 | 124 | |
120 | 125 | } |
@@ -6,6 +6,7 @@ import java.util.ArrayList; | ||
6 | 6 | import java.util.Collections; |
7 | 7 | import java.util.List; |
8 | 8 | |
9 | +import org.openintents.filemanager.util.FileUtils; | |
9 | 10 | import org.openintents.filemanager.util.MimeTypes; |
10 | 11 | |
11 | 12 | import android.content.Context; |
@@ -13,6 +14,7 @@ import android.content.Intent; | ||
13 | 14 | import android.content.pm.PackageManager; |
14 | 15 | import android.content.pm.ResolveInfo; |
15 | 16 | import android.graphics.drawable.Drawable; |
17 | +import android.net.Uri; | |
16 | 18 | import android.os.Handler; |
17 | 19 | import android.os.Message; |
18 | 20 | import android.os.SystemClock; |
@@ -43,12 +45,13 @@ public class DirectoryScanner extends Thread { | ||
43 | 45 | |
44 | 46 | |
45 | 47 | |
46 | - DirectoryScanner(File directory, Context context, Handler handler, MimeTypes mimeTypes) { | |
48 | + DirectoryScanner(File directory, Context context, Handler handler, MimeTypes mimeTypes, String sdCardPath) { | |
47 | 49 | super("Directory Scanner"); |
48 | 50 | currentDirectory = directory; |
49 | 51 | this.context = context; |
50 | 52 | this.handler = handler; |
51 | 53 | this.mMimeTypes = mimeTypes; |
54 | + this.mSdCardPath = sdCardPath; | |
52 | 55 | } |
53 | 56 | |
54 | 57 | private void clearData() { |
@@ -129,7 +132,7 @@ public class DirectoryScanner extends Thread { | ||
129 | 132 | |
130 | 133 | String mimetype = mMimeTypes.getMimeType(fileName); |
131 | 134 | |
132 | - currentIcon = getDrawableForMimetype(mimetype); | |
135 | + currentIcon = getDrawableForMimetype(currentFile, mimetype); | |
133 | 136 | if (currentIcon == null) { |
134 | 137 | currentIcon = genericFileIcon; |
135 | 138 | } |
@@ -204,17 +207,36 @@ public class DirectoryScanner extends Thread { | ||
204 | 207 | * @param mimetype |
205 | 208 | * @return |
206 | 209 | */ |
207 | - Drawable getDrawableForMimetype(String mimetype) { | |
210 | + Drawable getDrawableForMimetype(File file, String mimetype) { | |
211 | + if (mimetype == null) { | |
212 | + return null; | |
213 | + } | |
214 | + | |
208 | 215 | PackageManager pm = context.getPackageManager(); |
209 | 216 | |
217 | + Uri data = FileUtils.getUri(file); | |
218 | + | |
210 | 219 | Intent intent = new Intent(Intent.ACTION_VIEW); |
211 | - intent.setType(mimetype); | |
220 | + //intent.setType(mimetype); | |
212 | 221 | |
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 | + | |
213 | 226 | final List<ResolveInfo> lri = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); |
214 | 227 | |
215 | 228 | if (lri != null && lri.size() > 0) { |
229 | + //Log.i(TAG, "lri.size()" + lri.size()); | |
230 | + | |
216 | 231 | // 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); | |
218 | 240 | return ri.loadIcon(pm); |
219 | 241 | } |
220 | 242 |
@@ -626,7 +626,7 @@ public class FileManagerActivity extends ListActivity { | ||
626 | 626 | mProgressBar.setVisibility(View.GONE); |
627 | 627 | setListAdapter(null); |
628 | 628 | |
629 | - mDirectoryScanner = new DirectoryScanner(currentDirectory, this, currentHandler, mMimeTypes); | |
629 | + mDirectoryScanner = new DirectoryScanner(currentDirectory, this, currentHandler, mMimeTypes, mSdCardPath); | |
630 | 630 | mDirectoryScanner.start(); |
631 | 631 | |
632 | 632 |
@@ -906,17 +906,23 @@ public class FileManagerActivity extends ListActivity { | ||
906 | 906 | menu.add(0, MENU_RENAME, 0, R.string.menu_rename); |
907 | 907 | menu.add(0, MENU_DELETE, 0, R.string.menu_delete); |
908 | 908 | |
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()); | |
912 | 913 | |
913 | - intent.setDataAndType(data, type); | |
914 | + intent.setDataAndType(data, type); | |
915 | + //intent.addCategory(Intent.CATEGORY_SELECTED_ALTERNATIVE); | |
914 | 916 | |
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 | + //} | |
920 | 926 | } |
921 | 927 | |
922 | 928 | @Override |