joesox / cpforandroid

Automatically exported from code.google.com/p/cpforandroid
0 stars 0 forks source link

Smiles do not appear in the DetailDialog view #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Click on a message (often in the Lounge) that has a smiley
It does not display

Original issue reported on code.google.com by joesox on 31 Aug 2010 at 6:11

GoogleCodeExporter commented 9 years ago
Going to try below code in DetailsDialog.java

WebView description = (WebView) dialogView.findViewById(R.id.webviewbody);
description.getSettings().setJavaScriptEnabled(true); 

Original comment by joesox on 1 Sep 2010 at 2:15

GoogleCodeExporter commented 9 years ago

Original comment by joesox on 1 Sep 2010 at 2:16

GoogleCodeExporter commented 9 years ago
the javascript idea did not work. I tried "description.loadDataWithBaseURL..." 
null went away but nothing displayed.

I may need to cache the smiley images but still don't know why hyperlinks do 
not display.

Original comment by joesox on 2 Sep 2010 at 5:24

GoogleCodeExporter commented 9 years ago
Fixed in version 1.16. Fixed with encoding and decoding to get past Expat parser

    CPForAndroid.java
    /** Expat parser strips all of the html tags out of <description> content, this hack preps for WebView */
    private String PrepAndEncodeLine(String strLine)
    {
        String newline = strLine;
        //Lets go line by line for easy reading/debugging etc (keep in sequence order)
        newline = newline.replace("<a href=\"", "{{a");
        newline = newline.replace("<", "[[").replace(">", "]]");
        newline = newline.replace("[[div class=\"signature\"]]", "{hr}");

        return newline;
    }

    DetailsDialog.java
    /** Expat parser strips all of the html tags out of <description> content, this decodes the hack preps for WebView */
    private String DecodeLine(String strLine)
    {
        String newline = strLine;
        //Lets go line by line for easy reading/debugging etc (keep in sequence order)
        newline = newline.replace("{{a", "<a href=\"");
        newline = newline.replace("[[", "<").replace("]]", ">");
        newline = newline.replace("{hr}", "<hr>");
        return newline;
    }

Original comment by joesox on 4 Sep 2010 at 2:26