Convert GalleryDetailParser to kotlin

This commit is contained in:
FooIbar authored and tarsin committed 2023-02-10 00:55:28 +08:00
1 parent 911ff31f69
commit 09842f5d72
4 files changed
+423 -477

No files matched your search

@@ -323,7 +323,7 @@ object EhEngine {
if (html != null) {
application.showEventPane(html)
}
return GalleryDetailParser.parse(body)
return GalleryDetailParser.parse(body!!)
}
} catch (e: Throwable) {
ExceptionUtils.throwIfFatal(e)
@@ -348,8 +348,8 @@ object EhEngine {
headers = response.headers
body = response.body.string()
return Pair.create(
GalleryDetailParser.parsePreviewSet(body),
GalleryDetailParser.parsePreviewPages(body)
GalleryDetailParser.parsePreviewSet(body!!),
GalleryDetailParser.parsePreviewPages(body!!)
)
}
} catch (e: Throwable) {
@@ -15,6 +15,7 @@
*/
package com.hippo.ehviewer.client.data
import com.hippo.ehviewer.client.data.GalleryInfo.Companion.S_LANGS
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
@@ -74,4 +75,30 @@ class GalleryDetail(
@IgnoredOnParcel
@JvmField
var previewSet: PreviewSet? = null,
) : AbstractGalleryInfo by galleryInfo, GalleryInfo
) : AbstractGalleryInfo by galleryInfo, GalleryInfo {
override fun generateSLang() {
val index = LANGUAGES.indexOf(language)
if (index != -1) {
simpleLanguage = S_LANGS[index]
}
}
companion object {
private val LANGUAGES = arrayOf(
"English",
"Chinese",
"Spanish",
"Korean",
"Russian",
"French",
"Portuguese",
"Thai",
"German",
"Italian",
"Vietnamese",
"Polish",
"Hungarian",
"Dutch"
)
}
}
File diff suppressed because it is too large. Load diff
@@ -1,26 +0,0 @@
/*
* Copyright 2019 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.util;
public class MutableBoolean {
public boolean value;
public MutableBoolean(boolean value) {
this.value = value;
}
}