mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
34 lines
1.0 KiB
Java
34 lines
1.0 KiB
Java
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.gecko;
|
|
|
|
import android.net.Uri;
|
|
import android.text.TextUtils;
|
|
|
|
public class ReaderModeUtils {
|
|
private static final String LOGTAG = "ReaderModeUtils";
|
|
|
|
public static boolean isAboutReader(String url) {
|
|
if (url == null)
|
|
return false;
|
|
|
|
return url.startsWith("about:reader");
|
|
}
|
|
|
|
public static String getAboutReaderForUrl(String url, boolean inReadingList) {
|
|
return getAboutReaderForUrl(url, -1, inReadingList);
|
|
}
|
|
|
|
public static String getAboutReaderForUrl(String url, int tabId, boolean inReadingList) {
|
|
String aboutReaderUrl = "about:reader?url=" + Uri.encode(url) +
|
|
"&readingList=" + (inReadingList ? 1 : 0);
|
|
|
|
if (tabId >= 0)
|
|
aboutReaderUrl += "&tabId=" + tabId;
|
|
|
|
return aboutReaderUrl;
|
|
}
|
|
}
|