feat:update assets and set ip for input

This commit is contained in:
pengfeizhou 2021-02-25 12:43:22 +08:00 committed by osborn
parent d834f03835
commit b60fffd055
6 changed files with 17 additions and 8 deletions

View File

@ -120,7 +120,7 @@ public class MainActivity extends AppCompatActivity {
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(tv.getContext(), DoricActivity.class); Intent intent = new Intent(tv.getContext(), DoricActivity.class);
intent.putExtra("source", "assets://src/" + data[position - 1]); intent.putExtra("source", "assets://src/" + data[position - 1]);
intent.putExtra("alias", data[position - 1]); intent.putExtra("alias", data[position - 1].replace(".js", ""));
tv.getContext().startActivity(intent); tv.getContext().startActivity(intent);
} }
}); });

View File

@ -101,7 +101,7 @@ public class DoricDev {
} }
public String getIP() { public String getIP() {
if (wsClient != null) { if (url != null) {
return url.replace("ws://", "").replace(":7777", ""); return url.replace("ws://", "").replace(":7777", "");
} else { } else {
return "0.0.0.0"; return "0.0.0.0";

View File

@ -10,6 +10,7 @@ import android.graphics.BitmapFactory;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64; import android.util.Base64;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -152,6 +153,11 @@ public class DoricDevActivity extends AppCompatActivity implements DoricDev.Stat
View v = LayoutInflater.from(DoricDevActivity.this).inflate(R.layout.doric_modal_prompt, null); View v = LayoutInflater.from(DoricDevActivity.this).inflate(R.layout.doric_modal_prompt, null);
final EditText editText = v.findViewById(R.id.edit_input); final EditText editText = v.findViewById(R.id.edit_input);
editText.setHint("192.168.1.1"); editText.setHint("192.168.1.1");
String ip = DoricDev.getInstance().getIP();
if (!TextUtils.isEmpty(ip)) {
editText.setText(ip);
editText.setSelection(ip.length());
}
builder.setView(v); builder.setView(v);
builder builder
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

View File

@ -6,21 +6,21 @@
{ {
"label": "Doric Build", "label": "Doric Build",
"type": "shell", "type": "shell",
"command": "doric build", "command": "npm run build",
"group": "build", "group": "build",
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"label": "Doric Clean", "label": "Doric Clean",
"type": "shell", "type": "shell",
"command": "doric clean", "command": "npm run clean",
"group": "build", "group": "build",
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"label": "Doric Dev", "label": "Doric Dev",
"type": "shell", "type": "shell",
"command": "doric dev", "command": "npm run dev",
"group": "build", "group": "build",
"problemMatcher": [] "problemMatcher": []
} }

View File

@ -59,9 +59,9 @@ class CounterVM extends ViewModel<CountModel, CounterView> {
} }
onBind(s: CountModel, vh: CounterView) { onBind(s: CountModel, vh: CounterView) {
vh.number.text = `${s.count}`; vh.number.text = `${s.count}`;
log("onBind"); log(`Current count is ${s.count}`);
logw("onBind"); logw(`Current count is ${s.count}`);
loge("onBind"); loge(`Current count is ${s.count}`);
} }
} }

View File

@ -194,6 +194,9 @@ - (void)input {
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
[alert addTextFieldWithConfigurationHandler:^(UITextField *_Nonnull textField) { [alert addTextFieldWithConfigurationHandler:^(UITextField *_Nonnull textField) {
textField.placeholder = @"192.168.1.1"; textField.placeholder = @"192.168.1.1";
if (DoricDev.instance.ip) {
textField.text = DoricDev.instance.ip;
}
}]; }];
__weak typeof(alert) _alert = alert; __weak typeof(alert) _alert = alert;