disable irrelevant menu items when article is open

fix link color in dark theme webview
This commit is contained in:
Andrew Dolgov 2011-11-25 14:53:32 +03:00
parent 6488994dfa
commit 86b967f08f
3 changed files with 23 additions and 23 deletions

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation='horizontal'
android:gravity="center"
android:layout_height="fill_parent">
<ProgressBar android:layout_height="wrap_content" android:layout_width="wrap_content" style="?android:attr/progressBarStyleLarge" android:id="@+id/login_progress"></ProgressBar>
<TextView android:id="@+id/login_status_text" android:layout_height="wrap_content" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text=""></TextView>
</LinearLayout>

View File

@ -50,18 +50,19 @@ public class ArticleFragment extends Fragment {
// TODO white on black style for dark theme
String content;
try {
String backgroundOverride = "";
String cssOverride = "";
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
backgroundOverride = "body { background : black; color : #f0f0f0}\n";
cssOverride = "body { background : black; color : #f0f0f0}\na { color : #303060; }\n";
}
content = URLEncoder.encode("<html>" +
"<head>" +
"<meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\">" + // wtf, google?
"<style type=\"text/css\">" +
backgroundOverride +
cssOverride +
"img { max-width : 90%; }" +
"body { text-align : justify; }" +
"</style>" +
"</head>" +
"<body>" + m_article.content + "</body></html>", "utf-8").replace('+', ' ');

View File

@ -265,15 +265,18 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
m_menu.findItem(R.id.logout).setVisible(true);
m_menu.findItem(R.id.update_feeds).setEnabled(true);
m_menu.findItem(R.id.show_feeds).setEnabled(true);
if (m_selectedArticle != null) {
m_menu.findItem(R.id.close_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.show_feeds).setEnabled(false);
} else {
m_menu.findItem(R.id.close_article).setVisible(false);
m_menu.findItem(R.id.share_article).setVisible(false);
m_menu.findItem(R.id.update_feeds).setEnabled(true);
m_menu.findItem(R.id.show_feeds).setEnabled(true);
}
} else {
@ -410,11 +413,6 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
}
public void logout() {
findViewById(R.id.loading_container).setVisibility(View.VISIBLE);
findViewById(R.id.main).setVisibility(View.INVISIBLE);
initMainMenu();
if (m_refreshTask != null) {
m_refreshTask.cancel();
m_refreshTask = null;
@ -426,6 +424,19 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
}
m_sessionId = null;
findViewById(R.id.loading_container).setVisibility(View.VISIBLE);
findViewById(R.id.main).setVisibility(View.INVISIBLE);
TextView tv = (TextView)findViewById(R.id.loading_message);
if (tv != null) {
tv.setText(R.string.login_ready);
}
findViewById(R.id.loading_progress).setVisibility(View.GONE);
initMainMenu();
}
public void login() {