Skip to content

Commit

Permalink
⚰️ remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
ourfor committed Dec 3, 2024
1 parent 3654799 commit 0c18728
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 60 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
package top.ourfor.app.iplayx.page.setting.common;
package top.ourfor.app.iplayx.page.web;

import static top.ourfor.app.iplayx.module.Bean.XGET;

import android.app.Dialog;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout;

import com.google.android.flexbox.FlexboxLayout;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

import lombok.Getter;
import lombok.Setter;
import lombok.val;
import top.ourfor.app.iplayx.R;
import top.ourfor.app.iplayx.action.UpdateModelAction;
import top.ourfor.app.iplayx.bean.KVStorage;
import top.ourfor.app.iplayx.databinding.ScriptManageBinding;
import top.ourfor.app.iplayx.databinding.SettingCellBinding;
import top.ourfor.app.iplayx.util.DeviceUtil;
import top.ourfor.app.iplayx.view.TagView;

public class ScriptManageView extends ConstraintLayout {
ScriptManageBinding binding = null;
@Getter
ScriptManageViewModel viewModel = new ScriptManageViewModel();

@Getter @Setter
Consumer<View> onSaveButtonClick;

public ScriptManageView(@NonNull Context context) {
super(context);
binding = ScriptManageBinding.inflate(LayoutInflater.from(context), this, true);
Expand All @@ -48,8 +43,14 @@ private void bind() {
viewModel.value = XGET(KVStorage.class).get("@script");
setupTextArea();

binding.settingButton.setOnClickListener(v -> {
XGET(KVStorage.class).set("@script", viewModel.value);
binding.saveButton.setOnClickListener(v -> {
val kv = XGET(KVStorage.class);
if (kv != null) {
kv.set("@script", viewModel.value);
}
if (onSaveButtonClick != null) {
onSaveButtonClick.accept(v);
}
});

if (!DeviceUtil.isTV) return;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package top.ourfor.app.iplayx.page.web;

import java.util.function.Consumer;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor
@AllArgsConstructor
public class ScriptManageViewModel {
@Getter @Setter
String value;

@Getter @Setter
Consumer<String> onClick;

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@
import android.view.ViewGroup;
import android.webkit.JavascriptInterface;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

import com.airbnb.lottie.LottieAnimationView;
Expand All @@ -45,15 +42,10 @@
import top.ourfor.app.iplayx.databinding.WebPageBinding;
import top.ourfor.app.iplayx.page.Activity;
import top.ourfor.app.iplayx.page.Page;
import top.ourfor.app.iplayx.page.setting.common.ScriptManageView;
import top.ourfor.app.iplayx.page.setting.common.WebScriptMessage;
import top.ourfor.app.iplayx.store.GlobalStore;
import top.ourfor.app.iplayx.util.AnimationUtil;
import top.ourfor.app.iplayx.util.DeviceUtil;
import top.ourfor.app.iplayx.util.WindowUtil;
import top.ourfor.app.iplayx.view.infra.Button;
import top.ourfor.app.iplayx.view.infra.EditText;
import top.ourfor.app.iplayx.view.infra.TextView;
import top.ourfor.app.iplayx.view.infra.Toolbar;
import top.ourfor.app.iplayx.view.infra.ToolbarAction;

Expand Down Expand Up @@ -211,11 +203,10 @@ void bind() {
}

void showScriptPanel() {
val drive = store.getDrive();
dialog = new BottomSheetDialog(getContext(), R.style.SiteBottomSheetDialog);
dialog.setOnDismissListener(dlg -> {
});
dialog.setOnDismissListener(dlg -> { });
var view = new ScriptManageView(context);
view.setOnSaveButtonClick(v -> dialog.dismiss());
dialog.setContentView(view);
var behavior = BottomSheetBehavior.from((View) view.getParent());
val height = (int) (DeviceUtil.screenSize(getContext()).getHeight() * 0.6);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package top.ourfor.app.iplayx.page.setting.common;
package top.ourfor.app.iplayx.page.web;

import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/layout/script_manage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/>

<top.ourfor.app.iplayx.view.infra.Button
android:id="@+id/setting_button"
android:id="@+id/save_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/save"
Expand Down

0 comments on commit 0c18728

Please sign in to comment.