fix context dependency
This commit is contained in:
parent
b434f61742
commit
72e59ffb86
@ -25,7 +25,7 @@ import okhttp3.WebSocket;
|
||||
import okhttp3.WebSocketListener;
|
||||
import pub.doric.devkit.DevKit;
|
||||
import pub.doric.devkit.event.QuitDebugEvent;
|
||||
import pub.doric.engine.IStatusCallback;
|
||||
import pub.doric.devkit.IStatusCallback;
|
||||
|
||||
public class RemoteJSExecutor {
|
||||
private final WebSocket webSocket;
|
||||
|
@ -15,14 +15,22 @@ import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import pub.doric.DoricContext;
|
||||
import pub.doric.DoricContextManager;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import pub.doric.devkit.BuildConfig;
|
||||
import pub.doric.devkit.DataModel;
|
||||
import pub.doric.devkit.DoricDev;
|
||||
import pub.doric.devkit.IDevKit;
|
||||
import pub.doric.devkit.R;
|
||||
|
||||
public class DebugContextPanel extends DialogFragment {
|
||||
|
||||
private ArrayList<DataModel> dataModels;
|
||||
|
||||
public DebugContextPanel(ArrayList<DataModel> dataModels) {
|
||||
this.dataModels = dataModels;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(
|
||||
@ -53,22 +61,22 @@ public class DebugContextPanel extends DialogFragment {
|
||||
LinearLayout container = getView().findViewById(R.id.container);
|
||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
|
||||
for (final DoricContext doricContext : DoricContextManager.aliveContexts()) {
|
||||
for (final DataModel dataModel : dataModels) {
|
||||
View cell = inflater.inflate(R.layout.layout_debug_context_cell, container, false);
|
||||
|
||||
TextView contextIdTextView = cell.findViewById(R.id.context_id_text_view);
|
||||
contextIdTextView.setText(doricContext.getContextId());
|
||||
contextIdTextView.setText(dataModel.contextId);
|
||||
|
||||
TextView sourceTextView = cell.findViewById(R.id.source_text_view);
|
||||
sourceTextView.setText(doricContext.getSource());
|
||||
sourceTextView.setText(dataModel.source);
|
||||
|
||||
cell.findViewById(R.id.debug_text_view).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("contextId", doricContext.getContextId());
|
||||
jsonObject.addProperty("contextId", dataModel.contextId);
|
||||
jsonObject.addProperty("projectHome", BuildConfig.PROJECT_HOME);
|
||||
jsonObject.addProperty("source", doricContext.getSource().replace(".js", ".ts"));
|
||||
jsonObject.addProperty("source", dataModel.source.replace(".js", ".ts"));
|
||||
DoricDev.sendDevCommand(IDevKit.Command.DEBUG, jsonObject);
|
||||
dismissAllowingStateLoss();
|
||||
}
|
||||
|
@ -21,8 +21,11 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import pub.doric.devkit.DataModel;
|
||||
import pub.doric.devkit.DevKit;
|
||||
import pub.doric.devkit.DoricDev;
|
||||
import pub.doric.devkit.R;
|
||||
@ -34,8 +37,10 @@ public class DevPanel extends BottomSheetDialogFragment {
|
||||
|
||||
public static boolean isDevConnected = false;
|
||||
|
||||
public DevPanel() {
|
||||
ArrayList<DataModel> dataModels;
|
||||
|
||||
public DevPanel(ArrayList<DataModel> dataModels) {
|
||||
this.dataModels = dataModels;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -80,7 +85,7 @@ public class DevPanel extends BottomSheetDialogFragment {
|
||||
getView().findViewById(R.id.debug_text_view).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
DebugContextPanel debugContextPanel = new DebugContextPanel();
|
||||
DebugContextPanel debugContextPanel = new DebugContextPanel(dataModels);
|
||||
debugContextPanel.show(getActivity().getSupportFragmentManager(), "DebugContextPanel");
|
||||
dismissAllowingStateLoss();
|
||||
}
|
||||
|
Reference in New Issue
Block a user