diff --git a/app/src/main/java/com/hippo/ehviewer/ui/legacy/DialogWebChromeClient.java b/app/src/main/java/com/hippo/ehviewer/ui/legacy/DialogWebChromeClient.java deleted file mode 100644 index 9ba70ef82..000000000 --- a/app/src/main/java/com/hippo/ehviewer/ui/legacy/DialogWebChromeClient.java +++ /dev/null @@ -1,77 +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.ehviewer.ui.legacy; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.webkit.JsPromptResult; -import android.webkit.JsResult; -import android.webkit.WebChromeClient; -import android.webkit.WebView; -import android.widget.EditText; -import android.widget.TextView; - -import com.hippo.ehviewer.R; - -public class DialogWebChromeClient extends WebChromeClient { - - private final Context context; - - public DialogWebChromeClient(Context context) { - this.context = context; - } - - @Override - public boolean onJsAlert(WebView view, String url, String message, JsResult result) { - new BaseDialogBuilder(view.getContext()) - .setMessage(message) - .setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm()) - .setOnCancelListener(dialog -> result.cancel()) - .show(); - return true; - } - - @Override - public boolean onJsConfirm(WebView view, String url, String message, JsResult result) { - new BaseDialogBuilder(view.getContext()) - .setMessage(message) - .setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm()) - .setNegativeButton(android.R.string.cancel, (dialog, which) -> result.cancel()) - .setOnCancelListener(dialog -> result.cancel()) - .show(); - return true; - } - - @Override - public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) { - LayoutInflater inflater = LayoutInflater.from(context); - View promptView = inflater.inflate(R.layout.dialog_js_prompt, null, false); - TextView messageView = promptView.findViewById(R.id.message); - messageView.setText(message); - final EditText valueView = promptView.findViewById(R.id.value); - valueView.setText(defaultValue); - - new BaseDialogBuilder(context) - .setView(promptView) - .setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm(valueView.getText().toString())) - .setOnCancelListener(dialog -> result.cancel()) - .show(); - - return true; - } -} diff --git a/app/src/main/java/com/hippo/ehviewer/ui/legacy/SearchLayout.kt b/app/src/main/java/com/hippo/ehviewer/ui/legacy/SearchLayout.kt index 338c77083..83b5814ea 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/legacy/SearchLayout.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/legacy/SearchLayout.kt @@ -265,6 +265,8 @@ class SearchLayout @JvmOverloads constructor( } } + private inner class SimpleHolder(itemView: View) : ViewHolder(itemView) + private inner class SearchAdapter : Adapter() { override fun getItemCount(): Int { var count = SEARCH_ITEM_COUNT_ARRAY[mSearchMode] @@ -283,7 +285,7 @@ class SearchLayout @JvmOverloads constructor( } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SimpleHolder { - val view: View? + val view: View if (viewType == ITEM_TYPE_ACTION) { mActionView.removeFromParent() view = mActionView diff --git a/app/src/main/java/com/hippo/ehviewer/ui/legacy/SimpleHolder.java b/app/src/main/java/com/hippo/ehviewer/ui/legacy/SimpleHolder.java deleted file mode 100644 index 99eac8717..000000000 --- a/app/src/main/java/com/hippo/ehviewer/ui/legacy/SimpleHolder.java +++ /dev/null @@ -1,28 +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.ui.legacy; - -import android.view.View; - -import androidx.recyclerview.widget.RecyclerView; - -public class SimpleHolder extends RecyclerView.ViewHolder { - - public SimpleHolder(View itemView) { - super(itemView); - } -}