Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
<classpath>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="libs/HtmlCleaner/src"/>
<classpathentry kind="src" path="libs/jackson-core/src/main/java"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="org.eclipse.andmore.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="org.eclipse.andmore.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="org.eclipse.andmore.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
16 changes: 16 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.andmore.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.andmore.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
Expand All @@ -25,8 +35,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.andmore.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.andmore.AndroidNature</nature>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Expand Down
5 changes: 0 additions & 5 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name="org.freshrss.easyrss.SyncingReceiver" >
<intent-filter>
<action android:name="android.net.ConnectivityManager.CONNECTIVITY_ACTION" />
</intent-filter>
</receiver>

<provider
android:name="org.freshrss.easyrss.data.DataProvider"
Expand Down
2 changes: 1 addition & 1 deletion project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
# project structure.

# Project target.
target=android-19
target=android-22
54 changes: 27 additions & 27 deletions res/values-ja/arrays.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="SettingItemSync">
<item>WLAN有りの時のみ自動同期</item>
<item>ネットワーク有りの時のみ自動同期</item>
<item>自動同期オフ</item>
</string-array>
<string-array name="SettingImageFetching">
<item>WLAN有りの時のみ画像をダウロード</item>
<item>ネットワーク有りの時のみ画像をダウロード</item>
<item>画像をダウロードしない</item>
</string-array>
<string-array name="SettingTheme">
<item>デフォルトテーマ</item>
<item>ナイトモード</item>
</string-array>
<string-array name="SettingSyncInterval">
<item>1時間</item>
<item>2時間</item>
<item>3時間</item>
<item>4時間</item>
<item>6時間</item>
<item>20分</item>
<item>30分</item>
</string-array>
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string-array name="SettingItemSync">
<item>WLAN有りの時のみ自動同期</item>
<item>ネットワーク有りの時のみ自動同期</item>
<item>自動同期オフ</item>
</string-array>
<string-array name="SettingImageFetching">
<item>WLAN有りの時のみ画像をダウロード</item>
<item>ネットワーク有りの時のみ画像をダウロード</item>
<item>画像をダウロードしない</item>
</string-array>
<string-array name="SettingTheme">
<item>デフォルトテーマ</item>
<item>ナイトモード</item>
</string-array>
<string-array name="SettingSyncInterval">
<item>1時間</item>
<item>2時間</item>
<item>3時間</item>
<item>4時間</item>
<item>6時間</item>
<item>20分</item>
<item>30分</item>
</string-array>

</resources>
246 changes: 123 additions & 123 deletions res/values-ja/strings.xml

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="pageBackground" format="reference" />
<attr name="textColor" format="reference" />
<attr name="listItemBackground" format="reference" />
<attr name="listItemUnclickableBackground" format="reference" />
<attr name="listItemArrow" format="reference" />
<attr name="itemTitleTextColor" format="reference" />
<attr name="itemLastNextBackground" format="reference" />
<attr name="itemLastNextTextColor" format="reference" />
<attr name="itemLastBorderColor" format="reference" />
<attr name="itemNextBorderColor" format="reference" />
<attr name="itemBottomLineBackground" format="reference" />
<attr name="itemBottomMenuBackground" format="reference" />
<attr name="itemButtonMobilizedViewBackground" format="reference" />
<attr name="itemButtonOriginalViewBackground" format="reference" />
<attr name="verticalScrollView" format="reference" />
<?xml version="1.0" encoding="utf-8"?>
<resources>

<attr name="pageBackground" format="reference" />
<attr name="textColor" format="reference" />
<attr name="listItemBackground" format="reference" />
<attr name="listItemUnclickableBackground" format="reference" />
<attr name="listItemArrow" format="reference" />
<attr name="itemTitleTextColor" format="reference" />
<attr name="itemLastNextBackground" format="reference" />
<attr name="itemLastNextTextColor" format="reference" />
<attr name="itemLastBorderColor" format="reference" />
<attr name="itemNextBorderColor" format="reference" />
<attr name="itemBottomLineBackground" format="reference" />
<attr name="itemBottomMenuBackground" format="reference" />
<attr name="itemButtonMobilizedViewBackground" format="reference" />
<attr name="itemButtonOriginalViewBackground" format="reference" />
<attr name="verticalScrollView" format="reference" />

</resources>
16 changes: 16 additions & 0 deletions src/org/freshrss/easyrss/BootReceiver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.freshrss.easyrss;

import org.freshrss.easyrss.network.NetworkUtils;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class BootReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
NetworkUtils.startSyncingTimer(context);
}

}
1 change: 1 addition & 0 deletions src/org/freshrss/easyrss/VerticalSingleItemView.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebSettings.RenderPriority;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.CheckBox;
Expand Down
26 changes: 19 additions & 7 deletions src/org/freshrss/easyrss/network/GlobalItemDataSyncer.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;

