Rename SD card to external storage.

Rename phone to device.
This commit is contained in:
Jimmy Shih
2012-09-21 15:33:59 -07:00
parent 07053d270d
commit 29d44d45b6
13 changed files with 176 additions and 168 deletions
@@ -111,9 +111,10 @@ public class ImportActivity extends Activity {
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_PROGRESS_ID:
progressDialog = DialogUtils.createHorizontalProgressDialog(
this, R.string.sd_card_import_progress_message, new DialogInterface.OnCancelListener() {
@Override
progressDialog = DialogUtils.createHorizontalProgressDialog(this,
R.string.external_storage_import_progress_message,
new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
importAsyncTask.cancel(true);
finish();
@@ -123,12 +124,12 @@ public class ImportActivity extends Activity {
case DIALOG_RESULT_ID:
String message;
if (successCount == 0) {
message = getString(R.string.sd_card_import_error_no_file, path);
message = getString(R.string.external_storage_import_error_no_file, path);
} else {
String totalFiles = getResources()
.getQuantityString(R.plurals.importGpxFiles, totalCount, totalCount);
message = getString(
R.string.sd_card_import_success_count, successCount, totalFiles, path);
R.string.external_storage_import_success_count, successCount, totalFiles, path);
}
return new AlertDialog.Builder(this)
.setCancelable(true)
@@ -175,7 +176,7 @@ public class ImportActivity extends Activity {
if (success) {
showDialog(DIALOG_RESULT_ID);
} else {
Toast.makeText(this, R.string.sd_card_import_error, Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.external_storage_import_error, Toast.LENGTH_LONG).show();
finish();
}
}
@@ -56,7 +56,7 @@ public class BackupAsyncTask extends AsyncTask<Void, Integer, Boolean> {
this.externalFileBackup = new ExternalFileBackup(backupActivity);
success = false;
completed = false;
messageId = R.string.sd_card_save_error;
messageId = R.string.external_storage_save_error;
}
/**
@@ -81,18 +81,18 @@ public class BackupAsyncTask extends AsyncTask<Void, Integer, Boolean> {
@Override
protected Boolean doInBackground(Void... params) {
if (!FileUtils.isSdCardAvailable()) {
messageId = R.string.sd_card_error_no_storage;
messageId = R.string.external_storage_error_no_storage;
return false;
}
if (!externalFileBackup.isBackupsDirectoryAvailable(true)) {
messageId = R.string.sd_card_save_error_create_dir;
messageId = R.string.external_storage_save_error_create_dir;
return false;
}
try {
externalFileBackup.writeToDefaultFile();
messageId = R.string.sd_card_save_success;
messageId = R.string.external_storage_save_success;
return true;
} catch (IOException e) {
Log.d(TAG, "IO exception", e);
@@ -59,7 +59,7 @@ public class RestoreAsyncTask extends AsyncTask<Void, Integer, Boolean> {
this.externalFileBackup = new ExternalFileBackup(restoreActivity);
success = false;
completed = false;
messageId = R.string.sd_card_import_error;
messageId = R.string.external_storage_import_error;
}
/**
@@ -85,7 +85,7 @@ public class RestoreAsyncTask extends AsyncTask<Void, Integer, Boolean> {
protected Boolean doInBackground(Void... params) {
try {
externalFileBackup.restoreFromDate(date);
messageId = R.string.sd_card_import_success;
messageId = R.string.external_storage_import_success;
return true;
} catch (IOException e) {
Log.d(TAG, "IO exception", e);
@@ -58,7 +58,7 @@ public class RestoreChooserActivity extends Activity {
// Get the list of existing backups
if (!FileUtils.isSdCardAvailable()) {
Toast.makeText(this, R.string.sd_card_error_no_storage, Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.external_storage_error_no_storage, Toast.LENGTH_LONG).show();
finish();
return;
}
@@ -100,9 +100,10 @@ public class SaveActivity extends Activity {
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_PROGRESS_ID:
progressDialog = DialogUtils.createHorizontalProgressDialog(
this, R.string.sd_card_save_progress_message, new DialogInterface.OnCancelListener() {
@Override
progressDialog = DialogUtils.createHorizontalProgressDialog(this,
R.string.external_storage_save_progress_message,
new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
saveAsyncTask.cancel(true);
finish();
@@ -91,7 +91,7 @@ public class SaveAsyncTask extends AsyncTask<Void, Integer, Boolean> {
trackWriter = null;
success = false;
completed = false;
messageId = R.string.sd_card_save_error;
messageId = R.string.external_storage_save_error;
savedPath = null;
}
@@ -170,12 +170,12 @@ public class SaveAsyncTask extends AsyncTask<Void, Integer, Boolean> {
try {
cursor = myTracksProviderUtils.getTrackCursor(null, null, TracksColumns._ID);
if (cursor == null) {
messageId = R.string.sd_card_save_error_no_track;
messageId = R.string.external_storage_save_error_no_track;
return false;
}
int count = cursor.getCount();
if (count == 0) {
messageId = R.string.sd_card_save_error_no_track;
messageId = R.string.external_storage_save_error_no_track;
return false;
}
int idIndex = cursor.getColumnIndexOrThrow(TracksColumns._ID);
@@ -190,7 +190,7 @@ public class SaveAsyncTask extends AsyncTask<Void, Integer, Boolean> {
}
publishProgress(i + 1, count);
}
messageId = R.string.sd_card_save_success;
messageId = R.string.external_storage_save_success;
return true;
} finally {
if (cursor != null) {
@@ -53,7 +53,7 @@ class TrackWriterImpl implements TrackWriter {
private final Track track;
private final TrackFormatWriter writer;
private boolean success = false;
private int errorMessage = R.string.sd_card_save_error;
private int errorMessage = R.string.external_storage_save_error;
private File directory = null;
private File file = null;
private OnWriteListener onWriteListener;
@@ -105,7 +105,7 @@ class TrackWriterImpl implements TrackWriter {
private void doWriteTrack() {
// Open the input and output
success = false;
errorMessage = R.string.sd_card_save_error;
errorMessage = R.string.external_storage_save_error;
if (track != null) {
if (openFile()) {
try {
@@ -118,7 +118,7 @@ class TrackWriterImpl implements TrackWriter {
}
}
success = false;
errorMessage = R.string.sd_card_canceled;
errorMessage = R.string.external_storage_canceled;
}
}
}
@@ -186,7 +186,7 @@ class TrackWriterImpl implements TrackWriter {
writer.prepare(track, newOutputStream(fileName));
} catch (FileNotFoundException e) {
Log.e(Constants.TAG, "Failed to open output file.", e);
errorMessage = R.string.sd_card_save_error;
errorMessage = R.string.external_storage_save_error;
return false;
}
return true;
@@ -204,12 +204,12 @@ class TrackWriterImpl implements TrackWriter {
if (!FileUtils.isSdCardAvailable()) {
Log.i(Constants.TAG, "Could not find SD card.");
errorMessage = R.string.sd_card_error_no_storage;
errorMessage = R.string.external_storage_error_no_storage;
return false;
}
if (!FileUtils.ensureDirectoryExists(directory)) {
Log.i(Constants.TAG, "Could not create export directory.");
errorMessage = R.string.sd_card_save_error_create_dir;
errorMessage = R.string.external_storage_save_error_create_dir;
return false;
}
@@ -283,7 +283,7 @@ class TrackWriterImpl implements TrackWriter {
writer.close();
success = true;
Log.d(Constants.TAG, "Done writing track.");
errorMessage = R.string.sd_card_save_success;
errorMessage = R.string.external_storage_save_success;
}
private void writeLocations() throws InterruptedException {