add a hacky way to pass the font color to our webview dialog

This commit is contained in:
Adrian Ulrich 2015-04-12 15:33:20 +02:00
parent e5d3d4b768
commit 1607bcd2d8
2 changed files with 16 additions and 3 deletions

View File

@ -1,7 +1,8 @@
<html>
<head>
<meta charset="utf-8" />
<style>
body { font-family: sans-serif; color: #f3f3f3; background: transparent;}
body { font-family: sans-serif; background: transparent;}
pre { background-color: #ccc; color: #000; padding: 1em; white-space: pre-wrap; display: none; }
h2 { border-bottom: 1px solid #444; }
a { color: #5c5cff; }
@ -90,4 +91,15 @@ See the License for the specific language governing permissions and
limitations under the License.
</pre>
</body>
<script>
var query = decodeURIComponent(window.location.search.substring(1));
var color = query.match(/^#..(.+)/);
if (color != null) {
// android gives us aRGB, but we need RGB
color = '#' + color[1];
document.body.style.color = color;
}
</script>
</html>

View File

@ -38,6 +38,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewFragment;
import android.net.Uri;
import java.util.List;
/**
@ -175,9 +176,9 @@ public class PreferencesActivity extends PreferenceActivity {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
WebView view = (WebView)super.onCreateView(inflater, container, savedInstanceState);
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
view.getSettings().setJavaScriptEnabled(true);
view.loadUrl("file:///android_asset/about.html");
String fontColor = getResources().getString(R.color.overlay_foreground_color);
view.loadUrl("file:///android_asset/about.html?"+Uri.encode(fontColor));
view.setBackgroundColor(Color.TRANSPARENT);
return view;
}