disable transitioner in offline mode (broken)

fix androidhttpclient leaks introduced with previous patch
This commit is contained in:
Andrew Dolgov 2012-05-02 08:35:53 +04:00
parent dd95973d2d
commit 835ec51811
4 changed files with 20 additions and 2 deletions

View File

@ -6,5 +6,6 @@
<classpathentry kind="lib" path="C:/Users/fox/workspace/org.fox.ttrss/libs/gson-1.7.1.jar"/>
<classpathentry kind="lib" path="C:/Users/fox/workspace/org.fox.ttrss/libs/jsoup-1.6.1.jar"/>
<classpathentry kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -12,18 +12,24 @@ import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.protocol.ClientContext;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.http.AndroidHttpClient;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.util.Log;
@ -189,6 +195,8 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
m_apiStatusCode = resultObj.get("status").getAsInt();
client.close();
switch (m_apiStatusCode) {
case API_STATUS_OK:
return result.getAsJsonObject().get("content");
@ -210,6 +218,8 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, Integer, JsonE
}
}
client.close();
return null;
case 401:
m_lastError = ApiError.HTTP_UNAUTHORIZED;

View File

@ -18,14 +18,19 @@ import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.protocol.ClientContext;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import android.app.Activity;
import android.content.Context;
@ -33,6 +38,7 @@ import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.http.AndroidHttpClient;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
@ -538,10 +544,11 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
fos.close();
is.close();
client.close();
} catch (Exception e) {
e.printStackTrace();
}
}
protected void onPostExecute(Integer result) {

View File

@ -133,7 +133,7 @@ public class OfflineActivity extends FragmentActivity implements
Log.d(TAG, "m_compatMode=" + m_compatMode);
if (!m_compatMode) {
if (android.os.Build.VERSION.SDK_INT < 14 || android.os.Build.VERSION.SDK_INT == 15) {
if (android.os.Build.VERSION.SDK_INT < 14 /* || android.os.Build.VERSION.SDK_INT == 15 */) {
if (!m_smallScreenMode) {
LayoutTransition transitioner = new LayoutTransition();
((ViewGroup) findViewById(R.id.main)).setLayoutTransition(transitioner);