Indentation fixing.

Unsure how it got so out of whack to begin with
This commit is contained in:
YuviPanda 2013-02-02 15:30:01 +05:30
parent da92ec7235
commit 569143e44b

View file

@ -53,6 +53,7 @@ public class UploadService extends IntentService {
public UploadService() {
super("UploadService");
}
// DO NOT HAVE NOTIFICATION ID OF 0 FOR ANYTHING
// See http://stackoverflow.com/questions/8725909/startforeground-does-not-show-my-notification
// Seriously, Android?
@ -77,6 +78,7 @@ public class UploadService extends IntentService {
this.notificationFinishingTitle = notificationFinishingTitle;
this.contribution = contribution;
}
@Override
public void onProgress(long transferred, long total) {
Log.d("Commons", String.format("Uploaded %d of %d", transferred, total));
@ -96,7 +98,7 @@ public class UploadService extends IntentService {
curView.setTextViewText(R.id.uploadNotificationTitle, notificationFinishingTitle);
notificationManager.notify(NOTIFICATION_DOWNLOAD_IN_PROGRESS, curNotification);
} else {
curNotification.contentView.setProgressBar(R.id.uploadNotificationProgress, 100, (int)(((double)transferred / (double)total) * 100), false);
curNotification.contentView.setProgressBar(R.id.uploadNotificationProgress, 100, (int) (((double) transferred / (double) total) * 100), false);
notificationManager.notify(NOTIFICATION_DOWNLOAD_IN_PROGRESS, curNotification);
Intent mediaUploadProgressIntent = new Intent(INTENT_CONTRIBUTION_STATE_CHANGED);
@ -107,6 +109,7 @@ public class UploadService extends IntentService {
}
}
@Override
public void onDestroy() {
super.onDestroy();
@ -117,14 +120,14 @@ public class UploadService extends IntentService {
@Override
public void onCreate() {
super.onCreate();
notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
localBroadcastManager = LocalBroadcastManager.getInstance(this);
app = (CommonsApplication)this.getApplicationContext();
app = (CommonsApplication) this.getApplicationContext();
contributionsProviderClient = this.getContentResolver().acquireContentProviderClient(ContributionsContentProvider.AUTHORITY);
}
private String getRealPathFromURI(Uri contentUri) {
String[] proj = { MediaStore.Images.Media.DATA };
String[] proj = {MediaStore.Images.Media.DATA};
CursorLoader loader = new CursorLoader(this, contentUri, proj, null, null, null);
Cursor cursor = loader.loadInBackground();
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
@ -134,7 +137,7 @@ public class UploadService extends IntentService {
private Contribution mediaFromIntent(Intent intent) {
Bundle extras = intent.getExtras();
Uri mediaUri = (Uri)extras.getParcelable(EXTRA_MEDIA_URI);
Uri mediaUri = (Uri) extras.getParcelable(EXTRA_MEDIA_URI);
String filename = intent.getStringExtra(EXTRA_TARGET_FILENAME);
String description = intent.getStringExtra(EXTRA_DESCRIPTION);
String editSummary = intent.getStringExtra(EXTRA_EDIT_SUMMARY);
@ -144,16 +147,16 @@ public class UploadService extends IntentService {
Long length = null;
try {
length = this.getContentResolver().openAssetFileDescriptor(mediaUri, "r").getLength();
} catch (FileNotFoundException e) {
} catch(FileNotFoundException e) {
throw new RuntimeException(e);
}
Log.d("Commons", "MimeType is " + mimeType);
if (mimeType.startsWith("image/")) {
if(mimeType.startsWith("image/")) {
Cursor cursor = this.getContentResolver().query(mediaUri,
new String[]{MediaStore.Images.ImageColumns.DATE_TAKEN}, null, null, null);
if (cursor.getCount() != 0) {
if(cursor.getCount() != 0) {
cursor.moveToFirst();
dateCreated = new Date(cursor.getLong(0));
}
@ -163,6 +166,7 @@ public class UploadService extends IntentService {
Contribution contribution = new Contribution(mediaUri, null, filename, description, null, length, dateCreated, null, app.getCurrentAccount().name, editSummary);
return contribution;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
toUpload++;
@ -192,14 +196,14 @@ public class UploadService extends IntentService {
RemoteViews notificationView;
Contribution contribution;
InputStream file = null;
contribution = (Contribution)intent.getSerializableExtra("dummy-data");
contribution = (Contribution) intent.getSerializableExtra("dummy-data");
String notificationTag = contribution.getLocalUri().toString();
try {
file = this.getContentResolver().openInputStream(contribution.getLocalUri());
} catch (FileNotFoundException e) {
} catch(FileNotFoundException e) {
throw new RuntimeException(e);
}
@ -241,7 +245,7 @@ public class UploadService extends IntentService {
contribution
);
result = api.upload(contribution.getFilename(), file, contribution.getDataLength(), contribution.getPageContents(), contribution.getEditSummary(), notificationUpdater);
} catch (IOException e) {
} catch(IOException e) {
Log.d("Commons", "I have a network fuckup");
stopForeground(true);
Notification failureNotification = new NotificationCompat.Builder(this).setAutoCancel(true)
@ -272,7 +276,7 @@ public class UploadService extends IntentService {
Date dateUploaded = null;
try {
dateUploaded = isoFormat.parse(result.getString("/api/upload/imageinfo/@timestamp"));
} catch (java.text.ParseException e) {
} catch(java.text.ParseException e) {
throw new RuntimeException(e); // Hopefully mediawiki doesn't give me bogus stuff?
}