Tidy up incorrect indentation resulting from Eclipse misconfiguration

This commit is contained in:
David Piggott
2011-02-14 11:17:14 +00:00
parent 0eb676d3cd
commit 89d2cf8340
2 changed files with 110 additions and 110 deletions
@@ -91,19 +91,19 @@ public class ImportAllTracks {
wakeLock.release(); wakeLock.release();
Log.i(MyTracksConstants.TAG, "ImportAllTracks: Releasing wake lock."); Log.i(MyTracksConstants.TAG, "ImportAllTracks: Releasing wake lock.");
} }
Log.i(MyTracksConstants.TAG, "ImportAllTracks: Done"); Log.i(MyTracksConstants.TAG, "ImportAllTracks: Done");
AlertDialog.Builder builder = new AlertDialog.Builder(activity); AlertDialog.Builder builder = new AlertDialog.Builder(activity);
if (gpxFileCandidateCount == 0) { if (gpxFileCandidateCount == 0) {
builder.setMessage(activity.getString(R.string.import_empty, builder.setMessage(activity.getString(R.string.import_empty,
MyTracksConstants.SDCARD_TOP_DIR)); MyTracksConstants.SDCARD_TOP_DIR));
} else { } else {
builder.setMessage(activity.getString(R.string.import_done, builder.setMessage(activity.getString(R.string.import_done,
importSuccessCount, gpxFileCandidateCount, importSuccessCount, gpxFileCandidateCount,
MyTracksConstants.SDCARD_TOP_DIR)); MyTracksConstants.SDCARD_TOP_DIR));
} }
builder.setPositiveButton(R.string.ok, null); builder.setPositiveButton(R.string.ok, null);
builder.show(); builder.show();
} }
private void makeProgressDialog(final int trackCount) { private void makeProgressDialog(final int trackCount) {
@@ -121,72 +121,72 @@ public class ImportAllTracks {
* Actually import the tracks. * Actually import the tracks.
* This should be called after the wake locks have been acquired. * This should be called after the wake locks have been acquired.
*/ */
private void importAll() { private void importAll() {
MyTracksProviderUtils providerUtils = MyTracksProviderUtils.Factory MyTracksProviderUtils providerUtils = MyTracksProviderUtils.Factory
.get(activity); .get(activity);
LinkedList<File> gpxFiles = new LinkedList<File>(); LinkedList<File> gpxFiles = new LinkedList<File>();
File[] gpxFileCandidates = new File("/sdcard/" File[] gpxFileCandidates = new File("/sdcard/"
+ MyTracksConstants.SDCARD_TOP_DIR + "/gpx").listFiles(); + MyTracksConstants.SDCARD_TOP_DIR + "/gpx").listFiles();
if (gpxFileCandidates != null) { if (gpxFileCandidates != null) {
for (File file : gpxFileCandidates) { for (File file : gpxFileCandidates) {
if (!file.isDirectory() && file.getName().endsWith(".gpx")) { if (!file.isDirectory() && file.getName().endsWith(".gpx")) {
gpxFiles.add(file); gpxFiles.add(file);
} }
} }
} }
gpxFileCandidateCount = gpxFiles.size(); gpxFileCandidateCount = gpxFiles.size();
if (gpxFileCandidateCount != 0) { if (gpxFileCandidateCount != 0) {
Log.i(MyTracksConstants.TAG, "ImportAllTracks: Importing: " Log.i(MyTracksConstants.TAG, "ImportAllTracks: Importing: "
+ gpxFileCandidateCount + " tracks."); + gpxFileCandidateCount + " tracks.");
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
public void run() { public void run() {
makeProgressDialog(gpxFileCandidateCount); makeProgressDialog(gpxFileCandidateCount);
} }
}); });
Iterator<File> gpxFilesIterator = gpxFiles.iterator(); Iterator<File> gpxFilesIterator = gpxFiles.iterator();
File currentFile; File currentFile;
int currentFileNumber = 0; int currentFileNumber = 0;
while (gpxFilesIterator.hasNext()) { while (gpxFilesIterator.hasNext()) {
currentFile = gpxFilesIterator.next(); currentFile = gpxFilesIterator.next();
final int status = currentFileNumber; final int status = currentFileNumber;
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
public void run() { public void run() {
synchronized (this) { synchronized (this) {
if (progress == null) { if (progress == null) {
return; return;
} }
progress.setProgress(status); progress.setProgress(status);
} }
} }
}); });
if (importFile(currentFile, providerUtils)) { if (importFile(currentFile, providerUtils)) {
importSuccessCount++; importSuccessCount++;
} }
currentFileNumber++; currentFileNumber++;
} }
if (progress != null) { if (progress != null) {
synchronized (this) { synchronized (this) {
progress.dismiss(); progress.dismiss();
progress = null; progress = null;
} }
} }
} }
} }
private boolean importFile(File gpxFile, MyTracksProviderUtils providerUtils) { private boolean importFile(File gpxFile, MyTracksProviderUtils providerUtils) {
Log.i(MyTracksConstants.TAG, "ImportAllTracks: importing: " Log.i(MyTracksConstants.TAG, "ImportAllTracks: importing: "
+ gpxFile.getName()); + gpxFile.getName());
try { try {
GpxImporter.importGPXFile(new FileInputStream(gpxFile), providerUtils); GpxImporter.importGPXFile(new FileInputStream(gpxFile), providerUtils);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
Log.w("", e); Log.w("", e);
Toast.makeText(activity, Toast.makeText(activity,
activity.getString(R.string.import_error) + " " + gpxFile.getName(), activity.getString(R.string.import_error) + " " + gpxFile.getName(),
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
return false; return false;
} }
} }
} }
@@ -294,37 +294,37 @@ public class MyTracksUtils {
* Tries to acquire a partial wake lock if not already acquired. Logs errors * Tries to acquire a partial wake lock if not already acquired. Logs errors
* and gives up trying in case the wake lock cannot be acquired. * and gives up trying in case the wake lock cannot be acquired.
*/ */
public static WakeLock acquireWakeLock(Activity activity, WakeLock wakeLock) { public static WakeLock acquireWakeLock(Activity activity, WakeLock wakeLock) {
Log.i(MyTracksConstants.TAG, "MyTracksUtils: Acquiring wake lock."); Log.i(MyTracksConstants.TAG, "MyTracksUtils: Acquiring wake lock.");
try { try {
PowerManager pm = (PowerManager) activity PowerManager pm = (PowerManager) activity
.getSystemService(Context.POWER_SERVICE); .getSystemService(Context.POWER_SERVICE);
if (pm == null) { if (pm == null) {
Log.e(MyTracksConstants.TAG, "MyTracksUtils: Power manager not found!"); Log.e(MyTracksConstants.TAG, "MyTracksUtils: Power manager not found!");
return wakeLock; return wakeLock;
} }
if (wakeLock == null) { if (wakeLock == null) {
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
MyTracksConstants.TAG); MyTracksConstants.TAG);
if (wakeLock == null) { if (wakeLock == null) {
Log.e(MyTracksConstants.TAG, Log.e(MyTracksConstants.TAG,
"MyTracksUtils: Could not create wake lock (null)."); "MyTracksUtils: Could not create wake lock (null).");
} }
return wakeLock; return wakeLock;
} }
if (!wakeLock.isHeld()) { if (!wakeLock.isHeld()) {
wakeLock.acquire(); wakeLock.acquire();
if (!wakeLock.isHeld()) { if (!wakeLock.isHeld()) {
Log.e(MyTracksConstants.TAG, Log.e(MyTracksConstants.TAG,
"MyTracksUtils: Could not acquire wake lock."); "MyTracksUtils: Could not acquire wake lock.");
} }
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
Log.e(MyTracksConstants.TAG, Log.e(MyTracksConstants.TAG,
"MyTracksUtils: Caught unexpected exception: " + e.getMessage(), e); "MyTracksUtils: Caught unexpected exception: " + e.getMessage(), e);
} }
return wakeLock; return wakeLock;
} }
/** /**
* This is a utility class w/ only static members. * This is a utility class w/ only static members.