读取app 准备
parent
0f83bf9a17
commit
38edb74d4c
@ -0,0 +1,35 @@
|
||||
package com.example.jinyu_rfid.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.example.jinyu_rfid.R;
|
||||
import com.example.jinyu_rfid.databinding.DialogLayoutBinding;
|
||||
|
||||
/**
|
||||
* @author wanghao
|
||||
* @date 2024/6/3 9:17
|
||||
*/
|
||||
public class TipDialog extends Dialog {
|
||||
|
||||
private DialogLayoutBinding binding;
|
||||
|
||||
public TipDialog(@NonNull Context context) {
|
||||
super(context, R.style.dialog);
|
||||
binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.dialog_layout, null, false);
|
||||
setContentView(binding.getRoot());
|
||||
binding.dialogButton.setOnClickListener(v -> dismiss());
|
||||
}
|
||||
|
||||
public void shouDialog(boolean state,String text){
|
||||
binding.setState(state);
|
||||
binding.setTipText(text);
|
||||
show();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white"/>
|
||||
<corners android:radius="10dp"/>
|
||||
<stroke android:color="#e1e1e1" android:width="1dp"/>
|
||||
</shape>
|
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="state"
|
||||
type="Boolean" />
|
||||
|
||||
<variable
|
||||
name="tipText"
|
||||
type="String" />
|
||||
<import type="android.view.View"/>
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/dialog_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:visibility="@{state?View.VISIBLE:View.GONE}"
|
||||
android:src="@mipmap/icon_true" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:visibility="@{state?View.GONE:View.VISIBLE}"
|
||||
android:src="@mipmap/icon_false" />
|
||||
|
||||
<TextView
|
||||
style="@style/text_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="66dp"
|
||||
android:text="@{tipText}" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#e1e1e1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_button"
|
||||
style="@style/text_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:text="@string/dialog_button_text"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</layout>
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in New Issue