diff --git a/MyTracks/proguard.cfg b/MyTracks/proguard.cfg index 7a2867d7e..65fa34cbb 100644 --- a/MyTracks/proguard.cfg +++ b/MyTracks/proguard.cfg @@ -12,6 +12,8 @@ -dontwarn com.google.android.googleapps.** -dontwarn com.android.common.** -dontwarn com.google.android.gsf.** +-dontwarn org.codehaus.** +-dontwarn com.google.appengine.** # Keep everything android references from XMLs -keep public class * extends android.app.Activity @@ -20,6 +22,7 @@ -keep public class * extends android.app,backup.BackupAgent -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider +-keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService -keepclasseswithmembernames class * { diff --git a/MyTracks/res/values-fr/arrays.xml b/MyTracks/res/values-fr/arrays.xml index 8492157da..0c9eedf72 100644 --- a/MyTracks/res/values-fr/arrays.xml +++ b/MyTracks/res/values-fr/arrays.xml @@ -201,7 +201,7 @@ limitations under the License. kayak bateau à moteur ferry - boat télécommandé + bateau télécommandé surf planche à voile kite surf @@ -304,4 +304,11 @@ limitations under the License. point de passage + + Aucun + Capteur ANT+ + Pont SRM ANT+ + Bluetooth Zephyr + + diff --git a/MyTracks/res/values-fr/strings.xml b/MyTracks/res/values-fr/strings.xml index 3f58be7e7..eaabdce72 100644 --- a/MyTracks/res/values-fr/strings.xml +++ b/MyTracks/res/values-fr/strings.xml @@ -30,7 +30,9 @@ limitations under the License. Sélectionnez le parcours à visualiser Parcours actuel Segment actuel - + État du capteur + Statistiques consolidées + Aucune source de localisation n\'a été trouvée sur ce système ! Aucune source GPS de localisation n\'a été trouvée sur ce système. @@ -49,7 +51,7 @@ limitations under the License. Attente du signal GPS. Assurez-vous que le ciel est bien visible. Parcours en cours d\'enregistrement. Enregistrement du parcours terminé. - + Une nouvelle table Google Fusion vient d\'être créée sur google.com/fusiontables. Votre parcours a été envoyé à maps.google.com. Votre parcours a été envoyé dans un tableur à docs.google.com. Votre parcours a été envoyé à docs.google.com. @@ -64,11 +66,11 @@ limitations under the License. Envoi du parcours à Google... Lecture du parcours... Préparation du parcours - + Authentification à Google Fusion Tables... Authentification à Google Docs... Envoi du parcours vers Google Docs... - - + Envoi du parcours vers Google Fusion Tables... + Création d\'une nouvelle \'Fusion Table\'... Importation du parcours GPS. Patientez SVP. Enregistrement du fichier sur la carte SD. Patientez SVP. Mise à jour des statistiques du parcours... @@ -109,8 +111,8 @@ limitations under the License. Afficher - - + Envoyer à Google Fusion Tables + Envoyer et créer un nouvelle table Google Fusion Tables Envoyer à Google Docs Envoyer à Google... Effacer du téléphone... @@ -118,14 +120,14 @@ limitations under the License. Enregistrer sur la carte SD... Enregistrer en fichier GPX Enregistrer en fichier KML - + Envoyer à Google Fusion Tables Exporter tous les parcours Tout supprimer Choisissez un parcours. Faites un appui prolongé pour plus d\'options. Tous les parcours: Ce parcours Partager... - + Lien sur Google Fusion Tables Fichier GPX Fichier KML Effacer la carte @@ -193,6 +195,34 @@ limitations under the License. Temps ou distance minimum avant l\'insertion d\'un marqueur de séparation Rythme + Nécessite au minimum Android 2.0 + Type de capteur + Type du capteur à utiliser + Se désassocier du Cardiofréquencemètre ANT + Se désassocier du compteur ANT + Se désassocier du pont SRM ANT + Capteur ANT non associé + Capteur ANT associé: %d + Capteur Bluetooth + Capteur Bluetooth à utiliser + Affichage des statistiques modulaires + + + Sauvegarde (BETA) + Sauvegarde sur carte SD + Sauvegarder + Copier tous vos parcours et paramètres sur la carte SD + Restaurer + Restaurer tous les parcours et paramètres depuis la carte SD + Sauvegarde impossible lors de l\'enregistrement d\'un parcours. + + + Restaurer une sauvegarde depuis la carte SD écrasera tous vos parcours et paramètres actuels. + Choisissez la sauvegarde à restaurer + Pas de sauvegarde disponible. + Écriture de tous vos parcours et paramètres sur la carte SD. Veuillez patienter... + Lecture de tous vos parcours et paramètres depuis la carte SD. Veuillez patienter... + Satellites GPS @@ -267,6 +297,9 @@ limitations under the License. miles/heure per mile + + Waiting... + Durée (déplacement) Durée totale @@ -274,6 +307,12 @@ limitations under the License. Carte SD indisponible Vitesse Vous devez commencer un parcours + Distance + Puissance + Cadence + Rythme cardiaque + Rythme cardiaque maximum + - Statistiques Distance totale Patientez @@ -330,4 +369,42 @@ limitations under the License. $6 : Speed units (mph) : Pace units (per mile) --> My Tracks %1$s %2$.2f %3$s en %4$s at %5$s %6$s + + + Note sur les unités de mesure + Le système métrique est utilisé par défaut. Souhaitez-vous changer ce paramètre ? + + + Bluetooth + Options Bluetooth + Association d\'un appareil + Visitez les paramètres Bluetooth d\'Android pour associer un nouvel appareil + bluetoothSensorsEnabled + Options du capteur + + + Connecté à %s + Connexion du capteur Bluetooth... + Capteur Bluetooth non connecté + + + Date des données du capteur + Compteur activé + Cardiofréquencemètre activé + Pas de gestionnaire de capteur + Activé + Connexion + Connecté + Déconnecté + Pas de capteur + Recherche + Envoi + + + notifications lors de l\'enregistrement de parcours + lecture des parcours enregistrés + sauvegarde de parcours, lancer/arrêter l\'enregistrement de parcours + Notifications lors du lancement et de l\'arrêt de l\'enregistrement de parcours. + Possibilité de lire les données des parcours enregistrés, telles que les marqueurs et les points de passage. + Possibilité d\'écrire des données de parcours, telles que les marqueurs et les points de passage.. diff --git a/MyTracks/res/values-ja/arrays.xml b/MyTracks/res/values-ja/arrays.xml index 3b469da0b..a3b6e1fde 100644 --- a/MyTracks/res/values-ja/arrays.xml +++ b/MyTracks/res/values-ja/arrays.xml @@ -151,6 +151,14 @@ limitations under the License. 1 分 + + + なし + 5 分 + 10 分 + 15 分 + 常時 + @@ -249,12 +257,12 @@ limitations under the License. ゴルフ場 雑貨店 美容室 - 散髪屋 + 船着き場 ハイキング道 ホテル 家 - 情報 - 交差 + 案内所 + 交差点 メールボックス 市場 集合場所 diff --git a/MyTracks/res/values-ja/strings.xml b/MyTracks/res/values-ja/strings.xml index 4e2b3f144..8895c3c22 100644 --- a/MyTracks/res/values-ja/strings.xml +++ b/MyTracks/res/values-ja/strings.xml @@ -22,18 +22,20 @@ limitations under the License. 地図モード 現在地 トラック - マーカ + マーカー 全トラック消去 設定 標高 表示するトラックを選択して下さい 現在のトラック 最終セグメント + センサー情報 + 集計情報 - この端末でロケーションマネージャを発見できませんでした - この端末でGPSロケーションプロバイダを発見できました - Googleマイマップへのトラック送信でエラーが発生しました.しばらく待って試して下さい. + この端末でロケーションマネージャを発見できませんでした. + この端末でGPSロケーションプロバイダを発見できました. + Google Fusion Tablesへのトラック送信でエラーが発生しました.しばらく待って試して下さい. Google Docsへのトラック送信でエラーが発生しました.しばらく待って試して下さい. 記録作成開始できません.もう一度試して下さい. 記録停止できません.もう一度試して下さい. @@ -42,52 +44,52 @@ limitations under the License. エラーが発生しました.もう一度試して下さい. トラックが存在しません. 大きなファイルです(500KB未満でなければなりません).終了します. - マーカの挿入ができません.位置決定ができません. + マーカーの挿入ができません.位置決定ができません. GPS位置精度がよくなるまで待機しています.空が見えるところにいて下さい. 新しいトラックを記録中です. トラック記録を停止しました. - - トラックを maps.google.com に送信しました. - トラックを docs.google.com の新しいスプレッドシートに送信しました. - トラックを docs.google.com に送信しました. - ここをタップして,セキュリティ &位置情報 を開いて,「GPS機能をONにする」にチェックして下さい.バックボタンで戻ってください. + 新しいGoogle Fusion Tableをgoogle.com/fusiontablesに作成しました. + トラックをmaps.google.comに送信しました. + トラックをdocs.google.comの新しいスプレッドシートに送信しました. + トラックをdocs.google.comに送信しました. + ここをタップして「位置情報とセキュリティの設定」を開いて「GPS機能を使用」にチェックして下さい.バックボタンで戻ってください. ご注意: 携帯電話中継局とWi-Fiネットワークから大まかな位置を特定します. - 現在位置決定ができません.位置取得源を増やし(セキュリティ&位置情報をご覧ください),空が見えるようにして下さい.もう一度試して下さい. - ウェイポイントマーカを挿入しました. - 統計マーカを挿入しました. + 現在位置決定ができません.位置取得源を増やし(位置情報とセキュリティの設定 をご覧ください)、空が見えるようにして下さい.もう一度試して下さい. + ウェイポイントマーカーを挿入しました. + 統計マーカーを挿入しました. お待ちください... トラックをGoogleに送信しました. トラックを読んでいます... トラックを準備しています... - + Google Fusion Tablesへの認証を行っています... Google Docsへの認証を行っています... トラックをGoogle Docsに送信しています... - - + トラックをFusion Tablesに送信しています... + 新しいFusion Tablesを生成しています... GPSトラックをインポートしています.若干時間がかかります. SDカードにデータを書き込んでいます.若干時間がかかります. トラック統計情報を更新しています... よろしいですか? - 全てのトラックとマーカをこの端末から削除しました. - トラックとマーカをこの端末から完全に削除しました. - マーカをこの端末から完全に削除しました. + 全てのトラックとマーカーをこの端末から削除します. + トラックとマーカーをこの端末から完全に削除します. + マーカーをこの端末から完全に削除します. - + Android用My Tracksで作成 Android用<a href=\'http://mytracks.appspot.com\'>My Tracks</a>で作成しました. ポイント - 記録 + 記録日 活動タイプ - マーカタイプ - (Part %d) + マーカータイプ + (パート %d) トラックを保存中... @@ -96,10 +98,10 @@ limitations under the License. いいえ はい - OK エラー 成功 ウェイポイント + ライセンス キャンセル 閉じる 編集 @@ -111,8 +113,8 @@ limitations under the License. 表示 - - + Google Fusion Tablesへ送信 + 新規Google Fusion Tableへ送信 Google Docsへ送信 Googleへ送信... 端末から削除... @@ -121,42 +123,44 @@ limitations under the License. GPXファイルの保存 KMLファイルの保存 CVSファイルの保存 - Googleマイマップへの送信 - 全てのトラックの削除 + TCXファイルの保存 + Google Fusion Tablesへの送信 + 全トラックの削除 - 全てのトラックのエクスポート - エクスポート終了 + 全トラックの出力 + 出力終了 トラックを選択します.オプションを表示するには長押しして下さい. 全てのトラック: このトラック 共有... - + Google Fusion Tablesへのリンク GPXファイル KMLファイル CSVファイル + TCXファイル マップの消去 - 全てのマーカの削除 - このマーカ + 全てのマーカーの削除 + このマーカー 削除 詳細編集 マップに表示 ウェイポイントの挿入 統計情報の挿入 - マーカを選択します.オプションを表示するには長押しして下さい. + マーカーを選択します.オプションを表示するには長押しして下さい. トラック詳細 トラック名 トラック説明 - 活動タイプ(ハイキング, サイクリング, ランニング, 登山...) + 活動タイプ(ハイキング, サイクリング、ランニング、登山...) - マーカ詳細 - マーカ名 - マーカ説明 - マーカタイプ(建物, 洞穴, 名所...) + マーカー詳細 + マーカー名 + マーカー説明 + マーカータイプ(建物、洞穴、名所...) My Tracks設定 @@ -164,9 +168,10 @@ limitations under the License. 記録 共有 + このAndroidバージョンでは使用できません + 定期通知 音声通知間隔の最小時間 - ポイント間の最短距離 位置記録間の最短距離 @@ -197,13 +202,49 @@ limitations under the License. 共有時にトラックのコンテントが含まれます 分割頻度 - 分割マーカを挿入する時間または距離の間隔 + 分割マーカーを挿入する時間または距離の間隔 + + 記録自動再開の制限時間 + 指定時間(分単位)以内なら端末再起動時に以前のトラック記録を再開します. + + 日時をトラック名にする + デフォルトのトラック名をトラック開始日時にします. + トラック名を昇順の数字にします. + ペース + Android 2.0以上でのみサポート + センサータイプ + 接続先センサーのタイプ + ANT心拍数センサーとのペアリング解消 + ANT心拍強度センサーとのペアリング解消 + ANT SRMブリッジセンサーとのペアリング解消 + ANTセンサーとペアリングしていません + ANTセンサーとペアリング: %d + Bluetoothセンサー + Bluetoothセンサー接続先 + モジュール統計表示 + + + バックアップ (ベータ版) + SDカード バックアップ + 今すぐバックアップ + SDカードに全てのトラックと設定をバックアップします + 今すぐ復元 + SDカードから全てのトラックと設定を復元します + トラック記録中はバックアップ操作はできません. + + SDカードからの復元を実行すると、現在のトラックと設定は *全て上書き* されてしまいます.よろしいですか? + 復元するバックアップの選択 + バックアップがありません. + SDカードに全てのトラックと設定をバックアップしています.しばらくかかることがあります... + SDカードから全てのトラックと設定を復元しています.しばらくかかることがあります... + GPS衛星 + マップ共有 マップを共有したいと思います このマップに興味を持って頂けると思います: @@ -211,7 +252,7 @@ limitations under the License. トラックを共有したいと思います このトラックに興味を持って頂けると思います. - このトラックを閲覧するには,Google Earthまたは他のマッピングソフトウェアが必要です. + このトラックを閲覧するには、Google Earthまたは他のマッピングソフトウェアが必要です. トラックの共有 @@ -266,23 +307,16 @@ limitations under the License. 分 秒 秒 + ミリ秒 - m - km キロメータ - ft - mi マイル - km/h キロメータ毎時 - min/km 毎キロメータ - mi/h マイル毎時 - min/mi 毎マイル @@ -295,6 +329,10 @@ limitations under the License. 統計 合計距離 距離 + 心拍強度 + ケイデンス + 心拍数 + 最大心拍数 - 待機中... @@ -309,11 +347,11 @@ limitations under the License. チーム: バージョン: サポート: + プライバシー: 送信... - - Google Docs + Googleマイマップ 今すぐ送信 トラック統計情報送信 統計情報とポイント送信 @@ -324,22 +362,23 @@ limitations under the License. アカウント選択 - 外部ストレージを発見できませんでした.SDカードが刺さっているか,端末がコンピュータにマウントされているか確認してください. + 外部ストレージを発見できませんでした.SDカードが刺さっているか、端末がコンピュータにマウントされていないか確認してください. ファイルへの書き込みができません. + ファイルからの読み込みができません. SDカードにディレクトリを作成できません. SDカードへの書き込み終了. + SDカードからの読み込み終了. アップグレードチェック - 今すぐアップデート + 今すぐアップグレード アップグレードせずに続行 - お使いの版では,確実には動作せず,サポートもされません.ご使用を続けるには %1$s のアップグレードしてください. - お使いの版では,確実には動作しません.すぐにアップグレードすることをお勧めします.アップグレードされない場合は問題発生の可能性があることをご認識ください. サーバ同期するような機能の中には,アップグレードされるまで機能しないものがあります. - %1$s の新しい版が出ています.現版で問題なくご使用になれますが,アップグレードするまで最新の機能をお使いになれません. + お使いの版では、確実には動作せず、サポートもされません.ご使用を続けるには %1$s をアップグレードしてください. + お使いの版では、確実には動作しません.すぐにアップグレードすることをお勧めします.アップグレードされない場合は問題発生の可能性があることをご認識ください. サーバ同期するような機能の中には、アップグレードされるまで機能しないものがあります. + %1$s の新しい版が出ています.現版で問題なくご使用になれますが、アップグレードするまで最新の機能をお使いになれません. ようこそ - Ok My Tracksについて @@ -357,4 +396,38 @@ limitations under the License. 計測単位についてのご注意 デフォルトの単位はメートルです.設定を変更しますか? + + + + Bluetoothオプション + ペアリング + ペアリングを行うには「Bluetooth設定」を開いて下さい + bluetoothSensorsEnabled + センサーオプション + + + %sに接続しました + Bluetoothセンサー接続中... + Bluetoothセンサーに接続していません + + + 計測日時 + パワーメーター有効 + 心拍数モニタ有効 + センサーマネージャがありません + 有効 + 接続中 + 接続 + 解除 + センサーサービスがありません + 検索中 + 送信中 + + + トラック記録通知受信 + トラック読み込み + トラック書き込み トラック記録の開始・終了 + トラック記録の開始・終了時に通知されます. + ポイントやウェイポイントといったトラックの読み込みを可能にします. + 記録開始やウェイポイント追加といったトラック記録を可能にします. diff --git a/MyTracks/res/values/strings.xml b/MyTracks/res/values/strings.xml index fc3caca28..9b5d4a24f 100644 --- a/MyTracks/res/values/strings.xml +++ b/MyTracks/res/values/strings.xml @@ -64,7 +64,6 @@ limitations under the License. Please wait... Sending your track to Google. Reading track... - Preparing track... Authenticating to Google Fusion Tables... Authenticating to Google Docs... Sending track to Google Docs... diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/SendToFusionTables.java b/MyTracks/src/com/google/android/apps/mytracks/io/SendToFusionTables.java index bd32aa11e..9d08dd3b9 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/SendToFusionTables.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/SendToFusionTables.java @@ -30,12 +30,13 @@ import com.google.android.apps.mytracks.util.StringUtils; import com.google.android.apps.mytracks.util.UnitConversions; import com.google.android.maps.mytracks.R; import com.google.api.client.googleapis.GoogleHeaders; -import com.google.api.client.googleapis.GoogleTransport; +import com.google.api.client.googleapis.MethodOverrideIntercepter; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.InputStreamContent; +import com.google.api.client.javanet.NetHttpTransport; import com.google.api.client.util.Strings; import android.app.Activity; @@ -82,6 +83,21 @@ public class SendToFusionTables implements Runnable { private static final int MAX_POINTS_PER_UPLOAD = 2048; private static final String GDATA_VERSION = "2"; + + // This class reports upload status to the user as a completion percentage + // using a progress bar. Progress is defined as follows: + // + // 0% Getting track metadata + // 5% Creating Fusion Table (GData to FT server) + // 10%-90% Uploading the track data to Fusion Tables + // 95% Uploading waypoints + // 100% Done + private static final int PROGRESS_INITIALIZATION = 0; + private static final int PROGRESS_FUSION_TABLE_CREATE = 5; + private static final int PROGRESS_UPLOAD_DATA_MIN = 10; + private static final int PROGRESS_UPLOAD_DATA_MAX = 90; + private static final int PROGRESS_UPLOAD_WAYPOINTS = 95; + private static final int PROGRESS_COMPLETE = 100; private final Activity context; private final AuthManager auth; @@ -105,6 +121,12 @@ public class SendToFusionTables implements Runnable { private static String MARKER_TYPE_END = "large_red"; private static String MARKER_TYPE_WAYPOINT = "large_yellow"; + static { + // We manually assign the transport to avoid having HttpTransport try to + // load it via reflection (which breaks due to ProGuard). + HttpTransport.setLowLevelHttpTransport(new NetHttpTransport()); + } + public SendToFusionTables(Activity context, AuthManager auth, long trackId, ProgressIndicator progressIndicator, OnSendCompletedListener onCompletion) { @@ -115,10 +137,14 @@ public class SendToFusionTables implements Runnable { this.onCompletion = onCompletion; this.stringUtils = new StringUtils(context); this.providerUtils = MyTracksProviderUtils.Factory.get(context); - transport = GoogleTransport.create(); - GoogleHeaders headers = (GoogleHeaders) transport.defaultHeaders; + + GoogleHeaders headers = new GoogleHeaders(); headers.setApplicationName("Google-MyTracks-" + MyTracksUtils.getMyTracksVersion(context)); headers.gdataVersion = GDATA_VERSION; + + transport = new HttpTransport(); + MethodOverrideIntercepter.setAsFirstFor(transport); + transport.defaultHeaders = headers; } @Override @@ -141,7 +167,7 @@ public class SendToFusionTables implements Runnable { int statusMessageId = R.string.error_sending_to_fusiontables; boolean success = true; try { - progressIndicator.setProgressValue(1); + progressIndicator.setProgressValue(PROGRESS_INITIALIZATION); progressIndicator.setProgressMessage(R.string.progress_message_reading_track); // Get the track meta-data @@ -149,25 +175,30 @@ public class SendToFusionTables implements Runnable { String originalDescription = track.getDescription(); // Create a new table: + progressIndicator.setProgressValue(PROGRESS_FUSION_TABLE_CREATE); progressIndicator.setProgressMessage(R.string.progress_message_creating_fusiontable); - success = createNewTable(track); - - if (success) { - success = makeTableUnlisted(tableId); + if (!createNewTable(track) || !makeTableUnlisted(tableId)) { + return; } + progressIndicator.setProgressValue(PROGRESS_UPLOAD_DATA_MIN); + progressIndicator.setProgressMessage(R.string.progress_message_sending_fusiontables); + // Upload all of the segments of the track plus start/end markers - if (success) { - success = uploadAllTrackPoints(track, originalDescription); + if (!uploadAllTrackPoints(track, originalDescription)) { + return; } + + progressIndicator.setProgressValue(PROGRESS_UPLOAD_WAYPOINTS); // Upload all the waypoints. - if (success) { - success = uploadWaypoints(track); - statusMessageId = R.string.status_new_fusiontable_has_been_created; + if (!uploadWaypoints(track)) { + return; } + + statusMessageId = R.string.status_new_fusiontable_has_been_created; Log.d(MyTracksConstants.TAG, "SendToFusionTables: Done: " + success); - progressIndicator.setProgressValue(100); + progressIndicator.setProgressValue(PROGRESS_COMPLETE); } finally { final boolean finalSuccess = success; @@ -198,7 +229,7 @@ public class SendToFusionTables implements Runnable { private boolean makeTableUnlisted(String tableId) { Log.d(MyTracksConstants.TAG, "Setting visibility to unlisted."); - String query = "UPDATE TABLE " + tableId + " SET VISIBILITY = unlisted"; + String query = "UPDATE TABLE " + tableId + " SET VISIBILITY = UNLISTED"; return runUpdate(query); } @@ -290,11 +321,10 @@ public class SendToFusionTables implements Runnable { DoubleBuffer elevationBuffer = new DoubleBuffer(MyTracksConstants.ELEVATION_SMOOTHING_FACTOR); List locations = new ArrayList(MAX_POINTS_PER_UPLOAD); - progressIndicator.setProgressMessage(R.string.progress_message_reading_track); Location lastLocation = null; do { if (totalLocationsRead % 100 == 0) { - updateProgress(); + updateTrackDataUploadProgress(); } Location loc = providerUtils.createLocation(locationsCursor); @@ -406,8 +436,7 @@ public class SendToFusionTables implements Runnable { } private boolean prepareAndUploadPoints(Track track, List locations) { - progressIndicator.setProgressMessage(R.string.progress_message_preparing_track); - updateProgress(); + updateTrackDataUploadProgress(); int numLocations = locations.size(); if (numLocations < 2) { @@ -420,7 +449,6 @@ public class SendToFusionTables implements Runnable { ArrayList splitTracks = prepareLocations(track, locations); // Start uploading them - progressIndicator.setProgressMessage(R.string.progress_message_sending_fusiontables); for (Track splitTrack : splitTracks) { if (totalSegmentsUploaded > 1) { splitTrack.setName(splitTrack.getName() + " " @@ -444,7 +472,7 @@ public class SendToFusionTables implements Runnable { locations.clear(); totalLocationsUploaded += numLocations; - updateProgress(); + updateTrackDataUploadProgress(); return true; } @@ -473,7 +501,7 @@ public class SendToFusionTables implements Runnable { boolean startNewTrackSegment = false; for (Location loc : locations) { if (totalLocationsPrepared % 100 == 0) { - updateProgress(); + updateTrackDataUploadProgress(); } if (loc.getLatitude() > 90) { startNewTrackSegment = true; @@ -596,17 +624,18 @@ public class SendToFusionTables implements Runnable { } } - /** - * Sets the current upload progress. - */ - private void updateProgress() { + private void updateTrackDataUploadProgress() { // The percent of the total that represents the completed part of this - // segment. - int totalPercentage = + // segment. We calculate it as an absolute percentage, and then scale it + // to fit the completion percentage range alloted to track data upload. + double totalPercentage = (totalLocationsRead + totalLocationsPrepared + totalLocationsUploaded) / (totalLocations * 3); - totalPercentage = Math.min(99, totalPercentage); - progressIndicator.setProgressValue(totalPercentage); + + double scaledPercentage = totalPercentage + * (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN; + + progressIndicator.setProgressValue((int) scaledPercentage); } /** diff --git a/MyTracks/src/com/google/android/apps/mytracks/util/ApiFeatures.java b/MyTracks/src/com/google/android/apps/mytracks/util/ApiFeatures.java index 0bdec6e81..c6dd60c75 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/util/ApiFeatures.java +++ b/MyTracks/src/com/google/android/apps/mytracks/util/ApiFeatures.java @@ -33,12 +33,7 @@ public class ApiFeatures { */ public static final int ANDROID_API_LEVEL = Integer.parseInt( Build.VERSION.SDK); - - private static final String PLATFORM_ADAPTER_GINGERBREAD = - "com.google.android.apps.mytracks.util.GingerbreadPlatformAdapter"; - private static final String PLATFORM_ADAPTER_ECLAIR = - "com.google.android.apps.mytracks.util.EclairPlatformAdapter"; - + private static ApiFeatures instance; /** @@ -67,30 +62,18 @@ public class ApiFeatures { * Allow subclasses for mocking, but no direct instantiation. */ protected ApiFeatures() { + // It is safe to import unsupported classes as long as we only actually + // load the class when supported. if (getApiLevel() >= 9) { - apiPlatformAdapter = createPlatformAdapter(PLATFORM_ADAPTER_GINGERBREAD); + apiPlatformAdapter = new GingerbreadPlatformAdapter(); } else if (getApiLevel() >= 5) { - apiPlatformAdapter = createPlatformAdapter(PLATFORM_ADAPTER_ECLAIR); + apiPlatformAdapter = new EclairPlatformAdapter(); } else { - // Cupcake adapter is always supported, so it's safe to do static linkage. apiPlatformAdapter = new CupcakePlatformAdapter(); } - + Log.i(MyTracksConstants.TAG, "Using platform adapter " + apiPlatformAdapter.getClass()); } - - private static ApiPlatformAdapter createPlatformAdapter(String className) { - try { - Class clazz = Class.forName(className); - return (ApiPlatformAdapter) clazz.newInstance(); - } catch (ClassNotFoundException e) { - throw new RuntimeException("ApiFeatures: Unable to find " + className, e); - } catch (InstantiationException e) { - throw new RuntimeException("ApiFeatures: Unable to instantiate " + className, e); - } catch (IllegalAccessException e) { - throw new RuntimeException("ApiFeatures: Unable to access " + className, e); - } - } public ApiPlatformAdapter getApiPlatformAdapter() { return apiPlatformAdapter; diff --git a/MyTracksTest/.factorypath b/MyTracksTest/.factorypath index fefa9e647..37f943be0 100644 --- a/MyTracksTest/.factorypath +++ b/MyTracksTest/.factorypath @@ -1,7 +1,6 @@ - - - + +