support view_mode setting in offline (without adaptive for the time
being) (closes #712)
This commit is contained in:
parent
96e91b9c95
commit
fa3ee0b886
@ -3,11 +3,10 @@
|
|||||||
<group android:id="@+id/menu_group_feeds" >
|
<group android:id="@+id/menu_group_feeds" >
|
||||||
<item
|
<item
|
||||||
android:id="@+id/go_online"
|
android:id="@+id/go_online"
|
||||||
android:showAsAction="ifRoom|withText"
|
|
||||||
android:icon="@drawable/ic_cloud_light"
|
android:icon="@drawable/ic_cloud_light"
|
||||||
|
android:showAsAction="ifRoom|withText"
|
||||||
android:title="@string/go_online"
|
android:title="@string/go_online"
|
||||||
android:visible="false"/>
|
android:visible="false"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/show_feeds"
|
android:id="@+id/show_feeds"
|
||||||
android:icon="@drawable/ic_list_light"
|
android:icon="@drawable/ic_list_light"
|
||||||
@ -31,8 +30,13 @@
|
|||||||
android:icon="@drawable/ic_select_all_light"
|
android:icon="@drawable/ic_select_all_light"
|
||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
android:title="@string/headlines_select"/>
|
android:title="@string/headlines_select"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/headlines_view_mode"
|
||||||
|
android:showAsAction=""
|
||||||
|
android:title="@string/headlines_view_mode"/>
|
||||||
</group>
|
</group>
|
||||||
<!-- <group android:id="@+id/menu_group_headlines_selection" >
|
<!--
|
||||||
|
<group android:id="@+id/menu_group_headlines_selection" >
|
||||||
<item
|
<item
|
||||||
android:id="@+id/selection_toggle_unread"
|
android:id="@+id/selection_toggle_unread"
|
||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
@ -51,7 +55,8 @@
|
|||||||
android:id="@+id/selection_select_none"
|
android:id="@+id/selection_select_none"
|
||||||
android:showAsAction=""
|
android:showAsAction=""
|
||||||
android:title="@string/selection_select_none"/>
|
android:title="@string/selection_select_none"/>
|
||||||
</group> -->
|
</group>
|
||||||
|
-->
|
||||||
<group android:id="@+id/menu_group_article" >
|
<group android:id="@+id/menu_group_article" >
|
||||||
<item
|
<item
|
||||||
android:id="@+id/toggle_marked"
|
android:id="@+id/toggle_marked"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.fox.ttrss.offline;
|
package org.fox.ttrss.offline;
|
||||||
|
|
||||||
import org.fox.ttrss.ArticlePager;
|
|
||||||
import org.fox.ttrss.CommonActivity;
|
import org.fox.ttrss.CommonActivity;
|
||||||
import org.fox.ttrss.PreferencesActivity;
|
import org.fox.ttrss.PreferencesActivity;
|
||||||
import org.fox.ttrss.R;
|
import org.fox.ttrss.R;
|
||||||
@ -308,6 +307,67 @@ public class OfflineActivity extends CommonActivity {
|
|||||||
Intent intent = new Intent(this, PreferencesActivity.class);
|
Intent intent = new Intent(this, PreferencesActivity.class);
|
||||||
startActivityForResult(intent, 0);
|
startActivityForResult(intent, 0);
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.headlines_view_mode:
|
||||||
|
if (ohf != null) {
|
||||||
|
Dialog dialog = new Dialog(this);
|
||||||
|
|
||||||
|
String viewMode = getViewMode();
|
||||||
|
|
||||||
|
//Log.d(TAG, "viewMode:" + getViewMode());
|
||||||
|
|
||||||
|
int selectedIndex = 0;
|
||||||
|
|
||||||
|
if (viewMode.equals("all_articles")) {
|
||||||
|
selectedIndex = 0;
|
||||||
|
} else if (viewMode.equals("marked")) {
|
||||||
|
selectedIndex = 1;
|
||||||
|
} else if (viewMode.equals("published")) {
|
||||||
|
selectedIndex = 2;
|
||||||
|
} else if (viewMode.equals("unread")) {
|
||||||
|
selectedIndex = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this)
|
||||||
|
.setTitle(R.string.headlines_set_view_mode)
|
||||||
|
.setSingleChoiceItems(
|
||||||
|
new String[] {
|
||||||
|
/* getString(R.string.headlines_adaptive), */
|
||||||
|
getString(R.string.headlines_all_articles),
|
||||||
|
getString(R.string.headlines_starred),
|
||||||
|
getString(R.string.headlines_published),
|
||||||
|
getString(R.string.headlines_unread) },
|
||||||
|
selectedIndex, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog,
|
||||||
|
int which) {
|
||||||
|
switch (which) {
|
||||||
|
/* case 0:
|
||||||
|
setViewMode("adaptive");
|
||||||
|
break; */
|
||||||
|
case 0:
|
||||||
|
setViewMode("all_articles");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
setViewMode("marked");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
setViewMode("published");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
setViewMode("unread");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dialog.cancel();
|
||||||
|
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog = builder.create();
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
case R.id.headlines_select:
|
case R.id.headlines_select:
|
||||||
if (ohf != null) {
|
if (ohf != null) {
|
||||||
Dialog dialog = new Dialog(this);
|
Dialog dialog = new Dialog(this);
|
||||||
@ -789,4 +849,15 @@ public class OfflineActivity extends CommonActivity {
|
|||||||
public String getLastContentImageHitTestUrl() {
|
public String getLastContentImageHitTestUrl() {
|
||||||
return m_lastImageHitTestUrl;
|
return m_lastImageHitTestUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setViewMode(String viewMode) {
|
||||||
|
SharedPreferences.Editor editor = m_prefs.edit();
|
||||||
|
editor.putString("offline_view_mode", viewMode);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getViewMode() {
|
||||||
|
return m_prefs.getString("offline_view_mode", "adaptive");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -334,6 +334,20 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
|
|||||||
feedClause = "feed_id = ?";
|
feedClause = "feed_id = ?";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String viewMode = m_activity.getViewMode();
|
||||||
|
|
||||||
|
if ("adaptive".equals(viewMode)) {
|
||||||
|
// TODO: implement adaptive
|
||||||
|
} else if ("marked".equals(viewMode)) {
|
||||||
|
feedClause += "AND (marked = 1)";
|
||||||
|
} else if ("published".equals(viewMode)) {
|
||||||
|
feedClause += "AND (published = 1)";
|
||||||
|
} else if ("unread".equals(viewMode)) {
|
||||||
|
feedClause += "AND (unread = 1)";
|
||||||
|
} else { // all_articles
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
String orderBy = (m_prefs.getBoolean("offline_oldest_first", false)) ? "updated" : "updated DESC";
|
String orderBy = (m_prefs.getBoolean("offline_oldest_first", false)) ? "updated" : "updated DESC";
|
||||||
|
|
||||||
if (m_searchQuery == null || m_searchQuery.equals("")) {
|
if (m_searchQuery == null || m_searchQuery.equals("")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user