Modified extra whitespace lines in source code

Code is much easier to read if there isn't too much of a gap between
lines. Primarily converted multi-line gaps into single line gaps.
This commit is contained in:
Anirudh S 2016-10-30 23:01:44 +05:30
parent a685ecf2c3
commit 94e8c991ee
34 changed files with 5 additions and 76 deletions

View file

@ -149,8 +149,6 @@
android:exported="false">
</provider>
</application>
</manifest>

View file

@ -60,7 +60,6 @@ public class CommonsApplication extends Application {
public static final Object[] EVENT_SHARE_ATTEMPT = {"MobileAppShareAttempts", 5346170L};
public static final Object[] EVENT_CATEGORIZATION_ATTEMPT = {"MobileAppCategorizationAttempts", 5359208L};
public static final String DEFAULT_EDIT_SUMMARY = "Uploaded using Android Commons app";
public static final String FEEDBACK_EMAIL = "commons-app-android@googlegroups.com";
@ -94,7 +93,6 @@ public class CommonsApplication extends Application {
System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0");
api = createMWApi();
ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(getApplicationContext())
.discCache(new TotalSizeLimitedDiscCache(StorageUtils.getCacheDirectory(this), 128 * 1024 * 1024))
.build();
@ -111,7 +109,6 @@ public class CommonsApplication extends Application {
// Initialize EventLogging
EventLog.setApp(this);
// based off https://developer.android.com/training/displaying-bitmaps/cache-bitmap.html
// Cache for 1/8th of available VM memory
long maxMem = Runtime.getRuntime().maxMemory();

View file

@ -24,7 +24,6 @@ public class EventLog {
for(LogBuilder logBuilder: logBuilders) {
HttpURLConnection conn;
try {
URL url = logBuilder.toUrl();
HttpResponse response = Http.get(url.toString()).use(CommonsApplication.createHttpClient()).asResponse();
@ -37,7 +36,6 @@ public class EventLog {
// Probably just ignore for now. Can be much more robust with a service, etc later on.
Log.d("Commons", "IO Error, EventLog hit skipped");
}
}
return allSuccess;

View file

@ -32,7 +32,6 @@ public abstract class HandlerService<T> extends Service {
public HandlerService getService() {
return HandlerService.this;
}
}
private final IBinder localBinder = new HandlerServiceLocalBinder();

View file

@ -28,7 +28,6 @@ public class LicenseList {
fr.free.nrw.commons.License license = new fr.free.nrw.commons.License(id, template, url, name);
licenses.put(id, license);
}
}
public Set<String> keySet() {

View file

@ -143,10 +143,7 @@ public class Media implements Parcelable {
protected int width;
protected int height;
protected String license;
protected String creator;
protected ArrayList<String> categories; // as loaded at runtime?
protected Map<String, String> descriptions; // multilingual descriptions as loaded

View file

@ -30,7 +30,6 @@ import com.android.volley.toolbox.ImageLoader.ImageListener;
import fr.free.nrw.commons.contributions.Contribution;
import fr.free.nrw.commons.contributions.ContributionsContentProvider;
public class MediaWikiImageView extends ImageView {
private Media mMedia;
@ -89,7 +88,6 @@ public class MediaWikiImageView extends ImageView {
return;
}
// Do not count for density when loading thumbnails.
// FIXME: Use another 'algorithm' that doesn't punish low res devices
if(isThumbnail) {
@ -160,7 +158,6 @@ public class MediaWikiImageView extends ImageView {
}
});
}
}
@Override

View file

@ -6,7 +6,6 @@ public class Prefs {
public static String TRACKING_ENABLED = "eventLogging";
public static final String DEFAULT_LICENSE = "defaultLicense";
public static class Licenses {
public static final String CC_BY_SA = "CC BY-SA";
public static final String CC_BY = "CC BY";

View file

@ -55,7 +55,6 @@ public class Utils {
return String.format("%s/%s/%s/%s", CommonsApplication.IMAGE_URL_BASE, sha.substring(0, 1), sha.substring(0, 2), urlEncode(name));
}
public static String getStringFromDOM(Node dom) {
javax.xml.transform.Transformer transformer = null;
try {
@ -102,7 +101,6 @@ public class Utils {
}
}
private static DisplayImageOptions.Builder defaultImageOptionsBuilder;
public static DisplayImageOptions.Builder getGenericDisplayOptions() {
if(defaultImageOptionsBuilder == null) {

View file

@ -13,7 +13,6 @@ import fr.free.nrw.commons.Utils;
public abstract class AuthenticatedActivity extends AppCompatActivity {
String accountType;
CommonsApplication app;
@ -23,7 +22,6 @@ public abstract class AuthenticatedActivity extends AppCompatActivity {
this.accountType = accountType;
}
private class GetAuthCookieTask extends AsyncTask<Void, String, String> {
private Account account;
private AccountManager accountManager;
@ -60,7 +58,6 @@ public abstract class AuthenticatedActivity extends AppCompatActivity {
}
}
private class AddAccountTask extends AsyncTask<Void, String, String> {
private AccountManager accountManager;
public AddAccountTask(AccountManager accountManager) {
@ -106,6 +103,7 @@ public abstract class AuthenticatedActivity extends AppCompatActivity {
}
}
protected void requestAuthToken() {
if(authCookie != null) {
onAuthCookieAcquired(authCookie);

View file

@ -627,8 +627,6 @@ public class CategorizationFragment extends Fragment {
return super.onOptionsItemSelected(menuItem);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);

View file

@ -104,7 +104,6 @@ public class Category {
COLUMN_TIMES_USED
};
private static final String CREATE_TABLE_STATEMENT = "CREATE TABLE " + TABLE_NAME + " ("
+ COLUMN_ID + " INTEGER PRIMARY KEY,"
+ COLUMN_NAME + " STRING,"
@ -112,7 +111,6 @@ public class Category {
+ COLUMN_TIMES_USED + " INTEGER"
+ ");";
public static void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_STATEMENT);
}

View file

@ -29,7 +29,6 @@ public class CategoryContentProvider extends ContentProvider {
uriMatcher.addURI(AUTHORITY, BASE_PATH + "/#", CATEGORIES_ID);
}
public static Uri uriForId(int id) {
return Uri.parse(BASE_URI.toString() + "/" + id);
}

View file

@ -90,7 +90,6 @@ public class Contribution extends Media {
state = in.readInt();
transferred = in.readLong();
isMultiple = in.readInt() == 1;
}
public long getTransferred() {
@ -101,7 +100,6 @@ public class Contribution extends Media {
this.transferred = transferred;
}
public String getEditSummary() {
return editSummary != null ? editSummary : CommonsApplication.DEFAULT_EDIT_SUMMARY;
}
@ -267,7 +265,6 @@ public class Contribution extends Media {
this.localUri = localUri;
}
public static class Table {
public static final String TABLE_NAME = "contributions";

View file

@ -57,7 +57,6 @@ public class ContributionsActivity
*/
private String CONTRIBUTION_SORT = Contribution.Table.COLUMN_STATE + " DESC, " + Contribution.Table.COLUMN_UPLOADED + " DESC , (" + Contribution.Table.COLUMN_TIMESTAMP + " * " + Contribution.Table.COLUMN_STATE + ")";
public ContributionsActivity() {
super(WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE);
}
@ -191,7 +190,6 @@ public class ContributionsActivity
finish(); // If authentication failed, we just exit
}
public void onItemClick(AdapterView<?> adapterView, View view, int position, long item) {
showDetail(position);
}
@ -218,13 +216,10 @@ public class ContributionsActivity
contributionsList.clearSyncMessage();
notifyAndMigrateDataSetObservers();
}
public void onLoaderReset(Loader cursorLoader) {
((CursorAdapter) contributionsList.getAdapter()).swapCursor(null);
}
//FIXME: Potential cause of wrong image display bug

View file

@ -26,7 +26,6 @@ public class ContributionsContentProvider extends ContentProvider{
uriMatcher.addURI(AUTHORITY, BASE_PATH + "/#", CONTRIBUTIONS_ID);
}
public static Uri uriForId(int id) {
return Uri.parse(BASE_URI.toString() + "/" + id);
}

View file

@ -19,7 +19,6 @@ import fr.free.nrw.commons.R;
class ContributionsListAdapter extends CursorAdapter {
private DisplayImageOptions contributionDisplayOptions = Utils.getGenericDisplayOptions().build();
private Activity activity;
@ -111,6 +110,5 @@ class ContributionsListAdapter extends CursorAdapter {
views.progressView.setVisibility(View.GONE);
break;
}
}
}

View file

@ -108,7 +108,6 @@ public class ContributionsListFragment extends Fragment {
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
@ -210,7 +209,6 @@ public class ContributionsListFragment extends Fragment {
}
menu.findItem(R.id.menu_refresh).setVisible(false);
}
@Override

View file

@ -15,7 +15,6 @@ import org.mediawiki.api.*;
import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.Utils;
public class ContributionsSyncAdapter extends AbstractThreadedSyncAdapter {
private static int COMMIT_THRESHOLD = 10;
public ContributionsSyncAdapter(Context context, boolean autoInitialize) {
@ -122,7 +121,5 @@ public class ContributionsSyncAdapter extends AbstractThreadedSyncAdapter {
}
prefs.edit().putString("lastSyncTimestamp", Utils.toMWDate(curTime)).apply();
Log.d("Commons", "Oh hai, everyone! Look, a kitty!");
}
}

View file

@ -82,7 +82,6 @@ public class MediaDetailFragment extends Fragment {
private AsyncTask<Void,Void,Boolean> detailFetchTask;
private LicenseList licenseList;
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
@ -175,7 +174,6 @@ public class MediaDetailFragment extends Fragment {
scrollView.scrollTo(0, initialListTop);
}
}
};
view.getViewTreeObserver().addOnGlobalLayoutListener(layoutListener);

View file

@ -269,7 +269,6 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
// Default set of menu items works fine. Treat same as regular media object
break;
}
}
return;
}

View file

@ -6,7 +6,6 @@ import org.json.JSONObject;
public class CategoryModifier extends PageModifier {
public static String PARAM_CATEGORIES = "categories";
public static String MODIFIER_NAME = "CategoriesModifier";

View file

@ -26,7 +26,6 @@ public class ModificationsContentProvider extends ContentProvider{
uriMatcher.addURI(AUTHORITY, BASE_PATH + "/#", MODIFICATIONS_ID);
}
public static Uri uriForId(int id) {
return Uri.parse(BASE_URI.toString() + "/" + id);
}

View file

@ -18,7 +18,6 @@ import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.contributions.ContributionsContentProvider;
public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
public ModificationsSyncAdapter(Context context, boolean autoInitialize) {
@ -66,7 +65,6 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
return;
}
allModifications.moveToFirst();
Log.d("Commons", "Found " + allModifications.getCount() + " modifications to execute");
@ -129,13 +127,11 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
}
}
allModifications.moveToNext();
}
} finally {
if(contributionsClient != null) {
contributionsClient.release();
}
}
}
}

View file

@ -127,14 +127,12 @@ public class ModifierSequence {
COLUMN_DATA
};
private static final String CREATE_TABLE_STATEMENT = "CREATE TABLE " + TABLE_NAME + " ("
+ "_id INTEGER PRIMARY KEY,"
+ "mediauri STRING,"
+ "data STRING"
+ ");";
public static void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_STATEMENT);
}

