mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 09:33:06 +02:00
merge
This commit is contained in:
@@ -112,9 +112,9 @@ limitations under the License.
|
||||
<item>3.1 miles (senyal GPS pobre)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>Sense divisió</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Inactiu</item>
|
||||
<item>100 km</item>
|
||||
<item>50 km</item>
|
||||
<item>25 km</item>
|
||||
@@ -130,8 +130,8 @@ limitations under the License.
|
||||
<item>1 min</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>No splitting</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>Inactiu</item>
|
||||
<item>100 mi</item>
|
||||
<item>50 mi</item>
|
||||
<item>25 mi</item>
|
||||
@@ -286,6 +286,8 @@ limitations under the License.
|
||||
|
||||
<array name="sensor_type_options">
|
||||
<item>Cap</item>
|
||||
<item>ANT+ Sensors</item>
|
||||
<item>SRM ANT+ Bridge</item>
|
||||
<item>Zephyr Bluetooth</item>
|
||||
</array>
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ limitations under the License.
|
||||
<item>328 Fuß</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Maximum recording distance -->
|
||||
<string-array name="max_recording_distance_options">
|
||||
<item>50 m</item>
|
||||
@@ -113,9 +112,9 @@ limitations under the License.
|
||||
<item>3,1 Meilen (sehr schlechtes GPS-Signal)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>Nicht zerteilen</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Aus</item>
|
||||
<item>100 km</item>
|
||||
<item>50 km</item>
|
||||
<item>25 km</item>
|
||||
@@ -132,7 +131,7 @@ limitations under the License.
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>Nicht zerteilen</item>
|
||||
<item>Aus</item>
|
||||
<item>100 Meilen</item>
|
||||
<item>50 Meilen</item>
|
||||
<item>25 Meilen</item>
|
||||
|
||||
@@ -15,18 +15,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Apagado</item>
|
||||
<item>1 min</item>
|
||||
<item>2 min</item>
|
||||
<item>5 min</item>
|
||||
<item>10 min</item>
|
||||
<item>15 min</item>
|
||||
<item>30 min</item>
|
||||
<item>60 min</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Minimum recording distance -->
|
||||
<string-array name="min_recording_distance_options">
|
||||
<item>1 m</item>
|
||||
@@ -112,9 +100,9 @@ limitations under the License.
|
||||
<item>3.1 miles (señal GPS débil)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>No dividir</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Apagado</item>
|
||||
<item>100 km</item>
|
||||
<item>50 km</item>
|
||||
<item>25 km</item>
|
||||
@@ -130,8 +118,8 @@ limitations under the License.
|
||||
<item>1 min</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>No dividir</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>Apagado</item>
|
||||
<item>100 mi</item>
|
||||
<item>50 mi</item>
|
||||
<item>25 mi</item>
|
||||
|
||||
@@ -15,18 +15,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Absent</item>
|
||||
<item>1 min</item>
|
||||
<item>2 min</item>
|
||||
<item>5 min</item>
|
||||
<item>10 min</item>
|
||||
<item>15 min</item>
|
||||
<item>30 min</item>
|
||||
<item>60 min</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Minimum recording distance -->
|
||||
<string-array name="min_recording_distance_options">
|
||||
<item>1 m</item>
|
||||
@@ -112,10 +100,9 @@ limitations under the License.
|
||||
<item>3.1 miles (mauvais signal GPS)</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>Pas de séparation</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Absent</item>
|
||||
<item>100 km</item>
|
||||
<item>50 km</item>
|
||||
<item>25 km</item>
|
||||
@@ -131,8 +118,8 @@ limitations under the License.
|
||||
<item>1 min</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>Pas de séparation</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>Absent</item>
|
||||
<item>100 mi</item>
|
||||
<item>50 mi</item>
|
||||
<item>25 mi</item>
|
||||
@@ -310,5 +297,5 @@ limitations under the License.
|
||||
<item>Pont SRM ANT+</item>
|
||||
<item>Bluetooth Zephyr</item>
|
||||
</array>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -15,18 +15,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Disattivato</item>
|
||||
<item>1 min</item>
|
||||
<item>2 min</item>
|
||||
<item>5 min</item>
|
||||
<item>10 min</item>
|
||||
<item>15 min</item>
|
||||
<item>30 min</item>
|
||||
<item>60 min</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Minimum recording distance -->
|
||||
<string-array name="min_recording_distance_options">
|
||||
<item>1 m</item>
|
||||
@@ -112,9 +100,9 @@ limitations under the License.
|
||||
<item>3.1 mi (segnale GPS debole)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>Non dividere</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Disattivato</item>
|
||||
<item>100 km</item>
|
||||
<item>50 km</item>
|
||||
<item>25 km</item>
|
||||
@@ -130,8 +118,8 @@ limitations under the License.
|
||||
<item>1 min</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>Non dividere</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>Disattivato</item>
|
||||
<item>100 mi</item>
|
||||
<item>50 mi</item>
|
||||
<item>25 mi</item>
|
||||
|
||||
@@ -15,19 +15,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>不使用</item>
|
||||
<item>1 分</item>
|
||||
<item>2 分</item>
|
||||
<item>5 分</item>
|
||||
<item>10 分</item>
|
||||
<item>15 分</item>
|
||||
<item>30 分</item>
|
||||
<item>60 分</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Minimum recording distance -->
|
||||
<!-- Minimum recording distance -->
|
||||
<string-array name="min_recording_distance_options">
|
||||
<item>1 m</item>
|
||||
<item>2 m</item>
|
||||
@@ -48,7 +36,6 @@ limitations under the License.
|
||||
<item>328 ft</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Maximum recording distance -->
|
||||
<string-array name="max_recording_distance_options">
|
||||
<item>50 m</item>
|
||||
@@ -68,7 +55,6 @@ limitations under the License.
|
||||
<item>3.1 mi</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Minimum recording interval -->
|
||||
<string-array name="min_recording_interval_options">
|
||||
<item>電源節約 (動的制御)</item>
|
||||
@@ -89,7 +75,6 @@ limitations under the License.
|
||||
<item>30 分</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Minimum required accuracy -->
|
||||
<string-array name="min_required_accuracy_options">
|
||||
<item>10 m (GPS信号強度良好)</item>
|
||||
@@ -115,10 +100,9 @@ limitations under the License.
|
||||
<item>3.1 mi (GPS信号強度不良)</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>分割なし</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>不使用</item>
|
||||
<item>100 km</item>
|
||||
<item>50 km</item>
|
||||
<item>25 km</item>
|
||||
@@ -134,8 +118,8 @@ limitations under the License.
|
||||
<item>1 分</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>分割なし</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>不使用</item>
|
||||
<item>100 mi</item>
|
||||
<item>50 mi</item>
|
||||
<item>25 mi</item>
|
||||
@@ -294,4 +278,5 @@ limitations under the License.
|
||||
<item>SRM ANT+ ブリッジ</item>
|
||||
<item>Zephyr Bluetooth</item>
|
||||
</array>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -15,18 +15,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Brak</item>
|
||||
<item>1 min</item>
|
||||
<item>2 min</item>
|
||||
<item>5 min</item>
|
||||
<item>10 min</item>
|
||||
<item>15 min</item>
|
||||
<item>30 min</item>
|
||||
<item>60 min</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Minimum recording distance -->
|
||||
<string-array name="min_recording_distance_options">
|
||||
<item>1 m</item>
|
||||
@@ -112,9 +100,9 @@ limitations under the License.
|
||||
<item>3.1 mili (słaby sygnał GPS)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>Brak dzielenia</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Brak</item>
|
||||
<item>100 km</item>
|
||||
<item>50 km</item>
|
||||
<item>25 km</item>
|
||||
@@ -130,8 +118,8 @@ limitations under the License.
|
||||
<item>1 min</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>Brak dzielenia</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>Brak</item>
|
||||
<item>100 mi</item>
|
||||
<item>50 mi</item>
|
||||
<item>25 mi</item>
|
||||
@@ -146,7 +134,7 @@ limitations under the License.
|
||||
<item>2 min</item>
|
||||
<item>1 min</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Auto-resume track timeout -->
|
||||
<string-array name="auto_resume_track_timeout_options">
|
||||
<item>Nigdy</item>
|
||||
|
||||
@@ -15,21 +15,8 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task frequency -->
|
||||
<array name="task_frequency_options">
|
||||
<item>Desligado</item>
|
||||
<item>1 min</item>
|
||||
<item>2 min</item>
|
||||
<item>5 min</item>
|
||||
<item>10 min</item>
|
||||
<item>15 min</item>
|
||||
<item>30 min</item>
|
||||
<item>60 min</item>
|
||||
</array>
|
||||
|
||||
|
||||
<!-- Minimum recording distance -->
|
||||
<array name="min_recording_distance_options">
|
||||
<string-array name="min_recording_distance_options">
|
||||
<item>1 m</item>
|
||||
<item>2 m</item>
|
||||
<item>3 m</item>
|
||||
@@ -37,9 +24,9 @@ limitations under the License.
|
||||
<item>5 m (recomendada)</item>
|
||||
<item>10 m</item>
|
||||
<item>100 m</item>
|
||||
</array>
|
||||
</string-array>
|
||||
|
||||
<array name="min_recording_distance_options_ft">
|
||||
<string-array name="min_recording_distance_options_ft">
|
||||
<item>3 pés</item>
|
||||
<item>6 pés</item>
|
||||
<item>10 pés</item>
|
||||
@@ -47,31 +34,29 @@ limitations under the License.
|
||||
<item>16 pés (recomendado)</item>
|
||||
<item>33 pés</item>
|
||||
<item>328 pés</item>
|
||||
</array>
|
||||
|
||||
</string-array>
|
||||
|
||||
<!-- Maximum recording distance -->
|
||||
<array name="max_recording_distance_options">
|
||||
<string-array name="max_recording_distance_options">
|
||||
<item>50 m</item>
|
||||
<item>100 m</item>
|
||||
<item>200 m (recomendado)</item>
|
||||
<item>500 m</item>
|
||||
<item>1000 m</item>
|
||||
<item>5000 m</item>
|
||||
</array>
|
||||
</string-array>
|
||||
|
||||
<array name="max_recording_distance_options_ft">
|
||||
<string-array name="max_recording_distance_options_ft">
|
||||
<item>164 pés</item>
|
||||
<item>328 pés</item>
|
||||
<item>656 pés (recomendado)</item>
|
||||
<item>1640 pés</item>
|
||||
<item>0.6 milhas</item>
|
||||
<item>3.1 milhas</item>
|
||||
</array>
|
||||
|
||||
</string-array>
|
||||
|
||||
<!-- Minimum recording interval -->
|
||||
<array name="min_recording_interval_options">
|
||||
<string-array name="min_recording_interval_options">
|
||||
<item>economia de bateria (adaptativo)</item>
|
||||
<item>alta precisão (adaptativo)</item>
|
||||
<item>máxima (recomendada)</item>
|
||||
@@ -88,11 +73,10 @@ limitations under the License.
|
||||
<item>10 min</item>
|
||||
<item>15 min</item>
|
||||
<item>30 min</item>
|
||||
</array>
|
||||
|
||||
</string-array>
|
||||
|
||||
<!-- Minimum required accuracy -->
|
||||
<array name="min_required_accuracy_options">
|
||||
<string-array name="min_required_accuracy_options">
|
||||
<item>10 m (sinal de GPS excelente)</item>
|
||||
<item>20 m</item>
|
||||
<item>50 m</item>
|
||||
@@ -102,9 +86,9 @@ limitations under the License.
|
||||
<item>1000 m</item>
|
||||
<item>2000 m</item>
|
||||
<item>5000 m (sinal de GPS ruim)</item>
|
||||
</array>
|
||||
</string-array>
|
||||
|
||||
<array name="min_required_accuracy_options_ft">
|
||||
<string-array name="min_required_accuracy_options_ft">
|
||||
<item>33 pés (sinal de GPS excelente)</item>
|
||||
<item>66 pés</item>
|
||||
<item>165 pés</item>
|
||||
@@ -114,12 +98,11 @@ limitations under the License.
|
||||
<item>0.6 milhas</item>
|
||||
<item>1.2 milhas</item>
|
||||
<item>3.1 milhas (sinal de GPS ruim)</item>
|
||||
</array>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>Sem divisões</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Desligado</item>
|
||||
<item>100 km</item>
|
||||
<item>50 km</item>
|
||||
<item>25 km</item>
|
||||
@@ -135,8 +118,8 @@ limitations under the License.
|
||||
<item>1 min</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>Sem divisões</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>Desligado</item>
|
||||
<item>100 mi</item>
|
||||
<item>50 mi</item>
|
||||
<item>25 mi</item>
|
||||
|
||||
@@ -15,31 +15,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Выкл.</item>
|
||||
<item>1 мин</item>
|
||||
<item>2 мин</item>
|
||||
<item>5 мин</item>
|
||||
<item>10 мин</item>
|
||||
<item>15 мин</item>
|
||||
<item>30 мин</item>
|
||||
<item>60 мин</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="task_frequency_values">
|
||||
<item>-1</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>15</item>
|
||||
<item>30</item>
|
||||
<item>60</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Minimum recording distance -->
|
||||
<string-array name="min_recording_distance_options">
|
||||
<item>1 м</item>
|
||||
@@ -61,18 +36,6 @@ limitations under the License.
|
||||
<item>328 футов</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="min_recording_distance_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>100</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Maximum recording distance -->
|
||||
<string-array name="max_recording_distance_options">
|
||||
<item>50 м</item>
|
||||
@@ -92,17 +55,6 @@ limitations under the License.
|
||||
<item>3,1 мили</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="max_recording_distance_values">
|
||||
<item>50</item>
|
||||
<item>100</item>
|
||||
<item>200</item>
|
||||
<item>500</item>
|
||||
<item>1000</item>
|
||||
<item>5000</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Minimum recording interval -->
|
||||
<string-array name="min_recording_interval_options">
|
||||
<item>экономия батареи (адаптивная)</item>
|
||||
@@ -123,27 +75,6 @@ limitations under the License.
|
||||
<item>30 мин</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="min_recording_interval_values">
|
||||
<item>-2</item>
|
||||
<item>-1</item>
|
||||
<item>0</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>20</item>
|
||||
<item>30</item>
|
||||
<item>60</item>
|
||||
<item>120</item>
|
||||
<item>300</item>
|
||||
<item>480</item>
|
||||
<item>900</item>
|
||||
<item>1800</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Minimum required accuracy -->
|
||||
<string-array name="min_required_accuracy_options">
|
||||
<item>10 м (отличный сигнал GPS)</item>
|
||||
@@ -169,23 +100,9 @@ limitations under the License.
|
||||
<item>3,1 мили (плохой сигнал GPS)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="min_required_accuracy_values">
|
||||
<item>10</item>
|
||||
<item>20</item>
|
||||
<item>50</item>
|
||||
<item>100</item>
|
||||
<item>200</item>
|
||||
<item>500</item>
|
||||
<item>1000</item>
|
||||
<item>2000</item>
|
||||
<item>5000</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>Без делений</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Выкл.</item>
|
||||
<item>100 км</item>
|
||||
<item>50 км</item>
|
||||
<item>25 км</item>
|
||||
@@ -201,8 +118,8 @@ limitations under the License.
|
||||
<item>1 мин</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>Без делений</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>Выкл.</item>
|
||||
<item>100 миль</item>
|
||||
<item>50 миль</item>
|
||||
<item>25 миль</item>
|
||||
@@ -218,24 +135,6 @@ limitations under the License.
|
||||
<item>1 мин</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="split_frequency_values">
|
||||
<item>0</item>
|
||||
<item>-100</item>
|
||||
<item>-50</item>
|
||||
<item>-25</item>
|
||||
<item>-10</item>
|
||||
<item>-5</item>
|
||||
<item>-1</item>
|
||||
<item>60</item>
|
||||
<item>30</item>
|
||||
<item>15</item>
|
||||
<item>10</item>
|
||||
<item>5</item>
|
||||
<item>2</item>
|
||||
<item>1</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Auto-resume track timeout -->
|
||||
<string-array name="auto_resume_track_timeout_options">
|
||||
<item>Никогда</item>
|
||||
@@ -245,22 +144,12 @@ limitations under the License.
|
||||
<item>Всегда</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="auto_resume_track_timeout_values">
|
||||
<item>0</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>15</item>
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Other non-preference arrays -->
|
||||
<array name="activity_types">
|
||||
<item>не определен</item>
|
||||
<item>смешанного типа</item>
|
||||
<item>другое</item>
|
||||
|
||||
|
||||
<item>бег</item>
|
||||
<item>бег по улице</item>
|
||||
<item>бег по треку</item>
|
||||
@@ -271,7 +160,7 @@ limitations under the License.
|
||||
<item>прогулка по туристической тропе</item>
|
||||
<item>прогулка по бездорожью</item>
|
||||
<item>восхождение</item>
|
||||
|
||||
|
||||
<item>велосипедная прогулка</item>
|
||||
<item>шоссейный велосипед</item>
|
||||
<item>горный велосипед</item>
|
||||
@@ -383,14 +272,6 @@ limitations under the License.
|
||||
<item>путевая точка</item>
|
||||
</array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<array name="export_formats">
|
||||
<item>GPX</item>
|
||||
<item>KML</item>
|
||||
<item>CSV</item>
|
||||
<item>TCX</item>
|
||||
</array>
|
||||
|
||||
<array name="sensor_type_options">
|
||||
<item>Нет</item>
|
||||
<item>ANT+ Sensors</item>
|
||||
@@ -398,18 +279,4 @@ limitations under the License.
|
||||
<item>Zephyr Bluetooth</item>
|
||||
</array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<array name="sensor_type_values">
|
||||
<item>@string/none</item>
|
||||
<item>@string/ant_sensor_type</item>
|
||||
<item>@string/srm_ant_bridge_sensor_type</item>
|
||||
<item>@string/zephyr_sensor_type</item>
|
||||
</array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="ant_sensor_type_values">
|
||||
<item>@string/ant_sensor_type</item>
|
||||
<item>@string/srm_ant_bridge_sensor_type</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -15,18 +15,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Av</item>
|
||||
<item>1 min</item>
|
||||
<item>2 min</item>
|
||||
<item>5 min</item>
|
||||
<item>10 min</item>
|
||||
<item>15 min</item>
|
||||
<item>30 min</item>
|
||||
<item>60 min</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Minimum recording distance -->
|
||||
<string-array name="min_recording_distance_options">
|
||||
<item>1 m</item>
|
||||
@@ -67,7 +55,6 @@ limitations under the License.
|
||||
<item>3.1 miles</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Minimum recording interval -->
|
||||
<string-array name="min_recording_interval_options">
|
||||
<item>batterioptimerad (anpassningsbar)</item>
|
||||
@@ -113,9 +100,9 @@ limitations under the License.
|
||||
<item>3.1 miles (dålig GPS-signal)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>Ingen delning</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Av</item>
|
||||
<item>100 km</item>
|
||||
<item>50 km</item>
|
||||
<item>25 km</item>
|
||||
@@ -131,8 +118,8 @@ limitations under the License.
|
||||
<item>1 min</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>Ingen delning</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>Av</item>
|
||||
<item>100 mi</item>
|
||||
<item>50 mi</item>
|
||||
<item>25 mi</item>
|
||||
|
||||
@@ -15,18 +15,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>关闭</item>
|
||||
<item>1 分钟</item>
|
||||
<item>2 分钟</item>
|
||||
<item>5 分钟</item>
|
||||
<item>10 分钟</item>
|
||||
<item>15 分钟</item>
|
||||
<item>30 分钟</item>
|
||||
<item>60 分钟</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Minimum recording distance -->
|
||||
<string-array name="min_recording_distance_options">
|
||||
<item>1 米</item>
|
||||
@@ -112,9 +100,9 @@ limitations under the License.
|
||||
<item>3.1 英里 (糟糕的 GPS 信号)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>不分割</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>关闭</item>
|
||||
<item>100 千米</item>
|
||||
<item>50 千米</item>
|
||||
<item>25 千米</item>
|
||||
@@ -130,8 +118,8 @@ limitations under the License.
|
||||
<item>1 分钟</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>不分割</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>关闭</item>
|
||||
<item>100 英里</item>
|
||||
<item>50 英里</item>
|
||||
<item>25 英里</item>
|
||||
@@ -155,6 +143,7 @@ limitations under the License.
|
||||
<item>15 分钟</item>
|
||||
<item>总是</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Other non-preference arrays -->
|
||||
<array name="activity_types">
|
||||
<item>未知</item>
|
||||
|
||||
@@ -15,31 +15,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Off</item>
|
||||
<item>1 min</item>
|
||||
<item>2 min</item>
|
||||
<item>5 min</item>
|
||||
<item>10 min</item>
|
||||
<item>15 min</item>
|
||||
<item>30 min</item>
|
||||
<item>60 min</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="task_frequency_values">
|
||||
<item>-1</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>15</item>
|
||||
<item>30</item>
|
||||
<item>60</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Minimum recording distance -->
|
||||
<string-array name="min_recording_distance_options">
|
||||
<item>1 m</item>
|
||||
@@ -61,18 +36,6 @@ limitations under the License.
|
||||
<item>328 ft</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="min_recording_distance_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>100</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Maximum recording distance -->
|
||||
<string-array name="max_recording_distance_options">
|
||||
<item>50 m</item>
|
||||
@@ -92,17 +55,6 @@ limitations under the License.
|
||||
<item>3.1 miles</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="max_recording_distance_values">
|
||||
<item>50</item>
|
||||
<item>100</item>
|
||||
<item>200</item>
|
||||
<item>500</item>
|
||||
<item>1000</item>
|
||||
<item>5000</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Minimum recording interval -->
|
||||
<string-array name="min_recording_interval_options">
|
||||
<item>battery miser (adaptive)</item>
|
||||
@@ -123,27 +75,6 @@ limitations under the License.
|
||||
<item>30 min</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="min_recording_interval_values">
|
||||
<item>-2</item>
|
||||
<item>-1</item>
|
||||
<item>0</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>20</item>
|
||||
<item>30</item>
|
||||
<item>60</item>
|
||||
<item>120</item>
|
||||
<item>300</item>
|
||||
<item>480</item>
|
||||
<item>900</item>
|
||||
<item>1800</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Minimum required accuracy -->
|
||||
<string-array name="min_required_accuracy_options">
|
||||
<item>10 m (excellent GPS signal)</item>
|
||||
@@ -169,23 +100,9 @@ limitations under the License.
|
||||
<item>3.1 miles (poor GPS signal)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="min_required_accuracy_values">
|
||||
<item>10</item>
|
||||
<item>20</item>
|
||||
<item>50</item>
|
||||
<item>100</item>
|
||||
<item>200</item>
|
||||
<item>500</item>
|
||||
<item>1000</item>
|
||||
<item>2000</item>
|
||||
<item>5000</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Split frequency -->
|
||||
<string-array name="split_frequency_options">
|
||||
<item>No splitting</item>
|
||||
<!-- Task frequency -->
|
||||
<string-array name="task_frequency_options">
|
||||
<item>Off</item>
|
||||
<item>100 km</item>
|
||||
<item>50 km</item>
|
||||
<item>25 km</item>
|
||||
@@ -201,8 +118,8 @@ limitations under the License.
|
||||
<item>1 min</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="split_frequency_options_ft">
|
||||
<item>No splitting</item>
|
||||
<string-array name="task_frequency_options_ft">
|
||||
<item>Off</item>
|
||||
<item>100 mi</item>
|
||||
<item>50 mi</item>
|
||||
<item>25 mi</item>
|
||||
@@ -218,24 +135,6 @@ limitations under the License.
|
||||
<item>1 min</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="split_frequency_values">
|
||||
<item>0</item>
|
||||
<item>-100</item>
|
||||
<item>-50</item>
|
||||
<item>-25</item>
|
||||
<item>-10</item>
|
||||
<item>-5</item>
|
||||
<item>-1</item>
|
||||
<item>60</item>
|
||||
<item>30</item>
|
||||
<item>15</item>
|
||||
<item>10</item>
|
||||
<item>5</item>
|
||||
<item>2</item>
|
||||
<item>1</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Auto-resume track timeout -->
|
||||
<string-array name="auto_resume_track_timeout_options">
|
||||
<item>Never</item>
|
||||
@@ -245,16 +144,6 @@ limitations under the License.
|
||||
<item>Always</item>
|
||||
</string-array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="auto_resume_track_timeout_values">
|
||||
<item>0</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>15</item>
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Other non-preference arrays -->
|
||||
<array name="activity_types">
|
||||
<item>unknown</item>
|
||||
@@ -383,14 +272,6 @@ limitations under the License.
|
||||
<item>way point</item>
|
||||
</array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<array name="export_formats">
|
||||
<item>GPX</item>
|
||||
<item>KML</item>
|
||||
<item>CSV</item>
|
||||
<item>TCX</item>
|
||||
</array>
|
||||
|
||||
<array name="sensor_type_options">
|
||||
<item>None</item>
|
||||
<item>ANT+ Sensors</item>
|
||||
@@ -398,18 +279,4 @@ limitations under the License.
|
||||
<item>Zephyr Bluetooth</item>
|
||||
</array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<array name="sensor_type_values">
|
||||
<item>@string/none</item>
|
||||
<item>@string/ant_sensor_type</item>
|
||||
<item>@string/srm_ant_bridge_sensor_type</item>
|
||||
<item>@string/zephyr_sensor_type</item>
|
||||
</array>
|
||||
|
||||
<!-- DO NOT TRANSLATE -->
|
||||
<string-array name="ant_sensor_type_values">
|
||||
<item>@string/ant_sensor_type</item>
|
||||
<item>@string/srm_ant_bridge_sensor_type</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2010 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Do not translate any arrays in this file. -->
|
||||
<string-array name="min_required_accuracy_values">
|
||||
<item>10</item>
|
||||
<item>20</item>
|
||||
<item>50</item>
|
||||
<item>100</item>
|
||||
<item>200</item>
|
||||
<item>500</item>
|
||||
<item>1000</item>
|
||||
<item>2000</item>
|
||||
<item>5000</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="min_recording_distance_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>100</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="min_recording_distance_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>100</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="max_recording_distance_values">
|
||||
<item>50</item>
|
||||
<item>100</item>
|
||||
<item>200</item>
|
||||
<item>500</item>
|
||||
<item>1000</item>
|
||||
<item>5000</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="min_recording_interval_values">
|
||||
<item>-2</item>
|
||||
<item>-1</item>
|
||||
<item>0</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>20</item>
|
||||
<item>30</item>
|
||||
<item>60</item>
|
||||
<item>120</item>
|
||||
<item>300</item>
|
||||
<item>480</item>
|
||||
<item>900</item>
|
||||
<item>1800</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="task_frequency_values">
|
||||
<item>0</item>
|
||||
<item>-100</item>
|
||||
<item>-50</item>
|
||||
<item>-25</item>
|
||||
<item>-10</item>
|
||||
<item>-5</item>
|
||||
<item>-1</item>
|
||||
<item>60</item>
|
||||
<item>30</item>
|
||||
<item>15</item>
|
||||
<item>10</item>
|
||||
<item>5</item>
|
||||
<item>2</item>
|
||||
<item>1</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="auto_resume_track_timeout_values">
|
||||
<item>0</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>15</item>
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
<array name="export_formats">
|
||||
<item>GPX</item>
|
||||
<item>KML</item>
|
||||
<item>CSV</item>
|
||||
<item>TCX</item>
|
||||
</array>
|
||||
|
||||
<array name="sensor_type_values">
|
||||
<item>@string/none</item>
|
||||
<item>@string/ant_sensor_type</item>
|
||||
<item>@string/srm_ant_bridge_sensor_type</item>
|
||||
<item>@string/zephyr_sensor_type</item>
|
||||
</array>
|
||||
|
||||
<string-array name="ant_sensor_type_values">
|
||||
<item>@string/ant_sensor_type</item>
|
||||
<item>@string/srm_ant_bridge_sensor_type</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -48,8 +48,8 @@ limitations under the License.
|
||||
android:key="@string/split_frequency_key"
|
||||
android:title="@string/settings_split_frequency"
|
||||
android:summary="@string/settings_split_frequency_summary"
|
||||
android:entries="@array/split_frequency_options"
|
||||
android:entryValues="@array/split_frequency_values"
|
||||
android:entries="@array/task_frequency_options"
|
||||
android:entryValues="@array/task_frequency_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<com.google.android.apps.mytracks.IntegerListPreference
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.google.android.apps.mytracks.content.Sensor;
|
||||
import com.google.android.apps.mytracks.content.Sensor.SensorDataSet;
|
||||
import com.google.android.apps.mytracks.content.Track;
|
||||
import com.google.android.apps.mytracks.content.Waypoint;
|
||||
import com.google.android.apps.mytracks.services.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.stats.DoubleBuffer;
|
||||
import com.google.android.apps.mytracks.stats.TripStatisticsBuilder;
|
||||
import com.google.android.apps.mytracks.util.ApiFeatures;
|
||||
|
||||
@@ -20,7 +20,7 @@ import static com.google.android.apps.mytracks.Constants.TAG;
|
||||
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
||||
import com.google.android.apps.mytracks.content.Track;
|
||||
import com.google.android.apps.mytracks.content.Waypoint;
|
||||
import com.google.android.apps.mytracks.services.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||
import com.google.android.apps.mytracks.util.ApiFeatures;
|
||||
import com.google.android.apps.mytracks.util.GeoRect;
|
||||
|
||||
@@ -42,8 +42,8 @@ import com.google.android.apps.mytracks.io.sendtogoogle.SendDialog;
|
||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendResult;
|
||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendType;
|
||||
import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
||||
import com.google.android.apps.mytracks.services.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
||||
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.util.ApiFeatures;
|
||||
import com.google.android.apps.mytracks.util.FileUtils;
|
||||
import com.google.android.apps.mytracks.util.SystemUtils;
|
||||
|
||||
@@ -19,8 +19,8 @@ import static com.google.android.apps.mytracks.Constants.TAG;
|
||||
|
||||
import com.google.android.apps.mytracks.io.backup.BackupActivityHelper;
|
||||
import com.google.android.apps.mytracks.io.backup.BackupPreferencesListener;
|
||||
import com.google.android.apps.mytracks.services.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.services.sensors.ant.AntUtils;
|
||||
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.util.ApiFeatures;
|
||||
import com.google.android.apps.mytracks.util.BluetoothDeviceUtils;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
@@ -266,9 +266,6 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
final ListPreference minRequiredAccuracy =
|
||||
(ListPreference) findPreference(
|
||||
getString(R.string.min_required_accuracy_key));
|
||||
final ListPreference splitFrequency =
|
||||
(ListPreference) findPreference(
|
||||
getString(R.string.split_frequency_key));
|
||||
|
||||
minRecordingDistance.setEntries(isMetric
|
||||
? R.array.min_recording_distance_options
|
||||
@@ -279,11 +276,20 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
minRequiredAccuracy.setEntries(isMetric
|
||||
? R.array.min_required_accuracy_options
|
||||
: R.array.min_required_accuracy_options_ft);
|
||||
splitFrequency.setEntries(isMetric
|
||||
? R.array.split_frequency_options
|
||||
: R.array.split_frequency_options_ft);
|
||||
setTaskOptions(isMetric, R.string.announcement_frequency_key);
|
||||
setTaskOptions(isMetric, R.string.split_frequency_key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user visible options for a periodic task.
|
||||
*/
|
||||
private void setTaskOptions(boolean isMetric, int listId) {
|
||||
final ListPreference taskFrequency =
|
||||
(ListPreference) findPreference(getString(listId));
|
||||
taskFrequency.setEntries(isMetric
|
||||
? R.array.task_frequency_options
|
||||
: R.array.task_frequency_options_ft);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures preference actions related to bluetooth.
|
||||
|
||||
@@ -19,7 +19,7 @@ import static com.google.android.apps.mytracks.Constants.TAG;
|
||||
|
||||
import com.google.android.apps.mytracks.content.Track;
|
||||
import com.google.android.apps.mytracks.content.Waypoint;
|
||||
import com.google.android.apps.mytracks.services.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.util.ApiFeatures;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
|
||||
@@ -610,7 +610,7 @@ public class TrackDataHub {
|
||||
if (key.equals(RECORDING_TRACK_KEY)) {
|
||||
recordingTrackId = sharedPreferences.getLong(RECORDING_TRACK_KEY, -1);
|
||||
} else if (key.equals(MIN_REQUIRED_ACCURACY_KEY)) {
|
||||
minRequiredAccuracy = sharedPreferences.getInt(RECORDING_TRACK_KEY,
|
||||
minRequiredAccuracy = sharedPreferences.getInt(MIN_REQUIRED_ACCURACY_KEY,
|
||||
Constants.DEFAULT_MIN_REQUIRED_ACCURACY);
|
||||
} else if (key.equals(METRIC_UNITS_KEY)) {
|
||||
useMetricUnits = sharedPreferences.getBoolean(METRIC_UNITS_KEY, true);
|
||||
|
||||
@@ -156,11 +156,11 @@ public class PreferenceManager implements OnSharedPreferenceChangeListener {
|
||||
}
|
||||
}
|
||||
if (key == null || key.equals(splitFrequencyKey)) {
|
||||
service.getSplitManager().setSplitFrequency(
|
||||
service.setSplitFrequency(
|
||||
sharedPreferences.getInt(splitFrequencyKey, 0));
|
||||
}
|
||||
if (key == null || key.equals(metricUnitsKey)) {
|
||||
service.getSplitManager().setMetricUnits(
|
||||
service.setMetricUnits(
|
||||
sharedPreferences.getBoolean(metricUnitsKey, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.services;
|
||||
|
||||
import com.google.android.apps.mytracks.Constants;
|
||||
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* This class manages inserting time or distance splits.
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public class SplitManager {
|
||||
|
||||
/**
|
||||
* The frequency of splits.
|
||||
*/
|
||||
private int splitFrequency = 0;
|
||||
|
||||
/**
|
||||
* The next distance when a split should be taken.
|
||||
*/
|
||||
private double nextSplitDistance = 0;
|
||||
|
||||
/**
|
||||
* Splits executer.
|
||||
*/
|
||||
private PeriodicTaskExecuter splitExecuter = null;
|
||||
|
||||
private boolean metricUnits;
|
||||
|
||||
private final TrackRecordingService service;
|
||||
|
||||
public SplitManager(TrackRecordingService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the manager.
|
||||
*/
|
||||
public void restore() {
|
||||
if ((splitFrequency > 0) && (splitExecuter != null)) {
|
||||
splitExecuter.scheduleTask(splitFrequency * 60000);
|
||||
}
|
||||
calculateNextSplit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuts down the manager.
|
||||
*/
|
||||
public void shutdown() {
|
||||
if (splitExecuter != null) {
|
||||
splitExecuter.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the next distance that a split should be inserted at.
|
||||
*/
|
||||
public void calculateNextSplit() {
|
||||
// TODO: Decouple service from this class once and forever.
|
||||
if (!service.isRecording()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (splitFrequency >= 0) {
|
||||
nextSplitDistance = Double.MAX_VALUE;
|
||||
Log.d(Constants.TAG,
|
||||
"SplitManager: Distance splits disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
double dist = service.getTripStatistics().getTotalDistance() / 1000;
|
||||
if (!metricUnits) {
|
||||
dist *= UnitConversions.KM_TO_MI;
|
||||
}
|
||||
// The index will be negative since the frequency is negative.
|
||||
int index = (int) (dist / splitFrequency);
|
||||
index -= 1;
|
||||
nextSplitDistance = splitFrequency * index;
|
||||
Log.d(Constants.TAG,
|
||||
"SplitManager: Next split distance: " + nextSplitDistance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates split manager with new trip statistics.
|
||||
*/
|
||||
public void updateSplits() {
|
||||
if (this.splitFrequency >= 0) {
|
||||
return;
|
||||
}
|
||||
// Convert the distance in meters to km or mi.
|
||||
double distance = service.getTripStatistics().getTotalDistance() / 1000.0;
|
||||
if (!metricUnits) {
|
||||
distance *= UnitConversions.KM_TO_MI;
|
||||
}
|
||||
|
||||
if (distance > this.nextSplitDistance) {
|
||||
service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS);
|
||||
calculateNextSplit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the split frequency.
|
||||
* < 0 Use the absolute value as a distance in the current measurement km
|
||||
* or mi
|
||||
* 0 Turn off splits
|
||||
* > 0 Use the value as a time in minutes
|
||||
* @param splitFrequency The frequency in time or distance
|
||||
*/
|
||||
public void setSplitFrequency(int splitFrequency) {
|
||||
Log.d(Constants.TAG,
|
||||
"setSplitFrequency: splitFrequency = " + splitFrequency);
|
||||
this.splitFrequency = splitFrequency;
|
||||
|
||||
// TODO: Decouple service from this class once and forever.
|
||||
if (!service.isRecording()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (splitFrequency < 1) {
|
||||
if (splitExecuter != null) {
|
||||
splitExecuter.shutdown();
|
||||
splitExecuter = null;
|
||||
}
|
||||
}
|
||||
if (splitFrequency > 0) {
|
||||
if (splitExecuter == null) {
|
||||
TimeSplitTask splitter = new TimeSplitTask();
|
||||
splitExecuter = new PeriodicTaskExecuter(splitter, service);
|
||||
}
|
||||
splitExecuter.scheduleTask(splitFrequency * 60000);
|
||||
} else {
|
||||
// For distance based splits.
|
||||
calculateNextSplit();
|
||||
}
|
||||
}
|
||||
|
||||
public void setMetricUnits(boolean metricUnits) {
|
||||
this.metricUnits = metricUnits;
|
||||
calculateNextSplit();
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.services;
|
||||
|
||||
import com.google.android.apps.mytracks.Constants;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* This class manages a period task executer.
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public class TaskExecuterManager {
|
||||
|
||||
private int frequency;
|
||||
private final PeriodicTask task;
|
||||
private PeriodicTaskExecuter executer;
|
||||
|
||||
public TaskExecuterManager(int frequency, PeriodicTask task,
|
||||
TrackRecordingService service) {
|
||||
this.task = task;
|
||||
setFrequency(frequency, service);
|
||||
}
|
||||
|
||||
public int getFrequency() {
|
||||
return frequency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the frequency that the task should be run at.
|
||||
* If needed the task will be scheduled.
|
||||
*
|
||||
* @param frequency The frequency in minutes for the task to run
|
||||
* @param service The service to run the task on
|
||||
*/
|
||||
public void setFrequency(int frequency, TrackRecordingService service) {
|
||||
this.frequency = frequency;
|
||||
Log.i(Constants.TAG, "Frequency set to " + frequency
|
||||
+ " for task " + task.getClass().getSimpleName());
|
||||
|
||||
if (frequency == -1) {
|
||||
if (executer != null) {
|
||||
executer.shutdown();
|
||||
executer = null;
|
||||
Log.i(Constants.TAG,
|
||||
"Shut down service: " + task.getClass().getSimpleName());
|
||||
}
|
||||
} else {
|
||||
if (executer == null) {
|
||||
executer = new PeriodicTaskExecuter(task, service);
|
||||
}
|
||||
executer.scheduleTask(frequency * 60000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the task at the current frequency.
|
||||
*/
|
||||
public void restore() {
|
||||
if (frequency > 0) {
|
||||
executer.scheduleTask(frequency * 60000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuts down this executer.
|
||||
*/
|
||||
public void shutdown() {
|
||||
if (executer != null) {
|
||||
executer.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,9 @@ import com.google.android.apps.mytracks.content.WaypointsColumns;
|
||||
import com.google.android.apps.mytracks.content.Sensor.SensorDataSet;
|
||||
import com.google.android.apps.mytracks.services.sensors.SensorManager;
|
||||
import com.google.android.apps.mytracks.services.sensors.SensorManagerFactory;
|
||||
import com.google.android.apps.mytracks.services.tasks.PeriodicTaskExecutor;
|
||||
import com.google.android.apps.mytracks.services.tasks.SplitTask;
|
||||
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||
import com.google.android.apps.mytracks.stats.TripStatisticsBuilder;
|
||||
import com.google.android.apps.mytracks.util.ApiFeatures;
|
||||
@@ -111,10 +114,10 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
private double length;
|
||||
|
||||
/**
|
||||
* Status announcer executer.
|
||||
* Status announcer executor.
|
||||
*/
|
||||
private PeriodicTaskExecuter announcementExecuter;
|
||||
private SplitManager splitManager;
|
||||
private PeriodicTaskExecutor announcementExecutor;
|
||||
private PeriodicTaskExecutor splitExecutor;
|
||||
|
||||
private SensorManager sensorManager;
|
||||
|
||||
@@ -185,11 +188,9 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
private Location lastValidLocation;
|
||||
|
||||
/**
|
||||
* The frequency of status announcements.
|
||||
* A service to run tasks outside of the main thread.
|
||||
*/
|
||||
private int announcementFrequency = -1;
|
||||
|
||||
private ExecutorService executerServce;
|
||||
private ExecutorService executorService;
|
||||
|
||||
/*
|
||||
* Utility functions
|
||||
@@ -273,7 +274,8 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
"Caught SQLiteException: " + e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
splitManager.updateSplits();
|
||||
announcementExecutor.update();
|
||||
splitExecutor.update();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -425,9 +427,7 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
TripStatistics stats = track.getStatistics();
|
||||
statsBuilder = new TripStatisticsBuilder(stats.getStartTime());
|
||||
statsBuilder.setMinRecordingDistance(minRecordingDistance);
|
||||
setUpAnnouncer();
|
||||
|
||||
splitManager.restore();
|
||||
length = 0;
|
||||
lastValidLocation = null;
|
||||
|
||||
@@ -475,7 +475,8 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
}
|
||||
}
|
||||
|
||||
splitManager.calculateNextSplit();
|
||||
announcementExecutor.restore();
|
||||
splitExecutor.restore();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -483,7 +484,7 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
*/
|
||||
@Override
|
||||
public void onLocationChanged(final Location location) {
|
||||
this.executerServce.submit(
|
||||
executorService.submit(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -662,8 +663,8 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
notificationManager =
|
||||
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
|
||||
splitManager = new SplitManager(this);
|
||||
|
||||
setUpTaskExecutors();
|
||||
prefManager = new PreferenceManager(this);
|
||||
registerLocationListener();
|
||||
|
||||
@@ -688,49 +689,29 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
prefManager.setRecordingTrack(recordingTrackId = -1);
|
||||
}
|
||||
showNotification();
|
||||
executerServce = Executors.newSingleThreadExecutor();
|
||||
executorService = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an {@link Executer} and schedules {@class SafeStatusAnnouncerTask}.
|
||||
* The announcer requires a TTS service and user should have enabled
|
||||
* the announcements, otherwise this method is no-op.
|
||||
* Creates the periodic task executors.
|
||||
*/
|
||||
private void setUpAnnouncer() {
|
||||
Log.d(TAG, "TrackRecordingService.setUpAnnouncer: "
|
||||
+ announcementExecuter);
|
||||
if (announcementFrequency != -1 && recordingTrackId != -1) {
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (announcementExecuter == null) {
|
||||
StatusAnnouncerFactory statusAnnouncerFactory =
|
||||
new StatusAnnouncerFactory(ApiFeatures.getInstance());
|
||||
PeriodicTask announcer = statusAnnouncerFactory.create(
|
||||
TrackRecordingService.this);
|
||||
if (announcer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Either use TaskExecuterManager everywhere, or get rid of it
|
||||
announcementExecuter = new PeriodicTaskExecuter(announcer,
|
||||
TrackRecordingService.this);
|
||||
}
|
||||
announcementExecuter.scheduleTask(announcementFrequency * 60000);
|
||||
}
|
||||
});
|
||||
}
|
||||
private void setUpTaskExecutors() {
|
||||
announcementExecutor = new PeriodicTaskExecutor(
|
||||
this, new StatusAnnouncerFactory(ApiFeatures.getInstance()));
|
||||
splitExecutor = new PeriodicTaskExecutor(this, new SplitTask.Factory());
|
||||
}
|
||||
|
||||
private void shutdownAnnouncer() {
|
||||
Log.d(TAG, "TrackRecordingService.shutdownAnnouncer: "
|
||||
+ announcementExecuter);
|
||||
if (announcementExecuter != null) {
|
||||
try {
|
||||
announcementExecuter.shutdown();
|
||||
} finally {
|
||||
announcementExecuter = null;
|
||||
}
|
||||
private void shutdownTaskExecutors() {
|
||||
Log.d(TAG, "TrackRecordingService.shutdownExecuters");
|
||||
try {
|
||||
announcementExecutor.shutdown();
|
||||
} finally {
|
||||
announcementExecutor = null;
|
||||
}
|
||||
try {
|
||||
splitExecutor.shutdown();
|
||||
} finally {
|
||||
splitExecutor = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,9 +728,7 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
timer.cancel();
|
||||
timer.purge();
|
||||
unregisterLocationListener();
|
||||
shutdownAnnouncer();
|
||||
splitManager.shutdown();
|
||||
splitManager = null;
|
||||
shutdownTaskExecutors();
|
||||
if (sensorManager != null) {
|
||||
sensorManager.shutdown();
|
||||
sensorManager = null;
|
||||
@@ -1104,11 +1083,9 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
waypointStatsBuilder = new TripStatisticsBuilder(startTime);
|
||||
waypointStatsBuilder.setMinRecordingDistance(minRecordingDistance);
|
||||
currentWaypointId = insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS);
|
||||
setUpAnnouncer();
|
||||
length = 0;
|
||||
showNotification();
|
||||
registerLocationListener();
|
||||
splitManager.restore();
|
||||
sensorManager = SensorManagerFactory.getSensorManager(this);
|
||||
if (sensorManager != null) {
|
||||
sensorManager.onStartTrack();
|
||||
@@ -1123,6 +1100,8 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
// Notify the world that we're now recording.
|
||||
sendTrackBroadcast(
|
||||
R.string.track_started_broadcast_action, recordingTrackId);
|
||||
announcementExecutor.restore();
|
||||
splitExecutor.restore();
|
||||
|
||||
return recordingTrackId;
|
||||
}
|
||||
@@ -1133,7 +1112,8 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
throw new IllegalStateException("No recording track in progress!");
|
||||
}
|
||||
|
||||
shutdownAnnouncer();
|
||||
announcementExecutor.shutdown();
|
||||
splitExecutor.shutdown();
|
||||
isRecording = false;
|
||||
Track recordingTrack = providerUtils.getTrack(recordingTrackId);
|
||||
if (recordingTrack != null) {
|
||||
@@ -1193,19 +1173,6 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
this.recordingTrackId = recordingTrackId;
|
||||
}
|
||||
|
||||
public int getAnnouncementFrequency() {
|
||||
return announcementFrequency;
|
||||
}
|
||||
|
||||
public void setAnnouncementFrequency(int announcementFrequency) {
|
||||
this.announcementFrequency = announcementFrequency;
|
||||
if (announcementFrequency == -1) {
|
||||
shutdownAnnouncer();
|
||||
} else {
|
||||
setUpAnnouncer();
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxRecordingDistance() {
|
||||
return maxRecordingDistance;
|
||||
}
|
||||
@@ -1251,7 +1218,16 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
this.autoResumeTrackTimeout = autoResumeTrackTimeout;
|
||||
}
|
||||
|
||||
public SplitManager getSplitManager() {
|
||||
return splitManager;
|
||||
public void setAnnouncementFrequency(int announcementFrequency) {
|
||||
announcementExecutor.setTaskFrequency(announcementFrequency);
|
||||
}
|
||||
|
||||
public void setSplitFrequency(int frequency) {
|
||||
splitExecutor.setTaskFrequency(frequency);
|
||||
}
|
||||
|
||||
public void setMetricUnits(boolean metric) {
|
||||
announcementExecutor.setMetricUnits(metric);
|
||||
splitExecutor.setMetricUnits(metric);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -14,7 +14,7 @@
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.services;
|
||||
package com.google.android.apps.mytracks.services.tasks;
|
||||
|
||||
import static com.google.android.apps.mytracks.Constants.TAG;
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.util.Log;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* This class will periodically announce the user's trip statistics for Froyo and future handsets.
|
||||
* This class will request and release audio focus.
|
||||
+3
-1
@@ -14,7 +14,9 @@
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.services;
|
||||
package com.google.android.apps.mytracks.services.tasks;
|
||||
|
||||
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
||||
|
||||
/**
|
||||
* This is interface for a task that will be executed on some schedule.
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.services.tasks;
|
||||
|
||||
import static com.google.android.apps.mytracks.Constants.TAG;
|
||||
|
||||
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Execute a task on a time or distance schedule.
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public class PeriodicTaskExecutor {
|
||||
|
||||
/**
|
||||
* The frequency of the task.
|
||||
* A value greater than zero is a frequency in time.
|
||||
* A value less than zero is considered a frequency in distance.
|
||||
*/
|
||||
private int taskFrequency = 0;
|
||||
|
||||
/**
|
||||
* The next distance when the task should execute.
|
||||
*/
|
||||
private double nextTaskDistance = 0;
|
||||
|
||||
/**
|
||||
* Time based executor.
|
||||
*/
|
||||
private TimerTaskExecutor timerExecutor = null;
|
||||
|
||||
private boolean metricUnits;
|
||||
|
||||
private final TrackRecordingService service;
|
||||
|
||||
private final PeriodicTaskFactory factory;
|
||||
|
||||
private PeriodicTask task;
|
||||
|
||||
public PeriodicTaskExecutor(TrackRecordingService service, PeriodicTaskFactory factory) {
|
||||
this.service = service;
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the manager.
|
||||
*/
|
||||
public void restore() {
|
||||
// TODO: Decouple service from this class once and forever.
|
||||
if (!service.isRecording()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isTimeFrequency()) {
|
||||
if (timerExecutor != null) {
|
||||
timerExecutor.shutdown();
|
||||
timerExecutor = null;
|
||||
}
|
||||
}
|
||||
if (taskFrequency == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to make the task.
|
||||
task = factory.create(service);
|
||||
// Returning null is ok.
|
||||
if (task == null) {
|
||||
return;
|
||||
}
|
||||
task.start();
|
||||
|
||||
if (isTimeFrequency()) {
|
||||
if (timerExecutor == null) {
|
||||
timerExecutor = new TimerTaskExecutor(task, service);
|
||||
}
|
||||
timerExecutor.scheduleTask(taskFrequency * 60000);
|
||||
} else {
|
||||
// For distance based splits.
|
||||
calculateNextTaskDistance();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuts down the manager.
|
||||
*/
|
||||
public void shutdown() {
|
||||
if (task != null) {
|
||||
task.shutdown();
|
||||
task = null;
|
||||
}
|
||||
if (timerExecutor != null) {
|
||||
timerExecutor.shutdown();
|
||||
timerExecutor = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the next distance when the task should execute.
|
||||
*/
|
||||
void calculateNextTaskDistance() {
|
||||
// TODO: Decouple service from this class once and forever.
|
||||
if (!service.isRecording() || task == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDistanceFrequency()) {
|
||||
nextTaskDistance = Double.MAX_VALUE;
|
||||
Log.d(TAG, "SplitManager: Distance splits disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
double distance = service.getTripStatistics().getTotalDistance() / 1000;
|
||||
if (!metricUnits) {
|
||||
distance *= UnitConversions.KM_TO_MI;
|
||||
}
|
||||
// The index will be negative since the frequency is negative.
|
||||
int index = (int) (distance / taskFrequency);
|
||||
index -= 1;
|
||||
nextTaskDistance = taskFrequency * index;
|
||||
Log.d(TAG, "SplitManager: Next split distance: " + nextTaskDistance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates executer with new trip statistics.
|
||||
*/
|
||||
public void update() {
|
||||
if (!isDistanceFrequency() || task == null) {
|
||||
return;
|
||||
}
|
||||
// Convert the distance in meters to km or mi.
|
||||
double distance = service.getTripStatistics().getTotalDistance() / 1000.0;
|
||||
if (!metricUnits) {
|
||||
distance *= UnitConversions.KM_TO_MI;
|
||||
}
|
||||
|
||||
if (distance > nextTaskDistance) {
|
||||
task.run(service);
|
||||
calculateNextTaskDistance();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTimeFrequency() {
|
||||
return taskFrequency > 0;
|
||||
}
|
||||
|
||||
private boolean isDistanceFrequency() {
|
||||
return taskFrequency < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the task frequency.
|
||||
* < 0 Use the absolute value as a distance in the current measurement km
|
||||
* or mi
|
||||
* 0 Turn off the task
|
||||
* > 0 Use the value as a time in minutes
|
||||
* @param taskFrequency The frequency in time or distance
|
||||
*/
|
||||
public void setTaskFrequency(int taskFrequency) {
|
||||
Log.d(TAG, "setTaskFrequency: taskFrequency = " + taskFrequency);
|
||||
this.taskFrequency = taskFrequency;
|
||||
restore();
|
||||
}
|
||||
|
||||
public void setMetricUnits(boolean metricUnits) {
|
||||
this.metricUnits = metricUnits;
|
||||
calculateNextTaskDistance();
|
||||
}
|
||||
|
||||
double getNextTaskDistance() {
|
||||
return nextTaskDistance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.services.tasks;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* An interface for classes that can create periodic tasks.
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public interface PeriodicTaskFactory {
|
||||
|
||||
/**
|
||||
* Creates a periodic task which does voice announcements.
|
||||
*
|
||||
* @return the task, or null if task is not supported
|
||||
*/
|
||||
PeriodicTask create(Context context);
|
||||
}
|
||||
+20
-3
@@ -14,16 +14,22 @@
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.services;
|
||||
package com.google.android.apps.mytracks.services.tasks;
|
||||
|
||||
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
||||
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
/**
|
||||
* A simple task to insert statistics markers every n minutes.
|
||||
* A simple task to insert statistics markers periodically.
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public class TimeSplitTask implements PeriodicTask {
|
||||
public class SplitTask implements PeriodicTask {
|
||||
|
||||
private SplitTask() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(TrackRecordingService service) {
|
||||
@@ -37,4 +43,15 @@ public class TimeSplitTask implements PeriodicTask {
|
||||
@Override
|
||||
public void start() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new SplitTasks.
|
||||
*/
|
||||
public static class Factory implements PeriodicTaskFactory {
|
||||
|
||||
@Override
|
||||
public PeriodicTask create(Context context) {
|
||||
return new SplitTask();
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-7
@@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.services;
|
||||
package com.google.android.apps.mytracks.services.tasks;
|
||||
|
||||
import com.google.android.apps.mytracks.util.ApiFeatures;
|
||||
|
||||
@@ -26,7 +26,7 @@ import android.media.AudioManager;
|
||||
*
|
||||
* @author Rodrigo Damazio
|
||||
*/
|
||||
public class StatusAnnouncerFactory {
|
||||
public class StatusAnnouncerFactory implements PeriodicTaskFactory {
|
||||
|
||||
private final boolean hasTts;
|
||||
|
||||
@@ -34,11 +34,7 @@ public class StatusAnnouncerFactory {
|
||||
this.hasTts = apiFeatures.hasTextToSpeech();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a periodic task which does voice announcements.
|
||||
*
|
||||
* @return the task, or null if announcements are not supported
|
||||
*/
|
||||
@Override
|
||||
public PeriodicTask create(Context context) {
|
||||
if (hasTts) {
|
||||
if (ApiFeatures.getInstance().isAudioFocusSupported()) {
|
||||
+4
-2
@@ -14,11 +14,12 @@
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.services;
|
||||
package com.google.android.apps.mytracks.services.tasks;
|
||||
|
||||
import static com.google.android.apps.mytracks.Constants.TAG;
|
||||
|
||||
import com.google.android.apps.mytracks.Constants;
|
||||
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||
import com.google.android.apps.mytracks.util.StringUtils;
|
||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||
@@ -101,7 +102,8 @@ public class StatusAnnouncerTask implements PeriodicTask {
|
||||
*/
|
||||
protected void onTtsInit(int status) {
|
||||
Log.i(TAG, "TrackRecordingService.TTS init: " + status);
|
||||
this.ready = status == TextToSpeech.SUCCESS;
|
||||
// TTS should be valid here but NPE exceptions were reported to the market.
|
||||
this.ready = status == TextToSpeech.SUCCESS && tts != null;
|
||||
|
||||
if (ready) {
|
||||
// Force the language to be the same as the string we will be speaking,
|
||||
+10
-10
@@ -14,9 +14,9 @@
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.services;
|
||||
package com.google.android.apps.mytracks.services.tasks;
|
||||
|
||||
import com.google.android.apps.mytracks.Constants;
|
||||
import static com.google.android.apps.mytracks.Constants.TAG;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
@@ -24,12 +24,14 @@ import java.util.Date;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import com.google.android.apps.mytracks.services.TrackRecordingService;
|
||||
|
||||
/**
|
||||
* This class will periodically announce the user's trip statistics.
|
||||
* This class will periodically perform a task.
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public class PeriodicTaskExecuter {
|
||||
public class TimerTaskExecutor {
|
||||
|
||||
private final PeriodicTask task;
|
||||
private final TrackRecordingService service;
|
||||
@@ -40,8 +42,8 @@ public class PeriodicTaskExecuter {
|
||||
*/
|
||||
private Timer timer;
|
||||
|
||||
public PeriodicTaskExecuter(PeriodicTask task,
|
||||
TrackRecordingService service) {
|
||||
public TimerTaskExecutor(PeriodicTask task,
|
||||
TrackRecordingService service) {
|
||||
this.task = task;
|
||||
this.service = service;
|
||||
}
|
||||
@@ -77,8 +79,7 @@ public class PeriodicTaskExecuter {
|
||||
}
|
||||
|
||||
Date start = new Date(next);
|
||||
Log.i(Constants.TAG,
|
||||
task.getClass().getSimpleName() + " scheduled to start at " + start
|
||||
Log.i(TAG, task.getClass().getSimpleName() + " scheduled to start at " + start
|
||||
+ " every " + interval + " milliseconds.");
|
||||
timer.scheduleAtFixedRate(new PeriodicTimerTask(), start, interval);
|
||||
}
|
||||
@@ -87,8 +88,7 @@ public class PeriodicTaskExecuter {
|
||||
* Cleans up this object.
|
||||
*/
|
||||
public void shutdown() {
|
||||
Log.i(Constants.TAG,
|
||||
task.getClass().getSimpleName() + " shutting down.");
|
||||
Log.i(TAG, task.getClass().getSimpleName() + " shutting down.");
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer.purge();
|
||||
+6
-3
@@ -13,8 +13,11 @@
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.services;
|
||||
package com.google.android.apps.mytracks.services.tasks;
|
||||
|
||||
import com.google.android.apps.mytracks.services.tasks.PeriodicTask;
|
||||
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerFactory;
|
||||
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerTask;
|
||||
import com.google.android.apps.mytracks.util.ApiFeatures;
|
||||
|
||||
import android.media.AudioManager;
|
||||
@@ -55,7 +58,7 @@ public class StatusAnnouncerFactoryTest extends AndroidTestCase {
|
||||
|
||||
public void testCreate() {
|
||||
apiFeatures.setHasTextToSpeech(true);
|
||||
StatusAnnouncerFactory factory =
|
||||
PeriodicTaskFactory factory =
|
||||
new StatusAnnouncerFactory(apiFeatures);
|
||||
PeriodicTask task = factory.create(getContext());
|
||||
assertTrue(task instanceof StatusAnnouncerTask);
|
||||
@@ -63,7 +66,7 @@ public class StatusAnnouncerFactoryTest extends AndroidTestCase {
|
||||
|
||||
public void testCreate_notAvailable() {
|
||||
apiFeatures.setHasTextToSpeech(false);
|
||||
StatusAnnouncerFactory factory =
|
||||
PeriodicTaskFactory factory =
|
||||
new StatusAnnouncerFactory(apiFeatures);
|
||||
PeriodicTask task = factory.create(getContext());
|
||||
assertNull(task);
|
||||
+2
-1
@@ -13,13 +13,14 @@
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.services;
|
||||
package com.google.android.apps.mytracks.services.tasks;
|
||||
|
||||
import static com.google.android.testing.mocking.AndroidMock.capture;
|
||||
import static com.google.android.testing.mocking.AndroidMock.eq;
|
||||
import static com.google.android.testing.mocking.AndroidMock.expect;
|
||||
import static com.google.android.testing.mocking.AndroidMock.same;
|
||||
|
||||
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerTask;
|
||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||
import com.google.android.apps.mytracks.util.StringUtils;
|
||||
import com.google.android.testing.mocking.AndroidMock;
|
||||
Reference in New Issue
Block a user