机器人自动发言

This commit is contained in:
18401019693 2022-12-23 14:39:24 +08:00
parent e3a9a037ba
commit 1bde99f6c9
7 changed files with 214 additions and 1 deletions

View File

@ -988,4 +988,9 @@
<string name="automatic_message_sending" translatable="false">自動發消息設置</string>
<string name="robot_go_setting" translatable="false">前往設置</string>
<string name="robot_hint" translatable="false">感謝送禮、PK開始、PK結束的自動機器人消息\n暫不支持自定義。</string>
<string name="robot_add_content" translatable="false">添加內容</string>
<string name="robot_add_content_hint1" translatable="false">每隔一段時間,機器人自動隨機以下一句話發出。</string>
<string name="robot_add_content_hint2" translatable="false">填寫內容推薦,如:求送心願單、加粉絲團等</string>
<string name="robot_automatic_speech_interval" translatable="false">自動發言間隔時間(分鐘)</string>
<string name="robot_minimum_interval" translatable="false">最少間隔5分鐘1次</string>
</resources>

View File

@ -0,0 +1,37 @@
package com.yunbao.live.dialog;
import android.app.ActionBar;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.live.R;
public class LiveRobotMessageDialogFragment extends AbsDialogFragment {
@Override
protected int getLayoutId() {
return R.layout.dialog_live_robot_message;
}
@Override
protected int getDialogStyle() {
return R.style.dialog2;
}
@Override
protected boolean canCancel() {
return true;
}
@Override
protected void setWindowAttributes(Window window) {
WindowManager.LayoutParams params = window.getAttributes();
params.width = ActionBar.LayoutParams.MATCH_PARENT;
params.height = DpUtil.dp2px(400);
params.gravity = Gravity.BOTTOM;
window.setAttributes(params);
}
}

View File

@ -22,6 +22,7 @@ import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import java.util.List;
@ -69,6 +70,7 @@ public class LiveRobotSettingDialogFragment extends AbsDialogFragment implements
robotNameSetting = (EditText) findViewById(R.id.robot_name_setting);
automaticGreetingNumber = (AppCompatTextView) findViewById(R.id.automatic_greeting_number);
automaticMessageNumber = (AppCompatTextView) findViewById(R.id.automatic_message_number);
findViewById(R.id.automatic_message_sending).setOnClickListener(this);
robotNameSetting.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
@ -142,7 +144,14 @@ public class LiveRobotSettingDialogFragment extends AbsDialogFragment implements
@Override
public void onClick(View v) {
dismiss();
int viewID = v.getId();
if (viewID == R.id.automatic_message_sending) {
Bundle mArguments = new Bundle();
LiveRobotMessageDialogFragment fragment = new LiveRobotMessageDialogFragment();
fragment.setArguments(mArguments);
fragment.show(getChildFragmentManager(), "LiveRobotMessageDialogFragment");
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="11.67dp" />
<solid android:color="#81C16D" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="#000002">
<LinearLayout
android:id="@+id/line1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="5.33dp"
android:layout_marginTop="7.76dp"
android:layout_marginBottom="6.33dp"
android:src="@mipmap/icon_back" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="6.67dp"
android:text="@string/automatic_message_sending"
android:textColor="#CCCCCC"
android:textSize="15sp" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<TextView
android:layout_width="67.67dp"
android:layout_height="23.33dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="11dp"
android:background="@drawable/background_81c16d"
android:gravity="center"
android:text="@string/robot_add_content"
android:textColor="#FFFFFF"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/line2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/line1"
android:layout_marginStart="10.33dp"
android:layout_marginEnd="10.67dp"
android:background="@drawable/bg_prank_coin"
android:orientation="horizontal"
android:paddingTop="8.67dp"
android:paddingBottom="7.67dp">
<ImageView
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="13.67dp"
android:src="@mipmap/icon_tip" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8.33dp"
android:text="@string/robot_add_content_hint1"
android:textColor="#CCCCCC"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8.33dp"
android:layout_marginTop="6dp"
android:text="@string/robot_add_content_hint2"
android:textColor="#CCCCCC"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/robot_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/line2"
android:layout_marginTop="11dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="@string/robot_automatic_speech_interval"
android:textColor="#FFF"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="3.67dp"
android:text="@string/robot_minimum_interval"
android:textColor="#B3B3B3"
android:textSize="10sp" />
</LinearLayout>
<EditText
android:id="@+id/robot_name_setting"
android:layout_width="96dp"
android:layout_height="27dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_prank_coin"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="number"
android:maxLines="1"
android:textColor="#FFF"
android:textSize="12sp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/robot_name" />
</RelativeLayout>

View File

@ -204,6 +204,7 @@
<TextView
android:id="@+id/automatic_message_sending"
android:layout_width="96dp"
android:layout_height="27dp"
android:layout_gravity="center_vertical"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB