summaryrefslogtreecommitdiff
path: root/org.fox.ttrss/src/main
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-06-04 14:27:41 +0300
committerAndrew Dolgov <[email protected]>2015-06-04 14:27:41 +0300
commit42358f6f6d738b97a9e724688e3b497b693a57ba (patch)
tree1929563ded07f643d566363af8830473d4120725 /org.fox.ttrss/src/main
parent9f776be2ee1c5e7c22d99cc4317c403f64cd91c2 (diff)
move settings and unread only switch to the drawer
Diffstat (limited to 'org.fox.ttrss/src/main')
-rwxr-xr-xorg.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java109
-rwxr-xr-xorg.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java2
-rwxr-xr-xorg.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java77
-rwxr-xr-xorg.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java8
-rwxr-xr-xorg.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java71
-rwxr-xr-xorg.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java61
-rwxr-xr-x[-rw-r--r--]org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java8
-rwxr-xr-xorg.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java67
-rwxr-xr-xorg.fox.ttrss/src/main/res/drawable-hdpi/ic_settings_dark.pngbin0 -> 1288 bytes
-rwxr-xr-xorg.fox.ttrss/src/main/res/drawable-xhdpi/ic_settings_dark.pngbin0 -> 1778 bytes
-rwxr-xr-xorg.fox.ttrss/src/main/res/drawable-xxhdpi/ic_settings_dark.pngbin0 -> 2576 bytes
-rwxr-xr-xorg.fox.ttrss/src/main/res/drawable-xxxhdpi/ic_settings_dark.pngbin0 -> 3725 bytes
-rwxr-xr-xorg.fox.ttrss/src/main/res/layout/feeds_row.xml2
-rwxr-xr-xorg.fox.ttrss/src/main/res/layout/feeds_row_selected.xml2
-rwxr-xr-xorg.fox.ttrss/src/main/res/layout/feeds_row_toggle.xml46
-rwxr-xr-xorg.fox.ttrss/src/main/res/layout/headlines_divider.xml15
-rwxr-xr-xorg.fox.ttrss/src/main/res/menu/main_menu.xml8
-rwxr-xr-xorg.fox.ttrss/src/main/res/menu/offline_menu.xml4
-rwxr-xr-xorg.fox.ttrss/src/main/res/values/attrs.xml1
-rwxr-xr-xorg.fox.ttrss/src/main/res/values/strings.xml1
-rwxr-xr-xorg.fox.ttrss/src/main/res/values/style.xml2
21 files changed, 271 insertions, 213 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java
new file mode 100755
index 00000000..4a4585b6
--- /dev/null
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java
@@ -0,0 +1,109 @@
+package org.fox.ttrss;
+
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.Uri;
+import android.support.v4.app.Fragment;
+import android.support.v7.widget.SwitchCompat;
+import android.util.TypedValue;
+import android.view.InflateException;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.CompoundButton;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public abstract class BaseFeedlistFragment extends Fragment {
+ abstract public void refresh(boolean background);
+
+ public void initDrawerHeader(LayoutInflater inflater, View view, ListView list, final CommonActivity activity, final SharedPreferences prefs) {
+
+ if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) {
+ try {
+ View layout = inflater.inflate(R.layout.drawer_header, list, false);
+ list.addHeaderView(layout, null, false);
+
+ TextView login = (TextView) view.findViewById(R.id.drawer_header_login);
+ TextView server = (TextView) view.findViewById(R.id.drawer_header_server);
+
+ login.setText(prefs.getString("login", ""));
+ try {
+ server.setText(new URL(prefs.getString("ttrss_url", "")).getHost());
+ } catch (MalformedURLException e) {
+ server.setText("");
+ }
+
+ View account = view.findViewById(R.id.drawer_header_account);
+
+ account.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ try {
+ Intent intent = new Intent(Intent.ACTION_VIEW,
+ Uri.parse(prefs.getString("ttrss_url", "")));
+ startActivity(intent);
+ } catch (Exception e) {
+
+ }
+ }
+ });
+
+ /* deal with ~material~ footers */
+
+ // divider
+ View footer = inflater.inflate(R.layout.headlines_divider, list, false);
+ list.addFooterView(footer);
+
+ // unread only checkbox
+ footer = inflater.inflate(R.layout.feeds_row_toggle, list, false);
+ list.addFooterView(footer);
+ TextView text = (TextView) footer.findViewById(R.id.title);
+ text.setText(R.string.unread_only);
+
+ final SwitchCompat rowSwitch = (SwitchCompat) footer.findViewById(R.id.row_switch);
+ rowSwitch.setChecked(activity.getUnreadOnly());
+
+ rowSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton button, boolean isChecked) {
+ activity.setUnreadOnly(isChecked);
+ refresh(true);
+ }
+ });
+
+ text.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ rowSwitch.setChecked(!rowSwitch.isChecked());
+ }
+ });
+
+ // settings
+ footer = inflater.inflate(R.layout.feeds_row, list, false);
+ list.addFooterView(footer);
+ text = (TextView) footer.findViewById(R.id.title);
+ text.setText(R.string.preferences);
+
+ ImageView icon = (ImageView) footer.findViewById(R.id.icon);
+ TypedValue tv = new TypedValue();
+ getActivity().getTheme().resolveAttribute(R.attr.ic_settings, tv, true);
+ icon.setImageResource(tv.resourceId);
+
+ TextView counter = (TextView) footer.findViewById(R.id.unread_counter);
+ counter.setText(R.string.blank);
+
+ } catch (InflateException e) {
+ // welp couldn't inflate header i guess
+ e.printStackTrace();
+ } catch (java.lang.UnsupportedOperationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+}
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java
index 347c739b..347bb4b1 100755
--- a/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/CommonActivity.java
@@ -52,7 +52,7 @@ public class CommonActivity extends ActionBarActivity {
}
}
} */
-
+
protected void setSmallScreen(boolean smallScreen) {
Log.d(TAG, "m_smallScreenMode=" + smallScreen);
m_smallScreenMode = smallScreen;
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java
index 83f0ec25..795c0fe7 100755
--- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedCategoriesFragment.java
@@ -9,15 +9,12 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
-import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
-import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
-import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -41,25 +38,23 @@ import org.fox.ttrss.types.FeedCategory;
import org.fox.ttrss.types.FeedCategoryList;
import java.lang.reflect.Type;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
-public class FeedCategoriesFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
+public class FeedCategoriesFragment extends BaseFeedlistFragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
private final String TAG = this.getClass().getSimpleName();
- private SharedPreferences m_prefs;
private FeedCategoryListAdapter m_adapter;
private FeedCategoryList m_cats = new FeedCategoryList();
private FeedCategory m_selectedCat;
private FeedsActivity m_activity;
private SwipeRefreshLayout m_swipeLayout;
private ListView m_list;
+ protected SharedPreferences m_prefs;
- @SuppressLint("DefaultLocale")
+ @SuppressLint("DefaultLocale")
class CatUnreadComparator implements Comparator<FeedCategory> {
@Override
public int compare(FeedCategory a, FeedCategory b) {
@@ -222,44 +217,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
m_list = (ListView)view.findViewById(R.id.feeds);
m_adapter = new FeedCategoryListAdapter(getActivity(), R.layout.feeds_row, (ArrayList<FeedCategory>)m_cats);
- // TODO: better check
- if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) {
- try {
- View layout = inflater.inflate(R.layout.drawer_header, m_list, false);
- m_list.addHeaderView(layout, null, false);
-
- TextView login = (TextView) view.findViewById(R.id.drawer_header_login);
- TextView server = (TextView) view.findViewById(R.id.drawer_header_server);
-
- login.setText(m_prefs.getString("login", ""));
- try {
- server.setText(new URL(m_prefs.getString("ttrss_url", "")).getHost());
- } catch (MalformedURLException e) {
- server.setText("");
- }
-
- View account = view.findViewById(R.id.drawer_header_account);
-
- account.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- try {
- Intent intent = new Intent(Intent.ACTION_VIEW,
- Uri.parse(m_prefs.getString("ttrss_url", "")));
- startActivity(intent);
- } catch (Exception e) {
-
- }
- }
- });
-
- } catch (InflateException e) {
- // welp couldn't inflate header i guess
- e.printStackTrace();
- } catch (java.lang.UnsupportedOperationException e) {
- e.printStackTrace();
- }
- }
+ initDrawerHeader(inflater, view, m_list, m_activity, m_prefs);
m_list.setAdapter(m_adapter);
m_list.setOnItemClickListener(this);
@@ -552,17 +510,28 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
Log.d(TAG, "onItemClick=" + position);
if (list != null) {
+
+ if (position == list.getCount() - 1) {
+ Intent intent = new Intent(m_activity,
+ PreferencesActivity.class);
+ startActivityForResult(intent, 0);
+
+ return;
+ }
+
FeedCategory cat = (FeedCategory)list.getItemAtPosition(position);
- if (cat.id < 0) {
- m_activity.onCatSelected(cat, false);
- } else {
- m_activity.onCatSelected(cat);
- }
+ if (cat != null) {
+ if (cat.id < 0) {
+ m_activity.onCatSelected(cat, false);
+ } else {
+ m_activity.onCatSelected(cat);
+ }
- m_selectedCat = cat;
-
- m_adapter.notifyDataSetChanged();
+ m_selectedCat = cat;
+
+ m_adapter.notifyDataSetChanged();
+ }
}
}
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java
index 5ad9b476..edc9ecef 100755
--- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsActivity.java
@@ -229,13 +229,13 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
//m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false);
- MenuItem item = m_menu.findItem(R.id.show_feeds);
+ /* MenuItem item = m_menu.findItem(R.id.show_feeds);
if (getUnreadOnly()) {
item.setTitle(R.string.menu_all_feeds);
} else {
item.setTitle(R.string.menu_unread_feeds);
- }
+ } */
}
}
@@ -377,11 +377,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
dialog.show();
return true;
- case R.id.show_feeds:
+ /* case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());
invalidateOptionsMenu();
refresh();
- return true;
+ return true; */
/*case R.id.update_feeds:
//m_pullToRefreshAttacher.setRefreshing(true);
refresh();
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java
index ce25cdf5..fc1c7649 100755
--- a/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java
@@ -10,15 +10,12 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.graphics.Typeface;
-import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
-import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
-import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -42,15 +39,13 @@ import org.fox.ttrss.types.FeedCategory;
import org.fox.ttrss.types.FeedList;
import java.lang.reflect.Type;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
-public class FeedsFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
+public class FeedsFragment extends BaseFeedlistFragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
private final String TAG = this.getClass().getSimpleName();
private SharedPreferences m_prefs;
private FeedListAdapter m_adapter;
@@ -288,43 +283,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
m_list = (ListView)view.findViewById(R.id.feeds);
- // TODO: better check
- if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) {
- try {
- View layout = inflater.inflate(R.layout.drawer_header, m_list, false);
- m_list.addHeaderView(layout, null, false);
-
- TextView login = (TextView) view.findViewById(R.id.drawer_header_login);
- TextView server = (TextView) view.findViewById(R.id.drawer_header_server);
-
- login.setText(m_prefs.getString("login", ""));
- try {
- server.setText(new URL(m_prefs.getString("ttrss_url", "")).getHost());
- } catch (MalformedURLException e) {
- server.setText("");
- }
-
- View account = view.findViewById(R.id.drawer_header_account);
-
- account.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- try {
- Intent intent = new Intent(Intent.ACTION_VIEW,
- Uri.parse(m_prefs.getString("ttrss_url", "")));
- startActivity(intent);
- } catch (Exception e) {
-
- }
- }
- });
- } catch (InflateException e) {
- // welp couldn't inflate header i guess
- e.printStackTrace();
- } catch (java.lang.UnsupportedOperationException e) {
- e.printStackTrace();
- }
- }
+ initDrawerHeader(inflater, view, m_list, m_activity, m_prefs);
if (m_enableParentBtn) {
View layout = inflater.inflate(R.layout.feeds_goback, m_list, false);
@@ -399,16 +358,26 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
ListView list = (ListView)av;
if (list != null) {
+ if (position == list.getCount() - 1) {
+ Intent intent = new Intent(m_activity,
+ PreferencesActivity.class);
+ startActivityForResult(intent, 0);
+
+ return;
+ }
+
Feed feed = (Feed)list.getItemAtPosition(position);
- if (feed.is_cat) {
- if (feed.always_display_as_feed) {
- m_activity.onCatSelected(new FeedCategory(feed.id, feed.title, feed.unread), true);
- } else {
- m_activity.onCatSelected(new FeedCategory(feed.id, feed.title, feed.unread));
- }
- } else {
- m_activity.onFeedSelected(feed);
+ if (feed != null) {
+ if (feed.is_cat) {
+ if (feed.always_display_as_feed) {
+ m_activity.onCatSelected(new FeedCategory(feed.id, feed.title, feed.unread), true);
+ } else {
+ m_activity.onCatSelected(new FeedCategory(feed.id, feed.title, feed.unread));
+ }
+ } else {
+ m_activity.onFeedSelected(feed);
+ }
}
m_selectedFeed = feed;
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java
index 340b5997..0c48df4e 100755
--- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java
@@ -6,17 +6,14 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.database.Cursor;
-import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.BaseColumns;
-import android.support.v4.app.Fragment;
import android.support.v4.widget.SimpleCursorAdapter;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
-import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -29,12 +26,11 @@ import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
+import org.fox.ttrss.BaseFeedlistFragment;
+import org.fox.ttrss.PreferencesActivity;
import org.fox.ttrss.R;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class OfflineFeedCategoriesFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
+public class OfflineFeedCategoriesFragment extends BaseFeedlistFragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
private final String TAG = this.getClass().getSimpleName();
private SharedPreferences m_prefs;
private FeedCategoryListAdapter m_adapter;
@@ -152,43 +148,7 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
m_adapter = new FeedCategoryListAdapter(getActivity(), R.layout.feeds_row, m_cursor,
new String[] { "title", "unread" }, new int[] { R.id.title, R.id.unread_counter }, 0);
- // TODO: better check
- if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) {
- try {
- View layout = inflater.inflate(R.layout.drawer_header, m_list, false);
- m_list.addHeaderView(layout, null, false);
-
- TextView login = (TextView) view.findViewById(R.id.drawer_header_login);
- TextView server = (TextView) view.findViewById(R.id.drawer_header_server);
-
- login.setText(m_prefs.getString("login", ""));
- try {
- server.setText(new URL(m_prefs.getString("ttrss_url", "")).getHost());
- } catch (MalformedURLException e) {
- server.setText("");
- }
-
- View account = view.findViewById(R.id.drawer_header_account);
-
- account.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- try {
- Intent intent = new Intent(Intent.ACTION_VIEW,
- Uri.parse(m_prefs.getString("ttrss_url", "")));
- startActivity(intent);
- } catch (Exception e) {
-
- }
- }
- });
- } catch (InflateException e) {
- // welp couldn't inflate header i guess
- e.printStackTrace();
- } catch (java.lang.UnsupportedOperationException e) {
- e.printStackTrace();
- }
- }
+ initDrawerHeader(inflater, view, m_list, m_activity, m_prefs);
m_list.setAdapter(m_adapter);
m_list.setOnItemClickListener(this);
@@ -228,6 +188,14 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
ListView list = (ListView)getActivity().findViewById(R.id.feeds);
if (list != null) {
+ if (position == list.getCount() - 1) {
+ Intent intent = new Intent(m_activity,
+ PreferencesActivity.class);
+ startActivityForResult(intent, 0);
+
+ return;
+ }
+
Cursor cursor = (Cursor) list.getItemAtPosition(position);
if (cursor != null) {
@@ -243,6 +211,11 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
}
}
+ @Override
+ public void refresh(boolean background) {
+ refresh();
+ }
+
/* public void setLoadingStatus(int status, boolean showProgress) {
if (getView() != null) {
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java
index 3d6817de..d6fd2e4e 100644..100755
--- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java
@@ -180,11 +180,11 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
dialog.show();
return true;
- case R.id.show_feeds:
+ /* case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());
invalidateOptionsMenu();
refresh();
- return true;
+ return true; */
default:
Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId());
return super.onOptionsItemSelected(item);
@@ -223,13 +223,13 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
//m_menu.findItem(R.id.headlines_toggle_sidebar).setVisible(false);
- MenuItem item = m_menu.findItem(R.id.show_feeds);
+ /* MenuItem item = m_menu.findItem(R.id.show_feeds);
if (getUnreadOnly()) {
item.setTitle(R.string.menu_all_feeds);
} else {
item.setTitle(R.string.menu_unread_feeds);
- }
+ } */
}
}
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java
index 27f729f6..13d57dea 100755
--- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsFragment.java
@@ -6,16 +6,13 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.database.Cursor;
-import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
-import android.support.v4.app.Fragment;
import android.support.v4.widget.SimpleCursorAdapter;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
-import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -28,12 +25,11 @@ import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
+import org.fox.ttrss.BaseFeedlistFragment;
+import org.fox.ttrss.PreferencesActivity;
import org.fox.ttrss.R;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class OfflineFeedsFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
+public class OfflineFeedsFragment extends BaseFeedlistFragment implements OnItemClickListener, OnSharedPreferenceChangeListener {
private final String TAG = this.getClass().getSimpleName();
private SharedPreferences m_prefs;
private FeedListAdapter m_adapter;
@@ -111,7 +107,7 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
null, unreadOnly, null, null, null, order);
}
}
-
+
public void refresh() {
try {
if (!isAdded()) return;
@@ -131,7 +127,7 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
e.printStackTrace();
}
}
-
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -154,45 +150,9 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
m_list = (ListView)view.findViewById(R.id.feeds);
- // TODO: better check
- if (true /*m_activity.findViewById(R.id.headlines_drawer) != null*/) {
- try {
- View layout = inflater.inflate(R.layout.drawer_header, m_list, false);
- m_list.addHeaderView(layout, null, false);
-
- TextView login = (TextView) view.findViewById(R.id.drawer_header_login);
- TextView server = (TextView) view.findViewById(R.id.drawer_header_server);
-
- login.setText(m_prefs.getString("login", ""));
- try {
- server.setText(new URL(m_prefs.getString("ttrss_url", "")).getHost());
- } catch (MalformedURLException e) {
- server.setText("");
- }
-
- View account = view.findViewById(R.id.drawer_header_account);
-
- account.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- try {
- Intent intent = new Intent(Intent.ACTION_VIEW,
- Uri.parse(m_prefs.getString("ttrss_url", "")));
- startActivity(intent);
- } catch (Exception e) {
+ initDrawerHeader(inflater, view, m_list, m_activity, m_prefs);
- }
- }
- });
- } catch (InflateException e) {
- // welp couldn't inflate header i guess
- e.printStackTrace();
- } catch (java.lang.UnsupportedOperationException e) {
- e.printStackTrace();
- }
- }
-
- if (m_enableParentBtn) {
+ if (m_enableParentBtn) {
View layout = inflater.inflate(R.layout.feeds_goback, container, false);
layout.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT,
@@ -255,6 +215,14 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
ListView list = (ListView)getActivity().findViewById(R.id.feeds);
if (list != null) {
+ if (position == list.getCount() - 1) {
+ Intent intent = new Intent(m_activity,
+ PreferencesActivity.class);
+ startActivityForResult(intent, 0);
+
+ return;
+ }
+
Cursor cursor = (Cursor) list.getItemAtPosition(position);
if (cursor != null) {
@@ -270,6 +238,11 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
}
}
+ @Override
+ public void refresh(boolean background) {
+ refresh();
+ }
+
/* public void setLoadingStatus(int status, boolean showProgress) {
if (getView() != null) {
TextView tv = (TextView)getView().findViewById(R.id.loading_message);
diff --git a/org.fox.ttrss/src/main/res/drawable-hdpi/ic_settings_dark.png b/org.fox.ttrss/src/main/res/drawable-hdpi/ic_settings_dark.png
new file mode 100755
index 00000000..1069b9a5
--- /dev/null
+++ b/org.fox.ttrss/src/main/res/drawable-hdpi/ic_settings_dark.png
Binary files differ
diff --git a/org.fox.ttrss/src/main/res/drawable-xhdpi/ic_settings_dark.png b/org.fox.ttrss/src/main/res/drawable-xhdpi/ic_settings_dark.png
new file mode 100755
index 00000000..888fe55d
--- /dev/null
+++ b/org.fox.ttrss/src/main/res/drawable-xhdpi/ic_settings_dark.png
Binary files differ
diff --git a/org.fox.ttrss/src/main/res/drawable-xxhdpi/ic_settings_dark.png b/org.fox.ttrss/src/main/res/drawable-xxhdpi/ic_settings_dark.png
new file mode 100755
index 00000000..b6fe478a
--- /dev/null
+++ b/org.fox.ttrss/src/main/res/drawable-xxhdpi/ic_settings_dark.png
Binary files differ
diff --git a/org.fox.ttrss/src/main/res/drawable-xxxhdpi/ic_settings_dark.png b/org.fox.ttrss/src/main/res/drawable-xxxhdpi/ic_settings_dark.png
new file mode 100755
index 00000000..6bde63cd
--- /dev/null
+++ b/org.fox.ttrss/src/main/res/drawable-xxxhdpi/ic_settings_dark.png
Binary files differ
diff --git a/org.fox.ttrss/src/main/res/layout/feeds_row.xml b/org.fox.ttrss/src/main/res/layout/feeds_row.xml
index 138cede3..b8fe5724 100755
--- a/org.fox.ttrss/src/main/res/layout/feeds_row.xml
+++ b/org.fox.ttrss/src/main/res/layout/feeds_row.xml
@@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/feeds_row"
android:layout_width="match_parent"
- android:layout_height="?android:attr/listPreferredItemHeight"
+ android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:paddingLeft="16dp"
android:paddingRight="16dp"
diff --git a/org.fox.ttrss/src/main/res/layout/feeds_row_selected.xml b/org.fox.ttrss/src/main/res/layout/feeds_row_selected.xml
index 53e62215..601712fd 100755
--- a/org.fox.ttrss/src/main/res/layout/feeds_row_selected.xml
+++ b/org.fox.ttrss/src/main/res/layout/feeds_row_selected.xml
@@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/feeds_row"
android:layout_width="match_parent"
- android:layout_height="?android:attr/listPreferredItemHeight"
+ android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:background="?feedsSelectedBackground"
android:paddingLeft="16dp"
diff --git a/org.fox.ttrss/src/main/res/layout/feeds_row_toggle.xml b/org.fox.ttrss/src/main/res/layout/feeds_row_toggle.xml
new file mode 100755
index 00000000..e871a4a2
--- /dev/null
+++ b/org.fox.ttrss/src/main/res/layout/feeds_row_toggle.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/feeds_row"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:descendantFocusability="blocksDescendants"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:baselineAligned="true"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+ <ImageView
+ android:id="@+id/icon"
+ android:layout_gravity="center_vertical"
+ android:layout_width="21dp"
+ android:layout_height="21dp"
+ android:layout_weight="0"
+ android:scaleType="fitXY"
+ android:src="?ic_rss_box" />
+
+ <TextView
+ android:id="@+id/title"
+ android:fontFamily="sans-serif-medium"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:layout_weight="1"
+ android:ellipsize="end"
+ android:paddingLeft="35dp"
+ android:singleLine="true"
+ android:text="Feed"
+ android:paddingBottom="2dp"
+ android:textColor="?feedlistTextColor"
+ android:textSize="14sp" />
+
+ <android.support.v7.widget.SwitchCompat
+ android:id="@+id/row_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:layout_marginLeft="16dp" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/org.fox.ttrss/src/main/res/layout/headlines_divider.xml b/org.fox.ttrss/src/main/res/layout/headlines_divider.xml
new file mode 100755
index 00000000..40294376
--- /dev/null
+++ b/org.fox.ttrss/src/main/res/layout/headlines_divider.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/headlines_footer"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
+
+ <View
+ android:layout_gravity="top|center_horizontal"
+ android:layout_marginTop="10dp"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="?headlineFooterColor"/>
+
+</FrameLayout> \ No newline at end of file
diff --git a/org.fox.ttrss/src/main/res/menu/main_menu.xml b/org.fox.ttrss/src/main/res/menu/main_menu.xml
index f3715010..8693dc2b 100755
--- a/org.fox.ttrss/src/main/res/menu/main_menu.xml
+++ b/org.fox.ttrss/src/main/res/menu/main_menu.xml
@@ -9,11 +9,11 @@
app:showAsAction=""
android:title="@string/subscribe_to_feed"/> <!-- iRroom -->
- <item
+ <!-- <item
android:id="@+id/show_feeds"
android:icon="@drawable/ic_filter_remove"
app:showAsAction=""
- android:title="@string/menu_all_feeds"/>
+ android:title="@string/menu_all_feeds"/> -->
<item
android:id="@+id/go_offline"
android:icon="@drawable/ic_cloud_download"
@@ -114,12 +114,12 @@
app:showAsAction=""
android:title="@string/trial_purchase"/>
- <item
+ <!-- <item
android:orderInCategory="999"
android:id="@+id/preferences"
android:icon="@drawable/ic_settings"
app:showAsAction=""
- android:title="@string/preferences"/>
+ android:title="@string/preferences"/> -->
</group>
diff --git a/org.fox.ttrss/src/main/res/menu/offline_menu.xml b/org.fox.ttrss/src/main/res/menu/offline_menu.xml
index f51521b7..11c37642 100755
--- a/org.fox.ttrss/src/main/res/menu/offline_menu.xml
+++ b/org.fox.ttrss/src/main/res/menu/offline_menu.xml
@@ -7,11 +7,11 @@
app:showAsAction=""
android:title="@string/go_online"
android:visible="false"/> <!-- ifRoom|withText -->
- <item
+ <!-- <item
android:id="@+id/show_feeds"
android:icon="@drawable/ic_filter_remove"
app:showAsAction=""
- android:title="@string/menu_all_feeds"/>
+ android:title="@string/menu_all_feeds"/> -->
</group>
<group android:id="@+id/menu_group_headlines" >
<item
diff --git a/org.fox.ttrss/src/main/res/values/attrs.xml b/org.fox.ttrss/src/main/res/values/attrs.xml
index 68278455..dd208c91 100755
--- a/org.fox.ttrss/src/main/res/values/attrs.xml
+++ b/org.fox.ttrss/src/main/res/values/attrs.xml
@@ -36,4 +36,5 @@
<attr name="ic_star_outline" format="reference" />
<attr name="ic_share" format="reference" />
<attr name="ic_keyboard_backspace" format="reference" />
+ <attr name="ic_settings" format="reference" />
</resources> \ No newline at end of file
diff --git a/org.fox.ttrss/src/main/res/values/strings.xml b/org.fox.ttrss/src/main/res/values/strings.xml
index 39246126..1d88f150 100755
--- a/org.fox.ttrss/src/main/res/values/strings.xml
+++ b/org.fox.ttrss/src/main/res/values/strings.xml
@@ -23,6 +23,7 @@
<string name="loading_message">Loading, please wait…</string>
<string name="menu_unread_feeds">Show unread feeds</string>
<string name="menu_all_feeds">Show all feeds</string>
+ <string name="unread_only">Unread only</string>
<string name="update_feeds">Refresh</string>
<string name="share_article">Share article</string>
<string name="catchup">Mark read</string>
diff --git a/org.fox.ttrss/src/main/res/values/style.xml b/org.fox.ttrss/src/main/res/values/style.xml
index ffe02dc8..a3fe17f7 100755
--- a/org.fox.ttrss/src/main/res/values/style.xml
+++ b/org.fox.ttrss/src/main/res/values/style.xml
@@ -44,6 +44,7 @@
<item name="ic_star_outline">@drawable/ic_star_outline_dark</item>
<item name="ic_share">@drawable/ic_share_dark</item>
<item name="ic_keyboard_backspace">@drawable/ic_keyboard_backspace_dark</item>
+ <item name="ic_settings">@drawable/ic_settings_dark</item>
</style>
<style name="DarkTheme" parent="Theme.AppCompat.NoActionBar">
@@ -90,6 +91,7 @@
<item name="ic_star_outline">@drawable/ic_star_outline</item>
<item name="ic_share">@drawable/ic_share</item>
<item name="ic_keyboard_backspace">@drawable/ic_keyboard_backspace</item>
+ <item name="ic_settings">@drawable/ic_settings</item>
</style>
<style name="DarkDialogTheme" parent="android:Theme"></style>