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) {
Intent intent = new Intent(tv.getContext(), DoricActivity.class);
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);
}
});

View File

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

View File

@ -10,6 +10,7 @@ import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import android.view.LayoutInflater;
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);
final EditText editText = v.findViewById(R.id.edit_input);
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
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

View File

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

View File

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

View File

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