From 89f9df6e44684c3a9f95cc16b5004818ea1900ba Mon Sep 17 00:00:00 2001 From: seven332 Date: Tue, 11 Aug 2015 17:06:46 +0800 Subject: [PATCH] Improve parser --- .../ehviewer/client/DetailUrlParser.java | 41 -------- .../ehviewer/client/GalleryDetailParser.java | 94 ++++++++++--------- .../client/GalleryDetailUrlParser.java | 5 +- .../ehviewer/client/GalleryListParser.java | 74 ++++++++------- .../hippo/ehviewer/client/SignInParser.java | 14 +-- .../hippo/ehviewer/gallery/ImageHandler.java | 4 + .../hippo/ehviewer/gallery/SpiderParser.java | 14 +-- .../hippo/ehviewer/gallery/SpiderQueen.java | 9 +- .../ehviewer/gallery/ui/GalleryView.java | 66 +++++++++++-- 9 files changed, 172 insertions(+), 149 deletions(-) delete mode 100644 app/src/main/java/com/hippo/ehviewer/client/DetailUrlParser.java diff --git a/app/src/main/java/com/hippo/ehviewer/client/DetailUrlParser.java b/app/src/main/java/com/hippo/ehviewer/client/DetailUrlParser.java deleted file mode 100644 index e49fd3496..000000000 --- a/app/src/main/java/com/hippo/ehviewer/client/DetailUrlParser.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2015 Hippo Seven - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.hippo.ehviewer.client; - -import com.hippo.yorozuya.AssertUtils; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class DetailUrlParser { - - public int gid; - public String token; - - public void parser(String url) throws Exception { - AssertUtils.assertNotNull("Url is null when parse detail url", url); - - Pattern p = Pattern.compile("/(\\d+)/(\\w+)"); - Matcher m = p.matcher(url); - if (m.find()) { - gid = Integer.parseInt(m.group(1)); - token = m.group(2); - } else { - throw new EhException("Can not parse detail url"); - } - } -} diff --git a/app/src/main/java/com/hippo/ehviewer/client/GalleryDetailParser.java b/app/src/main/java/com/hippo/ehviewer/client/GalleryDetailParser.java index 33c8722b8..b99b29c20 100644 --- a/app/src/main/java/com/hippo/ehviewer/client/GalleryDetailParser.java +++ b/app/src/main/java/com/hippo/ehviewer/client/GalleryDetailParser.java @@ -40,6 +40,45 @@ public class GalleryDetailParser { private static final DateFormat WEB_COMMENT_DATE_FORMAT = new SimpleDateFormat("dd MMMMM yyyy, HH:mm z", Locale.US); private static final DateFormat OUT_COMMENT_DATE_FORMAT = GalleryBase.DEFAULT_DATE_FORMAT; + private static final Pattern ERROR_PATTERN = Pattern.compile("
\n

([^<]+)

"); + private static final Pattern DETAIL_PATTERN = Pattern.compile( + "var gid = (\\d+)" // 1 gid + + ".+?" + + "var token = \"([a-z0-9A]+)\"" // 2 token + + ".+?" + + "
]+>
" // 3 thumb + + "
" + + "
" + + "

([^<>]+)

" // 4 title + + "

([^<>]*)

" // 5 title_jpn might be empty string + + "
" + + ".+?" + + "]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Torrent Download \\( (\\d+) \\)" // 6 torrentUrl, 7 torrentCount + + ".+?" + + "
]+><[^<>]*alt=\"([\\w\\-]+)\"[^<>]*>
" // 8 category + + "
]+>([^<>]+)" // 9 uploader + + ".+?" + + "]*>Posted:]*>([\\w\\-\\s:]+)" // 10 posted + + "]*>Parent:]*>(?:]*>)?([^<>]+)(?:)?" // 11 parent + + "]*>Visible:]*>([^<>]+)" // 12 visible + + "]*>Language:]*>([^<>]+)(?:]*>[^<>]*)?" // 13 language + + "]*>File Size:]*>([^<>]+)(?:]*>([^<>]+))?" // 14 File size, 15 resize + + "]*>Length:]*>([\\d,]+) pages" // 16 pageCount + + "]*>Favorited:<[^<>]*>([^<>]+)" // 17 Favorite times "([\d,]+) times" or "Once" or "Never" + + ".+?" + + "([\\d,]+)" // 18 ratedTimes + + "" + + "]*>([^<>]+)" // 19 rating "Average: x.xx" or "Not Yet Rated" + + ".+?" + + "]*>(.+?)", Pattern.DOTALL); // 20 isFavored "Favorite Gallery" for favorite + private static final Pattern TAG_PATTERN = Pattern.compile("]+>([\\w\\s]+):(?:]+>]+>[\\w\\s]+
)+"); + private static final Pattern COMMENT_PATTERN = Pattern.compile("
Posted on ([^<>]+) by:   ]+>([^<>]+).+?
]*>(.+?)
]+>]+>([\\w\\s]+)
"); + public static final Pattern PAGES_PATTERN = Pattern.compile("]*>Length:]*>([\\d,]+) pages"); + public static final Pattern PREVIEW_PAGES_PATTERN = Pattern.compile("]+>]+>([\\d,]+)]+>(?:]+>)?>(?:)?"); + private static final Pattern NORMAL_PREVIEW_PATTERN = Pattern.compile("]*class=\"gdtm\"[^<>]*>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*-(\\d+)px[^<>]*>]*href=\"(.+?)\"[^<>]*>"); + private static final Pattern LARGE_PREVIEW_PATTERN = Pattern.compile("
\n

([^<]+)

"); - m = p.matcher(body); + m = ERROR_PATTERN.matcher(body); if (m.find()) { throw new EhException(m.group(1)); } @@ -96,36 +134,7 @@ public class GalleryDetailParser { GalleryDetail galleryDetail = new GalleryDetail(); if ((request & REQUEST_DETAIL) != 0) { - p = Pattern.compile("var gid = (\\d+)" // 1 gid - + ".+?" - + "var token = \"([a-z0-9A]+)\"" // 2 token - + ".+?" - + "
]+>
" // 3 thumb - + "
" - + "
" - + "

([^<>]+)

" // 4 title - + "

([^<>]*)

" // 5 title_jpn might be empty string - + "
" - + ".+?" - + "]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Torrent Download \\( (\\d+) \\)" // 6 torrentUrl, 7 torrentCount - + ".+?" - + "
]+><[^<>]*alt=\"([\\w\\-]+)\"[^<>]*>
" // 8 category - + "
]+>([^<>]+)" // 9 uploader - + ".+?" - + "]*>Posted:]*>([\\w\\-\\s:]+)" // 10 posted - + "]*>Parent:]*>(?:]*>)?([^<>]+)(?:)?" // 11 parent - + "]*>Visible:]*>([^<>]+)" // 12 visible - + "]*>Language:]*>([^<>]+)(?:]*>[^<>]*)?" // 13 language - + "]*>File Size:]*>([^<>]+)(?:]*>([^<>]+))?" // 14 File size, 15 resize - + "]*>Length:]*>([\\d,]+) pages" // 16 pageCount - + "]*>Favorited:<[^<>]*>([^<>]+)" // 17 Favorite times "([\d,]+) times" or "Once" or "Never" - + ".+?" - + "([\\d,]+)" // 18 ratedTimes - + "" - + "]*>([^<>]+)" // 19 rating "Average: x.xx" or "Not Yet Rated" - + ".+?" - + "]*>(.+?)", Pattern.DOTALL); // 20 isFavored "Favorite Gallery" for favorite - m = p.matcher(body); + m = DETAIL_PATTERN.matcher(body); if (m.find()) { galleryDetail.gid = ParserUtils.parseInt(m.group(1)); galleryDetail.token = ParserUtils.trim(m.group(2)); @@ -184,8 +193,7 @@ public class GalleryDetailParser { if ((request & REQUEST_TAG) != 0) { galleryDetail.tags = new LinkedList<>(); - p = Pattern.compile("]+>([\\w\\s]+):(?:]+>]+>[\\w\\s]+
)+"); - m = p.matcher(body); + m = TAG_PATTERN.matcher(body); while (m.find()) { TagGroup tagGroup = new TagGroup(); tagGroup.groupName = ParserUtils.trim(m.group(1)); @@ -209,8 +217,7 @@ public class GalleryDetailParser { // Get comment if ((request & REQUEST_COMMENT) != 0) { - p = Pattern.compile("
Posted on ([^<>]+) by:   ]+>([^<>]+).+?
]*>(.+?)
(); while (m.find()) { String webDateString = ParserUtils.trim(m.group(1)); @@ -229,16 +236,14 @@ public class GalleryDetailParser { } private static void parseTagGroup(TagGroup tagGroup, String body) { - Pattern p = Pattern.compile("]+>]+>([\\w\\s]+)
"); - Matcher m = p.matcher(body); + Matcher m = TAG_GROUP_PATTERN.matcher(body); while (m.find()) { tagGroup.addTag(ParserUtils.trim(m.group(1))); } } public static int parsePreviewPages(String body) throws ParseException { - Pattern p = Pattern.compile("]+>]+>([\\d,]+)]+>(?:]+>)?>(?:)?"); - Matcher m = p.matcher(body); + Matcher m = PREVIEW_PAGES_PATTERN.matcher(body); int previewPages = -1; if (m.find()) { previewPages = ParserUtils.parseInt(m.group(1)); @@ -252,8 +257,7 @@ public class GalleryDetailParser { } public static int parsePages(String body) throws ParseException { - Pattern p = Pattern.compile("]*>Length:]*>([\\d,]+) pages"); - Matcher m = p.matcher(body); + Matcher m = PAGES_PATTERN.matcher(body); if (m.find()) { return ParserUtils.parseInt(m.group(1)); } else { @@ -285,8 +289,7 @@ public class GalleryDetailParser { } private static NormalPreviewSet parseNormalPreview(String body) { - Pattern p = Pattern.compile("]*class=\"gdtm\"[^<>]*>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*-(\\d+)px[^<>]*>]*href=\"(.+?)\"[^<>]*>"); - Matcher m = p.matcher(body); + Matcher m = NORMAL_PREVIEW_PATTERN.matcher(body); NormalPreviewSet normalPreviewSet = new NormalPreviewSet(); while (m.find()) { normalPreviewSet.addItem(m.group(3), Integer.parseInt(m.group(4)), 0, @@ -297,8 +300,7 @@ public class GalleryDetailParser { } private static LargePreviewSet parseLargePreview(String body) { - Pattern p = Pattern.compile("
]+>([\\d]+)]+>(?:]+>)?&"); + static final Pattern PATTERN = Pattern.compile( + "(?:)?(?:)?" // category + + "(.+?)" // posted + + "" + + "(?:" + + "|init~([^<>\"~]+~[^<>\"~]+)~([^<>]+))" // thumb and title + + "
" + + ".+?" + + "" // url and title + + ".+?" + + "
\"]+)\">" // rating + + ".+?" + + "
(.+?)"); // uploader + static final Pattern LOFI_PATTERN = Pattern.compile( + "" // detail url + + "" // thumb url + + ".+?(.+?)" // title + + ".+?Posted:(.+?)" // Posted and uploader + + "Category:(.+?)" // Category + + "Tags:(.+?)" // Tags + + "Rating:(.+?)"); // rating + static final Pattern RATING_PATTERN = Pattern.compile("\\d+px"); + public static class Result { public static final int CURRENT_PAGE_IS_LAST = -1; @@ -62,12 +86,10 @@ public class GalleryListParser { private static Result parse(String body) throws EhException { Result result = new Result(); - Pattern p; Matcher m; // pages - p = Pattern.compile("]+>([\\d]+)]+>(?:]+>)?&"); - m = p.matcher(body); + m = PAGES_PATTERN.matcher(body); if (m.find()) { result.pages = ParserUtils.parseInt(m.group(1)); } else if (body.contains("No hits found

")) { @@ -81,19 +103,7 @@ public class GalleryListParser { List list = new ArrayList<>(25); result.galleryInfos = list; - p = Pattern.compile("(?:)?(?:)?" // category - + "(.+?)" // posted - + "" - + "(?:" - + "|init~([^<>\"~]+~[^<>\"~]+)~([^<>]+))" // thumb and title - + "
" - + ".+?" - + "" // url and title - + ".+?" - + "
\"]+)\">" // rating - + ".+?" - + "
(.+?)"); // uploader - m = p.matcher(body); + m = PATTERN.matcher(body); while (m.find()) { GalleryInfo gi = new GalleryInfo(); @@ -110,9 +120,7 @@ public class GalleryListParser { gi.title = ParserUtils.trim(m.group(6)); } - Pattern pattern = Pattern - .compile("/(\\d+)/(\\w+)"); - Matcher matcher = pattern.matcher(m.group(9)); + Matcher matcher = GalleryDetailUrlParser.URL_PATTERN.matcher(m.group(9)); if (matcher.find()) { gi.gid = ParserUtils.parseInt(matcher.group(1)); gi.token = ParserUtils.trim(matcher.group(2)); @@ -120,7 +128,7 @@ public class GalleryListParser { continue; } - gi.rating = NumberUtils.parseFloatSafely(getRate(m.group(11)), Float.NaN); + gi.rating = NumberUtils.parseFloatSafely(getRating(m.group(11)), Float.NaN); gi.uploader = ParserUtils.trim(m.group(12)); gi.generateSLang(); @@ -137,27 +145,22 @@ public class GalleryListParser { private static Result parseLofi(String body) throws Exception { Result result = new Result(); - Pattern p; Matcher m; List list = new ArrayList<>(25); result.galleryInfos = list; - p = Pattern.compile("" // detail url - + "" // thumb url - + ".+?(.+?)" // title - + ".+?Posted:(.+?)" // Posted and uploader - + "Category:(.+?)" // Category - + "Tags:(.+?)" // Tags - + "Rating:(.+?)"); // rating - m = p.matcher(body); - DetailUrlParser dup = new DetailUrlParser(); + m = LOFI_PATTERN.matcher(body); String[] pau = new String[2]; while (m.find()) { LofiGalleryInfo lgi = new LofiGalleryInfo(); - dup.parser(m.group(1)); - lgi.gid = dup.gid; - lgi.token = dup.token; + GalleryDetailUrlParser.Result result1 = GalleryDetailUrlParser.parser(m.group(1)); + if (result1 != null) { + lgi.gid = result1.gid; + lgi.token = result1.token; + } else { + continue; + } lgi.thumb = ParserUtils.trim(m.group(2)); lgi.title = ParserUtils.trim(m.group(3)); @@ -203,9 +206,8 @@ public class GalleryListParser { return result; } - private static String getRate(String rawRate) { - Pattern p = Pattern.compile("\\d+px"); - Matcher m = p.matcher(rawRate); + private static String getRating(String rawRate) { + Matcher m = RATING_PATTERN.matcher(rawRate); int num1; int num2; int rate = 5; diff --git a/app/src/main/java/com/hippo/ehviewer/client/SignInParser.java b/app/src/main/java/com/hippo/ehviewer/client/SignInParser.java index 8bf8b625b..fb660a28f 100644 --- a/app/src/main/java/com/hippo/ehviewer/client/SignInParser.java +++ b/app/src/main/java/com/hippo/ehviewer/client/SignInParser.java @@ -21,19 +21,19 @@ import java.util.regex.Pattern; public class SignInParser { + static final Pattern NAME_PATTERN = Pattern.compile("

You are now logged in as: (.+?)
"); + static final Pattern ERROR_PATTERN = Pattern.compile( + "(?:

The error returned was:

\\s*

(.+?)

)" + + "|(?:(.+?))"); + public static String parse(String body) throws Exception { - Pattern p; Matcher m; - p = Pattern.compile("

You are now logged in as: (.+?)
"); - m = p.matcher(body); + m = NAME_PATTERN.matcher(body); if (m.find()) { return m.group(1); } else { - p = Pattern.compile("(?:

The error returned was:

\\s*

(.+?)

)" - + "|(?:(.+?))"); - m = p.matcher(body); - + m = ERROR_PATTERN.matcher(body); if (m.find()) { throw new EhException(m.group(1) == null ? m.group(2) : m.group(1)); } else { diff --git a/app/src/main/java/com/hippo/ehviewer/gallery/ImageHandler.java b/app/src/main/java/com/hippo/ehviewer/gallery/ImageHandler.java index cfd62d786..064520166 100644 --- a/app/src/main/java/com/hippo/ehviewer/gallery/ImageHandler.java +++ b/app/src/main/java/com/hippo/ehviewer/gallery/ImageHandler.java @@ -444,6 +444,10 @@ public class ImageHandler { public abstract void onSave(long receivedSize); + public boolean isCancelled() { + return mCancel; + } + public void cancel() { mCancel = true; if (mRequest != null) { diff --git a/app/src/main/java/com/hippo/ehviewer/gallery/SpiderParser.java b/app/src/main/java/com/hippo/ehviewer/gallery/SpiderParser.java index 8076548ee..d76ef543c 100644 --- a/app/src/main/java/com/hippo/ehviewer/gallery/SpiderParser.java +++ b/app/src/main/java/com/hippo/ehviewer/gallery/SpiderParser.java @@ -17,6 +17,7 @@ package com.hippo.ehviewer.gallery; import com.hippo.ehviewer.client.EhConfig; +import com.hippo.ehviewer.client.GalleryDetailParser; import com.hippo.ehviewer.client.ParseException; import com.hippo.ehviewer.client.ParserUtils; @@ -27,6 +28,9 @@ import java.util.regex.Pattern; public class SpiderParser { + private static final Pattern NORMAL_PREVIEW_PATTERN = Pattern.compile("
]+>]+>"); + private static final Pattern LARGE_PREVIEW_PATTERN = Pattern.compile("
]+>"); + public static class Result { public int pages; public int previewPages; @@ -44,16 +48,14 @@ public class SpiderParser { Matcher m; if (request == REQUEST_ALL) { - p = Pattern.compile("]*>Length:]*>([\\d,]+) pages"); - m = p.matcher(body); + m = GalleryDetailParser.PAGES_PATTERN.matcher(body); if (m.find()) { result.pages = ParserUtils.parseInt(m.group(1)); } else { throw new ParseException("Parse pages error", body); } - p = Pattern.compile("]+>]+>([\\d,]+)]+>(?:]+>)?>(?:)?"); - m = p.matcher(body); + m = GalleryDetailParser.PREVIEW_PAGES_PATTERN.matcher(body); if (m.find()) { result.previewPages = ParserUtils.parseInt(m.group(1)); } else { @@ -64,11 +66,11 @@ public class SpiderParser { List list; if (body.contains("
]+>]+>"); + p = NORMAL_PREVIEW_PATTERN; list = new ArrayList<>(40); } else { result.previewSize = EhConfig.PREVIEW_SIZE_LARGE; - p = Pattern.compile("
]+>"); + p = LARGE_PREVIEW_PATTERN; list = new ArrayList<>(20); } result.tokens = list; diff --git a/app/src/main/java/com/hippo/ehviewer/gallery/SpiderQueen.java b/app/src/main/java/com/hippo/ehviewer/gallery/SpiderQueen.java index b9c39cc0e..b8596b679 100644 --- a/app/src/main/java/com/hippo/ehviewer/gallery/SpiderQueen.java +++ b/app/src/main/java/com/hippo/ehviewer/gallery/SpiderQueen.java @@ -39,6 +39,7 @@ import com.hippo.yorozuya.Say; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.LinkedList; @@ -766,7 +767,13 @@ public class SpiderQueen implements Runnable { mSpiderListener.onSpiderSucceed(index); return; } catch (Exception e) { - exception = e; + if (mCurrentSaveHelper != null && mCurrentSaveHelper.isCancelled()) { + mPageStates.lazySet(index, PAGE_STATE_FAILED); + mSpiderListener.onSpiderFailed(index, new IOException("Cancelled")); + return; + } else { + exception = e; + } } finally { mCurrentSaveHelper = null; } diff --git a/app/src/main/java/com/hippo/ehviewer/gallery/ui/GalleryView.java b/app/src/main/java/com/hippo/ehviewer/gallery/ui/GalleryView.java index 8402d7bca..260999ba9 100644 --- a/app/src/main/java/com/hippo/ehviewer/gallery/ui/GalleryView.java +++ b/app/src/main/java/com/hippo/ehviewer/gallery/ui/GalleryView.java @@ -46,7 +46,7 @@ public class GalleryView extends GLView implements GestureRecognizer.Listener, M private static final float[] RIGHT_AREA = {2.0f / 3.0f, 0.0f, 1.0f, 1f}; private static final float[] CENTER_AREA = {1.0f / 3.0f, 2.0f / 5.0f, 2.0f / 3.0f, 3.0f / 5.0f}; - private static final Interpolator SMOOTH_SCALER_INTERPOLATOR = new OvershootInterpolator(); + private static final Interpolator SMOOTH_SCALER_INTERPOLATOR = new OvershootInterpolator(0.7f); private boolean mEnableRequestLayout = true; @@ -181,6 +181,7 @@ public class GalleryView extends GLView implements GestureRecognizer.Listener, M if (mMode != mode) { Mode oldMode = mMode; mMode = mode; + resetPageMoving(); superRequestLayout(); mListener.onSetMode(mode); @@ -191,6 +192,13 @@ public class GalleryView extends GLView implements GestureRecognizer.Listener, M } } + private void resetPageMoving() { + mSmoothScroller.forceStop(); + mSmoothScaler.forceStop(); + mLayoutOffset = 0; + mHaveChangePage = false; + } + public void setAdapter(Adapter adapter) { mAdapter = adapter; } @@ -222,18 +230,60 @@ public class GalleryView extends GLView implements GestureRecognizer.Listener, M } } + public void scrollToPrevious() { + scrollToPage(mFirstShownIndex - 1); + } + + public void scrollToNext() { + scrollToPage(mFirstShownIndex + 1); + } + + public void scrollToLeft() { + if (mMode == Mode.RIGHT_TO_LEFT) { + scrollToNext(); + } else { + scrollToPrevious(); + } + } + + public void scrollToRight() { + if (mMode == Mode.RIGHT_TO_LEFT) { + scrollToPrevious(); + } else { + scrollToNext(); + } + } + public void scrollToPage(int page) { scrollToPageInternal(page, false); } private void scrollToPageInternal(int page, boolean internal) { - mSmoothScroller.forceStop(); - mSmoothScaler.forceStop(); - - if (page < 0 || page >= mAdapter.getPages()) { + if (mMode == Mode.NONE) { return; } + if (page < 0) { + if (mMode == Mode.LEFT_TO_RIGHT) { + mEdgeView.onPull(getWidth() * 2, EdgeView.LEFT); + } else if (mMode == Mode.RIGHT_TO_LEFT) { + mEdgeView.onPull(getWidth() * 2, EdgeView.RIGHT); + } + return; + } + + if (page >= mAdapter.getPages()) { + if (mMode == Mode.LEFT_TO_RIGHT) { + mEdgeView.onPull(getWidth() * 2, EdgeView.RIGHT); + } else if (mMode == Mode.RIGHT_TO_LEFT) { + mEdgeView.onPull(getWidth() * 2, EdgeView.LEFT); + } + return; + } + + mSmoothScroller.forceStop(); + mSmoothScaler.forceStop(); + mFirstShownIndex = page; mLayoutOffset = 0; requestFill(); @@ -598,8 +648,7 @@ public class GalleryView extends GLView implements GestureRecognizer.Listener, M @Override protected void onLayout(boolean changeSize, int left, int top, int right, int bottom) { - mSmoothScroller.forceStop(); - mSmoothScaler.forceStop(); + mEdgeView.layout(left, top, right, bottom); /* TODO set all seen UNKNOWN_SEEN in order to setScaleAndOffset @@ -611,9 +660,6 @@ public class GalleryView extends GLView implements GestureRecognizer.Listener, M } */ - - mLayoutOffset = 0; - mHaveChangePage = false; fill(); if (changeSize) {