View file

@ -15,7 +15,6 @@ public class TemplateRemoveModifier extends PageModifier {
public static final Pattern PATTERN_TEMPLATE_OPEN = Pattern.compile("\\{\\{");
public static final Pattern PATTERN_TEMPLATE_CLOSE = Pattern.compile("\\}\\}");
public TemplateRemoveModifier(String templateName) {
super(MODIFIER_NAME);
try {
@ -86,7 +85,6 @@ public class TemplateRemoveModifier extends PageModifier {
}
return pageContents;
}
@Override

View file

@ -354,7 +354,6 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
return distanceRadians(Math.toRadians(from.latitude), Math.toRadians(from.longitude), Math.toRadians(to.latitude), Math.toRadians(to.longitude));
}
private static double distanceRadians(double lat1, double lng1, double lat2, double lng2) {
return arcHav(havDistance(lat1, lat2, lng1 - lng2));
}

View file

@ -26,7 +26,6 @@ public class NearbyPlaces {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
URL file = new URL("https://tools.wmflabs.org/wiki-needs-pictures/data/data.csv");
BufferedReader in = new BufferedReader(new InputStreamReader(file.openStream()));

View file

@ -78,7 +78,6 @@ public class MultipleShareActivity
public void onItemClick(AdapterView<?> adapterView, View view, int index, long item) {
showDetail(index);
}
public void OnMultipleUploadInitiated() {
@ -201,10 +200,8 @@ public class MultipleShareActivity
getSupportFragmentManager().addOnBackStackChangedListener(this);
requestAuthToken();
}
@Override
protected void onDestroy() {
super.onDestroy();
@ -262,10 +259,8 @@ public class MultipleShareActivity
setTitle(getResources().getQuantityString(R.plurals.multiple_uploads_title, photosList.size(), photosList.size()));
uploadController.prepareService();
}
}
@Override
protected void onAuthFailure() {
Toast failureToast = Toast.makeText(this, R.string.authentication_failed, Toast.LENGTH_LONG);

View file

@ -92,7 +92,6 @@ public class MultipleUploadListFragment extends Fragment {
}
return view;
}
}
@ -117,8 +116,8 @@ public class MultipleUploadListFragment extends Fragment {
int picWidth = Math.min((int) Math.sqrt(screenWidth * screenHeight / count), screenWidth);
picWidth = Math.min((int)(192 * screenMetrics.density), Math.max((int) (120 * screenMetrics.density), picWidth / 48 * 48));
int picHeight = Math.min(picWidth, (int)(192 * screenMetrics.density)); // Max Height is same as Contributions list
return new Point(picWidth, picHeight);
return new Point(picWidth, picHeight);
}
public void notifyDatasetChanged() {
@ -144,7 +143,6 @@ public class MultipleUploadListFragment extends Fragment {
photosGrid = (GridView)view.findViewById(R.id.multipleShareBackground);
baseTitle = (EditText)view.findViewById(R.id.multipleBaseTitle);
photosAdapter = new PhotoDisplayAdapter();
photosGrid.setAdapter(photosAdapter);
photosGrid.setOnItemClickListener((AdapterView.OnItemClickListener)getActivity());
@ -169,7 +167,6 @@ public class MultipleUploadListFragment extends Fragment {
}
}
detailProvider.notifyDatasetChanged();
}
public void afterTextChanged(Editable editable) {
@ -208,5 +205,4 @@ public class MultipleUploadListFragment extends Fragment {
setHasOptionsMenu(true);
}
}