Expand Down Expand Up @@ -124,8 +126,14 @@ public void onProgressChanged(final String text, final int progress, final int m

@Override
protected void startSyncing() throws DataSyncerException {

final Context context = dataMgr.getContext();
if (!NetworkUtils.checkSyncingNetworkStatus(context, networkConfig)) {
return;
}

final String sExpTime = dataMgr.getSettingByName(Setting.SETTING_ITEM_LIST_EXPIRE_TIME);
if (networkConfig != SettingSyncMethod.SYNC_METHOD_MANUAL
if (networkConfig != SettingSyncMethod.SYNC_METHOD_MANUAL
&& sExpTime != null
&& Long.valueOf(sExpTime) + new SettingSyncInterval(dataMgr).toSeconds() * 1000 - 10 * 60 * 1000 > System
.currentTimeMillis()) {
Expand All @@ -152,9 +160,6 @@ protected void startSyncing() throws DataSyncerException {

private void syncAllItems() throws DataSyncerException {
final Context context = dataMgr.getContext();
if (!NetworkUtils.checkSyncingNetworkStatus(context, networkConfig)) {
return;
}
int count = 0;
String sSetting = dataMgr.getSettingByName(Setting.SETTING_GLOBAL_NEWEST_ITEM_TIMESTAMP);
long newestTimestamp = (sSetting == null) ? 0 : Long.valueOf(sSetting);
Expand Down Expand Up @@ -226,9 +231,6 @@ private void syncUnreadCount() throws DataSyncerException {

private void syncUnreadItems() throws DataSyncerException {
final Context context = dataMgr.getContext();
if (!NetworkUtils.checkSyncingNetworkStatus(context, networkConfig)) {
return;
}
String sSetting = dataMgr.getSettingByName(Setting.SETTING_GLOBAL_ITEM_UNREAD_COUNT);
final int unreadCount = (sSetting == null) ? 0 : Integer.valueOf(sSetting);
if (unreadCount == 0) {
Expand All @@ -250,6 +252,16 @@ public void onItemIdRetrieved(final ItemId itemId) throws IOException {
itemIds.add(itemId);
}
});

// Sort ItemIds by timestamp (Downward). That prevents mark all
// items as read if they are disordered.
Collections.sort(itemIds, new Comparator<ItemId>() {
@Override
public int compare(ItemId lhs, ItemId rhs) {
return Long.valueOf(lhs.getTimestamp()).compareTo(rhs.getTimestamp());
}
});

for (int i = 0; i < itemIds.size(); i += 50) {
if (i + 50 <= itemIds.size()) {
dataMgr.markItemsAsReadItemIds(itemIds, i, i + 50);
Expand Down
12 changes: 6 additions & 6 deletions src/org/freshrss/easyrss/network/SubscriptionDataSyncer.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ protected void finishSyncing() {

@Override
public void startSyncing() throws DataSyncerException {

final Context context = dataMgr.getContext();
if (!NetworkUtils.checkSyncingNetworkStatus(context, networkConfig)) {
return;
}

final String sExpTime = dataMgr.getSettingByName(Setting.SETTING_SUBSCRIPTION_LIST_EXPIRE_TIME);
if (networkConfig != SettingSyncMethod.SYNC_METHOD_MANUAL
&& sExpTime != null
Expand All @@ -105,9 +111,6 @@ public void startSyncing() throws DataSyncerException {

private void syncSubscriptionIcons() throws DataSyncerException {
final Context context = dataMgr.getContext();
if (!NetworkUtils.checkSyncingNetworkStatus(context, networkConfig)) {
return;
}
final ContentResolver resolver = context.getContentResolver();
final Cursor cur = resolver.query(Subscription.CONTENT_URI, new String[] { Subscription._UID,
Subscription._ICON, Subscription._URL }, null, null, null);
Expand Down Expand Up @@ -137,9 +140,6 @@ private void syncSubscriptionIcons() throws DataSyncerException {

private void syncSubscriptions() throws DataSyncerException {
final Context context = dataMgr.getContext();
if (!NetworkUtils.checkSyncingNetworkStatus(context, networkConfig)) {
return;
}
notifyProgressChanged(context.getString(R.string.TxtSyncingSubscriptions), -1, -1);

final InputStream stream = httpGetQueryStream(new SubscriptionListURL(isHttpsConnection));
Expand Down
9 changes: 6 additions & 3 deletions src/org/freshrss/easyrss/network/TagDataSyncer.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ protected void finishSyncing() {

@Override
public void startSyncing() throws DataSyncerException {

final Context context = dataMgr.getContext();
if (!NetworkUtils.checkSyncingNetworkStatus(context, networkConfig)) {
return;
}

final String sExpTime = dataMgr.getSettingByName(Setting.SETTING_TAG_LIST_EXPIRE_TIME);
if (networkConfig != SettingSyncMethod.SYNC_METHOD_MANUAL
&& sExpTime != null
Expand All @@ -98,9 +104,6 @@ public void startSyncing() throws DataSyncerException {

private void syncTags() throws DataSyncerException {
final Context context = dataMgr.getContext();
if (!NetworkUtils.checkSyncingNetworkStatus(context, networkConfig)) {
return;
}
notifyProgressChanged(context.getString(R.string.TxtSyncingTags), -1, -1);

final InputStream stream = httpGetQueryStream(new TagListURL(isHttpsConnection));
Expand Down
5 changes: 2 additions & 3 deletions src/org/freshrss/easyrss/network/url/StreamContentsURL.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

package org.freshrss.easyrss.network.url;

import android.net.Uri;

/*
* Reference: http://code.google.com/p/google-reader-api/wiki/ApiStreamContents
*/
Expand All @@ -34,7 +32,7 @@ public StreamContentsURL(final boolean isHttpsConnection, final String uid, fina

@Override
public String getBaseURL() {
return appendURL(serverUrl + URL_STREAM_CONTENTS, Uri.encode(uid, "/"));
return appendURL(serverUrl, URL_STREAM_CONTENTS);
}

public String getContinuation() {
Expand Down Expand Up @@ -96,6 +94,7 @@ public void setNewestItemTime(final long newestItemTime) {

public void setUid(final String uid) {
this.uid = uid;
addParam("s", uid);
}

public void setUnread(final boolean isUnread) {
Expand Down