summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-09-10 12:03:32 +0400
committerAndrew Dolgov <[email protected]>2011-09-10 12:03:32 +0400
commit09fed5025fddc49bba6559082e56e3860bb1928e (patch)
treee799f2c6db047b480df7bcc931752d996d79209d
parentafc8996fff1dfb8b4fa36db7a965100eafe3c852 (diff)
misc fixes
-rw-r--r--res/layout/article_fragment.xml8
-rw-r--r--res/layout/headlines_row.xml3
-rw-r--r--res/layout/main.xml17
-rw-r--r--res/values/strings.xml1
-rw-r--r--src/org/fox/ttrss/FeedsFragment.java2
-rw-r--r--src/org/fox/ttrss/MainActivity.java34
6 files changed, 45 insertions, 20 deletions
diff --git a/res/layout/article_fragment.xml b/res/layout/article_fragment.xml
index 1c54d3d7..cec8e0b2 100644
--- a/res/layout/article_fragment.xml
+++ b/res/layout/article_fragment.xml
@@ -1,8 +1,8 @@
- <LinearLayout android:padding="6dip" android:id="@+id/article_fragment" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical">
- <LinearLayout android:layout_margin="12dip" android:padding="6dip" android:background="#e0e0e0" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/article_header">
- <TextView android:layout_weight="1" android:textAppearance="?android:attr/textAppearanceLarge" android:text="TextView" android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/title"></TextView>
+ <LinearLayout android:id="@+id/article_fragment" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical">
+ <LinearLayout android:layout_gravity="center_vertical" android:padding="6dip" android:background="#e0e0e0" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/article_header">
+ <TextView android:layout_weight="1" android:text="TextView" android:layout_height="wrap_content" android:textColor="#909090" android:layout_width="match_parent" android:id="@+id/title"></TextView>
<Button android:text="Close" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/close_button"></Button>
</LinearLayout>
- <WebView android:layout_width="match_parent" android:id="@+id/content" android:layout_height="match_parent"></WebView>
+ <WebView android:padding="3dip" android:layout_width="match_parent" android:id="@+id/content" android:layout_height="match_parent"></WebView>
</LinearLayout>
diff --git a/res/layout/headlines_row.xml b/res/layout/headlines_row.xml
index 91b81a30..1cb583f6 100644
--- a/res/layout/headlines_row.xml
+++ b/res/layout/headlines_row.xml
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
- android:layout_height="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
- android:padding="3dip" android:id="@+id/headlines_row" android:orientation="horizontal">
+ android:padding="3dip" android:id="@+id/headlines_row" android:orientation="horizontal" android:layout_height="wrap_content">
<CheckBox android:focusable="false"
android:paddingLeft="6dip" android:paddingRight="6dip" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/selected"></CheckBox>
diff --git a/res/layout/main.xml b/res/layout/main.xml
index c4d233b5..717231cf 100644
--- a/res/layout/main.xml
+++ b/res/layout/main.xml
@@ -1,8 +1,15 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:layout_height="fill_parent" android:id="@+id/main_flipper">
- <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal">
+ <FrameLayout android:layout_gravity="center_vertical" android:id="@+id/sync_splash" android:layout_width="match_parent" android:layout_height="match_parent">
+ <LinearLayout android:gravity="center" android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent">
+ <ProgressBar android:id="@+id/loading_progress" android:layout_height="wrap_content" android:layout_width="wrap_content" style="?android:attr/progressBarStyleLarge"></ProgressBar>
+ <TextView android:textAppearance="?android:attr/textAppearanceLarge" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/loading_message" android:text="@string/loading_message"></TextView>
+ </LinearLayout>
+ </FrameLayout>
+
+ <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:id="@+id/main">
<LinearLayout android:layout_weight="1.5" android:layout_height="match_parent" android:id="@+id/linearLayout4" android:layout_width="match_parent">
@@ -25,11 +32,11 @@
<ImageView android:paddingRight="2dip" android:layout_height="match_parent" android:background="?feedlistDivider" android:layout_width="wrap_content" android:paddingLeft="2dip"></ImageView>
- <LinearLayout android:layout_weight="1" android:visibility="gone" android:layout_width="match_parent" android:background="#f0f0ff" android:id="@+id/article_container" android:layout_height="match_parent"></LinearLayout>
+ <LinearLayout android:layout_weight="1" android:visibility="gone" android:layout_width="match_parent" android:id="@+id/article_container" android:layout_height="match_parent"></LinearLayout>
</LinearLayout>
</LinearLayout>
-</FrameLayout> \ No newline at end of file
+</ViewFlipper> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0d14aa5d..c24d6911 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -28,4 +28,5 @@
<string name="online">Online</string>
<string name="synchronizing">Synchronizing...</string>
<string name="no_headlines">No articles found.</string>
+ <string name="loading_message">Loading, please wait...</string>
</resources>
diff --git a/src/org/fox/ttrss/FeedsFragment.java b/src/org/fox/ttrss/FeedsFragment.java
index e1fb945b..34fe3464 100644
--- a/src/org/fox/ttrss/FeedsFragment.java
+++ b/src/org/fox/ttrss/FeedsFragment.java
@@ -48,7 +48,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener {
DatabaseHelper helper = new DatabaseHelper(getActivity());
m_db = helper.getReadableDatabase();
- m_cursor = m_db.query("feeds_unread", null, "unread > 0", null, null, null, "title");
+ m_cursor = m_db.query("feeds_unread", null, null, null, null, null, "unread DESC, title");
m_adapter = new FeedsListAdapter(getActivity(), R.layout.feeds_row, m_cursor,
new String[] { "title", "unread" }, new int[] { R.id.title, R.id.unread_counter }, 0);
diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java
index 49ab21f2..69f9e249 100644
--- a/src/org/fox/ttrss/MainActivity.java
+++ b/src/org/fox/ttrss/MainActivity.java
@@ -23,8 +23,8 @@ import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
-import android.view.View;
import android.widget.LinearLayout;
+import android.widget.ViewFlipper;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
@@ -37,14 +37,14 @@ public class MainActivity extends Activity {
private final static int UPDATE_SEQUENTIAL = 2;
private final static int UPDATE_OFFLINE = 3;
- private final static int INITIAL_OFFSET_MAX = 100;
+ private final static int OFFSET_MAX = 100;
private SharedPreferences m_prefs;
private String m_themeName = "";
private boolean m_feedsOpened = false;
protected String m_sessionId;
protected int m_offset = 0;
- protected int m_limit = 25;
+ protected int m_limit = 30;
protected int m_maxId = 0;
protected int m_updateMode = UPDATE_INITIAL;
@@ -79,7 +79,7 @@ public class MainActivity extends Activity {
private class FeedsTask extends TimerTask {
@Override
public void run() {
- downloadFeeds();
+ downloadFeeds();
}
};
@@ -144,7 +144,7 @@ public class MainActivity extends Activity {
m_feedsOpened = true;
}
- scheduleNextUpdate();
+ //scheduleNextUpdate();
}
@Override
@@ -174,6 +174,12 @@ public class MainActivity extends Activity {
public void onDestroy() {
super.onDestroy();
+ m_feedsTask.cancel();
+ m_articlesTask.cancel();
+
+ m_feedsTimer.cancel();
+ m_feedsTimer = null;
+
m_articlesTimer.cancel();
m_articlesTimer = null;
}
@@ -343,7 +349,7 @@ public class MainActivity extends Activity {
Log.d(TAG, articlesFound + " articles processed");
- if (m_updateMode == UPDATE_INITIAL && articlesFound == m_limit && m_offset < INITIAL_OFFSET_MAX) {
+ if (articlesFound == m_limit && m_offset < OFFSET_MAX) {
m_offset += m_limit;
@@ -363,6 +369,17 @@ public class MainActivity extends Activity {
}
}
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ ViewFlipper vf = (ViewFlipper) findViewById(R.id.main_flipper);
+
+ if (vf != null && vf.getDisplayedChild() == 0) {
+ vf.showNext();
+ }
+ }
+ });
+
scheduleNextUpdate();
} catch (Exception e) {
@@ -386,7 +403,7 @@ public class MainActivity extends Activity {
put("sid", m_sessionId);
put("op", "getFeeds");
put("cat_id", "-3");
- put("unread_only", "0");
+ put("unread_only", "1");
}
});
@@ -454,10 +471,11 @@ public class MainActivity extends Activity {
if (frag != null) {
frag.updateListView();
- }
+ }
}
});
+ scheduleNextUpdate();
} catch (Exception e) {
e.printStackTrace();