View file

@ -241,8 +241,8 @@ public class ShareActivity
if(savedInstanceState != null) {
contribution = savedInstanceState.getParcelable("contribution");
}
requestAuthToken();
requestAuthToken();
Log.d(TAG, "Uri: " + mediaUriString);
Log.d(TAG, "Ext storage dir: " + Environment.getExternalStorageDirectory());

View file

@ -133,7 +133,6 @@ public class SingleUploadFragment extends Fragment {
return rootView;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);

View file

@ -79,7 +79,6 @@ public class UploadController {
public void startUpload(final Contribution contribution, final ContributionUploadProgress onComplete) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
if(TextUtils.isEmpty(contribution.getCreator())) {
@ -93,7 +92,6 @@ public class UploadController {
String license = prefs.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA);
contribution.setLicense(license);
//FIXME: Add permission request here. Only executeAsyncTask if permission has been granted
Utils.executeAsyncTask(new AsyncTask<Void, Void, Contribution>() {

View file

@ -146,7 +146,6 @@ public class UploadService extends HandlerService<Contribution> {
default:
throw new IllegalArgumentException("Unknown value for what");
}
}
private boolean freshStart = true;
@ -235,7 +234,6 @@ public class UploadService extends HandlerService<Contribution> {
curProgressNotification = null;
String resultStatus = result.getString("/api/upload/@result");
if(!resultStatus.equals("Success")) {
String errorCode = result.getString("/api/error/@code");
@ -281,7 +279,6 @@ public class UploadService extends HandlerService<Contribution> {
stopForeground(true);
}
}
}
private void showFailedNotification(Contribution contribution) {