move settings and unread only switch to the drawer
This commit is contained in:
parent
9f776be2ee
commit
42358f6f6d
109
org.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java
Executable file
109
org.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java
Executable file
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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,23 +38,21 @@ 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")
|
||||
class CatUnreadComparator implements Comparator<FeedCategory> {
|
||||
@ -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,8 +510,18 @@ 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 != null) {
|
||||
if (cat.id < 0) {
|
||||
m_activity.onCatSelected(cat, false);
|
||||
} else {
|
||||
@ -565,6 +533,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
|
||||
m_adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelectedCategory(FeedCategory cat) {
|
||||
m_selectedCat = cat;
|
||||
|
@ -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();
|
||||
|
@ -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,8 +358,17 @@ 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 != null) {
|
||||
if (feed.is_cat) {
|
||||
if (feed.always_display_as_feed) {
|
||||
m_activity.onCatSelected(new FeedCategory(feed.id, feed.title, feed.unread), true);
|
||||
@ -410,6 +378,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
} else {
|
||||
m_activity.onFeedSelected(feed);
|
||||
}
|
||||
}
|
||||
|
||||
m_selectedFeed = feed;
|
||||
|
||||
|
@ -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);
|
||||
|
8
org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java
Normal file → Executable file
8
org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineFeedsActivity.java
Normal file → Executable file
@ -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);
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
@ -154,43 +150,7 @@ 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) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
} 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, container, false);
|
||||
@ -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);
|
||||
|
BIN
org.fox.ttrss/src/main/res/drawable-hdpi/ic_settings_dark.png
Executable file
BIN
org.fox.ttrss/src/main/res/drawable-hdpi/ic_settings_dark.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
org.fox.ttrss/src/main/res/drawable-xhdpi/ic_settings_dark.png
Executable file
BIN
org.fox.ttrss/src/main/res/drawable-xhdpi/ic_settings_dark.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
org.fox.ttrss/src/main/res/drawable-xxhdpi/ic_settings_dark.png
Executable file
BIN
org.fox.ttrss/src/main/res/drawable-xxhdpi/ic_settings_dark.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
org.fox.ttrss/src/main/res/drawable-xxxhdpi/ic_settings_dark.png
Executable file
BIN
org.fox.ttrss/src/main/res/drawable-xxxhdpi/ic_settings_dark.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
@ -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"
|
||||
|
@ -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"
|
||||
|
46
org.fox.ttrss/src/main/res/layout/feeds_row_toggle.xml
Executable file
46
org.fox.ttrss/src/main/res/layout/feeds_row_toggle.xml
Executable file
@ -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>
|
15
org.fox.ttrss/src/main/res/layout/headlines_divider.xml
Executable file
15
org.fox.ttrss/src/main/res/layout/headlines_divider.xml
Executable file
@ -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>
|
@ -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>
|
||||
|
||||
|
@ -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
|
||||
|
@ -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>
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user