d
This commit is contained in:
75
app/src/main/java/com/sl/house_property/DialogHelptwo.java
Normal file
75
app/src/main/java/com/sl/house_property/DialogHelptwo.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.sl.house_property;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Time: 2020/5/12
|
||||
* Author: jianbo
|
||||
* Description: 封装的自定义对话框
|
||||
*/
|
||||
public class DialogHelptwo {
|
||||
|
||||
Context mcontext;
|
||||
ClickListener clickListener;
|
||||
String money_sum;
|
||||
String bond;
|
||||
|
||||
public void showDownloadDialog(Context mcontext,final String bond,final String money_sum, final String s2, final ClickListener clickListener) {
|
||||
this.clickListener=clickListener;
|
||||
this.mcontext=mcontext;
|
||||
this.money_sum=money_sum;
|
||||
this.bond=bond;
|
||||
final Dialog dialog = new Dialog(mcontext, R.style.DialogStyle);
|
||||
dialog.setCancelable(false);
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
View view = LayoutInflater.from(mcontext).inflate(R.layout.item_leibiandialog, null);
|
||||
dialog.setContentView(view);
|
||||
TextView tv_title = (TextView) view.findViewById(R.id.tv_title);
|
||||
TextView tvSexCancel = (TextView) view.findViewById(R.id.tvSexCancel);
|
||||
TextView tvPhone = (TextView) view.findViewById(R.id.tvPhone);
|
||||
TextView tvSexSend = (TextView) view.findViewById(R.id.tvSexSend);
|
||||
tv_title.setText("温馨提示");
|
||||
tvSexSend.setText(s2);
|
||||
|
||||
tvSexSend.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
clickListener.confirm();
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
tvSexCancel.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
clickListener.cancle();
|
||||
dialog.dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
Window mWindow = dialog.getWindow();
|
||||
WindowManager.LayoutParams lp = mWindow.getAttributes();
|
||||
lp.width = MyDialog.getScreenWidth(mcontext);
|
||||
mWindow.setGravity(Gravity.CENTER);
|
||||
// mWindow.setWindowAnimations(R.style.dialogAnim);
|
||||
mWindow.setAttributes(lp);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public interface ClickListener{
|
||||
|
||||
void confirm();
|
||||
void cancle();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -175,6 +175,26 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
|
||||
}
|
||||
});
|
||||
mDataBinding.llRenxiang.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//弹出激活对话框
|
||||
new DialogHelptwo().showDownloadDialog(getActivity(), "", "","确认", new DialogHelptwo.ClickListener() {
|
||||
@Override
|
||||
public void confirm() {
|
||||
Intent intent = new Intent(getActivity(), MyPropertyActivity.class);
|
||||
intent.putExtra("usertitile", "我的房产");
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancle() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// mDataBinding.llGeren.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
|
||||
16
app/src/main/java/com/sl/house_property/MyDialog.java
Normal file
16
app/src/main/java/com/sl/house_property/MyDialog.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.sl.house_property;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
|
||||
public class MyDialog {
|
||||
|
||||
|
||||
public static int getScreenWidth(Context context){
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
return dm.widthPixels;
|
||||
}
|
||||
}
|
||||
6
app/src/main/res/anim/dialog_dismiss.xml
Normal file
6
app/src/main/res/anim/dialog_dismiss.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:toYDelta="100%p"
|
||||
android:duration="500" />
|
||||
</set>
|
||||
6
app/src/main/res/anim/dialog_show.xml
Normal file
6
app/src/main/res/anim/dialog_show.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromYDelta="100%p"
|
||||
android:duration="500" />
|
||||
</set>
|
||||
8
app/src/main/res/drawable/dialogwhite.xml
Normal file
8
app/src/main/res/drawable/dialogwhite.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="15dp"/>
|
||||
|
||||
<solid android:color="@color/white"/>
|
||||
</shape>
|
||||
@@ -262,10 +262,29 @@
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/divider_line_color" />
|
||||
|
||||
<View
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_renxiang"
|
||||
android:layout_width="0dp"
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="上传人脸头像" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/icon_default_head" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
91
app/src/main/res/layout/item_leibiandialog.xml
Normal file
91
app/src/main/res/layout/item_leibiandialog.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="276dp"
|
||||
android:layout_height="208dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/dialogwhite"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="159dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20dp"
|
||||
|
||||
android:text="温馨提示"
|
||||
android:textColor="#ff000000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@mipmap/icon_default_head"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="10dp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tvPhone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:autoLink = "web"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="请按照以上样式进行上传"
|
||||
android:textColor="#ff000000"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/light" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSexCancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="取消"
|
||||
android:textColor="#000000"
|
||||
android:textSize="16sp" />
|
||||
<View
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/light" />
|
||||
<TextView
|
||||
android:id="@+id/tvSexSend"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="调职"
|
||||
android:textColor="#ff333333"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
BIN
app/src/main/res/mipmap-xxhdpi/icon_default_head.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/icon_default_head.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
@@ -19,6 +19,7 @@
|
||||
<color name="red">#ed2c2c</color>
|
||||
<color name="main4">#5F3424</color>
|
||||
<color name="gap_line">#e2e2e2</color>
|
||||
<color name="light">#CCCCCC</color>
|
||||
<color name="f7">#f7f7f7</color>
|
||||
<color name="text1">#59B29C</color>
|
||||
<color name="text2">#333333</color>
|
||||
|
||||
@@ -119,4 +119,16 @@
|
||||
|
||||
<style name="PictureTheme.Main" parent="PictureTheme" />
|
||||
|
||||
<style name="DialogStyle" parent="@android:style/Theme.Dialog">
|
||||
<item name="android:windowFrame">@null</item><!-- 边框-->
|
||||
<item name="android:windowIsFloating">true</item><!--是否浮现在activity之上-->
|
||||
<item name="android:windowIsTranslucent">false</item><!--半透明-->
|
||||
<item name="android:windowNoTitle">true</item><!--无标题-->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowEnterAnimation">@anim/dialog_show</item>
|
||||
<item name="android:windowExitAnimation">@anim/dialog_dismiss</item>
|
||||
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user