新增auth弹出框的类型

This commit is contained in:
jiangke 2025-10-16 20:24:40 +08:00
parent 0101057644
commit 696d083c68
15 changed files with 85 additions and 21 deletions

View File

@ -33,6 +33,14 @@ public class BaseConstants {
* 自定义字符串 权限请求
*/
public final static String REQUEST_PER = "request_per";
/**
* 自定义字符串 退出APP
*/
public final static String EXIT_APP = "exit_app";
/**
* 自定义字符串 自定义类型
*/
public final static String CUSTOM_TYPE = "custom_type";
/**
* 自定义字符串 跳转动画
*/

View File

@ -1,5 +1,12 @@
package com.tfq.library.view;
import static com.tfq.library.app.BaseConstants.AUTHORIZATIO;
import static com.tfq.library.app.BaseConstants.CUSTOM_TYPE;
import static com.tfq.library.app.BaseConstants.EXIT_APP;
import static com.tfq.library.app.BaseConstants.PLAYURL;
import static com.tfq.library.app.BaseConstants.PRIVACY;
import static com.tfq.library.app.BaseConstants.REQUEST_PER;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
@ -16,11 +23,6 @@ import android.widget.TextView;
import com.tfq.library.R;
import com.tfq.library.app.BaseConstants;
import static com.tfq.library.app.BaseConstants.AUTHORIZATIO;
import static com.tfq.library.app.BaseConstants.PLAYURL;
import static com.tfq.library.app.BaseConstants.PRIVACY;
import static com.tfq.library.app.BaseConstants.REQUEST_PER;
public class AuthDialog extends Dialog {
private final Context mContext;
@ -28,6 +30,8 @@ public class AuthDialog extends Dialog {
private Listener listener;
private View contentView;
private String type;
private String title;
private String content;
public AuthDialog(Context context, Listener listener) {
super(context, R.style.Dialog);
@ -51,6 +55,16 @@ public class AuthDialog extends Dialog {
inflater = LayoutInflater.from(context);
}
public AuthDialog(Context context, String type, String title, String content, Listener listener) {
super(context, R.style.Dialog);
this.listener = listener;
this.mContext = context;
this.type = type;
this.title = title;
this.content = content;
inflater = LayoutInflater.from(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -139,7 +153,7 @@ public class AuthDialog extends Dialog {
});
this.setCanceledOnTouchOutside(false);
this.setCancelable(false);
}else if (REQUEST_PER.equals(type)) {
} else if (REQUEST_PER.equals(type)) {
tv_title.setText("权限申请");
tv_content.setText("当前操作需要您授权相应权限,否则可能无法正常使用此功能");
tv_content.setGravity(Gravity.CENTER);
@ -160,6 +174,48 @@ public class AuthDialog extends Dialog {
});
this.setCanceledOnTouchOutside(false);
this.setCancelable(false);
} else if (EXIT_APP.equals(type)) {
tv_title.setText("退出应用");
tv_content.setText("退出应用请点击确定按钮");
tv_content.setGravity(Gravity.CENTER);
tv_right.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
if (listener != null) {
listener.callBack();
}
}
});
tv_left.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
this.setCanceledOnTouchOutside(false);
this.setCancelable(false);
} else if (CUSTOM_TYPE.equals(type)) {
tv_title.setText(title);
tv_content.setText(content);
tv_content.setGravity(Gravity.CENTER);
tv_right.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
if (listener != null) {
listener.callBack();
}
}
});
tv_left.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
this.setCanceledOnTouchOutside(false);
this.setCancelable(false);
} else {
tv_right.setOnClickListener(new View.OnClickListener() {
@Override

View File

@ -21,7 +21,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="Title"
android:text=""
android:textColor="#FF333333"
android:textSize="17dp"
android:textStyle="bold"
@ -36,7 +36,7 @@
android:layout_marginTop="10dp"
android:layout_marginRight="5dp"
android:gravity="center"
android:text="content"
android:text=""
android:textColor="#FF333333"
android:textSize="13dp"
/>

View File

@ -18,7 +18,7 @@
android:layout_marginTop="15dp"
android:layout_marginRight="15dp"
android:gravity="center"
android:text="Title"
android:text=""
android:textColor="#FF333333"
android:textSize="16sp"
android:textStyle="bold" />
@ -34,7 +34,7 @@
android:gravity="center"
android:paddingLeft="22dp"
android:paddingRight="22dp"
android:text="content"
android:text=""
android:textColor="#FF333333"
android:textSize="14sp" />

View File

@ -20,7 +20,7 @@
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Title"
android:text=""
android:textColor="@color/black"
android:textSize="17dp"
android:textStyle="bold"
@ -32,7 +32,7 @@
android:layout_height="wrap_content"
android:layout_below="@+id/tv_title"
android:layout_marginTop="10dp"
android:text="content"
android:text=""
android:textColor="#212121"
android:textSize="15dp"
/>

View File

@ -1 +1 @@
8c477eba97731fbe79d9663af2518298
82978083b7a9dc63ac2ea5b363657fd3

View File

@ -1 +1 @@
2d3d867ae453082e62eb6333d4885107f4978073
49647a06684fb194d73066e0bd527c16a12c14cc

View File

@ -1 +1 @@
6f479ffac05a3ee0506ed0ea8c873a18f0799cb6dcf1801c99a1b17386c374ba
ea391aa2070a476446c208b0084ff125015cd35e05d8b56ba9dc6398a380bd94

View File

@ -1 +1 @@
5674456dce464dca57189ce4ef8246cda2118c92b45c153757ba9af1551d42f9a940846ab3e196c87241f975b142c6144f6a318f6296191a175b68a010bea180
922a98afbe4c7a07b6946e9e2280fdba34bacf9ae618e0f015075ba2ae44a4bc33bfd9ebeb14ceb2dc4e709c8b6b38494300d968f882a152522e7c9790f6647e

View File

@ -8,6 +8,6 @@
<versions>
<version>1.0.0</version>
</versions>
<lastUpdated>20250907141830</lastUpdated>
<lastUpdated>20251016122404</lastUpdated>
</versioning>
</metadata>

View File

@ -1 +1 @@
34eea020b0626cb20b3414517b9159c9
cec8739567a7395a79db341dfc6361dd

View File

@ -1 +1 @@
ae52d0f623ab1ce238b22fe5491d87a0a4d92452
884642a62b0472ff417731ebc84c1f82a6245f55

View File

@ -1 +1 @@
d1c1df19b84dc27a5e39fe79b3d43ab1b6e0facc67788e6dd6d3321c8109d67f
8b43d5687a367bb5de4e20bd911ed6c2ce6ed2fc62b88a3daaa8a919550d18ff

View File

@ -1 +1 @@
61936a4c82eb8c4ce51f8975c5d3c28f7460fa278c2f947e46aea63f6f66894866d8200a1bef03217d29a0832427a99e160655d0c4e58e79b572164bd7cf4eb2
999a7d65001f86c0cd16a2b01ec2720de7db2af25c7b79fe31f4a8b3946f281118e7d67be579a89556da6ecfc2a60ca48b9a47804a969da6933c246485d1d271