Skip to content

Commit

Permalink
Merge pull request #36 from kevinhinterlong/fixScrollingToAnchor
Browse files Browse the repository at this point in the history
Minor fix for scrolling to links
  • Loading branch information
kevinhinterlong authored Jun 9, 2017
2 parents 4059eec + 832cedf commit d3e4feb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void addHistory(WikiPage wikiPage) {
*/
public void loadWikiHtml(WikiPage wikiPage) {
webView.loadDataWithBaseURL(
ARCHWIKI_BASE,
wikiPage.getPageUrl(),
wikiPage.getHtmlString(),
TEXT_HTML_MIME,
UTF_8,
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/jtmcn/archwiki/viewer/WikiView.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

public class WikiView extends WebView {
public static final String TAG = WikiView.class.getSimpleName();
private Context context;
WikiClient wikiClient;
private Context context;

public WikiView(Context context, AttributeSet attrs) {
super(context, attrs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static String getPageTitle(StringBuilder htmlString) {
* Removes the contents within the head block of the html
* and replaces it with the a reference to a local css file.
*
* @param htmlString The html of the page as a string.
* @param htmlString The html of the page as a string.
* @param localCSSFilePath The path of the css file to inject.
* @return true if the block was successfully replaced.
*/
Expand Down
37 changes: 18 additions & 19 deletions app/src/main/java/com/jtmcn/archwiki/viewer/tasks/FetchUrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,9 @@
* @param <Result> The type which the fetched url's text will be mapped to.
*/
public class FetchUrl<Result> extends AsyncTask<String, Void, Result> {
/**
* A listener which is called when {@link Result} is ready.
*
* @param <Result> the type of object which has been created.
*/
public interface OnFinish<Result> {
void onFinish(Result result);
}

/**
* Maps the url and fetched text to {@link R}
*
* @param <R> The type which the text will be mapped to.
*/
public interface FetchUrlMapper<R> {
R mapTo(String url, StringBuilder sb);
}

private static final String TAG = FetchUrl.class.getSimpleName();
private final OnFinish<Result> onFinish;
private final FetchUrlMapper<Result> mapper;

/**
* Fetches the first url and notifies the {@link OnFinish} listener.
*
Expand Down Expand Up @@ -80,4 +61,22 @@ private StringBuilder getItem(String url) {

return toReturn;
}

/**
* A listener which is called when {@link Result} is ready.
*
* @param <Result> the type of object which has been created.
*/
public interface OnFinish<Result> {
void onFinish(Result result);
}

/**
* Maps the url and fetched text to {@link R}
*
* @param <R> The type which the text will be mapped to.
*/
public interface FetchUrlMapper<R> {
R mapTo(String url, StringBuilder sb);
}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.android.tools.build:gradle:2.3.3'
}
}

Expand Down

0 comments on commit d3e4feb

Please sign in to comment.