mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Fix lint issues.
This commit is contained in:
parent
de1a3144cc
commit
8656098dc5
5 changed files with 19 additions and 13 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue