Still the same first
Main additions:
1. Article Details screen image Click to enlarge, move, zoom
2. New profile interface "not completed"
Mainly related to knowledge points:
1.TextView parsing of IMG tags in HTML, setting click events
2. Custom ImageView for zooming, moving
3. Learn from Fadingactionbar to achieve Fadingtoolbar "reference my information, the adoption of toolbar implementation"
4. Use BASE64 encoding to decode into bitmap for network pictures
Detailed explanation of TextView in the HTML tag in the IMG settings Click event Monitoring, the code is as follows:
public class Textimagehandle implements Html.taghandler {private context context; Private String Imgpath; Public Textimagehandle (context context, String Imgpath) {this.context = context; This.imgpath = Imgpath; } @Override public void Handletag (Boolean opening, String tag, Editable output, XMLReader XMLReader) {if (Ta G.tolowercase (). Equals ("img")) {int len = output.length (); imagespan[] images = Output.getspans (len-1, Len, Imagespan.class); String Imgurl = Images[0].getsource (); Register Click event Output.setspan (New ImageClick (context, Imgurl), len-1, Len, Spanned.span_exclusi ve_exclusive); }} Private class ImageClick extends Clickablespan {private String imgurl; Private context context; Public ImageClick (context context, String imgurl) {this.imgurl = Imgurl; This.context = context; } @Override PUBlic void OnClick (View widget) {if (Stringutil.isblank (Imgurl)) {return; }//do Something}}}
which
Spanned.span_exclusive_exclusive (not included before and after)
Spanned.span_inclusive_exclusive (included above, not included later)
Spanned.span_exclusive_inclusive (not previously included, included later)
Spanned.span_inclusive_inclusive (both front and rear included)
Picture Base64 transcoding, online There are many, here to provide one of the processing:
/** * Base64 transcoding * @param string * @return * /public static Bitmap Stringtobitmap (string string) { Bitmap Bitmap = null; try { byte[] bitmaparray; Bitmaparray = Base64.decode (string, base64.default); Bitmap = Bitmapfactory.decodebytearray (Bitmaparray, 0, bitmaparray.length); } catch (Exception e) { e.printstacktrace (); } return bitmap; }
Gradually improve the function, which also encountered a variety of bizarre problems, such as:
1. When crawling Csdn's blog data, the returned HTML data is not the same as the browser request, and the background is resolved by setting various Requestproperty properties of the urlconnection . At first I thought it was csdn to request IP intercept, try to use Proxy server request, the result is really intercepted, direct 404 ...
2. Network pictures, some use directly provide URLs, and some use BASE64 encoding processing, the results of local image cache, Base64 only by the forced conversion of the name to achieve.
3.FadingActionBar processing and Fadingtoolbar treatment, similar, but also delayed long time to fix.
Pending Completion:
1. User Profile Module "User basic information, user article information"
2. Article comments "Ah!!!" I forgot to do it today. 】
Program Ape Technology Blog Android client--Dig the pit yourself and have to fill it out yourself