Commit d51ffc2d by yuichiro ogawa

#39336 戻るボタンの挙動修正

parent 789d6a25
......@@ -10,6 +10,7 @@ import android.view.Window;
import android.webkit.CookieManager;
import android.webkit.DownloadListener;
import android.webkit.URLUtil;
import android.webkit.WebBackForwardList;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
......@@ -75,7 +76,18 @@ public class OnlineHTMLWebViewActivity extends ABVContentViewActivity {
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
webView.goBack();
// PDFダウンロードの場合はスキップする
WebBackForwardList bfList = webView.copyBackForwardList();
for (int i = 0, len = bfList.getCurrentIndex(); i < len; i++) {
String url = bfList.getItemAtIndex(len - i).getUrl();
if (url.contains("fileSelect")) {
continue;
}
if (webView.canGoBackOrForward(-1 * (i + 1))) {
webView.goBackOrForward(-1 * (i + 1));
break;
}
}
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment