机器人自动发言
This commit is contained in:
parent
9158424a25
commit
a069562bbe
@ -7,6 +7,7 @@ import android.view.View;
|
|||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -31,6 +32,9 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View
|
|||||||
private AppCompatTextView automaticGreetingNumber, automaticMessageNumber;
|
private AppCompatTextView automaticGreetingNumber, automaticMessageNumber;
|
||||||
private TextView robotNameText;
|
private TextView robotNameText;
|
||||||
private String time = "";
|
private String time = "";
|
||||||
|
private ImageView robotState;
|
||||||
|
|
||||||
|
private int robotStateInt = 1;
|
||||||
|
|
||||||
public LiveRobotSettingCustomPopup(@NonNull Context context) {
|
public LiveRobotSettingCustomPopup(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -53,10 +57,13 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View
|
|||||||
private void intiView() {
|
private void intiView() {
|
||||||
robotNameSetting = findViewById(R.id.robot_name_setting);
|
robotNameSetting = findViewById(R.id.robot_name_setting);
|
||||||
robotNameText = findViewById(R.id.robot_name_text);
|
robotNameText = findViewById(R.id.robot_name_text);
|
||||||
|
robotState = findViewById(R.id.robot_state);
|
||||||
automaticGreetingNumber = findViewById(R.id.automatic_greeting_number);
|
automaticGreetingNumber = findViewById(R.id.automatic_greeting_number);
|
||||||
automaticMessageNumber = findViewById(R.id.automatic_message_number);
|
automaticMessageNumber = findViewById(R.id.automatic_message_number);
|
||||||
findViewById(R.id.automatic_message_sending).setOnClickListener(this);
|
findViewById(R.id.automatic_message_sending).setOnClickListener(this);
|
||||||
robotNameText.setOnClickListener(this);
|
robotNameText.setOnClickListener(this);
|
||||||
|
robotState.setOnClickListener(this);
|
||||||
|
|
||||||
robotNameSetting.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
robotNameSetting.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||||
@ -145,6 +152,33 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View
|
|||||||
//键盘输入法管理器
|
//键盘输入法管理器
|
||||||
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.showSoftInput(robotNameSetting, 0);
|
imm.showSoftInput(robotNameSetting, 0);
|
||||||
|
} else if (viewID == R.id.robot_state) {
|
||||||
|
int state = 0;
|
||||||
|
if (robotStateInt == 1) {
|
||||||
|
state = 0;
|
||||||
|
} else {
|
||||||
|
state = 1;
|
||||||
|
}
|
||||||
|
// 修改助手名字
|
||||||
|
int finalState = state;
|
||||||
|
LiveNetManager.get(getContext())
|
||||||
|
.setAiRobotDate("ai_state", String.valueOf(state), new HttpCallback<HttpCallbackModel>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
|
if (finalState == 1) {
|
||||||
|
robotState.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
robotStateInt=1;
|
||||||
|
} else {
|
||||||
|
robotState.setImageResource(R.mipmap.special_icon_off);
|
||||||
|
robotStateInt=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
ToastUtil.show(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,6 +191,10 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View
|
|||||||
automaticGreetingNumber.setText(String.valueOf(data.getAutoSeyHiNumber()));
|
automaticGreetingNumber.setText(String.valueOf(data.getAutoSeyHiNumber()));
|
||||||
automaticMessageNumber.setText(String.valueOf(data.getAutoRequestFollowNumber()));
|
automaticMessageNumber.setText(String.valueOf(data.getAutoRequestFollowNumber()));
|
||||||
time = String.valueOf(data.getTime());
|
time = String.valueOf(data.getTime());
|
||||||
|
robotStateInt = data.getStatus();
|
||||||
|
if (data.getStatus() == 1) {
|
||||||
|
robotState.setImageResource(R.mipmap.special_icon_on);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/robot_state"
|
||||||
android:layout_width="46dp"
|
android:layout_width="46dp"
|
||||||
android:layout_height="23dp"
|
android:layout_height="23dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
|
Loading…
Reference in New Issue
Block a user