update 机器人
This commit is contained in:
@@ -2,23 +2,29 @@ package com.yunbao.live.dialog;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 机器人设置
|
||||
*/
|
||||
public class LiveRobotSettingDialogFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||
|
||||
|
||||
private static String TAG = "AI机器人";
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -43,10 +49,64 @@ public class LiveRobotSettingDialogFragment extends AbsDialogFragment implements
|
||||
params.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
initDate();
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
LiveNetManager.get(mContext)
|
||||
.getAiRobotStatus(new HttpCallback<LiveAiRobotBean>() {
|
||||
@Override
|
||||
public void onSuccess(LiveAiRobotBean data) {
|
||||
Log.i(TAG, "onSuccess: " + data.toString());
|
||||
initListType1();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initListType1() {
|
||||
LiveNetManager.get(mContext)
|
||||
.getAiRobotBody(LiveAiRobotBean.Message.TYPE_SAY_HI, new HttpCallback<List<LiveAiRobotBean.Message>>() {
|
||||
@Override
|
||||
public void onSuccess(List<LiveAiRobotBean.Message> data) {
|
||||
Log.i(TAG, "onSuccess: " + data.size());
|
||||
for (LiveAiRobotBean.Message message : data) {
|
||||
Log.i(TAG, "onSuccess: message=" + message.toString());
|
||||
}
|
||||
initListType2();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initListType2() {
|
||||
LiveNetManager.get(mContext)
|
||||
.getAiRobotBody(LiveAiRobotBean.Message.TYPE_FOLLOW, new HttpCallback<List<LiveAiRobotBean.Message>>() {
|
||||
@Override
|
||||
public void onSuccess(List<LiveAiRobotBean.Message> data) {
|
||||
Log.i(TAG, "onSuccess: " + data.size());
|
||||
for (LiveAiRobotBean.Message message : data) {
|
||||
Log.i(TAG, "onSuccess: message=" + message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/border_translucent">
|
||||
android:layout_height="400dp"
|
||||
android:background="#000">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="自動發言機器人設置"
|
||||
android:textColor="#CCCCCC"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/robot_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="18dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView6">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="機器人開關"
|
||||
android:textColor="#FFF" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:srcCompat="@mipmap/special_icon_off" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/robot_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="18dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/robot_status">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="機器人開關"
|
||||
android:textColor="#FFF" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:background="@drawable/bg_prank_coin"
|
||||
android:textColor="#FFF"
|
||||
android:gravity="center"
|
||||
android:text="TextView" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user