forked from upstream-mirrors/OpenTracks
Merge with 63eb7915dafe329e8f06cc33c56122ee15ea6df7
This commit is contained in:
@@ -102,6 +102,19 @@
|
||||
|
||||
<!-- Permissions for misc services -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
|
||||
<!-- Features required -->
|
||||
<uses-feature android:name="android.hardware.location" android:required="true"/>
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="true"/>
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="true"/>
|
||||
|
||||
<!-- Features optional -->
|
||||
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.location.network" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.sensor.compass" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.telephony" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.telephony.gsm" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false"/>
|
||||
|
||||
<uses-sdk android:minSdkVersion="3"/>
|
||||
<supports-screens
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
<booleanAttribute key="com.android.ide.eclipse.adt.wipedata" value="false"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/MyTracks"/>
|
||||
<listEntry value="/MyTracks/AndroidManifest.xml"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
|
||||
@@ -26,8 +26,8 @@ limitations under the License.
|
||||
android:enabled="true"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:apiKey="0TXoRmxTinrZKQ9JSazj-9A34XX6_lXsRvTpXWA"/>
|
||||
<!-- corresponding certificate md5: 81:DF:A2:63:53:C7:6B:1E:6C:24:62:D4:91:1C:36:3A -->
|
||||
android:apiKey="0y_T_wDlbgovCQMZX7ZClDeveHLLhczEyiUblvw"/>
|
||||
<!-- corresponding certificate md5: 88:3B:2F:19:EC:0A:9D:E9:33:89:30:BE:94:D1:79:91 -->
|
||||
<LinearLayout android:id="@+id/messagepane"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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>
|
||||
<array name="left_icons">
|
||||
<item>@drawable/left_arrow_chart_stateful</item>
|
||||
<item>@drawable/left_arrow_track_stateful</item>
|
||||
<item>@drawable/left_arrow_stats_stateful</item>
|
||||
</array>
|
||||
|
||||
<array name="right_icons">
|
||||
<item>@drawable/right_arrow_stats_stateful</item>
|
||||
<item>@drawable/right_arrow_chart_stateful</item>
|
||||
<item>@drawable/right_arrow_track_stateful</item>
|
||||
</array>
|
||||
</resources>
|
||||
@@ -202,17 +202,6 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
||||
|
||||
private NavControls navControls;
|
||||
|
||||
/** Icons shown on the left for each tab. */
|
||||
private final int leftIcons[] =
|
||||
{ R.drawable.left_arrow_chart_stateful,
|
||||
R.drawable.left_arrow_track_stateful,
|
||||
R.drawable.left_arrow_stats_stateful };
|
||||
/** Icons shown on the right for each tab. */
|
||||
private final int rightIcons[] =
|
||||
{ R.drawable.right_arrow_stats_stateful,
|
||||
R.drawable.right_arrow_chart_stateful,
|
||||
R.drawable.right_arrow_track_stateful };
|
||||
|
||||
private final Runnable changeTab = new Runnable() {
|
||||
public void run() {
|
||||
getTabHost().setCurrentTab(navControls.getCurrentIcons());
|
||||
@@ -266,7 +255,6 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
||||
providerUtils = MyTracksProviderUtils.Factory.get(this);
|
||||
menuManager = new MenuManager(this);
|
||||
sharedPreferences = getSharedPreferences(MyTracksSettings.SETTINGS_NAME, 0);
|
||||
dialogManager = new DialogManager(this);
|
||||
|
||||
// The volume we want to control is the Text-To-Speech volume
|
||||
int volumeStream =
|
||||
@@ -298,7 +286,10 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
||||
new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
|
||||
layout.setLayoutParams(params);
|
||||
navControls =
|
||||
new NavControls(this, layout, leftIcons, rightIcons, changeTab);
|
||||
new NavControls(this, layout,
|
||||
getResources().obtainTypedArray(R.array.left_icons),
|
||||
getResources().obtainTypedArray(R.array.right_icons),
|
||||
changeTab);
|
||||
navControls.show();
|
||||
tabHost.addView(layout);
|
||||
layout.setOnTouchListener(this);
|
||||
@@ -367,6 +358,7 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
||||
// to the user.
|
||||
Log.d(MyTracksConstants.TAG, "MyTracks.onResume");
|
||||
tryBindTrackRecordingService();
|
||||
dialogManager = new DialogManager(this);
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.google.android.apps.mytracks;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.view.MotionEvent;
|
||||
@@ -62,8 +63,7 @@ public class NavControls {
|
||||
addView(icon);
|
||||
}
|
||||
|
||||
public void setIcon(int iconId) {
|
||||
Drawable drawable = getContext().getResources().getDrawable(iconId);
|
||||
public void setIcon(Drawable drawable) {
|
||||
icon.setImageDrawable(drawable);
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@@ -102,21 +102,21 @@ public class NavControls {
|
||||
|
||||
private final TouchLayout prevImage;
|
||||
private final TouchLayout nextImage;
|
||||
private final int[] leftIcons;
|
||||
private final int[] rightIcons;
|
||||
private final TypedArray leftIcons;
|
||||
private final TypedArray rightIcons;
|
||||
private final Runnable touchRunnable;
|
||||
|
||||
private boolean isVisible = false;
|
||||
private int currentIcons;
|
||||
|
||||
public NavControls(Context context, ViewGroup container,
|
||||
int[] leftIcons, int[] rightIcons,
|
||||
TypedArray leftIcons, TypedArray rightIcons,
|
||||
Runnable touchRunnable) {
|
||||
this.leftIcons = leftIcons;
|
||||
this.rightIcons = rightIcons;
|
||||
this.touchRunnable = touchRunnable;
|
||||
|
||||
if (leftIcons.length != rightIcons.length || leftIcons.length < 1) {
|
||||
if (leftIcons.length() != rightIcons.length() || leftIcons.length() < 1) {
|
||||
throw new IllegalArgumentException("Invalid icons specified");
|
||||
}
|
||||
if (touchRunnable == null) {
|
||||
@@ -145,8 +145,8 @@ public class NavControls {
|
||||
container.addView(prevImage);
|
||||
container.addView(nextImage);
|
||||
|
||||
prevImage.setIcon(leftIcons[0]);
|
||||
nextImage.setIcon(rightIcons[0]);
|
||||
prevImage.setIcon(leftIcons.getDrawable(0));
|
||||
nextImage.setIcon(rightIcons.getDrawable(0));
|
||||
this.currentIcons = 0;
|
||||
}
|
||||
|
||||
@@ -206,8 +206,9 @@ public class NavControls {
|
||||
|
||||
private void shiftIcons(boolean isLeft) {
|
||||
// Increment or decrement by one, with wrap around
|
||||
currentIcons = (currentIcons + leftIcons.length + (isLeft ? -1 : 1)) % leftIcons.length;
|
||||
prevImage.setIcon(leftIcons[currentIcons]);
|
||||
nextImage.setIcon(rightIcons[currentIcons]);
|
||||
currentIcons = (currentIcons + leftIcons.length() +
|
||||
(isLeft ? -1 : 1)) % leftIcons.length();
|
||||
prevImage.setIcon(leftIcons.getDrawable(currentIcons));
|
||||
nextImage.setIcon(rightIcons.getDrawable(currentIcons));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +261,9 @@ public class StatusAnnouncerTask implements PeriodicTask {
|
||||
protected void listenToPhoneState(PhoneStateListener listener, int events) {
|
||||
TelephonyManager telephony =
|
||||
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
telephony.listen(listener, events);
|
||||
if (telephony != null) {
|
||||
telephony.listen(listener, events);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user