refresh feeds when article is closed
fixes for dark theme
This commit is contained in:
parent
8ace49fb71
commit
16bc77419f
@ -17,16 +17,16 @@
|
||||
<style name="DarkTheme" parent="android:Theme.Holo">
|
||||
<item name="feedlistDivider">@android:drawable/divider_horizontal_dark</item>
|
||||
<item name="feedlistBackground">#101010</item>
|
||||
<item name="unreadCounterColor">#0000ff</item>
|
||||
<item name="unreadCounterColor">#303030</item>
|
||||
<item name="headlinesBackground">#000000</item>
|
||||
<item name="articleDivider">#303030</item>
|
||||
<item name="articleDivider">#303060</item>
|
||||
<item name="articleHeader">@android:color/transparent</item>
|
||||
<item name="headlineSelectedBackground">#303060</item>
|
||||
<item name="headlineUnreadBackground">#303030</item>
|
||||
<item name="feedsSelectedBackground">#303060</item>
|
||||
<item name="headlineSeparatorUnread">#303060</item>
|
||||
<item name="headlineSeparatorNormal">#303060</item>
|
||||
<item name="headlineSeparatorSelected">#303060</item>
|
||||
<item name="headlineSeparatorNormal">#303030</item>
|
||||
<item name="headlineSeparatorSelected">#47478E</item>
|
||||
|
||||
</style>
|
||||
|
||||
|
@ -9,6 +9,7 @@ import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
@ -20,8 +21,7 @@ import android.widget.TextView;
|
||||
public class ArticleFragment extends Fragment {
|
||||
private final String TAG = this.getClass().getSimpleName();
|
||||
|
||||
protected SharedPreferences m_prefs;
|
||||
|
||||
private SharedPreferences m_prefs;
|
||||
private Article m_article;
|
||||
|
||||
@Override
|
||||
@ -50,10 +50,19 @@ public class ArticleFragment extends Fragment {
|
||||
// TODO white on black style for dark theme
|
||||
String content;
|
||||
try {
|
||||
String backgroundOverride = "";
|
||||
|
||||
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
|
||||
backgroundOverride = "body { background : black; color : #f0f0f0}\n";
|
||||
}
|
||||
|
||||
content = URLEncoder.encode("<html>" +
|
||||
"<head>" +
|
||||
"<meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\">" + // wtf, google?
|
||||
"<style type=\"text/css\">img { max-width : 90%; }</style>" +
|
||||
"<style type=\"text/css\">" +
|
||||
backgroundOverride +
|
||||
"img { max-width : 90%; }" +
|
||||
"</style>" +
|
||||
"</head>" +
|
||||
"<body>" + m_article.content + "</body></html>", "utf-8").replace('+', ' ');
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
@ -99,6 +108,7 @@ public class ArticleFragment extends Fragment {
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
||||
m_prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
|
||||
m_article = ((MainActivity)activity).getSelectedArticle();
|
||||
}
|
||||
}
|
||||
|
@ -42,13 +42,15 @@ import com.google.gson.reflect.TypeToken;
|
||||
|
||||
public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
||||
private final String TAG = this.getClass().getSimpleName();
|
||||
protected SharedPreferences m_prefs;
|
||||
private SharedPreferences m_prefs;
|
||||
|
||||
private Feed m_feed;
|
||||
private int m_selectedArticleId;
|
||||
|
||||
private ArticleListAdapter m_adapter;
|
||||
private ArticleList m_articles = new ArticleList();
|
||||
private ArticleList m_selectedArticles = new ArticleList();
|
||||
|
||||
private OnArticleSelectedListener m_articleSelectedListener;
|
||||
|
||||
public interface OnArticleSelectedListener {
|
||||
@ -87,6 +89,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
||||
m_feed = savedInstanceState.getParcelable("feed");
|
||||
m_articles = savedInstanceState.getParcelable("articles");
|
||||
m_selectedArticleId = savedInstanceState.getInt("selectedArticleId");
|
||||
m_selectedArticles = savedInstanceState.getParcelable("selectedArticles");
|
||||
}
|
||||
|
||||
View view = inflater.inflate(R.layout.headlines_fragment, container, false);
|
||||
@ -170,6 +173,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
||||
out.putParcelable("feed", m_feed);
|
||||
out.putParcelable("articles", m_articles);
|
||||
out.putInt("selectedArticleId", m_selectedArticleId);
|
||||
out.putParcelable("selectedArticles", m_selectedArticles);
|
||||
}
|
||||
|
||||
private class HeadlinesRequest extends ApiRequest {
|
||||
@ -266,8 +270,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
||||
|
||||
public static final int VIEW_COUNT = VIEW_SELECTED+1;
|
||||
|
||||
private ArrayList<Article> m_selectedArticles = new ArrayList<Article>();
|
||||
|
||||
public ArticleListAdapter(Context context, int textViewResourceId, ArrayList<Article> items) {
|
||||
super(context, textViewResourceId, items);
|
||||
this.items = items;
|
||||
|
@ -252,6 +252,7 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
|
||||
findViewById(R.id.feeds_fragment).setVisibility(View.VISIBLE);
|
||||
|
||||
initMainMenu();
|
||||
refreshFeeds();
|
||||
|
||||
m_selectedArticle = null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user