Fix lint issues.

This commit is contained in:
Dmitry Brant 2017-05-26 16:41:38 -04:00
parent de1a3144cc
commit 8656098dc5
5 changed files with 19 additions and 13 deletions

View file

@ -228,7 +228,8 @@ public class ContributionsActivity
@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);
}

View file

@ -17,7 +17,8 @@ class ContributionsListAdapter extends CursorAdapter {
@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;
}

View file

@ -32,7 +32,7 @@ public class GPSExtractor {
private LocationManager locationManager;
public GPSExtractor(String filePath){
public GPSExtractor(String filePath) {
this.filePath = filePath;
}
@ -41,7 +41,8 @@ public class GPSExtractor {
* @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;
@ -51,7 +52,8 @@ public class GPSExtractor {
* 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();

View file

@ -60,7 +60,6 @@ public class ShareActivity
private UploadController uploadController;
private CommonsApplication cacheObj;
private boolean cacheFound;
private GPSExtractor imageObj;
@ -195,11 +194,11 @@ public class ShareActivity
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();
}

View file

@ -103,10 +103,13 @@ public class UploadController {
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);
}