@@ -85,8 +85,7 @@ public static AbstractHttpClient createHttpClient() {
85
85
schemeRegistry .register (new Scheme ("https" , sslSocketFactory , 443 ));
86
86
ClientConnectionManager cm = new ThreadSafeClientConnManager (params , schemeRegistry );
87
87
params .setParameter (CoreProtocolPNames .USER_AGENT , "Commons/" + APPLICATION_VERSION + " (https://mediawiki.org/wiki/Apps/Commons) Android/" + Build .VERSION .RELEASE );
88
- DefaultHttpClient httpclient = new DefaultHttpClient (cm , params );
89
- return httpclient ;
88
+ return new DefaultHttpClient (cm , params );
90
89
}
91
90
92
91
public static MWApi createMWApi () {
@@ -95,8 +94,8 @@ public static MWApi createMWApi() {
95
94
96
95
@ Override
97
96
public void onCreate () {
98
- ACRA .init (this );
99
97
super .onCreate ();
98
+ ACRA .init (this );
100
99
// Fire progress callbacks for every 3% of uploaded content
101
100
System .setProperty ("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD" , "3.0" );
102
101
api = createMWApi ();
@@ -130,15 +129,10 @@ public void onCreate() {
130
129
imageCache = new LruCache <String , Bitmap >(cacheSize ) {
131
130
@ Override
132
131
protected int sizeOf (String key , Bitmap bitmap ) {
133
- // bitmap.getByteCount() not available on older androids
134
132
int bitmapSize ;
135
- if (Build .VERSION .SDK_INT < Build .VERSION_CODES .HONEYCOMB_MR1 ) {
136
- bitmapSize = bitmap .getRowBytes () * bitmap .getHeight ();
137
- } else {
138
- bitmapSize = bitmap .getByteCount ();
139
- }
140
- // The cache size will be measured in kilobytes rather than
141
- // number of items.
133
+ bitmapSize = bitmap .getByteCount ();
134
+
135
+ // The cache size will be measured in kilobytes rather than number of items.
142
136
return bitmapSize / 1024 ;
143
137
}
144
138
};
0 commit comments