mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	Fix Codacy Issues + remove unused patch
This commit is contained in:
		
							parent
							
								
									2e5fdf44ed
								
							
						
					
					
						commit
						ea43e1a796
					
				
					 8 changed files with 18 additions and 46 deletions
				
			
		|  | @ -85,8 +85,7 @@ public class CommonsApplication extends Application { | |||
|         schemeRegistry.register(new Scheme("https", sslSocketFactory, 443)); | ||||
|         ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry); | ||||
|         params.setParameter(CoreProtocolPNames.USER_AGENT, "Commons/" + APPLICATION_VERSION + " (https://mediawiki.org/wiki/Apps/Commons) Android/" + Build.VERSION.RELEASE); | ||||
|         DefaultHttpClient httpclient = new DefaultHttpClient(cm, params); | ||||
|         return httpclient; | ||||
|         return new DefaultHttpClient(cm, params); | ||||
|     } | ||||
| 
 | ||||
|     public static MWApi createMWApi() { | ||||
|  | @ -95,8 +94,8 @@ public class CommonsApplication extends Application { | |||
| 
 | ||||
|     @Override | ||||
|     public void onCreate() { | ||||
|         ACRA.init(this); | ||||
|         super.onCreate(); | ||||
|         ACRA.init(this); | ||||
|         // Fire progress callbacks for every 3% of uploaded content | ||||
|         System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0"); | ||||
|         api = createMWApi(); | ||||
|  | @ -130,15 +129,10 @@ public class CommonsApplication extends Application { | |||
|             imageCache = new LruCache<String, Bitmap>(cacheSize) { | ||||
|                 @Override | ||||
|                 protected int sizeOf(String key, Bitmap bitmap) { | ||||
|                     // bitmap.getByteCount() not available on older androids | ||||
|                     int bitmapSize; | ||||
|                     if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) { | ||||
|                         bitmapSize = bitmap.getRowBytes() * bitmap.getHeight(); | ||||
|                     } else { | ||||
|                         bitmapSize = bitmap.getByteCount(); | ||||
|                     } | ||||
|                     // The cache size will be measured in kilobytes rather than | ||||
|                     // number of items. | ||||
|                     bitmapSize = bitmap.getByteCount(); | ||||
| 
 | ||||
|                     // The cache size will be measured in kilobytes rather than number of items. | ||||
|                     return bitmapSize / 1024; | ||||
|                 } | ||||
|             }; | ||||
|  |  | |||
|  | @ -29,8 +29,8 @@ public abstract class HandlerService<T> extends Service { | |||
| 
 | ||||
|     @Override | ||||
|     public void onDestroy() { | ||||
|         super.onDestroy(); | ||||
|         threadLooper.quit(); | ||||
|         super.onDestroy(); | ||||
|     } | ||||
| 
 | ||||
|     public class HandlerServiceLocalBinder extends Binder { | ||||
|  |  | |||
|  | @ -225,17 +225,15 @@ public class MediaDataExtractor { | |||
|                 NodeList childNodes = node.getChildNodes(); | ||||
|                 for (int j = 0, childNodesLength = childNodes.getLength(); j < childNodesLength; j++) { | ||||
|                     Node childNode = childNodes.item(j); | ||||
|                     if (childNode.getNodeName().equals("name")) { | ||||
|                         if (comparator.match(childNode)) { | ||||
|                             // yay! Now fetch the value node. | ||||
|                             for (int k = j + 1; k < childNodesLength; k++) { | ||||
|                                 Node siblingNode = childNodes.item(k); | ||||
|                                 if (siblingNode.getNodeName().equals("value")) { | ||||
|                                     return siblingNode; | ||||
|                                 } | ||||
|                     if (childNode.getNodeName().equals("name") && comparator.match(childNode)) { | ||||
|                         // yay! Now fetch the value node. | ||||
|                         for (int k = j + 1; k < childNodesLength; k++) { | ||||
|                             Node siblingNode = childNodes.item(k); | ||||
|                             if (siblingNode.getNodeName().equals("value")) { | ||||
|                                 return siblingNode; | ||||
|                             } | ||||
|                             throw new IOException("No value node found for matched template parameter."); | ||||
|                         } | ||||
|                         throw new IOException("No value node found for matched template parameter."); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  |  | |||
|  | @ -12,6 +12,7 @@ public class ContributionsSyncService extends Service { | |||
| 
 | ||||
|     @Override | ||||
|     public void onCreate() { | ||||
|         super.onCreate(); | ||||
|         synchronized (sSyncAdapterLock) { | ||||
|             if (sSyncAdapter == null) { | ||||
|                 sSyncAdapter = new ContributionsSyncAdapter(getApplicationContext(), true); | ||||
|  |  | |||
|  | @ -12,6 +12,7 @@ public class ModificationsSyncService extends Service { | |||
| 
 | ||||
|     @Override | ||||
|     public void onCreate() { | ||||
|         super.onCreate(); | ||||
|         synchronized (sSyncAdapterLock) { | ||||
|             if (sSyncAdapter == null) { | ||||
|                 sSyncAdapter = new ModificationsSyncAdapter(getApplicationContext(), true); | ||||
|  |  | |||
|  | @ -109,10 +109,8 @@ public  class       MultipleShareActivity | |||
| 
 | ||||
|     @Override | ||||
|     public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { | ||||
|         if (requestCode == 1) { | ||||
|             if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | ||||
|                 multipleUploadBegins(); | ||||
|             } | ||||
|         if (requestCode == 1 && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | ||||
|             multipleUploadBegins(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Adam Jones
						Adam Jones