forked from upstream-mirrors/OpenTracks
Pick up new Chinese translations
This commit is contained in:
@@ -49,6 +49,7 @@ limitations under the License.
|
||||
<!-- Requirements -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="com.google.android.apps.mytracks.TRACK_NOTIFICATIONS" />
|
||||
<uses-permission android:name="com.google.android.apps.mytracks.WRITE_TRACK_DATA" />
|
||||
<uses-feature android:name="android.hardware.telephony" android:required="true"/>
|
||||
|
||||
+47
-2
@@ -15,9 +15,12 @@
|
||||
*/
|
||||
package com.google.android.apps.mytracks.signalstrength;
|
||||
|
||||
import static com.google.android.apps.mytracks.signalstrength.SignalStrengthConstants.*;
|
||||
import static com.google.android.apps.mytracks.signalstrength.SignalStrengthConstants.TAG;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.telephony.CellLocation;
|
||||
import android.telephony.NeighboringCellInfo;
|
||||
import android.telephony.PhoneStateListener;
|
||||
@@ -35,6 +38,8 @@ import java.util.List;
|
||||
*/
|
||||
public class SignalStrengthListenerCupcake extends PhoneStateListener
|
||||
implements SignalStrengthListener {
|
||||
private static final Uri APN_URI = Uri.parse("content://telephony/carriers");
|
||||
|
||||
private final Context context;
|
||||
private final SignalStrengthCallback callback;
|
||||
|
||||
@@ -100,7 +105,7 @@ public class SignalStrengthListenerCupcake extends PhoneStateListener
|
||||
* @return A human readable description of the network state
|
||||
*/
|
||||
private String getDescription() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getStrengthAsString());
|
||||
|
||||
sb.append("Network Type: ");
|
||||
@@ -117,6 +122,8 @@ public class SignalStrengthListenerCupcake extends PhoneStateListener
|
||||
sb.append(manager.isNetworkRoaming());
|
||||
sb.append('\n');
|
||||
|
||||
appendCurrentApns(sb);
|
||||
|
||||
List<NeighboringCellInfo> infos = manager.getNeighboringCellInfo();
|
||||
Log.i(TAG, "Found " + infos.size() + " cells.");
|
||||
if (infos.size() > 0) {
|
||||
@@ -138,6 +145,44 @@ public class SignalStrengthListenerCupcake extends PhoneStateListener
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void appendCurrentApns(StringBuilder output) {
|
||||
ContentResolver contentResolver = context.getContentResolver();
|
||||
|
||||
Cursor cursor = contentResolver.query(
|
||||
APN_URI, new String[] { "name", "apn" }, "current=1", null, null);
|
||||
|
||||
if (cursor == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
String name = null;
|
||||
String apn = null;
|
||||
|
||||
while (cursor.moveToNext()) {
|
||||
int nameIdx = cursor.getColumnIndex("name");
|
||||
int apnIdx = cursor.getColumnIndex("apn");
|
||||
if (apnIdx < 0 || nameIdx < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
name = cursor.getString(nameIdx);
|
||||
apn = cursor.getString(apnIdx);
|
||||
output.append("APN: ");
|
||||
if (name != null) {
|
||||
output.append(name);
|
||||
}
|
||||
if (apn != null) {
|
||||
output.append(" (");
|
||||
output.append(apn);
|
||||
output.append(")\n");
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the url for the waypoint icon for the current network type.
|
||||
*
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ public class SignalStrengthService extends Service
|
||||
// Create a waypoint.
|
||||
WaypointCreationRequest request =
|
||||
new WaypointCreationRequest(WaypointCreationRequest.WaypointType.MARKER,
|
||||
"Signal Strength", icon, description);
|
||||
"Signal Strength", description, icon);
|
||||
waypointId = mytracksService.insertWaypoint(request);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user