aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>2013-05-21 14:31:15 +0400
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>2013-05-21 14:31:15 +0400
commit4f49ae38dd06974ada031153569b5fff64e8afb3 (patch)
treeb1bb52e4f07b4cc4b4f436a28865d87161a72be6
parent1bc939e60b361bd85915511b0b3c27bb4ae12238 (diff)
parent48f2680916df329bbe34365ee58ceed67dc082ba (diff)
Merge branch 'master' of github.com:gothfox/Tiny-Tiny-RSS-for-Honeycomb
-rw-r--r--AndroidManifest.xml4
-rw-r--r--res/drawable-hdpi/arrowhead_light.pngbin1283 -> 287 bytes
-rw-r--r--res/drawable-hdpi/ic_mailbox_collapsed_holo_dark.pngbin0 -> 274 bytes
-rw-r--r--res/drawable-hdpi/ic_mailbox_collapsed_holo_light.pngbin0 -> 350 bytes
-rw-r--r--res/drawable/headline_row_selected_dark.xml2
-rw-r--r--res/drawable/shadow_headlines.xml2
-rw-r--r--res/layout-sw600dp/feeds_row_selected.xml12
-rw-r--r--res/layout/feeds_row.xml12
-rw-r--r--res/layout/feeds_row_selected.xml12
-rw-r--r--res/layout/headlines_row.xml9
-rw-r--r--res/layout/headlines_row_selected.xml10
-rw-r--r--res/layout/headlines_row_selected_unread.xml9
-rw-r--r--res/layout/headlines_row_unread.xml12
-rw-r--r--res/values-v11/style.xml2
-rw-r--r--res/values/strings.xml1
-rw-r--r--res/xml/preferences.xml6
-rw-r--r--src/org/fox/ttrss/CommonActivity.java7
-rw-r--r--src/org/fox/ttrss/FeedCategoriesFragment.java23
-rw-r--r--src/org/fox/ttrss/FeedsActivity.java39
-rw-r--r--src/org/fox/ttrss/FeedsFragment.java16
-rw-r--r--src/org/fox/ttrss/HeadlinesActivity.java4
-rw-r--r--src/org/fox/ttrss/HeadlinesFragment.java11
-rw-r--r--src/org/fox/ttrss/OnlineActivity.java113
-rw-r--r--src/org/fox/ttrss/offline/OfflineActivity.java4
-rw-r--r--src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java21
-rw-r--r--src/org/fox/ttrss/offline/OfflineFeedsActivity.java41
-rw-r--r--src/org/fox/ttrss/offline/OfflineFeedsFragment.java16
-rw-r--r--src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java26
-rw-r--r--src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java13
29 files changed, 339 insertions, 88 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d2baf5cf..3d6ebe8b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
- android:versionCode="168"
- android:versionName="1.7.5" >
+ android:versionCode="169"
+ android:versionName="1.7.6" >
<uses-sdk
android:minSdkVersion="8"
diff --git a/res/drawable-hdpi/arrowhead_light.png b/res/drawable-hdpi/arrowhead_light.png
index 130dbf18..2c113ae1 100644
--- a/res/drawable-hdpi/arrowhead_light.png
+++ b/res/drawable-hdpi/arrowhead_light.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_mailbox_collapsed_holo_dark.png b/res/drawable-hdpi/ic_mailbox_collapsed_holo_dark.png
new file mode 100644
index 00000000..eb1a7bd8
--- /dev/null
+++ b/res/drawable-hdpi/ic_mailbox_collapsed_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_mailbox_collapsed_holo_light.png b/res/drawable-hdpi/ic_mailbox_collapsed_holo_light.png
new file mode 100644
index 00000000..2c395b80
--- /dev/null
+++ b/res/drawable-hdpi/ic_mailbox_collapsed_holo_light.png
Binary files differ
diff --git a/res/drawable/headline_row_selected_dark.xml b/res/drawable/headline_row_selected_dark.xml
index b8ddb446..75c79a11 100644
--- a/res/drawable/headline_row_selected_dark.xml
+++ b/res/drawable/headline_row_selected_dark.xml
@@ -3,6 +3,8 @@
<item android:drawable="@color/ics_cyan"/>
+ <item android:drawable="@drawable/shadow"/>
+
<item><bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/arrowhead_dark"
diff --git a/res/drawable/shadow_headlines.xml b/res/drawable/shadow_headlines.xml
index 09e5aa6a..7c31ab34 100644
--- a/res/drawable/shadow_headlines.xml
+++ b/res/drawable/shadow_headlines.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
- <item android:drawable="@color/headlines_light"/>
+ <!-- <item android:drawable="@color/headlines_light"/> -->
<item android:drawable="@drawable/shadow"/>
</layer-list> \ No newline at end of file
diff --git a/res/layout-sw600dp/feeds_row_selected.xml b/res/layout-sw600dp/feeds_row_selected.xml
index 12336d71..f6217520 100644
--- a/res/layout-sw600dp/feeds_row_selected.xml
+++ b/res/layout-sw600dp/feeds_row_selected.xml
@@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="?feedsSelectedBackground"
+ android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="10dip"
@@ -43,4 +44,15 @@
android:textSize="13sp"
android:textStyle="bold" />
+ <ImageButton
+ android:id="@+id/feed_menu_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:background="@null"
+ android:paddingLeft="6dp"
+ android:paddingTop="6dp"
+ android:src="@drawable/ic_mailbox_collapsed_holo_light"
+ android:visibility="gone" />
+
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/feeds_row.xml b/res/layout/feeds_row.xml
index bd033b25..ffea8cf6 100644
--- a/res/layout/feeds_row.xml
+++ b/res/layout/feeds_row.xml
@@ -3,6 +3,7 @@
android:id="@+id/feeds_row"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
+ android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="10dip"
@@ -42,4 +43,15 @@
android:textSize="13sp"
android:textStyle="bold" />
+ <ImageButton
+ android:id="@+id/feed_menu_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:background="@null"
+ android:paddingLeft="6dp"
+ android:paddingTop="6dp"
+ android:visibility="gone"
+ android:src="@drawable/ic_mailbox_collapsed_holo_light" />
+
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/feeds_row_selected.xml b/res/layout/feeds_row_selected.xml
index cb95a819..b1d53549 100644
--- a/res/layout/feeds_row_selected.xml
+++ b/res/layout/feeds_row_selected.xml
@@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="?feedsSelectedBackgroundSolid"
+ android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="10dip"
@@ -43,4 +44,15 @@
android:textSize="13sp"
android:textStyle="bold" />
+ <ImageButton
+ android:id="@+id/feed_menu_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:background="@null"
+ android:paddingLeft="6dp"
+ android:paddingTop="6dp"
+ android:visibility="gone"
+ android:src="@drawable/ic_mailbox_collapsed_holo_light" />
+
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/headlines_row.xml b/res/layout/headlines_row.xml
index 94d5f856..d339e281 100644
--- a/res/layout/headlines_row.xml
+++ b/res/layout/headlines_row.xml
@@ -120,6 +120,15 @@
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
+ <ImageButton
+ android:id="@+id/article_menu_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:background="@null"
+ android:paddingLeft="6dp"
+ android:paddingTop="6dp"
+ android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/headlines_row_selected.xml b/res/layout/headlines_row_selected.xml
index e1788ad5..be2239d9 100644
--- a/res/layout/headlines_row_selected.xml
+++ b/res/layout/headlines_row_selected.xml
@@ -120,6 +120,16 @@
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
+
+ <ImageButton
+ android:id="@+id/article_menu_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:background="@null"
+ android:paddingLeft="6dp"
+ android:paddingTop="6dp"
+ android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>
diff --git a/res/layout/headlines_row_selected_unread.xml b/res/layout/headlines_row_selected_unread.xml
index 9051cfc9..93135abb 100644
--- a/res/layout/headlines_row_selected_unread.xml
+++ b/res/layout/headlines_row_selected_unread.xml
@@ -122,6 +122,15 @@
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
+ <ImageButton
+ android:id="@+id/article_menu_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:background="@null"
+ android:paddingLeft="6dp"
+ android:paddingTop="6dp"
+ android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>
</LinearLayout> \ No newline at end of file
diff --git a/res/layout/headlines_row_unread.xml b/res/layout/headlines_row_unread.xml
index b43b7f22..fc1ab67a 100644
--- a/res/layout/headlines_row_unread.xml
+++ b/res/layout/headlines_row_unread.xml
@@ -118,9 +118,19 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
- android:clickable="true"
+ android:clickable="true"
android:src="@drawable/ic_rss_bw" />
+ <ImageButton
+ android:id="@+id/article_menu_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:background="@null"
+ android:paddingLeft="6dp"
+ android:paddingTop="6dp"
+ android:src="@drawable/ic_mailbox_collapsed_holo_light" />
+
</LinearLayout>
</LinearLayout> \ No newline at end of file
diff --git a/res/values-v11/style.xml b/res/values-v11/style.xml
index 6fbb05e3..343c1e8e 100644
--- a/res/values-v11/style.xml
+++ b/res/values-v11/style.xml
@@ -51,7 +51,7 @@
<style name="DarkTheme" parent="Theme.Sherlock">
<item name="smallScreenBackground">@android:color/transparent</item>
<item name="ttrssHorizontalDivider">@android:drawable/divider_horizontal_dark</item>
- <item name="feedlistBackground">@drawable/ics_divider_vertical</item>
+ <item name="feedlistBackground">@android:color/transparent</item>
<item name="unreadCounterColor">@color/ics_cyan</item>
<item name="headlinesBackground">@drawable/headlines_dark</item>
<item name="headlinesBackgroundSolid">@drawable/headlines_dark</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9212a1e6..05df6e0c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -196,4 +196,5 @@
<string name="pref_headlines_mark_read_scroll">Mark read on scroll</string>
<string name="pref_headlines_mark_read_scroll_long">Headlines will be marked read when scrolling past them</string>
<string name="mark_num_headlines_as_read">Mark %1$d article(s) as read?</string>
+ <string name="prefs_confirm_headlines_catchup">Confirm marking articles as read</string>
</resources>
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index e05fc5b6..6bfa0e29 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -129,6 +129,12 @@
android:defaultValue="false"
android:key="full_screen_mode"
android:title="@string/prefs_fullscreen_mode" />
+
+ <CheckBoxPreference
+ android:defaultValue="true"
+ android:key="confirm_headlines_catchup"
+ android:title="@string/prefs_confirm_headlines_catchup" />
+
</PreferenceCategory>
<PreferenceCategory android:title="@string/offline_mode" >
<ListPreference
diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java
index e1cacb02..78d1937c 100644
--- a/src/org/fox/ttrss/CommonActivity.java
+++ b/src/org/fox/ttrss/CommonActivity.java
@@ -166,6 +166,13 @@ public class CommonActivity extends SherlockFragmentActivity {
toast.show();
}
+ public boolean isDarkTheme() {
+ String defaultTheme = "THEME_DARK";
+
+ return (m_prefs.getString("theme", defaultTheme).equals("THEME_DARK")) ||
+ m_prefs.getString("theme", defaultTheme).equals("THEME_DARK_GRAY");
+ }
+
protected void setAppTheme(SharedPreferences prefs) {
String defaultTheme = "THEME_DARK";
diff --git a/src/org/fox/ttrss/FeedCategoriesFragment.java b/src/org/fox/ttrss/FeedCategoriesFragment.java
index 90889255..144ea7c8 100644
--- a/src/org/fox/ttrss/FeedCategoriesFragment.java
+++ b/src/org/fox/ttrss/FeedCategoriesFragment.java
@@ -21,6 +21,7 @@ import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -29,6 +30,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@@ -406,6 +408,21 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
icon.setImageResource(cat.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
}
+ ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
+
+ if (ib != null) {
+ if (m_activity.isDarkTheme())
+ ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
+
+ ib.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getActivity().openContextMenu(v);
+ }
+ });
+ }
+
+
return v;
}
}
@@ -422,6 +439,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
public void onItemClick(AdapterView<?> av, View view, int position, long id) {
ListView list = (ListView)av;
+ Log.d(TAG, "onItemClick=" + position);
+
if (list != null) {
FeedCategory cat = (FeedCategory)list.getItemAtPosition(position);
@@ -438,8 +457,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
}
}
- if (!m_activity.isSmallScreen())
- m_selectedCat = cat;
+ //if (!m_activity.isSmallScreen())
+ // m_selectedCat = cat;
m_adapter.notifyDataSetChanged();
}
diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java
index 43ae5152..914d5461 100644
--- a/src/org/fox/ttrss/FeedsActivity.java
+++ b/src/org/fox/ttrss/FeedsActivity.java
@@ -34,6 +34,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
protected long m_lastRefresh = 0;
private boolean m_actionbarUpEnabled = false;
+ private int m_actionbarRevertDepth = 0;
@SuppressLint("NewApi")
@Override
@@ -58,10 +59,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (intent.getParcelableExtra("feed") != null || intent.getParcelableExtra("category") != null ||
intent.getParcelableExtra("article") != null) {
- if (!isCompatMode()) {
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- m_actionbarUpEnabled = true;
- }
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ m_actionbarUpEnabled = true;
Feed feed = (Feed) intent.getParcelableExtra("feed");
FeedCategory cat = (FeedCategory) intent.getParcelableExtra("category");
@@ -120,6 +119,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
}
} else { // savedInstanceState != null
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
+ m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
if (!isSmallScreen()) {
// temporary hack because FeedsActivity doesn't track whether active feed is open
@@ -127,7 +127,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
container.setWeightSum(3f);
}
- if (!isCompatMode() && m_actionbarUpEnabled) {
+ if (m_actionbarUpEnabled) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@@ -237,7 +237,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
}
public void onCatSelected(FeedCategory cat, boolean openAsFeed) {
-
+ FeedCategoriesFragment fc = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
+
if (!openAsFeed) {
if (isSmallScreen()) {
@@ -248,6 +249,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
startActivityForResult(intent, 0);
} else {
+ if (fc != null) {
+ fc.setSelectedCategory(null);
+ }
+
FragmentTransaction ft = getSupportFragmentManager()
.beginTransaction();
@@ -257,8 +262,17 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
ft.addToBackStack(null);
ft.commit();
+
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ m_actionbarUpEnabled = true;
+ m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
}
} else {
+
+ if (fc != null) {
+ fc.setSelectedCategory(cat);
+ }
+
Feed feed = new Feed(cat.id, cat.title, true);
onFeedSelected(feed);
}
@@ -271,6 +285,18 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
+ case android.R.id.home:
+ if (m_actionbarRevertDepth > 0) {
+
+ m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
+ m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
+ getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
+
+ onBackPressed();
+ } else {
+ finish();
+ }
+ return true;
case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());
initMenu();
@@ -299,6 +325,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
super.onSaveInstanceState(out);
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
+ out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
GlobalState.getInstance().save(out);
}
diff --git a/src/org/fox/ttrss/FeedsFragment.java b/src/org/fox/ttrss/FeedsFragment.java
index da428823..181d4418 100644
--- a/src/org/fox/ttrss/FeedsFragment.java
+++ b/src/org/fox/ttrss/FeedsFragment.java
@@ -34,6 +34,7 @@ import android.util.Base64;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -42,6 +43,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@@ -529,6 +531,20 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
}
}
+
+ ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
+
+ if (ib != null) {
+ if (m_activity.isDarkTheme())
+ ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
+
+ ib.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getActivity().openContextMenu(v);
+ }
+ });
+ }
return v;
}
diff --git a/src/org/fox/ttrss/HeadlinesActivity.java b/src/org/fox/ttrss/HeadlinesActivity.java
index 505f3344..b44b4388 100644
--- a/src/org/fox/ttrss/HeadlinesActivity.java
+++ b/src/org/fox/ttrss/HeadlinesActivity.java
@@ -33,9 +33,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
setContentView(R.layout.headlines);
- if (!isCompatMode()) {
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- }
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setSmallScreen(findViewById(R.id.headlines_fragment) == null);
diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java
index f9cc51d8..c8a791b0 100644
--- a/src/org/fox/ttrss/HeadlinesFragment.java
+++ b/src/org/fox/ttrss/HeadlinesFragment.java
@@ -41,6 +41,7 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@@ -272,7 +273,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
//list.setEmptyView(view.findViewById(R.id.no_headlines));
registerForContextMenu(list);
- if (m_activity.isSmallScreen() || m_activity.isPortrait())
+ if (m_activity.isSmallScreen())
view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0);
Log.d(TAG, "onCreateView, feed=" + m_feed);
@@ -721,17 +722,19 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
});
}
- /* ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button);
+ ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button);
if (ib != null) {
- ib.setVisibility(android.os.Build.VERSION.SDK_INT >= 10 ? View.VISIBLE : View.GONE);
+ if (m_activity.isDarkTheme())
+ ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
+
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
- } */
+ }
return v;
}
diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java
index 50f1c71c..c3696d02 100644
--- a/src/org/fox/ttrss/OnlineActivity.java
+++ b/src/org/fox/ttrss/OnlineActivity.java
@@ -621,9 +621,9 @@ public class OnlineActivity extends CommonActivity {
final ArticlePager ap = (ArticlePager)getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
switch (item.getItemId()) {
- case android.R.id.home:
+ /* case android.R.id.home:
finish();
- return true;
+ return true; */
case R.id.subscribe_to_feed:
Intent subscribe = new Intent(OnlineActivity.this, SubscribeActivity.class);
startActivityForResult(subscribe, 0);
@@ -749,55 +749,35 @@ public class OnlineActivity extends CommonActivity {
int count = hf.getUnreadArticles().size();
+ boolean confirm = m_prefs.getBoolean("confirm_headlines_catchup", true);
+
if (count > 0) {
- AlertDialog.Builder builder = new AlertDialog.Builder(
- OnlineActivity.this)
- .setMessage(getString(R.string.mark_num_headlines_as_read, count))
- .setPositiveButton(R.string.catchup,
- new Dialog.OnClickListener() {
- public void onClick(DialogInterface dialog,
- int which) {
-
- ArticleList articles = hf.getUnreadArticles();
-
- for (Article a : articles)
- a.unread = false;
-
- ApiRequest req = new ApiRequest(getApplicationContext()) {
- protected void onPostExecute(JsonElement result) {
- if (hf.isAdded()) {
- hf.refresh(false);
- }
- }
- };
-
- final String articleIds = articlesToIdString(articles);
-
- @SuppressWarnings("serial")
- HashMap<String, String> map = new HashMap<String, String>() {
- {
- put("sid", getSessionId());
- put("op", "updateArticle");
- put("article_ids", articleIds);
- put("mode", "0");
- put("field", "2");
- }
- };
- req.execute(map);
-
-
- }
- })
- .setNegativeButton(R.string.dialog_cancel,
- new Dialog.OnClickListener() {
- public void onClick(DialogInterface dialog,
- int which) {
-
- }
- });
-
- AlertDialog dlg = builder.create();
- dlg.show();
+ if (confirm) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(
+ OnlineActivity.this)
+ .setMessage(getString(R.string.mark_num_headlines_as_read, count))
+ .setPositiveButton(R.string.catchup,
+ new Dialog.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which) {
+
+ catchupVisibleArticles();
+
+ }
+ })
+ .setNegativeButton(R.string.dialog_cancel,
+ new Dialog.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which) {
+
+ }
+ });
+
+ AlertDialog dlg = builder.create();
+ dlg.show();
+ } else {
+ catchupVisibleArticles();
+ }
}
}
return true;
@@ -1020,6 +1000,39 @@ public class OnlineActivity extends CommonActivity {
}
}
+ protected void catchupVisibleArticles() {
+ final HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
+
+ if (hf != null) {
+ ArticleList articles = hf.getUnreadArticles();
+
+ for (Article a : articles)
+ a.unread = false;
+
+ ApiRequest req = new ApiRequest(getApplicationContext()) {
+ protected void onPostExecute(JsonElement result) {
+ if (hf.isAdded()) {
+ hf.refresh(false);
+ }
+ }
+ };
+
+ final String articleIds = articlesToIdString(articles);
+
+ @SuppressWarnings("serial")
+ HashMap<String, String> map = new HashMap<String, String>() {
+ {
+ put("sid", getSessionId());
+ put("op", "updateArticle");
+ put("article_ids", articleIds);
+ put("mode", "0");
+ put("field", "2");
+ }
+ };
+ req.execute(map);
+ }
+ }
+
public void editArticleNote(final Article article) {
String note = "";
diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java
index 319b76c8..de437fcf 100644
--- a/src/org/fox/ttrss/offline/OfflineActivity.java
+++ b/src/org/fox/ttrss/offline/OfflineActivity.java
@@ -169,9 +169,9 @@ public class OfflineActivity extends CommonActivity {
.findFragmentByTag(FRAG_ARTICLE);
switch (item.getItemId()) {
- case android.R.id.home:
+ /* case android.R.id.home:
finish();
- return true;
+ return true; */
case R.id.go_online:
switchOnline();
return true;
diff --git a/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java b/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java
index 85f49d6b..426cda0d 100644
--- a/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java
+++ b/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java
@@ -15,6 +15,7 @@ import android.support.v4.widget.SimpleCursorAdapter;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -22,6 +23,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@@ -195,8 +197,8 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
m_activity.onCatSelected(feedId);
}
- if (!m_activity.isSmallScreen())
- m_selectedCatId = feedId;
+ /* if (!m_activity.isSmallScreen())
+ m_selectedCatId = feedId; */
m_adapter.notifyDataSetChanged();
}
@@ -282,6 +284,21 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
if (icon != null) {
icon.setImageResource(cursor.getInt(cursor.getColumnIndex("unread")) > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
}
+
+ ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
+
+ if (ib != null) {
+ if (m_activity.isDarkTheme())
+ ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
+
+ ib.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getActivity().openContextMenu(v);
+ }
+ });
+ }
+
return v;
}
diff --git a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java
index dea8d336..fc0f521f 100644
--- a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java
+++ b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java
@@ -24,6 +24,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
private final String TAG = this.getClass().getSimpleName();
private boolean m_actionbarUpEnabled = false;
+ private int m_actionbarRevertDepth = 0;
@SuppressLint("NewApi")
@Override
@@ -44,8 +45,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
if (savedInstanceState != null) {
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
+ m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
- if (!isCompatMode() && m_actionbarUpEnabled) {
+ if (m_actionbarUpEnabled) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@@ -55,10 +57,8 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
if (intent.getIntExtra("feed", -10000) != -10000 || intent.getIntExtra("category", -10000) != -10000 ||
intent.getIntExtra("article", -10000) != -10000) {
- if (!isCompatMode()) {
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- m_actionbarUpEnabled = true;
- }
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ m_actionbarUpEnabled = true;
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
@@ -129,6 +129,18 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
+ case android.R.id.home:
+ if (m_actionbarRevertDepth > 0) {
+
+ m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
+ m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
+ getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
+
+ onBackPressed();
+ } else {
+ finish();
+ }
+ return true;
case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());
initMenu();
@@ -145,6 +157,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
super.onSaveInstanceState(out);
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
+ out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
GlobalState.getInstance().save(out);
}
@@ -181,7 +194,13 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
}
public void onCatSelected(int catId, boolean openAsFeed) {
+ OfflineFeedCategoriesFragment fc = (OfflineFeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
+
if (openAsFeed) {
+ if (fc != null) {
+ fc.setSelectedFeedId(catId);
+ }
+
onFeedSelected(catId, true, true);
} else {
if (isSmallScreen()) {
@@ -190,6 +209,10 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
startActivityForResult(intent, 0);
} else {
+ if (fc != null) {
+ fc.setSelectedFeedId(-1);
+ }
+
FragmentTransaction ft = getSupportFragmentManager()
.beginTransaction();
@@ -198,6 +221,10 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
ft.replace(R.id.feeds_fragment, ff, FRAG_FEEDS);
ft.addToBackStack(null);
+
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ m_actionbarUpEnabled = true;
+ m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
ft.commit();
}
@@ -305,7 +332,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
intent.putExtra("isCat", hf.getFeedIsCat());
intent.putExtra("article", articleId);
- startActivityForResult(intent, 0);
+ startActivityForResult(intent, 0);
+
+ overridePendingTransition(R.anim.right_slide_in, 0);
}
} else {
refresh();
diff --git a/src/org/fox/ttrss/offline/OfflineFeedsFragment.java b/src/org/fox/ttrss/offline/OfflineFeedsFragment.java
index 50e13afb..a2231485 100644
--- a/src/org/fox/ttrss/offline/OfflineFeedsFragment.java
+++ b/src/org/fox/ttrss/offline/OfflineFeedsFragment.java
@@ -20,6 +20,7 @@ import android.support.v4.widget.SimpleCursorAdapter;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -27,6 +28,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@@ -307,6 +309,20 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
}
+ ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
+
+ if (ib != null) {
+ if (m_activity.isDarkTheme())
+ ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
+
+ ib.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getActivity().openContextMenu(v);
+ }
+ });
+ }
+
return v;
}
}
diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java
index 9aabfc9d..cfd1e19e 100644
--- a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java
+++ b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java
@@ -3,6 +3,8 @@ package org.fox.ttrss.offline;
import org.fox.ttrss.GlobalState;
import org.fox.ttrss.R;
+import com.actionbarsherlock.view.MenuItem;
+
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -13,6 +15,7 @@ import android.preference.PreferenceManager;
import android.provider.BaseColumns;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
+import android.util.Log;
import android.view.View;
public class OfflineHeadlinesActivity extends OfflineActivity implements OfflineHeadlinesEventListener {
@@ -33,9 +36,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
setContentView(R.layout.headlines);
- if (!isCompatMode()) {
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- }
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setSmallScreen(findViewById(R.id.headlines_fragment) == null);
@@ -93,6 +94,19 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
}
@Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ overridePendingTransition(0, R.anim.right_slide_out);
+ return true;
+ default:
+ Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId());
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ @Override
public void onArticleSelected(int articleId, boolean open) {
SQLiteStatement stmt = getWritableDb().compileStatement(
"UPDATE articles SET modified = 1, unread = 0 " + "WHERE " + BaseColumns._ID
@@ -144,4 +158,10 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
public void onArticleSelected(int articleId) {
onArticleSelected(articleId, true);
}
+
+ @Override
+ public void onBackPressed() {
+ super.onBackPressed();
+ overridePendingTransition(0, R.anim.right_slide_out);
+ }
}
diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java
index e7e848d2..b8ac6023 100644
--- a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java
+++ b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java
@@ -38,6 +38,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.CheckBox;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@@ -283,7 +284,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
list.setEmptyView(view.findViewById(R.id.no_headlines));
registerForContextMenu(list);
- if (m_activity.isSmallScreen() || m_activity.isPortrait())
+ if (m_activity.isSmallScreen())
view.findViewById(R.id.headlines_fragment).setPadding(0, 0, 0, 0);
getActivity().setProgressBarIndeterminateVisibility(false);
@@ -576,18 +577,20 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
});
}
- /* ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button);
+ ImageButton ib = (ImageButton) v.findViewById(R.id.article_menu_button);
if (ib != null) {
- ib.setVisibility(android.os.Build.VERSION.SDK_INT >= 10 ? View.VISIBLE : View.GONE);
+ if (m_activity.isDarkTheme())
+ ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
+
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
- } */
-
+ }
+
return v;
}