Skip to content

Commit

Permalink
Fix lint issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrant committed May 26, 2017
1 parent de1a314 commit 8656098
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
if(contributionsList.getAdapter() == null) {
contributionsList.setAdapter(new ContributionsListAdapter(getApplicationContext(), cursor, 0));
contributionsList
.setAdapter(new ContributionsListAdapter(getApplicationContext(), cursor, 0));
} else {
((CursorAdapter)contributionsList.getAdapter()).swapCursor(cursor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public ContributionsListAdapter(Context context, Cursor c, int flags) {

@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
View parent = LayoutInflater.from(context).inflate(R.layout.layout_contribution, viewGroup, false);
View parent = LayoutInflater.from(context)
.inflate(R.layout.layout_contribution, viewGroup, false);
parent.setTag(new ContributionViewHolder(parent));
return parent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class GPSExtractor {
private LocationManager locationManager;


public GPSExtractor(String filePath){
public GPSExtractor(String filePath) {
this.filePath = filePath;
}

Expand All @@ -41,7 +41,8 @@ public GPSExtractor(String filePath){
* @return true if enabled, false if disabled
*/
private boolean gpsPreferenceEnabled() {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(CommonsApplication.getInstance());
SharedPreferences sharedPref
= PreferenceManager.getDefaultSharedPreferences(CommonsApplication.getInstance());
boolean gpsPref = sharedPref.getBoolean("allowGps", false);
Timber.d("Gps pref set to: %b", gpsPref);
return gpsPref;
Expand All @@ -51,7 +52,8 @@ private boolean gpsPreferenceEnabled() {
* Registers a LocationManager to listen for current location
*/
protected void registerLocationManager() {
locationManager = (LocationManager) CommonsApplication.getInstance().getSystemService(Context.LOCATION_SERVICE);
locationManager = (LocationManager) CommonsApplication.getInstance()
.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = locationManager.getBestProvider(criteria, true);
myLocationListener = new MyLocationListener();
Expand Down
11 changes: 5 additions & 6 deletions app/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public class ShareActivity

private UploadController uploadController;

private CommonsApplication cacheObj;
private boolean cacheFound;

private GPSExtractor imageObj;
Expand Down Expand Up @@ -195,11 +194,11 @@ protected void onAuthCookieAcquired(String authCookie) {
SingleUploadFragment shareView = (SingleUploadFragment) getSupportFragmentManager().findFragmentByTag("shareView");
categorizationFragment = (CategorizationFragment) getSupportFragmentManager().findFragmentByTag("categorization");
if(shareView == null && categorizationFragment == null) {
shareView = new SingleUploadFragment();
getSupportFragmentManager()
.beginTransaction()
.add(R.id.single_upload_fragment_container, shareView, "shareView")
.commitAllowingStateLoss();
shareView = new SingleUploadFragment();
getSupportFragmentManager()
.beginTransaction()
.add(R.id.single_upload_fragment_container, shareView, "shareView")
.commitAllowingStateLoss();
}
uploadController.prepareService();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,13 @@ protected Contribution doInBackground(Void... voids /* stare into you */) {
long length;
try {
if(contribution.getDataLength() <= 0) {
length = app.getContentResolver().openAssetFileDescriptor(contribution.getLocalUri(), "r").getLength();
length = app.getContentResolver()
.openAssetFileDescriptor(contribution.getLocalUri(), "r")
.getLength();
if(length == -1) {
// Let us find out the long way!
length = Utils.countBytes(app.getContentResolver().openInputStream(contribution.getLocalUri()));
length = Utils.countBytes(app.getContentResolver()
.openInputStream(contribution.getLocalUri()));
}
contribution.setDataLength(length);
}
Expand Down

0 comments on commit 8656098

Please sign in to comment.