mirror of
https://github.com/moparisthebest/android-app
synced 2024-11-15 05:15:04 -05:00
parent
c4636fbb25
commit
30634ae224
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="fr.gaulupeau.apps.InThePoche"
|
||||
android:versionCode="7"
|
||||
android:versionCode="8"
|
||||
android:versionName="@string/version" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-sdk android:minSdkVersion="8"
|
||||
android:targetSdkVersion="8" />
|
||||
|
@ -23,5 +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>
|
||||
<string name="version">1.5.3.2</string>
|
||||
</resources>
|
||||
|
@ -15,6 +15,7 @@ public class ArticlesSQLiteOpenHelper extends SQLiteOpenHelper {
|
||||
public static final String DB_NAME = "article_db.sqlite";
|
||||
public static String MY_ID = "my_id";
|
||||
public static String ARTICLE_TABLE = "article";
|
||||
public static String ARTICLE_DATE = "update_date";
|
||||
public static String ARTICLE_ID = "article_id";
|
||||
public static String ARTICLE_AUTHOR = "author";
|
||||
public static String ARTICLE_CONTENT = "content";
|
||||
@ -57,6 +58,7 @@ public class ArticlesSQLiteOpenHelper extends SQLiteOpenHelper {
|
||||
"create table " + ARTICLE_TABLE + " (" +
|
||||
MY_ID + " integer primary key autoincrement not null, " +
|
||||
ARTICLE_AUTHOR + " text, " +
|
||||
ARTICLE_DATE + " datetime, " +
|
||||
ARTICLE_CONTENT + " text, " +
|
||||
ARTICLE_TITLE + " text, " +
|
||||
ARTICLE_URL + " text, " +
|
||||
|
@ -94,7 +94,7 @@ public class ListArticles extends Activity {
|
||||
Cursor ac = database.query(
|
||||
ARTICLE_TABLE,
|
||||
getStrColumns,
|
||||
filter, null, null, null, null);
|
||||
filter, null, null, null, ARTICLE_DATE + " DESC");
|
||||
ac.moveToFirst();
|
||||
if(!ac.isAfterLast()) {
|
||||
do {
|
||||
|
@ -19,6 +19,8 @@ import java.net.URL;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
@ -45,6 +47,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteConstraintException;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
@ -68,6 +71,7 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_TITLE;
|
||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_CONTENT;
|
||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARCHIVE;
|
||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_SYNC;
|
||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
|
||||
|
||||
|
||||
|
||||
@ -392,6 +396,7 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_SYNC;
|
||||
arrays.PodcastURL = new String[itemLst.getLength()];
|
||||
arrays.PodcastContent = new String[itemLst.getLength()];
|
||||
arrays.PodcastMedia = new String[itemLst.getLength()];
|
||||
arrays.PodcastDate = new String[itemLst.getLength()];
|
||||
|
||||
// Loop through the XML passing the data to the arrays
|
||||
for (int i = 0; i < itemLst.getLength(); i++)
|
||||
@ -407,6 +412,7 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_SYNC;
|
||||
// and remove elements that you want / don't want
|
||||
NodeList title = ielem.getElementsByTagName("title");
|
||||
NodeList link = ielem.getElementsByTagName("link");
|
||||
NodeList date = ielem.getElementsByTagName("pubDate");
|
||||
NodeList content = ielem
|
||||
.getElementsByTagName("description");
|
||||
//NodeList media = ielem
|
||||
@ -429,7 +435,12 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_SYNC;
|
||||
e.printStackTrace();
|
||||
arrays.PodcastTitle[i] = "Echec";
|
||||
}
|
||||
|
||||
try {
|
||||
arrays.PodcastDate[i] = date.item(0).getChildNodes().item(0).getNodeValue();
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
arrays.PodcastDate[i] = null;
|
||||
}
|
||||
try
|
||||
{
|
||||
arrays.PodcastURL[i] = link.item(0).getChildNodes()
|
||||
@ -454,13 +465,17 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_SYNC;
|
||||
values.put(ARTICLE_CONTENT, Html.fromHtml(arrays.PodcastContent[i]).toString());
|
||||
//values.put(ARTICLE_ID, Html.fromHtml(article.getString("id")).toString());
|
||||
values.put(ARTICLE_URL, Html.fromHtml(arrays.PodcastURL[i]).toString());
|
||||
values.put(ARTICLE_DATE, arrays.PodcastDate[i]);
|
||||
values.put(ARCHIVE, 0);
|
||||
values.put(ARTICLE_SYNC, 0);
|
||||
try {
|
||||
database.insertOrThrow(ARTICLE_TABLE, null, values);
|
||||
} catch (SQLiteConstraintException e) {
|
||||
continue;
|
||||
}
|
||||
} catch (SQLiteException e) {
|
||||
database.execSQL("ALTER TABLE " + ARTICLE_TABLE + " ADD COLUMN " + ARTICLE_DATE + " datetime;");
|
||||
database.insertOrThrow(ARTICLE_TABLE, null, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,7 @@ public class ReadArticle extends Activity {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(ARCHIVE, 1);
|
||||
database.update(ARTICLE_TABLE, values, MY_ID + "=" + id, null);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -5,4 +5,5 @@ public class arrays {
|
||||
public static String[] PodcastURL;
|
||||
public static String[] PodcastContent;
|
||||
public static String[] PodcastMedia;
|
||||
public static String[] PodcastDate;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user