implement show all/show unread
tweak menu theme tweaks bump version
This commit is contained in:
parent
e722a06651
commit
2229ae0fc4
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.fox.ttrss"
|
package="org.fox.ttrss"
|
||||||
android:versionCode="5"
|
android:versionCode="6"
|
||||||
android:versionName="0.1.4">
|
android:versionName="0.1.5">
|
||||||
<uses-sdk android:minSdkVersion="8" />
|
<uses-sdk android:minSdkVersion="8" />
|
||||||
<!-- <supports-screens android:smallScreens="false" android:normalScreens="false" /> -->
|
<!-- <supports-screens android:smallScreens="false" android:normalScreens="false" /> -->
|
||||||
|
|
||||||
|
@ -2,38 +2,32 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<item android:id="@+id/login"
|
<item android:id="@+id/login"
|
||||||
android:visible="false"
|
|
||||||
android:icon="@android:drawable/ic_menu_rotate"
|
android:icon="@android:drawable/ic_menu_rotate"
|
||||||
android:title="@string/login"
|
android:title="@string/login"
|
||||||
android:showAsAction="ifRoom|withText"/>
|
android:showAsAction="ifRoom|withText"/>
|
||||||
|
|
||||||
|
|
||||||
<item android:id="@+id/show_feeds"
|
<item android:id="@+id/show_feeds"
|
||||||
android:enabled="false"
|
android:icon="@android:drawable/ic_menu_agenda"
|
||||||
android:icon="@android:drawable/ic_menu_rotate"
|
|
||||||
android:title="@string/menu_all_feeds"
|
android:title="@string/menu_all_feeds"
|
||||||
android:showAsAction=""/>
|
android:showAsAction=""/>
|
||||||
|
|
||||||
<item android:id="@+id/close_article"
|
<item android:id="@+id/close_article"
|
||||||
android:visible="false"
|
|
||||||
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||||
android:title="@string/close_article"
|
android:title="@string/close_article"
|
||||||
android:showAsAction="ifRoom|withText"/>
|
android:showAsAction="ifRoom|withText"/>
|
||||||
|
|
||||||
<item android:id="@+id/load_more_articles"
|
<item android:id="@+id/load_more_articles"
|
||||||
android:visible="false"
|
|
||||||
android:icon="@android:drawable/ic_menu_more"
|
android:icon="@android:drawable/ic_menu_more"
|
||||||
android:title="@string/load_more_articles"
|
android:title="@string/load_more_articles"
|
||||||
android:showAsAction="ifRoom|withText"/>
|
android:showAsAction="ifRoom|withText"/>
|
||||||
|
|
||||||
<item android:id="@+id/show_all_articles"
|
<item android:id="@+id/show_all_articles"
|
||||||
android:visible="false"
|
|
||||||
android:icon="@android:drawable/ic_menu_agenda"
|
android:icon="@android:drawable/ic_menu_agenda"
|
||||||
android:title="@string/show_all_articles"
|
android:title="@string/show_all_articles"
|
||||||
android:showAsAction="ifRoom|withText"/>
|
android:showAsAction="ifRoom|withText"/>
|
||||||
|
|
||||||
<item android:id="@+id/update_feeds"
|
<item android:id="@+id/update_feeds"
|
||||||
android:enabled="false"
|
|
||||||
android:icon="@android:drawable/ic_menu_rotate"
|
android:icon="@android:drawable/ic_menu_rotate"
|
||||||
android:title="@string/update_feeds"
|
android:title="@string/update_feeds"
|
||||||
android:showAsAction=""/>
|
android:showAsAction=""/>
|
||||||
@ -45,13 +39,11 @@
|
|||||||
|
|
||||||
|
|
||||||
<item android:id="@+id/share_article"
|
<item android:id="@+id/share_article"
|
||||||
android:visible="false"
|
|
||||||
android:icon="@android:drawable/ic_menu_share"
|
android:icon="@android:drawable/ic_menu_share"
|
||||||
android:title="@string/share_article"
|
android:title="@string/share_article"
|
||||||
android:showAsAction="ifRoom"/>
|
android:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
<item android:id="@+id/logout"
|
<item android:id="@+id/logout"
|
||||||
android:visible="false"
|
|
||||||
android:title="@string/logout"
|
android:title="@string/logout"
|
||||||
android:showAsAction=""/>
|
android:showAsAction=""/>
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<string name="share_article">Share article</string>
|
<string name="share_article">Share article</string>
|
||||||
<string name="could_not_decode_content">Could not decode content (UnsupportedEncodingException)</string>
|
<string name="could_not_decode_content">Could not decode content (UnsupportedEncodingException)</string>
|
||||||
<string name="sort_feeds_by_unread">Sort feeds by unread count</string>
|
<string name="sort_feeds_by_unread">Sort feeds by unread count</string>
|
||||||
<string name="load_more_articles">More headlines...</string>
|
<string name="load_more_articles">Load more...</string>
|
||||||
<string name="show_all_articles">Show all articles</string>
|
<string name="show_all_articles">Show all articles</string>
|
||||||
<string name="show_unread_articles">Show unread articles</string>
|
<string name="show_unread_articles">Show unread articles</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<item name="headlineSeparatorSelected">#DBC981</item>
|
<item name="headlineSeparatorSelected">#DBC981</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="LightCompatTheme" parent="android:Theme.Light">
|
<style name="LightCompatTheme" parent="android:Theme.Light.NoTitleBar">
|
||||||
<item name="feedlistDivider">@android:drawable/divider_horizontal_bright</item>
|
<item name="feedlistDivider">@android:drawable/divider_horizontal_bright</item>
|
||||||
<item name="feedlistBackground">#fafafa</item>
|
<item name="feedlistBackground">#fafafa</item>
|
||||||
<item name="unreadCounterColor">#0000ff</item>
|
<item name="unreadCounterColor">#0000ff</item>
|
||||||
@ -47,7 +47,7 @@
|
|||||||
<item name="headlineSeparatorSelected">#47478E</item>
|
<item name="headlineSeparatorSelected">#47478E</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="DarkCompatTheme" parent="android:Theme">
|
<style name="DarkCompatTheme" parent="android:Theme.Black.NoTitleBar">
|
||||||
<item name="feedlistDivider">@android:drawable/divider_horizontal_dark</item>
|
<item name="feedlistDivider">@android:drawable/divider_horizontal_dark</item>
|
||||||
<item name="feedlistBackground">#101010</item>
|
<item name="feedlistBackground">#101010</item>
|
||||||
<item name="unreadCounterColor">#303030</item>
|
<item name="unreadCounterColor">#303030</item>
|
||||||
|
@ -127,6 +127,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
|||||||
req.setApi(m_prefs.getString("ttrss_url", null));
|
req.setApi(m_prefs.getString("ttrss_url", null));
|
||||||
|
|
||||||
final String sessionId = ((MainActivity)getActivity()).getSessionId();
|
final String sessionId = ((MainActivity)getActivity()).getSessionId();
|
||||||
|
final boolean showUnread = ((MainActivity)getActivity()).getUnreadArticlesOnly();
|
||||||
int skip = 0;
|
int skip = 0;
|
||||||
|
|
||||||
if (append) {
|
if (append) {
|
||||||
@ -149,7 +150,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
|||||||
put("show_content", "true");
|
put("show_content", "true");
|
||||||
put("limit", String.valueOf(30));
|
put("limit", String.valueOf(30));
|
||||||
put("offset", String.valueOf(0));
|
put("offset", String.valueOf(0));
|
||||||
put("view_mode", "adaptive");
|
put("view_mode", showUnread ? "adaptive" : "all_articles");
|
||||||
put("skip", String.valueOf(fskip));
|
put("skip", String.valueOf(fskip));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -200,7 +201,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
|||||||
|
|
||||||
ListView list = (ListView)getView().findViewById(R.id.headlines);
|
ListView list = (ListView)getView().findViewById(R.id.headlines);
|
||||||
|
|
||||||
if (list != null) {
|
if (list != null && m_offset != 0) {
|
||||||
list.setSelection(last_position+1);
|
list.setSelection(last_position+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
private Menu m_menu;
|
private Menu m_menu;
|
||||||
private boolean m_smallScreenMode;
|
private boolean m_smallScreenMode;
|
||||||
private boolean m_unreadOnly = true;
|
private boolean m_unreadOnly = true;
|
||||||
|
private boolean m_unreadArticlesOnly = true;
|
||||||
|
|
||||||
private class RefreshTask extends TimerTask {
|
private class RefreshTask extends TimerTask {
|
||||||
|
|
||||||
@ -66,6 +67,17 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
return m_unreadOnly;
|
return m_unreadOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUnreadArticlesOnly(boolean unread) {
|
||||||
|
m_unreadArticlesOnly = unread;
|
||||||
|
|
||||||
|
HeadlinesFragment frag = (HeadlinesFragment)getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);
|
||||||
|
|
||||||
|
if (frag != null) frag.refresh(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getUnreadArticlesOnly() {
|
||||||
|
return m_unreadArticlesOnly;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSessionId() {
|
public String getSessionId() {
|
||||||
return m_sessionId;
|
return m_sessionId;
|
||||||
@ -92,6 +104,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
m_unreadOnly = savedInstanceState.getBoolean("unreadOnly");
|
m_unreadOnly = savedInstanceState.getBoolean("unreadOnly");
|
||||||
m_activeFeed = savedInstanceState.getParcelable("activeFeed");
|
m_activeFeed = savedInstanceState.getParcelable("activeFeed");
|
||||||
m_selectedArticle = savedInstanceState.getParcelable("selectedArticle");
|
m_selectedArticle = savedInstanceState.getParcelable("selectedArticle");
|
||||||
|
m_unreadArticlesOnly = savedInstanceState.getBoolean("unreadArticlesOnly");
|
||||||
}
|
}
|
||||||
|
|
||||||
Display display = getWindowManager().getDefaultDisplay();
|
Display display = getWindowManager().getDefaultDisplay();
|
||||||
@ -161,6 +174,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
out.putBoolean("unreadOnly", m_unreadOnly);
|
out.putBoolean("unreadOnly", m_unreadOnly);
|
||||||
out.putParcelable("activeFeed", m_activeFeed);
|
out.putParcelable("activeFeed", m_activeFeed);
|
||||||
out.putParcelable("selectedArticle", m_selectedArticle);
|
out.putParcelable("selectedArticle", m_selectedArticle);
|
||||||
|
out.putBoolean("unreadArticlesOnly", m_unreadArticlesOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -205,6 +219,22 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
|
|
||||||
initMainMenu();
|
initMainMenu();
|
||||||
|
|
||||||
|
MenuItem item = menu.findItem(R.id.show_feeds);
|
||||||
|
|
||||||
|
if (getUnreadOnly()) {
|
||||||
|
item.setTitle(R.string.menu_all_feeds);
|
||||||
|
} else {
|
||||||
|
item.setTitle(R.string.menu_unread_feeds);
|
||||||
|
}
|
||||||
|
|
||||||
|
item = menu.findItem(R.id.show_all_articles);
|
||||||
|
|
||||||
|
if (getUnreadArticlesOnly()) {
|
||||||
|
item.setTitle(R.string.show_all_articles);
|
||||||
|
} else {
|
||||||
|
item.setTitle(R.string.show_unread_articles);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,13 +302,24 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
shareArticle(m_selectedArticle);
|
shareArticle(m_selectedArticle);
|
||||||
return true;
|
return true;
|
||||||
case R.id.show_feeds:
|
case R.id.show_feeds:
|
||||||
|
setUnreadOnly(!getUnreadOnly());
|
||||||
|
|
||||||
if (getUnreadOnly()) {
|
if (getUnreadOnly()) {
|
||||||
item.setTitle(R.string.menu_unread_feeds);
|
|
||||||
} else {
|
|
||||||
item.setTitle(R.string.menu_all_feeds);
|
item.setTitle(R.string.menu_all_feeds);
|
||||||
|
} else {
|
||||||
|
item.setTitle(R.string.menu_unread_feeds);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
case R.id.show_all_articles:
|
||||||
|
setUnreadArticlesOnly(!getUnreadArticlesOnly());
|
||||||
|
|
||||||
|
if (getUnreadArticlesOnly()) {
|
||||||
|
item.setTitle(R.string.show_all_articles);
|
||||||
|
} else {
|
||||||
|
item.setTitle(R.string.show_unread_articles);
|
||||||
}
|
}
|
||||||
|
|
||||||
setUnreadOnly(!getUnreadOnly());
|
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
@ -319,24 +360,34 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
if (m_sessionId != null) {
|
if (m_sessionId != null) {
|
||||||
m_menu.findItem(R.id.login).setVisible(false);
|
m_menu.findItem(R.id.login).setVisible(false);
|
||||||
|
|
||||||
m_menu.findItem(R.id.logout).setVisible(true);
|
m_menu.findItem(R.id.logout).setVisible(m_activeFeed == null && m_selectedArticle == null);
|
||||||
|
|
||||||
if (m_selectedArticle != null) {
|
if (m_selectedArticle != null) {
|
||||||
m_menu.findItem(R.id.close_article).setVisible(true);
|
m_menu.findItem(R.id.close_article).setVisible(true);
|
||||||
m_menu.findItem(R.id.share_article).setVisible(true);
|
m_menu.findItem(R.id.share_article).setVisible(true);
|
||||||
|
|
||||||
m_menu.findItem(R.id.update_feeds).setEnabled(false);
|
m_menu.findItem(R.id.update_feeds).setVisible(false);
|
||||||
m_menu.findItem(R.id.show_feeds).setEnabled(false);
|
m_menu.findItem(R.id.show_feeds).setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
m_menu.findItem(R.id.close_article).setVisible(false);
|
m_menu.findItem(R.id.close_article).setVisible(false);
|
||||||
m_menu.findItem(R.id.share_article).setVisible(false);
|
m_menu.findItem(R.id.share_article).setVisible(false);
|
||||||
|
|
||||||
m_menu.findItem(R.id.update_feeds).setEnabled(true);
|
if (!m_smallScreenMode || m_activeFeed == null) {
|
||||||
m_menu.findItem(R.id.show_feeds).setEnabled(true);
|
m_menu.findItem(R.id.show_feeds).setVisible(true);
|
||||||
|
m_menu.findItem(R.id.update_feeds).setVisible(true);
|
||||||
|
} else {
|
||||||
|
m_menu.findItem(R.id.show_feeds).setVisible(false);
|
||||||
|
m_menu.findItem(R.id.update_feeds).setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_menu.findItem(R.id.load_more_articles).setVisible(m_activeFeed != null);
|
if (!m_smallScreenMode) {
|
||||||
m_menu.findItem(R.id.show_all_articles).setVisible(m_activeFeed != null);
|
m_menu.findItem(R.id.load_more_articles).setVisible(m_activeFeed != null);
|
||||||
|
m_menu.findItem(R.id.show_all_articles).setVisible(m_activeFeed != null);
|
||||||
|
} else {
|
||||||
|
m_menu.findItem(R.id.load_more_articles).setVisible(m_activeFeed != null && m_selectedArticle == null);
|
||||||
|
m_menu.findItem(R.id.show_all_articles).setVisible(m_activeFeed != null && m_selectedArticle == null);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
m_menu.findItem(R.id.login).setVisible(true);
|
m_menu.findItem(R.id.login).setVisible(true);
|
||||||
@ -346,8 +397,8 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
|
|||||||
m_menu.findItem(R.id.share_article).setVisible(false);
|
m_menu.findItem(R.id.share_article).setVisible(false);
|
||||||
m_menu.findItem(R.id.load_more_articles).setVisible(false);
|
m_menu.findItem(R.id.load_more_articles).setVisible(false);
|
||||||
|
|
||||||
m_menu.findItem(R.id.update_feeds).setEnabled(false);
|
m_menu.findItem(R.id.update_feeds).setVisible(false);
|
||||||
m_menu.findItem(R.id.show_feeds).setEnabled(false);
|
m_menu.findItem(R.id.show_feeds).setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user