feat:完成补填邀请码UI部分
This commit is contained in:
@@ -9,8 +9,11 @@ import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.core.util.Consumer;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.nnbc123.app.ui.setting.invite.InviteInputConfirmDialog;
|
||||
import com.nnbc123.app.ui.setting.invite.InviteInputDialog;
|
||||
import com.nnbc123.core.UriProvider;
|
||||
import com.nnbc123.core.auth.AuthModel;
|
||||
import com.nnbc123.core.auth.event.LogoutEvent;
|
||||
@@ -55,6 +58,8 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
|
||||
|
||||
private ActivitySettingBinding settingBinding;
|
||||
private WithdrawInfo withdrawInfos;
|
||||
private InviteInputDialog inviteInputDialog;
|
||||
private InviteInputConfirmDialog inviteInputConfirmDialog;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -76,6 +81,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
dismissInviteDialog();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -311,5 +317,34 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
|
||||
finish();
|
||||
}
|
||||
|
||||
public void showInviteInputDialog(){
|
||||
inviteInputDialog = new InviteInputDialog(this);
|
||||
inviteInputDialog.setOnNext(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String s) {
|
||||
showInviteInputDialog(s);
|
||||
}
|
||||
});
|
||||
inviteInputDialog.show();
|
||||
}
|
||||
|
||||
public void showInviteInputDialog(String code) {
|
||||
inviteInputConfirmDialog = new InviteInputConfirmDialog(this, code);
|
||||
inviteInputConfirmDialog.setOnNext(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String s) {
|
||||
dismissInviteDialog();
|
||||
}
|
||||
});
|
||||
inviteInputConfirmDialog.show();
|
||||
}
|
||||
|
||||
private void dismissInviteDialog() {
|
||||
if (inviteInputDialog != null && inviteInputDialog.isShowing()) {
|
||||
inviteInputDialog.dismiss();
|
||||
}
|
||||
if (inviteInputConfirmDialog != null && inviteInputConfirmDialog.isShowing()) {
|
||||
inviteInputConfirmDialog.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,57 @@
|
||||
package com.nnbc123.app.ui.setting.invite
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.WindowManager
|
||||
import android.widget.TextView
|
||||
import androidx.core.util.Consumer
|
||||
import com.chuhai.utils.ktx.getColorById
|
||||
import com.chuhai.utils.spannable.SpannableTextBuilder
|
||||
import com.nnbc123.app.R
|
||||
import com.nnbc123.app.databinding.InviteInputConfirmDialogBinding
|
||||
import com.nnbc123.app.ui.widget.dialog.BaseDialog
|
||||
import com.nnbc123.app.utils.SpannableBuilder
|
||||
import java.time.format.TextStyle
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/3/25 20:05
|
||||
* Desc:
|
||||
**/
|
||||
class InviteInputConfirmDialog(context: Context, val code: String) :
|
||||
BaseDialog(context, R.style.dialog) {
|
||||
|
||||
var onNext: Consumer<String>? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setCancelable(false)
|
||||
val binding = InviteInputConfirmDialogBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
window?.attributes?.let {
|
||||
it.width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
it.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
window?.attributes = it
|
||||
}
|
||||
SpannableTextBuilder(binding.tvTitle).appendText(context.getString(R.string.invite_input_confirm_title))
|
||||
.appendText(
|
||||
text = context.getString(R.string.invite_input_confirm_format).format(code),
|
||||
textColor = context.getColorById(R.color.color_2B2D33)
|
||||
)
|
||||
.appendText("?").apply()
|
||||
SpannableTextBuilder(binding.tvTips).appendText(context.getString(R.string.invite_input_tips3))
|
||||
.appendText(
|
||||
text = "1次",
|
||||
textSize = 16,
|
||||
textStyle = Typeface.BOLD,
|
||||
textColor = context.getColorById(R.color.color_theme)
|
||||
).apply()
|
||||
binding.tvCancel.setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
binding.tvSave.setOnClickListener {
|
||||
onNext?.accept(code)
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
package com.nnbc123.app.ui.setting.invite
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.core.util.Consumer
|
||||
import com.chuhai.utils.ktx.setOnInputChangedListener
|
||||
import com.nnbc123.app.R
|
||||
import com.nnbc123.app.databinding.InviteInputDialogBinding
|
||||
import com.nnbc123.app.ui.widget.dialog.BaseDialog
|
||||
|
||||
/**
|
||||
* Created by Max on 2024/3/25 20:05
|
||||
* Desc:
|
||||
**/
|
||||
class InviteInputDialog(context: Context) : BaseDialog(context, R.style.dialog) {
|
||||
|
||||
var onNext: Consumer<String>? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val binding = InviteInputDialogBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
window?.attributes?.let {
|
||||
it.width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
it.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
window?.attributes = it
|
||||
}
|
||||
binding.etCode.setOnInputChangedListener {
|
||||
resetSaveBtn(binding)
|
||||
true
|
||||
}
|
||||
binding.tvSave.setOnClickListener {
|
||||
onNext?.accept(binding.etCode.text.toString().trim())
|
||||
}
|
||||
resetSaveBtn(binding)
|
||||
}
|
||||
|
||||
private fun resetSaveBtn(binding: InviteInputDialogBinding) {
|
||||
if (binding.etCode.length() > 0) {
|
||||
binding.tvSave.isEnabled = true
|
||||
binding.tvSave.setBackgroundResource(R.drawable.shape_theme_26)
|
||||
} else {
|
||||
binding.tvSave.isEnabled = false
|
||||
binding.tvSave.setBackgroundResource(R.drawable.shape_33ffda24_26)
|
||||
}
|
||||
}
|
||||
}
|
7
app/src/main/res/drawable/shape_33ffda24_26.xml
Normal file
7
app/src/main/res/drawable/shape_33ffda24_26.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="26dp"/>
|
||||
<solid android:color="#33FFDA24"/>
|
||||
</shape>
|
6
app/src/main/res/drawable/shape_f3f5fa_8dp.xml
Normal file
6
app/src/main/res/drawable/shape_f3f5fa_8dp.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="8dp"/>
|
||||
<solid android:color="#F3F5FA"/>
|
||||
</shape>
|
7
app/src/main/res/drawable/shape_theme_26.xml
Normal file
7
app/src/main/res/drawable/shape_theme_26.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="26dp"/>
|
||||
<solid android:color="@color/color_theme"/>
|
||||
</shape>
|
72
app/src/main/res/layout/invite_input_confirm_dialog.xml
Normal file
72
app/src/main/res/layout/invite_input_confirm_dialog.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="34dp"
|
||||
android:background="@drawable/shape_white_20dp_round">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:textColor="#2B2D33"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@string/invite_input_confirm_format" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="28dp"
|
||||
android:text="@string/invite_input_tips3"
|
||||
android:textColor="#2B2D33"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cancel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="22dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:background="@drawable/shape_33ffda24_26"
|
||||
android:gravity="center"
|
||||
android:text="@string/cancel"
|
||||
android:textColor="#2B2D33"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_save"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_tips" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_save"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="22dp"
|
||||
android:background="@drawable/shape_theme_26"
|
||||
android:gravity="center"
|
||||
android:text="@string/dialog_privilege_15"
|
||||
android:textColor="#2B2D33"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_cancel"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_tips" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
81
app/src/main/res/layout/invite_input_dialog.xml
Normal file
81
app/src/main/res/layout/invite_input_dialog.xml
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="34dp"
|
||||
android:background="@drawable/shape_white_20dp_round">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="28dp"
|
||||
android:text="@string/invite_input_title"
|
||||
android:textColor="#2B2D33"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginHorizontal="26dp"
|
||||
android:layout_marginTop="26dp"
|
||||
android:background="@drawable/shape_f3f5fa_8dp"
|
||||
android:gravity="center"
|
||||
android:hint="@string/invite_input_hint"
|
||||
android:singleLine="true"
|
||||
android:textColor="#878B9C"
|
||||
android:textColorHint="#878B9C"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tips_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="28dp"
|
||||
android:text="@string/invite_input_tips"
|
||||
android:textColor="#2B2D33"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintStart_toStartOf="@id/et_code"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_code" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/invite_input_tips2"
|
||||
android:textColor="#A2A7B8"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_tips_title"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_tips_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginHorizontal="32dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:background="@drawable/shape_theme_26"
|
||||
android:gravity="center"
|
||||
android:text="@string/dialog_privilege_15"
|
||||
android:textColor="#2B2D33"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_tips" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
@@ -999,4 +999,12 @@
|
||||
<string name="all_service_gift_room_go_ignore">下次不再出现此提示</string>
|
||||
<string name="all_service_gift_room_go_cancel">留在这</string>
|
||||
<string name="all_service_gift_room_go_go">立即前往</string>
|
||||
|
||||
<string name="invite_input_title">填写邀请码</string>
|
||||
<string name="invite_input_hint">请输入要填写的邀请码</string>
|
||||
<string name="invite_input_tips">填写说明:</string>
|
||||
<string name="invite_input_tips2">请填写邀请人的邀请码;\n邀请码只能填写一次,请勿随意填写;</string>
|
||||
<string name="invite_input_confirm_title">确认填写 </string>
|
||||
<string name="invite_input_confirm_format">邀请码【%s】</string>
|
||||
<string name="invite_input_tips3">注意邀请码只能填写 </string>
|
||||
</resources>
|
||||
|
@@ -28,5 +28,5 @@ COMPILE_SDK_VERSION=32
|
||||
MIN_SDK_VERSION=21
|
||||
TARGET_SDK_VERSION=32
|
||||
|
||||
version_name=2.1.1
|
||||
version_code=2101
|
||||
version_name=2.1.3
|
||||
version_code=2103
|
Reference in New Issue
Block a user