do some webview background hacks

This commit is contained in:
Andrew Dolgov 2011-12-03 21:34:40 +03:00
parent 24516babd7
commit 34f6e76f4f
2 changed files with 15 additions and 9 deletions

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="29"
android:versionName="0.1.28">
android:versionCode="30"
android:versionName="0.1.29">
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<application android:icon="@drawable/icon" android:hardwareAccelerated="true" android:label="@string/app_name">
<activity android:name=".LoginActivity"
android:label="@string/app_name">
</activity>

View File

@ -14,18 +14,17 @@ import org.jsoup.Jsoup;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.webkit.WebView;
@ -330,7 +329,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
View v = convertView;
final Article article = items.get(position);
int webBgResource = R.attr.headlineNormalBackground;
if (v == null) {
int layoutId = R.layout.headlines_row;
@ -340,9 +340,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
break;
case VIEW_UNREAD:
layoutId = R.layout.headlines_row_unread;
webBgResource = R.attr.headlineUnreadBackground;
break;
case VIEW_SELECTED:
layoutId = R.layout.headlines_row_selected;
webBgResource = R.attr.headlineSelectedBackground;
break;
}
@ -420,8 +422,12 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
String content;
String cssOverride = "";
web.setBackgroundColor(0x00000000);
TypedValue tv = new TypedValue();
getActivity().getTheme().resolveAttribute(webBgResource, tv, true);
int webColor = tv.data;
web.setBackgroundColor(webColor);
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
cssOverride = "body { background : transparent; color : #e0e0e0}\n";
} else {