merge heads

This commit is contained in:
Jimmy Shih
2013-02-22 11:24:20 -08:00
8 changed files with 72 additions and 12 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+4
View File
@@ -74,6 +74,10 @@ limitations under the License.
android:icon="@drawable/menu_settings" android:icon="@drawable/menu_settings"
android:id="@+id/track_list_settings" android:id="@+id/track_list_settings"
android:title="@string/menu_settings"/> android:title="@string/menu_settings"/>
<item
android:icon="@drawable/menu_feedback"
android:id="@+id/track_list_feedback"
android:title="@string/menu_feedback"/>
<item <item
android:icon="@drawable/menu_help" android:icon="@drawable/menu_help"
android:id="@+id/track_list_help" android:id="@+id/track_list_help"
+15 -8
View File
@@ -617,9 +617,9 @@ limitations under the License.
translation_description="Error message when the external storage is not available."> translation_description="Error message when the external storage is not available.">
External storage not available. External storage not available.
</string> </string>
<string name="external_storage_not_writeable" <string name="external_storage_not_writable"
translation_description="Error message when the external storage is not writeable."> translation_description="Error message when the external storage is not writable.">
External storage not writeable. External storage not writable.
</string> </string>
<!-- Files --> <!-- Files -->
@@ -974,6 +974,12 @@ limitations under the License.
Character limit: ~20 (1 line)"> Character limit: ~20 (1 line)">
Edit Edit
</string> </string>
<string name="menu_feedback"
translation_description="In the menu, to enter feedback.
Character limit: ~20 (1 line)">
Feedback
</string>
<string name="menu_help" <string name="menu_help"
translation_description="In the menu, to go to the help page. translation_description="In the menu, to go to the help page.
@@ -1478,7 +1484,7 @@ limitations under the License.
Backup now Backup now
</string> </string>
<string name="settings_backup_now_error" <string name="settings_backup_now_error"
translation_description="When backing up to the external storage, the error messag."> translation_description="When backing up to the external storage, the error message.">
Unable to backup. Unable to backup.
</string> </string>
<string name="settings_backup_now_progress_message" <string name="settings_backup_now_progress_message"
@@ -1660,7 +1666,8 @@ limitations under the License.
Character limit: ~23 (1 line)"> Character limit: ~23 (1 line)">
Top medium speed Top medium speed
</string><string name="settings_map_percentage" </string>
<string name="settings_map_percentage"
translation_description="In the 'Map' settings, under the 'Dynamic thresholds' section, the translation_description="In the 'Map' settings, under the 'Dynamic thresholds' section, the
option to configure the medium speed range as a percentage from the average speed. option to configure the medium speed range as a percentage from the average speed.
@@ -1744,7 +1751,7 @@ limitations under the License.
when a time value is selected. when a time value is selected.
%1$s time value. E.g., '5 min'."> %1$s time value. E.g., '5 min'.">
Resume a recording after reboot if the last recorded loation was within the last %1$s Resume a recording after reboot if the last recorded location was within the last %1$s
</string> </string>
<string name="settings_recording_auto_resume_track_timeout_title" <string name="settings_recording_auto_resume_track_timeout_title"
translation_description="In the 'Recording' settings, the title to configure automatically translation_description="In the 'Recording' settings, the title to configure automatically
@@ -1817,14 +1824,14 @@ limitations under the License.
Date (ISO 8601) Date (ISO 8601)
</string> </string>
<string name="settings_recording_track_name_date_local_option" <string name="settings_recording_track_name_date_local_option"
translation_description="In the 'Recording' settings, the option in the 'Defaul track name' translation_description="In the 'Recording' settings, the option in the 'Default track name'
setting to use the track starting time in the local format as the default track name. setting to use the track starting time in the local format as the default track name.
Character limit: ~20 (1 line)"> Character limit: ~20 (1 line)">
Date (local) Date (local)
</string> </string>
<string name="settings_recording_track_name_location_option" <string name="settings_recording_track_name_location_option"
translation_description="In the 'Recording' settings, the option in the 'Defaul track name' translation_description="In the 'Recording' settings, the option in the 'Default track name'
setting to use the track starting location as the default track name. setting to use the track starting location as the default track name.
Character limit: ~20 (1 line)"> Character limit: ~20 (1 line)">
@@ -55,17 +55,27 @@ import com.google.android.apps.mytracks.util.TrackRecordingServiceConnectionUtil
import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.maps.mytracks.R; import com.google.android.maps.mytracks.R;
import com.google.userfeedback.android.api.UserFeedback;
import com.google.userfeedback.android.api.UserFeedbackSpec;
import android.app.Dialog; import android.app.Dialog;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor; import android.database.Cursor;
import android.location.Location; import android.location.Location;
import android.os.Binder;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.os.RemoteException;
import android.provider.Settings; import android.provider.Settings;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.app.LoaderManager.LoaderCallbacks;
@@ -87,6 +97,7 @@ import android.widget.ListView;
import android.widget.Toast; import android.widget.Toast;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
@@ -607,6 +618,32 @@ public class TrackListActivity extends AbstractSendToGoogleActivity
intent = IntentUtils.newIntent(this, SettingsActivity.class); intent = IntentUtils.newIntent(this, SettingsActivity.class);
startActivity(intent); startActivity(intent);
return true; return true;
case R.id.track_list_feedback:
if (isFeedbackAvailable()) {
intent = new Intent(Intent.ACTION_BUG_REPORT);
ServiceConnection conn = new ServiceConnection() {
public void onServiceDisconnected(ComponentName name) {}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
try {
service.transact(Binder.FIRST_CALL_TRANSACTION, Parcel.obtain(), null, 0);
} catch (RemoteException e) {
// TODO(jshih): Auto-generated catch block
e.printStackTrace();
}
}
};
// Bind to the service after creating it if necessary
bindService(intent, conn, BIND_AUTO_CREATE);
} else {
UserFeedbackSpec spec = new UserFeedbackSpec(this, "com.google.android.maps.mytracks:V *:S",
"com.google.android.maps.mytracks.USER_INITIATED_FEEDBACK_REPORT");
UserFeedback userFeedback = new UserFeedback();
userFeedback.startFeedback(spec);
}
return true;
case R.id.track_list_help: case R.id.track_list_help:
intent = IntentUtils.newIntent(this, HelpActivity.class); intent = IntentUtils.newIntent(this, HelpActivity.class);
startActivity(intent); startActivity(intent);
@@ -616,6 +653,18 @@ public class TrackListActivity extends AbstractSendToGoogleActivity
} }
} }
private boolean isFeedbackAvailable() {
List<ResolveInfo> infos = getPackageManager().queryIntentServices(
new Intent(Intent.ACTION_BUG_REPORT), PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo info : infos) {
if (info.serviceInfo != null && info.serviceInfo.packageName != null
&& info.serviceInfo.packageName.equals("com.google.android.feedback")) {
return true;
}
}
return false;
}
@Override @Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo); super.onCreateContextMenu(menu, v, menuInfo);
@@ -81,12 +81,12 @@ public class BackupAsyncTask extends AsyncTask<Void, Integer, Boolean> {
@Override @Override
protected Boolean doInBackground(Void... params) { protected Boolean doInBackground(Void... params) {
if (!FileUtils.isExternalStorageWriteable()) { if (!FileUtils.isExternalStorageWriteable()) {
messageId = R.string.external_storage_not_writeable; messageId = R.string.external_storage_not_writable;
return false; return false;
} }
if (!externalFileBackup.isBackupsDirectoryAvailable(true)) { if (!externalFileBackup.isBackupsDirectoryAvailable(true)) {
messageId = R.string.external_storage_not_writeable; messageId = R.string.external_storage_not_writable;
return false; return false;
} }
@@ -83,7 +83,7 @@ public class SaveActivity extends Activity {
playTrack = intent.getBooleanExtra(EXTRA_PLAY_TRACK, false); playTrack = intent.getBooleanExtra(EXTRA_PLAY_TRACK, false);
if (!FileUtils.isExternalStorageWriteable()) { if (!FileUtils.isExternalStorageWriteable()) {
Toast.makeText(this, R.string.external_storage_not_writeable, Toast.LENGTH_LONG).show(); Toast.makeText(this, R.string.external_storage_not_writable, Toast.LENGTH_LONG).show();
finish(); finish();
return; return;
} }
@@ -94,7 +94,7 @@ public class SaveActivity extends Activity {
File directory = new File(directoryName); File directory = new File(directoryName);
if (!FileUtils.ensureDirectoryExists(directory)) { if (!FileUtils.ensureDirectoryExists(directory)) {
Toast.makeText(this, R.string.external_storage_not_writeable, Toast.LENGTH_LONG).show(); Toast.makeText(this, R.string.external_storage_not_writable, Toast.LENGTH_LONG).show();
finish(); finish();
return; return;
} }