mirror of
https://github.com/moparisthebest/android-app
synced 2024-11-15 05:15:04 -05:00
Merge pull request #47 from kevmeyer/rss-feed
Updating ActionBarTheme, added error messages
This commit is contained in:
commit
ba95bea59a
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,5 +10,4 @@ gen/
|
|||||||
.idea/
|
.idea/
|
||||||
.gradle/
|
.gradle/
|
||||||
build/
|
build/
|
||||||
gradle/
|
|
||||||
local.properties
|
local.properties
|
||||||
|
26
.travis.yml
Normal file
26
.travis.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
language: android
|
||||||
|
android:
|
||||||
|
components:
|
||||||
|
# Uncomment the lines below if you want to
|
||||||
|
# use the latest revision of Android SDK Tools
|
||||||
|
- platform-tools
|
||||||
|
- tools
|
||||||
|
|
||||||
|
# The BuildTools version used by your project
|
||||||
|
- build-tools-21.0.0
|
||||||
|
|
||||||
|
# The SDK version used to compile your project
|
||||||
|
- android-21
|
||||||
|
|
||||||
|
# Additional components
|
||||||
|
# - extra-google-google_play_services
|
||||||
|
# - extra-google-m2repository
|
||||||
|
# - extra-android-m2repository
|
||||||
|
# - addon-google_apis-google-19
|
||||||
|
|
||||||
|
# Specify at least one system image,
|
||||||
|
# if you need to run emulator(s) during your tests
|
||||||
|
# - sys-img-armeabi-v7a-android-19
|
||||||
|
# - sys-img-x86-android-17
|
||||||
|
|
||||||
|
script: ./gradlew build check
|
@ -1,3 +1,5 @@
|
|||||||
|
# wallabag - Android App [![Build Status](https://travis-ci.org/wallabag/android-app.svg?branch=rss-feed)](https://travis-ci.org/wallabag/android-app)
|
||||||
|
|
||||||
wallabag app for Android, originally written by Jonathan GAULUPEAU <jo.gaulupeau-at-gmail.com>
|
wallabag app for Android, originally written by Jonathan GAULUPEAU <jo.gaulupeau-at-gmail.com>
|
||||||
|
|
||||||
Android application to add post to wallabag <https://www.wallabag.org>
|
Android application to add post to wallabag <https://www.wallabag.org>
|
15
app/app.iml
15
app/app.iml
@ -13,6 +13,7 @@
|
|||||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
|
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
|
||||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||||
|
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
||||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||||
@ -37,22 +38,22 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||||
@ -77,11 +78,11 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Android API 20 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="appcompat-v7-20.0.0" level="project" />
|
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-annotations-20.0.0" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-v4-20.0.0" level="project" />
|
<orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 20
|
compileSdkVersion 21
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '21'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "fr.gaulupeau.apps.InThePoche"
|
applicationId "fr.gaulupeau.apps.InThePoche"
|
||||||
minSdkVersion 8
|
minSdkVersion 8
|
||||||
targetSdkVersion 20
|
targetSdkVersion 21
|
||||||
versionCode 9
|
versionCode 9
|
||||||
versionName "1.6"
|
versionName "1.6"
|
||||||
}
|
}
|
||||||
@ -20,5 +20,5 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.android.support:appcompat-v7:20.0.0'
|
compile 'com.android.support:appcompat-v7:21.0.0'
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,35 @@
|
|||||||
package fr.gaulupeau.apps.Poche;
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
public class Article {
|
public class Article {
|
||||||
public String url;
|
public String url;
|
||||||
public String id;
|
public String id;
|
||||||
public String title;
|
public String title;
|
||||||
public String content;
|
public String content;
|
||||||
public String archive;
|
public String archive;
|
||||||
|
|
||||||
public Article(String url, String id, String title, String content, String archive) {
|
private URL m_url = null;
|
||||||
super();
|
|
||||||
this.url = url;
|
public Article(String url, String id, String title, String content, String archive) {
|
||||||
this.id = id;
|
super();
|
||||||
this.title = title;
|
this.url = url;
|
||||||
this.content = content;
|
this.id = id;
|
||||||
this.archive = archive;
|
this.title = title;
|
||||||
}
|
this.content = content;
|
||||||
|
this.archive = archive;
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.m_url = new URL(url);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHostOfUrl() {
|
||||||
|
if (this.m_url != null) {
|
||||||
|
return m_url.getHost();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
|
||||||
import static fr.gaulupeau.apps.Poche.Helpers.PREFS_NAME;
|
import static fr.gaulupeau.apps.Poche.Helpers.PREFS_NAME;
|
||||||
import static fr.gaulupeau.apps.Poche.Helpers.zeroUpdate;
|
import static fr.gaulupeau.apps.Poche.Helpers.zeroUpdate;
|
||||||
|
|
||||||
@ -11,68 +12,68 @@ import static fr.gaulupeau.apps.Poche.Helpers.zeroUpdate;
|
|||||||
public class ArticlesSQLiteOpenHelper extends SQLiteOpenHelper {
|
public class ArticlesSQLiteOpenHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
|
|
||||||
public static final int VERSION = 1;
|
public static final int VERSION = 1;
|
||||||
public static final String DB_NAME = "article_db.sqlite";
|
public static final String DB_NAME = "article_db.sqlite";
|
||||||
public static String MY_ID = "my_id";
|
public static String MY_ID = "my_id";
|
||||||
public static String ARTICLE_TABLE = "article";
|
public static String ARTICLE_TABLE = "article";
|
||||||
public static String ARTICLE_DATE = "update_date";
|
public static String ARTICLE_DATE = "update_date";
|
||||||
public static String ARTICLE_ID = "article_id";
|
public static String ARTICLE_ID = "article_id";
|
||||||
public static String ARTICLE_AUTHOR = "author";
|
public static String ARTICLE_AUTHOR = "author";
|
||||||
public static String ARTICLE_CONTENT = "content";
|
public static String ARTICLE_CONTENT = "content";
|
||||||
public static String ARTICLE_TITLE = "title";
|
public static String ARTICLE_TITLE = "title";
|
||||||
public static String ARTICLE_URL = "url";
|
public static String ARTICLE_URL = "url";
|
||||||
public static String ARCHIVE = "archive";
|
public static String ARCHIVE = "archive";
|
||||||
public static String ARTICLE_SYNC = "sync";
|
public static String ARTICLE_SYNC = "sync";
|
||||||
public static String ARTICLE_READAT = "read_at";
|
public static String ARTICLE_READAT = "read_at";
|
||||||
Context c;
|
Context c;
|
||||||
|
|
||||||
public ArticlesSQLiteOpenHelper(Context context) {
|
|
||||||
super(context, DB_NAME, null, VERSION);
|
|
||||||
c = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public ArticlesSQLiteOpenHelper(Context context) {
|
||||||
public void onCreate(SQLiteDatabase db) {
|
super(context, DB_NAME, null, VERSION);
|
||||||
createTables(db);
|
c = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Override
|
public void onCreate(SQLiteDatabase db) {
|
||||||
public void onOpen(SQLiteDatabase db) {
|
createTables(db);
|
||||||
// TODO Auto-generated method stub
|
}
|
||||||
super.onOpen(db);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
|
||||||
db.delete(ARTICLE_TABLE, null, null);
|
|
||||||
SharedPreferences preferences = c.getSharedPreferences(PREFS_NAME, 0);
|
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
|
||||||
editor.putString("previous_update", zeroUpdate);
|
|
||||||
editor.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void createTables(SQLiteDatabase db) {
|
|
||||||
db.execSQL(
|
|
||||||
"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, " +
|
|
||||||
ARTICLE_ID + " integer, " +
|
|
||||||
ARCHIVE + " integer," +
|
|
||||||
ARTICLE_SYNC + " integer," +
|
|
||||||
ARTICLE_READAT + " integer," +
|
|
||||||
"UNIQUE (" + ARTICLE_URL + ")" +
|
|
||||||
");"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void truncateTables(SQLiteDatabase db) {
|
@Override
|
||||||
db.execSQL("DELETE FROM " + ARTICLE_TABLE + ";");
|
public void onOpen(SQLiteDatabase db) {
|
||||||
}
|
// TODO Auto-generated method stub
|
||||||
|
super.onOpen(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
|
db.delete(ARTICLE_TABLE, null, null);
|
||||||
|
SharedPreferences preferences = c.getSharedPreferences(PREFS_NAME, 0);
|
||||||
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
editor.putString("previous_update", zeroUpdate);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createTables(SQLiteDatabase db) {
|
||||||
|
db.execSQL(
|
||||||
|
"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, " +
|
||||||
|
ARTICLE_ID + " integer, " +
|
||||||
|
ARCHIVE + " integer," +
|
||||||
|
ARTICLE_SYNC + " integer," +
|
||||||
|
ARTICLE_READAT + " integer," +
|
||||||
|
"UNIQUE (" + ARTICLE_URL + ")" +
|
||||||
|
");"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void truncateTables(SQLiteDatabase db) {
|
||||||
|
db.execSQL("DELETE FROM " + ARTICLE_TABLE + ";");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
public class BaseActionBarActivity extends ActionBarActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
addBackButtonToActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetApi(11)
|
||||||
|
protected void addBackButtonToActionBar() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||||
|
try {
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == android.R.id.home) {
|
||||||
|
this.finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
@ -1,36 +1,32 @@
|
|||||||
package fr.gaulupeau.apps.Poche;
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
|
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.impl.client.DefaultHttpClient;
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
|
||||||
public class Helpers {
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
public static final String PREFS_NAME = "InThePoche";
|
import java.io.InputStream;
|
||||||
public final static String zeroUpdate = "2011-01-01 00:00:00";
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
public static String InputStreamtoString(InputStream is)
|
public class Helpers {
|
||||||
{
|
|
||||||
String s = "",line="";
|
public static final String PREFS_NAME = "InThePoche";
|
||||||
|
public final static String zeroUpdate = "2011-01-01 00:00:00";
|
||||||
|
|
||||||
|
public static String InputStreamtoString(InputStream is) {
|
||||||
|
String s = "", line = "";
|
||||||
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
|
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
|
||||||
try{
|
try {
|
||||||
for(; ; rd.readLine())
|
for (; ; rd.readLine()) {
|
||||||
{
|
if ((line = rd.readLine()) != null) {
|
||||||
if((line = rd.readLine())!=null)
|
s += line;
|
||||||
{
|
} else {
|
||||||
s +=line;
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -38,7 +34,7 @@ public class Helpers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getInputStreamFromUrl(String url) {
|
public static String getInputStreamFromUrl(String url) {
|
||||||
InputStream content = null;
|
InputStream content;
|
||||||
String res = "";
|
String res = "";
|
||||||
try {
|
try {
|
||||||
HttpGet httpGet = new HttpGet(url);
|
HttpGet httpGet = new HttpGet(url);
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
package fr.gaulupeau.apps.Poche;
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.*;
|
|
||||||
import fr.gaulupeau.apps.InThePoche.R;
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
@ -16,107 +11,101 @@ import android.view.View;
|
|||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
public class ListArticles extends Activity {
|
import java.util.ArrayList;
|
||||||
|
|
||||||
private ArrayList<Article> readArticlesInfo;
|
import fr.gaulupeau.apps.InThePoche.R;
|
||||||
private ListView readList;
|
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARCHIVE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_CONTENT;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_TABLE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_TITLE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_URL;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.MY_ID;
|
||||||
|
|
||||||
|
public class ListArticles extends BaseActionBarActivity {
|
||||||
|
|
||||||
|
private ArrayList<Article> readArticlesInfo;
|
||||||
private SQLiteDatabase database;
|
private SQLiteDatabase database;
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.list);
|
setContentView(R.layout.list);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
|
||||||
try {
|
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setupDB();
|
setupDB();
|
||||||
setupList(false);
|
setupList(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onResume() {
|
public void onDestroy() {
|
||||||
super.onResume();
|
super.onDestroy();
|
||||||
setupList(false);
|
database.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroy() {
|
@Override
|
||||||
super.onDestroy();
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
database.close();
|
MenuInflater inflater = getMenuInflater();
|
||||||
}
|
inflater.inflate(R.menu.option_list, menu);
|
||||||
|
return true;
|
||||||
@Override
|
}
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
MenuInflater inflater = getMenuInflater();
|
@Override
|
||||||
inflater.inflate(R.menu.option_list, menu);
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
return true;
|
switch (item.getItemId()) {
|
||||||
}
|
case R.id.menuShowAll:
|
||||||
|
setupList(true);
|
||||||
@Override
|
return true;
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
case R.id.menuWipeDb:
|
||||||
switch (item.getItemId()) {
|
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(this);
|
||||||
case R.id.menuShowAll:
|
helper.truncateTables(database);
|
||||||
setupList(true);
|
setupList(false);
|
||||||
return super.onOptionsItemSelected(item);
|
return true;
|
||||||
case R.id.menuWipeDb:
|
default:
|
||||||
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(this);
|
|
||||||
helper.truncateTables(database);
|
|
||||||
setupList(false);
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
case android.R.id.home:
|
|
||||||
this.finish();
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
default:
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setupDB() {
|
public void setupDB() {
|
||||||
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(this);
|
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(this);
|
||||||
database = helper.getWritableDatabase();
|
database = helper.getWritableDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupList(Boolean showAll) {
|
public void setupList(Boolean showAll) {
|
||||||
readList = (ListView) findViewById(R.id.liste_articles);
|
ListView readList = (ListView) findViewById(R.id.liste_articles);
|
||||||
readArticlesInfo = new ArrayList<Article>();
|
readArticlesInfo = new ArrayList<Article>();
|
||||||
String filter = null;
|
String filter = null;
|
||||||
if (showAll == false) {
|
if (!showAll) {
|
||||||
filter = ARCHIVE + "=0";
|
filter = ARCHIVE + "=0";
|
||||||
}
|
}
|
||||||
ReadingListAdapter ad = getAdapterQuery(filter, readArticlesInfo);
|
ReadingListAdapter ad = getAdapterQuery(filter, readArticlesInfo);
|
||||||
readList.setAdapter(ad);
|
readList.setAdapter(ad);
|
||||||
|
|
||||||
readList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
readList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
Intent i = new Intent(getBaseContext(), ReadArticle.class);
|
Intent i = new Intent(getBaseContext(), ReadArticle.class);
|
||||||
i.putExtra("id", (String) readArticlesInfo.get(position).id);
|
i.putExtra("id", readArticlesInfo.get(position).id);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReadingListAdapter getAdapterQuery(String filter, ArrayList<Article> articleInfo) {
|
public ReadingListAdapter getAdapterQuery(String filter, ArrayList<Article> articleInfo) {
|
||||||
//Log.e("getAdapterQuery", "running query");
|
//Log.e("getAdapterQuery", "running query");
|
||||||
//String url, String domain, String id, String title, String content
|
//String url, String domain, String id, String title, String content
|
||||||
String[] getStrColumns = new String[] {ARTICLE_URL, MY_ID, ARTICLE_TITLE, ARTICLE_CONTENT, ARCHIVE};
|
String[] getStrColumns = new String[]{ARTICLE_URL, MY_ID, ARTICLE_TITLE, ARTICLE_CONTENT, ARCHIVE};
|
||||||
Cursor ac = database.query(
|
Cursor ac = database.query(
|
||||||
ARTICLE_TABLE,
|
ARTICLE_TABLE,
|
||||||
getStrColumns,
|
getStrColumns,
|
||||||
filter, null, null, null, ARTICLE_DATE + " DESC");
|
filter, null, null, null, ARTICLE_DATE + " DESC");
|
||||||
ac.moveToFirst();
|
ac.moveToFirst();
|
||||||
if(!ac.isAfterLast()) {
|
if (!ac.isAfterLast()) {
|
||||||
do {
|
do {
|
||||||
Article tempArticle = new Article(ac.getString(0),ac.getString(1),ac.getString(2),ac.getString(3),ac.getString(4));
|
Article tempArticle = new Article(ac.getString(0), ac.getString(1), ac.getString(2), ac.getString(3), ac.getString(4));
|
||||||
articleInfo.add(tempArticle);
|
articleInfo.add(tempArticle);
|
||||||
} while (ac.moveToNext());
|
} while (ac.moveToNext());
|
||||||
}
|
}
|
||||||
ac.close();
|
ac.close();
|
||||||
return new ReadingListAdapter(getBaseContext(), articleInfo);
|
return new ReadingListAdapter(getBaseContext(), articleInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,39 +8,9 @@
|
|||||||
|
|
||||||
package fr.gaulupeau.apps.Poche;
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
import fr.gaulupeau.apps.InThePoche.R;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
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;
|
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import javax.net.ssl.SSLSession;
|
|
||||||
import javax.net.ssl.X509TrustManager;
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
|
|
||||||
import org.w3c.dom.DOMException;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
import org.xml.sax.InputSource;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -53,142 +23,177 @@ import android.net.NetworkInfo;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.provider.Browser;
|
import android.provider.Browser;
|
||||||
import android.text.Html;
|
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.view.Menu;
|
import android.util.Patterns;
|
||||||
import android.view.MenuInflater;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import static fr.gaulupeau.apps.Poche.Helpers.PREFS_NAME;
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_TABLE;
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_URL;
|
|
||||||
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;
|
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
import org.xml.sax.InputSource;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.security.cert.CertificateException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import javax.net.ssl.HostnameVerifier;
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSession;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
|
||||||
|
import fr.gaulupeau.apps.InThePoche.R;
|
||||||
|
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARCHIVE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_CONTENT;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_SYNC;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_TABLE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_TITLE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_URL;
|
||||||
|
import static fr.gaulupeau.apps.Poche.Helpers.PREFS_NAME;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main activity class
|
* Main activity class
|
||||||
*/
|
*/
|
||||||
@TargetApi(Build.VERSION_CODES.FROYO) public class Poche extends Activity {
|
@TargetApi(Build.VERSION_CODES.FROYO)
|
||||||
|
public class Poche extends Activity {
|
||||||
private static SQLiteDatabase database;
|
private static SQLiteDatabase database;
|
||||||
Button btnDone;
|
|
||||||
Button btnGetPost;
|
Button btnGetPost;
|
||||||
Button btnSync;
|
Button btnSync;
|
||||||
Button btnSettings;
|
Button btnSettings;
|
||||||
EditText editPocheUrl;
|
|
||||||
SharedPreferences settings;
|
SharedPreferences settings;
|
||||||
static String apiUsername;
|
static String apiUsername;
|
||||||
static String apiToken;
|
static String apiToken;
|
||||||
static String pocheUrl;
|
static String pocheUrl;
|
||||||
String action;
|
String action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the activity is first created.
|
||||||
/** Called when the activity is first created.
|
* Will act differently depending on whether sharing or
|
||||||
* Will act differently depending on whether sharing or
|
* displaying information page.
|
||||||
* displaying information page. */
|
*/
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
Intent intent = getIntent();
|
|
||||||
Bundle extras = intent.getExtras();
|
|
||||||
action = intent.getAction();
|
|
||||||
|
|
||||||
getSettings();
|
Intent intent = getIntent();
|
||||||
// Find out if Sharing or if app has been launched from icon
|
Bundle extras = intent.getExtras();
|
||||||
if (action.equals(Intent.ACTION_SEND) && pocheUrl != "http://") {
|
action = intent.getAction();
|
||||||
setContentView(R.layout.main);
|
|
||||||
findViewById(R.id.btnSync).setVisibility(View.GONE);
|
getSettings();
|
||||||
findViewById(R.id.btnGetPost).setVisibility(View.GONE);
|
// Find out if Sharing or if app has been launched from icon
|
||||||
findViewById(R.id.progressBar1).setVisibility(View.VISIBLE);
|
if (action.equals(Intent.ACTION_SEND) && !pocheUrl.equals("http://")) {
|
||||||
final String pageUrl = extras.getString("android.intent.extra.TEXT");
|
setContentView(R.layout.main);
|
||||||
// Vérification de la connectivité Internet
|
findViewById(R.id.btnSync).setVisibility(View.GONE);
|
||||||
final ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
findViewById(R.id.btnGetPost).setVisibility(View.GONE);
|
||||||
final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo();
|
findViewById(R.id.progressBar1).setVisibility(View.VISIBLE);
|
||||||
if (activeNetwork != null && activeNetwork.isConnected()) {
|
|
||||||
// Start to build the poche URL
|
|
||||||
Uri.Builder pocheSaveUrl = Uri.parse(pocheUrl).buildUpon();
|
|
||||||
// Add the parameters from the call
|
final String extraText = extras.getString("android.intent.extra.TEXT");
|
||||||
pocheSaveUrl.appendQueryParameter("action", "add");
|
final String pageUrl;
|
||||||
byte[] data = null;
|
|
||||||
try {
|
// Parsing string for urls.
|
||||||
data = pageUrl.getBytes("UTF-8");
|
Matcher matcher = Patterns.WEB_URL.matcher(extraText);
|
||||||
} catch (UnsupportedEncodingException e) {
|
if (matcher.find()) {
|
||||||
// TODO Auto-generated catch block
|
pageUrl = matcher.group();
|
||||||
e.printStackTrace();
|
} else {
|
||||||
}
|
showErrorMessage("Couldn't find a URL in share string:\n"+extraText);
|
||||||
String base64 = Base64.encodeToString(data, Base64.DEFAULT);
|
return;
|
||||||
pocheSaveUrl.appendQueryParameter("url", base64);
|
}
|
||||||
System.out.println("base64 : " + base64);
|
|
||||||
System.out.println("pageurl : " + pageUrl);
|
|
||||||
|
// Vérification de la connectivité Internet
|
||||||
// Load the constructed URL in the browser
|
final ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo();
|
||||||
i.setData(pocheSaveUrl.build());
|
if (activeNetwork != null && activeNetwork.isConnected()) {
|
||||||
i.putExtra(Browser.EXTRA_APPLICATION_ID, getPackageName());
|
// Start to build the poche URL
|
||||||
// If user has more then one browser installed give them a chance to
|
Uri.Builder pocheSaveUrl = Uri.parse(pocheUrl).buildUpon();
|
||||||
// select which one they want to use
|
// Add the parameters from the call
|
||||||
|
pocheSaveUrl.appendQueryParameter("action", "add");
|
||||||
startActivity(i);
|
byte[] data = null;
|
||||||
// That is all this app needs to do, so call finish()
|
try {
|
||||||
this.finish();
|
data = pageUrl.getBytes("UTF-8");
|
||||||
} else {
|
} catch (UnsupportedEncodingException e) {
|
||||||
// Afficher alerte connectivité
|
// TODO Auto-generated catch block
|
||||||
showToast(getString(R.string.txtNetOffline));
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
String base64 = Base64.encodeToString(data, Base64.DEFAULT);
|
||||||
else {
|
pocheSaveUrl.appendQueryParameter("url", base64);
|
||||||
setContentView(R.layout.main);
|
System.out.println("base64 : " + base64);
|
||||||
|
System.out.println("pageurl : " + pageUrl);
|
||||||
|
|
||||||
|
// Load the constructed URL in the browser
|
||||||
|
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||||
|
i.setData(pocheSaveUrl.build());
|
||||||
|
i.putExtra(Browser.EXTRA_APPLICATION_ID, getPackageName());
|
||||||
|
// If user has more then one browser installed give them a chance to
|
||||||
|
// select which one they want to use
|
||||||
|
|
||||||
|
startActivity(i);
|
||||||
|
// That is all this app needs to do, so call finish()
|
||||||
|
this.finish();
|
||||||
|
} else {
|
||||||
|
// Afficher alerte connectivité
|
||||||
|
showToast(getString(R.string.txtNetOffline));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setContentView(R.layout.main);
|
||||||
checkAndHandleAfterUpdate();
|
checkAndHandleAfterUpdate();
|
||||||
|
|
||||||
btnSync = (Button)findViewById(R.id.btnSync);
|
btnSync = (Button) findViewById(R.id.btnSync);
|
||||||
btnSync.setOnClickListener(new OnClickListener() {
|
btnSync.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// Vérification de la connectivité Internet
|
// Vérification de la connectivité Internet
|
||||||
final ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
final ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo();
|
final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo();
|
||||||
if (pocheUrl == "http://") {
|
if (pocheUrl.equals("http://")) {
|
||||||
showToast(getString(R.string.txtConfigNotSet));
|
showToast(getString(R.string.txtConfigNotSet));
|
||||||
} else if (activeNetwork != null && activeNetwork.isConnected()) {
|
} else if (activeNetwork != null && activeNetwork.isConnected()) {
|
||||||
// Exécution de la synchro en arrière-plan
|
// Exécution de la synchro en arrière-plan
|
||||||
findViewById(R.id.progressBar1).setVisibility(View.VISIBLE);
|
findViewById(R.id.progressBar1).setVisibility(View.VISIBLE);
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
//pushRead();
|
//pushRead();
|
||||||
parseRSS();
|
parseRSS();
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
findViewById(R.id.progressBar1).setVisibility(View.GONE);
|
findViewById(R.id.progressBar1).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
} else {
|
} else {
|
||||||
// Afficher alerte connectivité
|
// Afficher alerte connectivité
|
||||||
showToast(getString(R.string.txtNetOffline));
|
showToast(getString(R.string.txtNetOffline));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
btnGetPost = (Button)findViewById(R.id.btnGetPost);
|
btnGetPost = (Button) findViewById(R.id.btnGetPost);
|
||||||
//updateUnread();
|
//updateUnread();
|
||||||
|
|
||||||
btnGetPost.setOnClickListener(new OnClickListener() {
|
btnGetPost.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -196,20 +201,20 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
btnSettings = (Button)findViewById(R.id.btnSettings);
|
btnSettings = (Button) findViewById(R.id.btnSettings);
|
||||||
btnSettings.setOnClickListener(new OnClickListener() {
|
btnSettings.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
startActivity(new Intent(getBaseContext(), Settings.class));
|
startActivity(new Intent(getBaseContext(), Settings.class));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAndHandleAfterUpdate() {
|
private void checkAndHandleAfterUpdate() {
|
||||||
SharedPreferences pref = getSharedPreferences(PREFS_NAME, 0);
|
SharedPreferences pref = getSharedPreferences(PREFS_NAME, 0);
|
||||||
|
|
||||||
if (pref.getInt("update_checker",0) < 9) {
|
if (pref.getInt("update_checker", 0) < 9) {
|
||||||
// Wipe Database, because we now save HTML content instead of plain text
|
// Wipe Database, because we now save HTML content instead of plain text
|
||||||
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(this);
|
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(this);
|
||||||
database = helper.getReadableDatabase();
|
database = helper.getReadableDatabase();
|
||||||
@ -227,53 +232,64 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
|
|||||||
pref.edit().putInt("update_checker", versionCode).commit();
|
pref.edit().putInt("update_checker", versionCode).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getSettings(){
|
private void getSettings() {
|
||||||
settings = getSharedPreferences(PREFS_NAME, 0);
|
settings = getSharedPreferences(PREFS_NAME, 0);
|
||||||
pocheUrl = settings.getString("pocheUrl", "http://");
|
pocheUrl = settings.getString("pocheUrl", "http://");
|
||||||
apiUsername = settings.getString("APIUsername", "");
|
apiUsername = settings.getString("APIUsername", "");
|
||||||
apiToken = settings.getString("APIToken", "");
|
apiToken = settings.getString("APIToken", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
getSettings();
|
|
||||||
if (! action.equals(Intent.ACTION_SEND)){
|
|
||||||
updateUnread();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onResume() {
|
||||||
super.onDestroy();
|
super.onResume();
|
||||||
if (database != null) {
|
getSettings();
|
||||||
database.close();
|
if (!action.equals(Intent.ACTION_SEND)) {
|
||||||
|
updateUnread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUnread(){
|
@Override
|
||||||
runOnUiThread(new Runnable() {
|
protected void onDestroy() {
|
||||||
public void run()
|
super.onDestroy();
|
||||||
{
|
if (database != null) {
|
||||||
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(getApplicationContext());
|
database.close();
|
||||||
database = helper.getReadableDatabase();
|
}
|
||||||
int news = database.query(ARTICLE_TABLE, null, ARCHIVE + "=0", null, null, null, null).getCount();
|
}
|
||||||
btnGetPost.setText(String.format(getString(R.string.btnGetPost), news));
|
|
||||||
}
|
private void updateUnread() {
|
||||||
});
|
runOnUiThread(new Runnable() {
|
||||||
}
|
public void run() {
|
||||||
|
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(getApplicationContext());
|
||||||
public void showToast(final String toast)
|
database = helper.getReadableDatabase();
|
||||||
{
|
int news = database.query(ARTICLE_TABLE, null, ARCHIVE + "=0", null, null, null, null).getCount();
|
||||||
runOnUiThread(new Runnable() {
|
btnGetPost.setText(String.format(getString(R.string.btnGetPost), news));
|
||||||
public void run()
|
}
|
||||||
{
|
});
|
||||||
Toast.makeText(Poche.this, toast, Toast.LENGTH_SHORT).show();
|
}
|
||||||
}
|
|
||||||
});
|
public void showToast(final String toast) {
|
||||||
}
|
runOnUiThread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
Toast.makeText(Poche.this, toast, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showErrorMessage(final String message) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
AlertDialog.Builder messageBox = new AlertDialog.Builder(Poche.this);
|
||||||
|
messageBox.setMessage(message);
|
||||||
|
messageBox.setTitle(getString(R.string.error));
|
||||||
|
// messageBox.setIconAttribute(android.R.attr.alertDialogIcon);
|
||||||
|
messageBox.setPositiveButton("OK", null);
|
||||||
|
messageBox.setCancelable(false);
|
||||||
|
messageBox.create().show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// public void pocheIt(String url){
|
// public void pocheIt(String url){
|
||||||
// String id ="req-001";
|
// String id ="req-001";
|
||||||
// JSONRPC2Request reqOut = null;
|
// JSONRPC2Request reqOut = null;
|
||||||
@ -290,8 +306,8 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
|
|||||||
// }
|
// }
|
||||||
// finish();
|
// finish();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// public void pushRead(){
|
// public void pushRead(){
|
||||||
// JSONRPC2Request reqOut = null;
|
// JSONRPC2Request reqOut = null;
|
||||||
// String filter = ARCHIVE + "=1 AND " + ARTICLE_SYNC + "=0";
|
// String filter = ARCHIVE + "=1 AND " + ARTICLE_SYNC + "=0";
|
||||||
@ -323,208 +339,204 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_DATE;
|
|||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
public String cleanString(String s){
|
|
||||||
|
|
||||||
s = s.replace("é", "é");
|
|
||||||
s = s.replace("è", "è");
|
|
||||||
s = s.replace("ê", "ê");
|
|
||||||
s = s.replace("ë", "ë");
|
|
||||||
s = s.replace("Ã ", "à");
|
|
||||||
s = s.replace("ä", "ä");
|
|
||||||
s = s.replace("â", "â");
|
|
||||||
s = s.replace("ù", "ù");
|
|
||||||
s = s.replace("û", "û");
|
|
||||||
s = s.replace("ü", "ü");
|
|
||||||
s = s.replace("ô", "ô");
|
|
||||||
s = s.replace("ö", "ö");
|
|
||||||
s = s.replace("î", "î");
|
|
||||||
s = s.replace("ï", "ï");
|
|
||||||
s = s.replace("ç", "ç");
|
|
||||||
s = s.replace("&", "&");
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void trustEveryone() {
|
|
||||||
try {
|
|
||||||
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier(){
|
|
||||||
public boolean verify(String hostname, SSLSession session) {
|
|
||||||
return true;
|
|
||||||
}});
|
|
||||||
SSLContext context = SSLContext.getInstance("TLS");
|
|
||||||
context.init(null, new X509TrustManager[]{new X509TrustManager(){
|
|
||||||
public void checkClientTrusted(X509Certificate[] chain,
|
|
||||||
String authType) throws CertificateException {}
|
|
||||||
public void checkServerTrusted(X509Certificate[] chain,
|
|
||||||
String authType) throws CertificateException {}
|
|
||||||
public X509Certificate[] getAcceptedIssuers() {
|
|
||||||
return new X509Certificate[0];
|
|
||||||
}}}, new SecureRandom());
|
|
||||||
HttpsURLConnection.setDefaultSSLSocketFactory(
|
|
||||||
context.getSocketFactory());
|
|
||||||
} catch (Exception e) { // should never happen
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void parseRSS(){
|
|
||||||
|
|
||||||
URL url;
|
public String cleanString(String s) {
|
||||||
try
|
|
||||||
{
|
|
||||||
// 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
|
|
||||||
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
|
s = s.replace("é", "é");
|
||||||
DocumentBuilderFactory dbf = DocumentBuilderFactory
|
s = s.replace("è", "è");
|
||||||
.newInstance();
|
s = s.replace("ê", "ê");
|
||||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
s = s.replace("ë", "ë");
|
||||||
Document doc;
|
s = s.replace("Ã ", "à");
|
||||||
// doc = db.parse(url.openStream());
|
s = s.replace("ä", "ä");
|
||||||
InputSource is = new InputSource(
|
s = s.replace("â", "â");
|
||||||
new InputStreamReader(
|
s = s.replace("ù", "ù");
|
||||||
url.openStream()));
|
s = s.replace("û", "û");
|
||||||
doc = db.parse(is);
|
s = s.replace("ü", "ü");
|
||||||
// doc = db.parse(
|
s = s.replace("ô", "ô");
|
||||||
// new InputSource(
|
s = s.replace("ö", "ö");
|
||||||
// new InputStreamReader(
|
s = s.replace("î", "î");
|
||||||
// url.openStream(),
|
s = s.replace("ï", "ï");
|
||||||
// "latin-1")));
|
s = s.replace("ç", "ç");
|
||||||
doc.getDocumentElement().normalize();
|
s = s.replace("&", "&");
|
||||||
|
|
||||||
// This is the root node of each section you want to parse
|
|
||||||
NodeList itemLst = doc.getElementsByTagName("item");
|
|
||||||
|
|
||||||
// This sets up some arrays to hold the data parsed
|
// Replace multiple whitespaces with single space
|
||||||
arrays.PodcastTitle = new String[itemLst.getLength()];
|
s = s.replaceAll("\\s+", " ");
|
||||||
arrays.PodcastURL = new String[itemLst.getLength()];
|
s = s.trim();
|
||||||
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
|
return s;
|
||||||
for (int i = 0; i < itemLst.getLength(); i++)
|
}
|
||||||
{
|
|
||||||
|
|
||||||
Node item = itemLst.item(i);
|
|
||||||
if (item.getNodeType() == Node.ELEMENT_NODE)
|
|
||||||
{
|
|
||||||
Element ielem = (Element) item;
|
|
||||||
|
|
||||||
// This section gets the elements from the XML
|
private void trustEveryone() {
|
||||||
// that we want to use you will need to add
|
try {
|
||||||
// and remove elements that you want / don't want
|
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
|
||||||
NodeList title = ielem.getElementsByTagName("title");
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
NodeList link = ielem.getElementsByTagName("link");
|
return true;
|
||||||
NodeList date = ielem.getElementsByTagName("pubDate");
|
}
|
||||||
NodeList content = ielem
|
});
|
||||||
.getElementsByTagName("description");
|
SSLContext context = SSLContext.getInstance("TLS");
|
||||||
//NodeList media = ielem
|
context.init(null, new X509TrustManager[]{new X509TrustManager() {
|
||||||
// .getElementsByTagName("media:content");
|
public void checkClientTrusted(X509Certificate[] chain,
|
||||||
|
String authType) throws CertificateException {
|
||||||
|
}
|
||||||
|
|
||||||
// This is an attribute of an element so I create
|
public void checkServerTrusted(X509Certificate[] chain,
|
||||||
// a string to make it easier to use
|
String authType) throws CertificateException {
|
||||||
//String mediaurl = media.item(0).getAttributes()
|
}
|
||||||
// .getNamedItem("url").getNodeValue();
|
|
||||||
|
|
||||||
// This section adds an entry to the arrays with the
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
// data retrieved from above. I have surrounded each
|
return new X509Certificate[0];
|
||||||
// with try/catch just incase the element does not
|
}
|
||||||
// exist
|
}}, new SecureRandom());
|
||||||
try
|
HttpsURLConnection.setDefaultSSLSocketFactory(
|
||||||
{
|
context.getSocketFactory());
|
||||||
arrays.PodcastTitle[i] = cleanString(title.item(0).getChildNodes().item(0).getNodeValue());
|
} catch (Exception e) { // should never happen
|
||||||
} catch (NullPointerException e)
|
e.printStackTrace();
|
||||||
{
|
}
|
||||||
e.printStackTrace();
|
}
|
||||||
arrays.PodcastTitle[i] = "Echec";
|
|
||||||
}
|
|
||||||
try {
|
public void parseRSS() {
|
||||||
|
|
||||||
|
URL url;
|
||||||
|
try {
|
||||||
|
// 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);
|
||||||
|
if (pocheUrl.startsWith("https")) {
|
||||||
|
trustEveryone();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup the connection
|
||||||
|
HttpURLConnection urlConnection;
|
||||||
|
urlConnection = (HttpURLConnection) url.openConnection();
|
||||||
|
|
||||||
|
if ((urlConnection != null) && (urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK)) {
|
||||||
|
|
||||||
|
// Retreive the XML from the URL
|
||||||
|
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||||
|
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||||
|
Document doc = null;
|
||||||
|
|
||||||
|
InputSource is;
|
||||||
|
|
||||||
|
try {
|
||||||
|
is = new InputSource(
|
||||||
|
new InputStreamReader(
|
||||||
|
urlConnection.getInputStream()));
|
||||||
|
doc = db.parse(is);
|
||||||
|
doc.getDocumentElement().normalize();
|
||||||
|
} catch (SAXException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
InputStream inputStream = url.openStream();
|
||||||
|
int ch;
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
while ((ch = inputStream.read()) != -1) {
|
||||||
|
stringBuffer.append((char) ch);
|
||||||
|
}
|
||||||
|
showErrorMessage("Got invalid response:\n\"" + stringBuffer.toString() + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the root node of each section you want to parse
|
||||||
|
NodeList itemLst = doc.getElementsByTagName("item");
|
||||||
|
|
||||||
|
// This sets up some arrays to hold the data parsed
|
||||||
|
arrays.PodcastTitle = new String[itemLst.getLength()];
|
||||||
|
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++) {
|
||||||
|
|
||||||
|
Node item = itemLst.item(i);
|
||||||
|
if (item.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
Element ielem = (Element) item;
|
||||||
|
|
||||||
|
// This section gets the elements from the XML
|
||||||
|
// that we want to use you will need to add
|
||||||
|
// 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
|
||||||
|
// .getElementsByTagName("media:content");
|
||||||
|
|
||||||
|
// This is an attribute of an element so I create
|
||||||
|
// a string to make it easier to use
|
||||||
|
//String mediaurl = media.item(0).getAttributes()
|
||||||
|
// .getNamedItem("url").getNodeValue();
|
||||||
|
|
||||||
|
// This section adds an entry to the arrays with the
|
||||||
|
// data retrieved from above. I have surrounded each
|
||||||
|
// with try/catch just incase the element does not
|
||||||
|
// exist
|
||||||
|
try {
|
||||||
|
arrays.PodcastTitle[i] = cleanString(title.item(0).getChildNodes().item(0).getNodeValue());
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
arrays.PodcastTitle[i] = "Echec";
|
||||||
|
}
|
||||||
|
try {
|
||||||
arrays.PodcastDate[i] = date.item(0).getChildNodes().item(0).getNodeValue();
|
arrays.PodcastDate[i] = date.item(0).getChildNodes().item(0).getNodeValue();
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
arrays.PodcastDate[i] = null;
|
arrays.PodcastDate[i] = null;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
arrays.PodcastURL[i] = link.item(0).getChildNodes()
|
||||||
arrays.PodcastURL[i] = link.item(0).getChildNodes()
|
.item(0).getNodeValue();
|
||||||
.item(0).getNodeValue();
|
} catch (NullPointerException e) {
|
||||||
} catch (NullPointerException e)
|
e.printStackTrace();
|
||||||
{
|
arrays.PodcastURL[i] = "Echec";
|
||||||
e.printStackTrace();
|
}
|
||||||
arrays.PodcastURL[i] = "Echec";
|
try {
|
||||||
}
|
arrays.PodcastContent[i] = content.item(0)
|
||||||
try
|
.getChildNodes().item(0).getNodeValue();
|
||||||
{
|
} catch (NullPointerException e) {
|
||||||
arrays.PodcastContent[i] = content.item(0)
|
e.printStackTrace();
|
||||||
.getChildNodes().item(0).getNodeValue();
|
arrays.PodcastContent[i] = "Echec";
|
||||||
} catch (NullPointerException e)
|
}
|
||||||
{
|
|
||||||
e.printStackTrace();
|
ContentValues values = new ContentValues();
|
||||||
arrays.PodcastContent[i] = "Echec";
|
values.put(ARTICLE_TITLE, arrays.PodcastTitle[i]);
|
||||||
}
|
values.put(ARTICLE_CONTENT, arrays.PodcastContent[i]);
|
||||||
|
//values.put(ARTICLE_ID, Html.fromHtml(article.getString("id")).toString());
|
||||||
ContentValues values = new ContentValues();
|
values.put(ARTICLE_URL, arrays.PodcastURL[i]);
|
||||||
values.put(ARTICLE_TITLE, arrays.PodcastTitle[i]);
|
values.put(ARTICLE_DATE, arrays.PodcastDate[i]);
|
||||||
values.put(ARTICLE_CONTENT, arrays.PodcastContent[i]);
|
values.put(ARCHIVE, 0);
|
||||||
//values.put(ARTICLE_ID, Html.fromHtml(article.getString("id")).toString());
|
values.put(ARTICLE_SYNC, 0);
|
||||||
values.put(ARTICLE_URL, arrays.PodcastURL[i]);
|
try {
|
||||||
values.put(ARTICLE_DATE, arrays.PodcastDate[i]);
|
database.insertOrThrow(ARTICLE_TABLE, null, values);
|
||||||
values.put(ARCHIVE, 0);
|
} catch (SQLiteConstraintException e) {
|
||||||
values.put(ARTICLE_SYNC, 0);
|
continue;
|
||||||
try {
|
} catch (SQLiteException e) {
|
||||||
database.insertOrThrow(ARTICLE_TABLE, null, values);
|
database.execSQL("ALTER TABLE " + ARTICLE_TABLE + " ADD COLUMN " + ARTICLE_DATE + " datetime;");
|
||||||
} catch (SQLiteConstraintException e) {
|
database.insertOrThrow(ARTICLE_TABLE, null, values);
|
||||||
continue;
|
}
|
||||||
} catch (SQLiteException e) {
|
}
|
||||||
database.execSQL("ALTER TABLE " + ARTICLE_TABLE + " ADD COLUMN " + ARTICLE_DATE + " datetime;");
|
}
|
||||||
database.insertOrThrow(ARTICLE_TABLE, null, values);
|
|
||||||
}
|
showToast(getString(R.string.txtSyncDone));
|
||||||
}
|
} else {
|
||||||
}
|
// HTTP Connection not successful
|
||||||
|
if (urlConnection == null) {
|
||||||
}
|
showErrorMessage(getString(R.string.error_feed));
|
||||||
showToast(getString(R.string.txtSyncDone));
|
} else {
|
||||||
updateUnread();
|
showErrorMessage(getString(R.string.error_feed) + ":\n" + urlConnection.getResponseCode() + " " + urlConnection.getResponseMessage());
|
||||||
} catch (MalformedURLException e)
|
}
|
||||||
{
|
}
|
||||||
e.printStackTrace();
|
updateUnread();
|
||||||
} catch (DOMException e)
|
} catch (Exception e) {
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParserConfigurationException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (SAXException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
// public void fetchUnread(){
|
// public void fetchUnread(){
|
||||||
// String id = "req-001";
|
// String id = "req-001";
|
||||||
// JSONRPC2Request reqOut = null;
|
// JSONRPC2Request reqOut = null;
|
||||||
|
@ -1,65 +1,45 @@
|
|||||||
package fr.gaulupeau.apps.Poche;
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARCHIVE;
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_CONTENT;
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_ID;
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_TITLE;
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_URL;
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_TABLE;
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_AUTHOR;
|
|
||||||
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.MY_ID;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.View.OnTouchListener;
|
|
||||||
import android.view.Window;
|
|
||||||
import android.webkit.WebChromeClient;
|
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import fr.gaulupeau.apps.InThePoche.R;
|
import fr.gaulupeau.apps.InThePoche.R;
|
||||||
|
|
||||||
public class ReadArticle extends Activity {
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARCHIVE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_AUTHOR;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_CONTENT;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_ID;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_TABLE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_TITLE;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.ARTICLE_URL;
|
||||||
|
import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.MY_ID;
|
||||||
|
|
||||||
|
public class ReadArticle extends BaseActionBarActivity {
|
||||||
WebView webViewContent;
|
WebView webViewContent;
|
||||||
Button btnMarkRead;
|
Button btnMarkRead;
|
||||||
SQLiteDatabase database;
|
SQLiteDatabase database;
|
||||||
String id = "";
|
String id = "";
|
||||||
ScrollView view;
|
ScrollView view;
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
|
||||||
requestWindowFeature(Window.FEATURE_PROGRESS);
|
|
||||||
setContentView(R.layout.article);
|
setContentView(R.layout.article);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
|
||||||
try {
|
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
view = (ScrollView) findViewById(R.id.scroll);
|
view = (ScrollView) findViewById(R.id.scroll);
|
||||||
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(getApplicationContext());
|
ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(getApplicationContext());
|
||||||
database = helper.getWritableDatabase();
|
database = helper.getWritableDatabase();
|
||||||
String[] getStrColumns = new String[] {ARTICLE_URL, MY_ID, ARTICLE_TITLE, ARTICLE_CONTENT, ARCHIVE, ARTICLE_AUTHOR};
|
String[] getStrColumns = new String[]{ARTICLE_URL, MY_ID, ARTICLE_TITLE, ARTICLE_CONTENT, ARCHIVE, ARTICLE_AUTHOR};
|
||||||
Bundle data = getIntent().getExtras();
|
Bundle data = getIntent().getExtras();
|
||||||
if(data != null) {
|
if (data != null) {
|
||||||
id = data.getString("id");
|
id = data.getString("id");
|
||||||
}
|
}
|
||||||
Cursor ac = database.query(ARTICLE_TABLE, getStrColumns, MY_ID + "=" + id, null, null, null, null);
|
Cursor ac = database.query(ARTICLE_TABLE, getStrColumns, MY_ID + "=" + id, null, null, null, null);
|
||||||
@ -73,8 +53,7 @@ public class ReadArticle extends Activity {
|
|||||||
try {
|
try {
|
||||||
URL originalUrl = new URL(originalUrlText);
|
URL originalUrl = new URL(originalUrlText);
|
||||||
originalUrlDesc = originalUrl.getHost();
|
originalUrlDesc = originalUrl.getHost();
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,8 +69,8 @@ public class ReadArticle extends Activity {
|
|||||||
"\t\t\t\t<div id=\"content\" class=\"w600p center\">\n" +
|
"\t\t\t\t<div id=\"content\" class=\"w600p center\">\n" +
|
||||||
"\t\t\t\t\t<div id=\"article\">\n" +
|
"\t\t\t\t\t<div id=\"article\">\n" +
|
||||||
"\t\t\t\t\t\t<header class=\"mbm\">\n" +
|
"\t\t\t\t\t\t<header class=\"mbm\">\n" +
|
||||||
"\t\t\t\t\t\t\t<h1>"+ titleText +"</h1>\n" +
|
"\t\t\t\t\t\t\t<h1>" + titleText + "</h1>\n" +
|
||||||
"\t\t\t\t\t\t\t<p>Open Original: <a href=\""+ originalUrlText +"\">"+ originalUrlDesc +"</a></p>\n" +
|
"\t\t\t\t\t\t\t<p>Open Original: <a href=\"" + originalUrlText + "\">" + originalUrlDesc + "</a></p>\n" +
|
||||||
"\t\t\t\t\t\t</header>\n" +
|
"\t\t\t\t\t\t</header>\n" +
|
||||||
"\t\t\t\t\t\t<article>";
|
"\t\t\t\t\t\t<article>";
|
||||||
String htmlFooter = "</article>\n" +
|
String htmlFooter = "</article>\n" +
|
||||||
@ -102,24 +81,12 @@ public class ReadArticle extends Activity {
|
|||||||
"</html>";
|
"</html>";
|
||||||
|
|
||||||
|
|
||||||
setProgressBarIndeterminateVisibility(true);
|
webViewContent = (WebView) findViewById(R.id.webViewContent);
|
||||||
setProgressBarVisibility(true);
|
|
||||||
|
|
||||||
webViewContent = (WebView)findViewById(R.id.webViewContent);
|
|
||||||
webViewContent.setWebChromeClient(new WebChromeClient() {
|
|
||||||
public void onProgressChanged(WebView view, int progress) {
|
|
||||||
setProgress(progress * 100);
|
|
||||||
if(progress == 100) {
|
|
||||||
setProgressBarIndeterminateVisibility(false);
|
|
||||||
setProgressBarVisibility(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
webViewContent.loadDataWithBaseURL("file:///android_asset/", htmlHeader + htmlContent + htmlFooter, "text/html", "utf-8", null);
|
webViewContent.loadDataWithBaseURL("file:///android_asset/", htmlHeader + htmlContent + htmlFooter, "text/html", "utf-8", null);
|
||||||
|
|
||||||
btnMarkRead = (Button)findViewById(R.id.btnMarkRead);
|
btnMarkRead = (Button) findViewById(R.id.btnMarkRead);
|
||||||
btnMarkRead.setOnClickListener(new OnClickListener() {
|
btnMarkRead.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
@ -128,35 +95,24 @@ public class ReadArticle extends Activity {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put("read_at", view.getScrollY());
|
values.put("read_at", view.getScrollY());
|
||||||
database.update(ARTICLE_TABLE, values, ARTICLE_ID + "=" + id, null);
|
database.update(ARTICLE_TABLE, values, ARTICLE_ID + "=" + id, null);
|
||||||
System.out.println(view.getScrollY());
|
System.out.println(view.getScrollY());
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
database.close();
|
database.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case android.R.id.home:
|
|
||||||
this.finish();
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,54 +1,51 @@
|
|||||||
package fr.gaulupeau.apps.Poche;
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import fr.gaulupeau.apps.InThePoche.R;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.Html;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import fr.gaulupeau.apps.InThePoche.R;
|
||||||
|
|
||||||
public class ReadingListAdapter extends BaseAdapter {
|
public class ReadingListAdapter extends BaseAdapter {
|
||||||
private Context context;
|
private Context context;
|
||||||
private List<Article> listArticles;
|
private List<Article> listArticles;
|
||||||
|
|
||||||
public ReadingListAdapter(Context context, List<Article> listArticles) {
|
public ReadingListAdapter(Context context, List<Article> listArticles) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.listArticles = listArticles;
|
this.listArticles = listArticles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return listArticles.size();
|
return listArticles.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getItem(int position) {
|
public Object getItem(int position) {
|
||||||
return listArticles.get(position);
|
return listArticles.get(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position) {
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
Article entry = listArticles.get(position);
|
|
||||||
if (convertView == null) {
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context
|
|
||||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
convertView = inflater.inflate(R.layout.article_list, null);
|
|
||||||
}
|
|
||||||
TextView tvTitle = (TextView) convertView.findViewById(R.id.listitem_titre);
|
|
||||||
//Log.e("title", entry.title);
|
|
||||||
tvTitle.setText(entry.title);
|
|
||||||
|
|
||||||
return convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
Article entry = listArticles.get(position);
|
||||||
|
if (convertView == null) {
|
||||||
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
convertView = inflater.inflate(R.layout.article_list, parent, false);
|
||||||
|
}
|
||||||
|
TextView tvTitle = (TextView) convertView.findViewById(R.id.listitem_titre);
|
||||||
|
TextView tvHost = (TextView) convertView.findViewById(R.id.listitem_textview_url);
|
||||||
|
|
||||||
|
tvTitle.setText(entry.title);
|
||||||
|
tvHost.setText(entry.getHostOfUrl());
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,22 @@
|
|||||||
package fr.gaulupeau.apps.Poche;
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
import static fr.gaulupeau.apps.Poche.Helpers.PREFS_NAME;
|
|
||||||
import fr.gaulupeau.apps.InThePoche.R;
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class Settings extends Activity {
|
import fr.gaulupeau.apps.InThePoche.R;
|
||||||
|
|
||||||
|
import static fr.gaulupeau.apps.Poche.Helpers.PREFS_NAME;
|
||||||
|
|
||||||
|
public class Settings extends BaseActionBarActivity {
|
||||||
Button btnDone;
|
Button btnDone;
|
||||||
EditText editPocheUrl;
|
EditText editPocheUrl;
|
||||||
EditText editAPIUsername;
|
EditText editAPIUsername;
|
||||||
EditText editAPIToken;
|
EditText editAPIToken;
|
||||||
EditText editGlobalToken;
|
|
||||||
TextView textViewVersion;
|
TextView textViewVersion;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -26,36 +24,28 @@ public class Settings extends Activity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.settings);
|
setContentView(R.layout.settings);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
|
||||||
try {
|
String pocheUrl = settings.getString("pocheUrl", "http://");
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
String apiUsername = settings.getString("APIUsername", "");
|
||||||
} catch (Exception e) {
|
String apiToken = settings.getString("APIToken", "");
|
||||||
//
|
editPocheUrl = (EditText) findViewById(R.id.pocheUrl);
|
||||||
}
|
editPocheUrl.setText(pocheUrl);
|
||||||
}
|
editAPIUsername = (EditText) findViewById(R.id.APIUsername);
|
||||||
|
editAPIUsername.setText(apiUsername);
|
||||||
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
|
editAPIToken = (EditText) findViewById(R.id.APIToken);
|
||||||
String pocheUrl = settings.getString("pocheUrl", "http://");
|
editAPIToken.setText(apiToken);
|
||||||
String apiUsername = settings.getString("APIUsername", "");
|
btnDone = (Button) findViewById(R.id.btnDone);
|
||||||
String apiToken = settings.getString("APIToken", "");
|
btnDone.setOnClickListener(new OnClickListener() {
|
||||||
editPocheUrl = (EditText)findViewById(R.id.pocheUrl);
|
|
||||||
editPocheUrl.setText(pocheUrl);
|
|
||||||
editAPIUsername = (EditText)findViewById(R.id.APIUsername);
|
|
||||||
editAPIUsername.setText(apiUsername);
|
|
||||||
editAPIToken = (EditText)findViewById(R.id.APIToken);
|
|
||||||
editAPIToken.setText(apiToken);
|
|
||||||
btnDone = (Button)findViewById(R.id.btnDone);
|
|
||||||
btnDone.setOnClickListener(new OnClickListener() {
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
|
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putString("pocheUrl", editPocheUrl.getText().toString());
|
editor.putString("pocheUrl", editPocheUrl.getText().toString());
|
||||||
editor.putString("APIUsername", editAPIUsername.getText().toString());
|
editor.putString("APIUsername", editAPIUsername.getText().toString());
|
||||||
editor.putString("APIToken", editAPIToken.getText().toString());
|
editor.putString("APIToken", editAPIToken.getText().toString());
|
||||||
editor.commit();
|
editor.commit();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
textViewVersion = (TextView) findViewById(R.id.version);
|
textViewVersion = (TextView) findViewById(R.id.version);
|
||||||
textViewVersion.setText(getApplicationContext().getPackageManager().getPackageInfo(getApplicationContext().getPackageName(), 0).versionName);
|
textViewVersion.setText(getApplicationContext().getPackageManager().getPackageInfo(getApplicationContext().getPackageName(), 0).versionName);
|
||||||
@ -63,15 +53,4 @@ public class Settings extends Activity {
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case android.R.id.home:
|
|
||||||
this.finish();
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package fr.gaulupeau.apps.Poche;
|
package fr.gaulupeau.apps.Poche;
|
||||||
|
|
||||||
public class arrays {
|
public class arrays {
|
||||||
public static String[] PodcastTitle;
|
public static String[] PodcastTitle;
|
||||||
public static String[] PodcastURL;
|
public static String[] PodcastURL;
|
||||||
public static String[] PodcastContent;
|
public static String[] PodcastContent;
|
||||||
public static String[] PodcastMedia;
|
public static String[] PodcastMedia;
|
||||||
public static String[] PodcastDate;
|
public static String[] PodcastDate;
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
@ -10,7 +10,8 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical"
|
||||||
|
tools:ignore="WebViewLayout" >
|
||||||
|
|
||||||
<WebView
|
<WebView
|
||||||
android:id="@+id/webViewContent"
|
android:id="@+id/webViewContent"
|
||||||
|
@ -1,14 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical" android:padding="10sp"
|
android:orientation="vertical" android:padding="8sp"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" >
|
android:layout_width="fill_parent" android:layout_height="fill_parent" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/listitem_titre"
|
android:id="@+id/listitem_titre"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="20sp"
|
android:textSize="18sp"
|
||||||
android:typeface="serif" />
|
android:textColor="@android:color/black"
|
||||||
|
android:paddingBottom="4sp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/listitem_textview_url"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:singleLine="true" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
<string name="author">GAULUPEAU Jonathan - 2013</string>
|
<string name="author">GAULUPEAU Jonathan - 2013</string>
|
||||||
<string name="instructions">Um eine Website zu speichern benutze einfach den <i>Teilen</i> Button deines Browsers und drücke dann auf <i>Bag it!</i>.\nDann wirst du zur Login-Seite deiner wallabag weitergeleitet. \nFertig!\nErfahre mehr über wallabag auf:\n http://www.wallabag.org</string>
|
<string name="instructions">Um eine Website zu speichern benutze einfach den <i>Teilen</i> Button deines Browsers und drücke dann auf <i>Bag it!</i>.\nDann wirst du zur Login-Seite deiner wallabag weitergeleitet. \nFertig!\nErfahre mehr über wallabag auf:\n http://www.wallabag.org</string>
|
||||||
<string name="btnDone">Speichern</string>
|
<string name="btnDone">Speichern</string>
|
||||||
<string name="which_browser">Welchen Browser möchtest du benutzen?</string>
|
|
||||||
<string name="authorSite">http://cv.gaulupeau.fr</string>
|
|
||||||
<string name="url_label"><b><u>Deine wallabag URL:</u></b></string>
|
<string name="url_label"><b><u>Deine wallabag URL:</u></b></string>
|
||||||
<string name="url_help">Beispiele:\n<i>http://wallabag.example.com</i>\n<i>http://www.example.com/wallabag</i></string>
|
<string name="url_help">Beispiele:\n<i>http://wallabag.example.com</i>\n<i>http://www.example.com/wallabag</i></string>
|
||||||
<string name="btnGetPost">Artikelliste - %1$d ungelesene</string>
|
<string name="btnGetPost">Artikelliste - %1$d ungelesene</string>
|
||||||
@ -17,10 +15,10 @@
|
|||||||
<string name="menuShowAll">Alle anzeigen</string>
|
<string name="menuShowAll">Alle anzeigen</string>
|
||||||
<string name="menuWipeDb">Datenbank leeren</string>
|
<string name="menuWipeDb">Datenbank leeren</string>
|
||||||
<string name="txtSyncDone">Synchronisieren erfolgreich!</string>
|
<string name="txtSyncDone">Synchronisieren erfolgreich!</string>
|
||||||
<string name="txtSyncFailed">Synchronisieren fehlgeschlagen!</string>
|
|
||||||
<string name="txtNetOffline">Internetverbindung prüfen!</string>
|
<string name="txtNetOffline">Internetverbindung prüfen!</string>
|
||||||
<string name="txtConfigNotSet">Bitte konfiguriere die App zunächst!</string>
|
<string name="txtConfigNotSet">Bitte konfiguriere die App zunächst!</string>
|
||||||
<string name="txtGlobalToken"><b><u>Globales API Token:</u></b></string>
|
|
||||||
<string name="txtAPIUsername"><b><u>Deine User ID:</u></b></string>
|
<string name="txtAPIUsername"><b><u>Deine User ID:</u></b></string>
|
||||||
<string name="txtAPIToken"><b><u>Dein Token:</u></b></string>
|
<string name="txtAPIToken"><b><u>Dein Token:</u></b></string>
|
||||||
|
<string name="error">Fehler</string>
|
||||||
|
<string name="error_feed">Fehler beim laden des Feeds</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<style name="app_theme" parent="android:Theme.Holo.Light"/>
|
|
||||||
<style name="mainActivity_theme" parent="android:Theme.Holo.Light" />
|
|
||||||
</resources>
|
|
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<style name="app_theme" parent="android:Theme.DeviceDefault.Light.DarkActionBar"/>
|
|
||||||
<style name="mainActivity_theme" parent="android:Theme.DeviceDefault.Light.NoActionBar" />
|
|
||||||
</resources>
|
|
@ -6,8 +6,6 @@
|
|||||||
<string name="author">GAULUPEAU Jonathan - 2013</string>
|
<string name="author">GAULUPEAU Jonathan - 2013</string>
|
||||||
<string name="instructions">To save a web page to wallabag, open the page in a browser then tap <i>Share</i> and tap on <i>Bag it!</i>. \nYou could then see your wallabag login page. \nAnd it\'s done ! \nMore infos about wallabag at:\n http://www.wallabag.org</string>
|
<string name="instructions">To save a web page to wallabag, open the page in a browser then tap <i>Share</i> and tap on <i>Bag it!</i>. \nYou could then see your wallabag login page. \nAnd it\'s done ! \nMore infos about wallabag at:\n http://www.wallabag.org</string>
|
||||||
<string name="btnDone">Save</string>
|
<string name="btnDone">Save</string>
|
||||||
<string name="which_browser">Which browser would you like to use?</string>
|
|
||||||
<string name="authorSite">http://cv.gaulupeau.fr</string>
|
|
||||||
<string name="url_label"><b><u>Your wallabag URL :</u></b></string>
|
<string name="url_label"><b><u>Your wallabag URL :</u></b></string>
|
||||||
<string name="url_help">Examples:\n<i>http://wallabag.example.fr</i>\n<i>http://www.example.fr/wallabag</i></string>
|
<string name="url_help">Examples:\n<i>http://wallabag.example.fr</i>\n<i>http://www.example.fr/wallabag</i></string>
|
||||||
<string name="btnGetPost">List articles - %1$d unread</string>
|
<string name="btnGetPost">List articles - %1$d unread</string>
|
||||||
@ -17,10 +15,10 @@
|
|||||||
<string name="menuShowAll">Show All</string>
|
<string name="menuShowAll">Show All</string>
|
||||||
<string name="menuWipeDb">Wipe Database</string>
|
<string name="menuWipeDb">Wipe Database</string>
|
||||||
<string name="txtSyncDone">Synchronize done !</string>
|
<string name="txtSyncDone">Synchronize done !</string>
|
||||||
<string name="txtSyncFailed">Synchronize failed !</string>
|
|
||||||
<string name="txtNetOffline">Check Internet Connectivity !</string>
|
<string name="txtNetOffline">Check Internet Connectivity !</string>
|
||||||
<string name="txtConfigNotSet">Please configure the app before Syncing !</string>
|
<string name="txtConfigNotSet">Please configure the app before Syncing !</string>
|
||||||
<string name="txtGlobalToken"><b><u>API global token :</u></b></string>
|
|
||||||
<string name="txtAPIUsername"><b><u>Your User ID:</u></b></string>
|
<string name="txtAPIUsername"><b><u>Your User ID:</u></b></string>
|
||||||
<string name="txtAPIToken"><b><u>Your Token:</u></b></string>
|
<string name="txtAPIToken"><b><u>Your Token:</u></b></string>
|
||||||
|
<string name="error">Error</string>
|
||||||
|
<string name="error_feed">Error loading feed</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="app_theme" parent="android:Theme.Light"/>
|
<style name="app_theme" parent="Theme.AppCompat.Light.DarkActionBar"/>
|
||||||
<style name="mainActivity_theme" parent="android:Theme.Light.NoTitleBar" />
|
<style name="mainActivity_theme" parent="Theme.AppCompat.Light.NoActionBar" />
|
||||||
</resources>
|
</resources>
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Sun Jun 22 17:29:26 CEST 2014
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
|
Loading…
Reference in New Issue
Block a user