Correction de quelques bugs avec le offline

This commit is contained in:
GAULUPEAU Jonathan 2014-01-06 20:25:36 +01:00
parent 7b0f1e2200
commit c4636fbb25
4 changed files with 24 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="fr.gaulupeau.apps.InThePoche"
android:versionCode="6"
android:versionName="1.5.3" xmlns:android="http://schemas.android.com/apk/res/android">
android:versionCode="7"
android:versionName="@string/version" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"/>

View File

@ -89,6 +89,14 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/btnDone" />
<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/version"
android:textSize="12sp" />
<TextView
android:id="@+id/author"

View File

@ -23,4 +23,5 @@
<string name="txtGlobalToken"><b><u>API global token :</u></b></string>
<string name="txtAPIUsername"><b><u>Your username ID (user_id in Feed URL):</u></b></string>
<string name="txtAPIToken"><b><u>Your token (token in Feed URL):</u></b></string>
<string name="version">1.5.3.1</string>
</resources>

View File

@ -352,9 +352,19 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_SYNC;
// Set the url (you will need to change this to your RSS URL
url = new URL(pocheUrl + "/?feed&type=home&user_id=" + apiUsername + "&token=" + apiToken );
// Setup the connection
trustEveryone();
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK)
HttpsURLConnection conn_s = null;
HttpURLConnection conn = null;
if (pocheUrl.startsWith("https") ) {
trustEveryone();
conn_s = (HttpsURLConnection) url.openConnection();
}else{
conn = (HttpURLConnection) url.openConnection();
}
if (
((conn != null) && (conn.getResponseCode() == HttpURLConnection.HTTP_OK))
|| ((conn_s != null) && (conn_s.getResponseCode() == HttpURLConnection.HTTP_OK))
)
{
// Retreive the XML from the URL