This commit is contained in:
2021-03-09 17:40:00 +08:00
parent 1fe96ef22a
commit 092181c088
10 changed files with 323 additions and 123 deletions

View File

@@ -28,15 +28,17 @@ public class DialogHelptwo {
this.money_sum=money_sum;
this.bond=bond;
final Dialog dialog = new Dialog(mcontext, R.style.DialogStyle);
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
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("温馨提示");
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
// 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);
TextView tvSexSend = (TextView) view.findViewById(R.id.btn_oreder_back);
// tv_title.setText("温馨提示");
tvSexSend.setText(s2);
tvSexSend.setOnClickListener(new View.OnClickListener() {
@@ -47,15 +49,15 @@ public class DialogHelptwo {
dialog.dismiss();
}
});
tvSexCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickListener.cancle();
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);

View File

@@ -10,6 +10,7 @@ import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
@@ -20,6 +21,8 @@ import android.widget.RelativeLayout;
import com.cutil.SizeUtils;
import com.cutil.StringUtils;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.sl.house_property.cart.AddressListActivity;
import com.sl.house_property.databinding.FragmentMain4Binding;
import com.sl.house_property.discovery.LikeActivity;
@@ -36,6 +39,8 @@ import com.sl.house_property.user.MyUserMessage;
import com.sl.house_property.user.MyWalletActivity;
import com.squareup.picasso.Picasso;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -210,9 +215,10 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> implements
startActivityForResult(intent, 0);
return;
}
// RedPackagedialog.build(getActivity()).showAwardRedPackagedialog("");
//弹出激活对话框
new DialogHelptwo().showDownloadDialog(getActivity(), "", "","确认", new DialogHelptwo.ClickListener() {
new DialogHelptwo().showDownloadDialog(getActivity(), "", "","好的,去上传人脸照片", new DialogHelptwo.ClickListener() {
@Override
public void confirm() {
takeMyPhoto(1000);
@@ -246,6 +252,7 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> implements
}
});
}
});
mDataBinding.ll1.setOnClickListener(new View.OnClickListener() {
@@ -589,6 +596,7 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> implements
intent.putExtra("crop", true);
intent.putExtra("cropx", 100);
intent.putExtra("cropy", 100);
intent.putExtra("entertype", 100);
startActivityForResult(intent, userImgeREQUST);
getActivity().overridePendingTransition(R.anim.slide_from_bottom,
R.anim.slide_out_bottom);
@@ -630,7 +638,8 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> implements
file = BitmapTools.saveFile(image, Environment.getExternalStorageDirectory().getPath() + "/haotian", itmepath+requestCode + otherphoto);
// Picasso.with(getActivity()).load(file).into(mDataBinding.myphoto);
uploaduPuserImage(file);
uploaduPuserImageone(file);
// uploaduPuserImage(file);
} catch (IOException e) {
e.printStackTrace();
}
@@ -655,7 +664,7 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> implements
}
};
private void uploaduPuserImage(File file) {
private void uploaduPuserImage(String file) {
progressDialog.setMessage(getString(R.string.requsting));
progressDialog.setCancelable(false);
progressDialog.show();
@@ -669,17 +678,17 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> implements
} else {
map.put("userid", 0 + "");
}
map.put("app", "Cas");
map.put("class", "UploadAvatar");
map.put("sign", Md5.md5("Cas" + "UploadAvatar" + Md5.secret));
map.put("app", "Door");
map.put("class", "AddFaceInfo");
map.put("sign", Md5.md5("Door" + "AddFaceInfo" + Md5.secret));
map.put("avatar", file);
map.put("faceinfo", file);
Map<String, RequestBody> params = retrofitHttpUpLoad.addParameter(map).bulider();
retrofitHttpUpLoad.setHandler(handler);
retrofitHttpUpLoad.addToEnqueue(retrofitHttpUpLoad.mHttpService.upLoadAgree(ApiConfig.BASE_URL, params),
this, HttpStaticApi.HTTP_UPLOADIMAGE);
this, HttpStaticApi.HTTP_UPLOADIMAGF);
}
@@ -691,11 +700,32 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> implements
Resultcode resultcode = (Resultcode)response.body();
if (0==(resultcode.status)) {
baseActivity.setToast("修改成功");
// baseActivity.setToast("修改成功");
Object body= (Object)resultcode.data;
Gson gson = new Gson();
String bodyy = gson.toJson(body);
try {
JSONObject jsonObject = new JSONObject(bodyy);
String success = jsonObject.optString("filepath");
Log.e("获得的图片链接",success);
uploaduPuserImage(success);
} catch (Exception e) {
}
// updatePortrait = true;
RegisterUser user=Config.getInstance(getActivity()).getUser();
user.setAvatar((String)resultcode.data);
Config.getInstance(getActivity()).putUser(user);
// RegisterUser user=Config.getInstance(getActivity()).getUser();
// user.setAvatar((String)resultcode.data);
// Config.getInstance(getActivity()).putUser(user);
} else {
baseActivity.setToast(resultcode.msg);
}
break;
case HttpStaticApi.HTTP_UPLOADIMAGF:
resultcode = (Resultcode)response.body();
if (0==(resultcode.status)) {
baseActivity.setToast("上传成功");
} else {
baseActivity.setToast(resultcode.msg);
}
@@ -711,6 +741,33 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> implements
baseActivity.setToast(getString(R.string.getdatafailure));
}
private void uploaduPuserImageone(File file) {
progressDialog.setMessage(getString(R.string.requsting));
progressDialog.setCancelable(false);
progressDialog.show();
RetrofitHttpUpLoad retrofitHttpUpLoad = RetrofitHttpUpLoad.getInstance();
retrofitHttpUpLoad.clear();
Map<String, Object> map = new HashMap<>();
RegisterUser user =
Config.getInstance(getActivity()).getUser();
if (user != null) {
map.put("userid", user.getUserid());
} else {
map.put("userid", 0 + "");
}
map.put("app", "Cas");
map.put("class", "UploadFacePic");
map.put("sign", Md5.md5("Cas" + "UploadFacePic" + Md5.secret));
map.put("avatar", file);
Map<String, RequestBody> params = retrofitHttpUpLoad.addParameter(map).bulider();
retrofitHttpUpLoad.setHandler(handler);
retrofitHttpUpLoad.addToEnqueue(retrofitHttpUpLoad.mHttpService.upLoadAgree(ApiConfig.BASE_URL, params),
this, HttpStaticApi.HTTP_UPLOADIMAGE);
}
}

View File

@@ -0,0 +1,69 @@
package com.sl.house_property;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import utils.SelectPicDanimicActivity;
/**
* Created by 蔡雅楠 on 2018/4/24.
*/
public class MarkingFinishAwardDialong extends Dialog implements View.OnClickListener{
private ImageView mIvClose;
private TextView mTvMoney;
private String awardMoney;
private Button btn_oreder_back;
public MarkingFinishAwardDialong(@NonNull Context context, int themeResId, String moneyStr) {
super(context, themeResId);
this.awardMoney = moneyStr;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.marking_award_activity);
mIvClose = (ImageView) findViewById(R.id.close);
btn_oreder_back = (Button) findViewById(R.id.btn_oreder_back);
// mTvMoney = findViewById(R.id.tv_award_money);
mIvClose.setOnClickListener(this);
btn_oreder_back.setOnClickListener(this);
// mTvMoney.setText(awardMoney);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.close:
MarkingFinishAwardDialong.this.dismiss();
break;
case R.id.btn_oreder_back:
// takeMyPhoto(1000);
break;
default:
break;
}
}
// private void takeMyPhoto(int userImgeREQUST) {
// //拍照
// Intent intent = new Intent(getActivity(),
// SelectPicDanimicActivity.class);
// intent.putExtra("photoid", userImgeREQUST);
// intent.putExtra("crop", true);
// intent.putExtra("cropx", 100);
// intent.putExtra("cropy", 100);
// intent.putExtra("entertype", 100);
// startActivityForResult(intent, userImgeREQUST);
// getActivity().overridePendingTransition(R.anim.slide_from_bottom,
// R.anim.slide_out_bottom);
// }
}

View File

@@ -0,0 +1,53 @@
package com.sl.house_property;
import android.app.Activity;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.Window;
public class RedPackagedialog {
Activity context;
private MarkingFinishAwardDialong myDialog;
public RedPackagedialog(Activity contextt) {
this.context = contextt;
}
public static RedPackagedialog build(Activity contextt) {
return new RedPackagedialog(contextt);
}
public void showAwardRedPackagedialog(String moneyStr) {
//若想让弹出的dialog之外的背景为半透明第二个参数传0 或者自定义样式
myDialog = new MarkingFinishAwardDialong(context, 0, moneyStr);
myDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);//代码中取消标题栏
myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
myDialog.show();
myDialog.setCancelable(true);
myDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
}
});
}
public void showAwardRedPackagedialogtwo(String moneyStr) {
//若想让弹出的dialog之外的背景为半透明第二个参数传0 或者自定义样式
myDialog = new MarkingFinishAwardDialong(context, 0, moneyStr);
myDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);//代码中取消标题栏
myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
myDialog.show();
myDialog.setCancelable(false);
myDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
}
});
}
}

View File

@@ -6,4 +6,5 @@ package http.FileUpLoad.retrofit;
public class HttpStaticApi {
public static final int HTTP_UPLOADIMAGE = 21007;//上传图片
public static final int HTTP_UPLOADIMAGF = 21008;//上传图片
}

View File

@@ -45,6 +45,7 @@ public class SelectPicDanimicActivity extends Activity implements OnClickListene
private int photeid;
private boolean crop;//裁剪
private int cropx, cropy;//裁剪的高和宽
private int entertype=1;//
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -101,22 +102,23 @@ public class SelectPicDanimicActivity extends Activity implements OnClickListene
crop = getIntent().getBooleanExtra("crop", false);
cropx = getIntent().getIntExtra("cropx", 1);
cropy = getIntent().getIntExtra("cropy", 2);
entertype = getIntent().getIntExtra("entertype", 1);
fileolod = Environment.getExternalStorageDirectory().getPath() + string + filelodother;
break;
}
try {
if(entertype==100){
try {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri
.fromFile(new File(fileolod)));
startActivityForResult(intent, 1);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri
.fromFile(new File(fileolod)));
startActivityForResult(intent, 1);
//拍照我们用Action为MediaStore.ACTION_IMAGE_CAPTURE
//有些人使用其他的Action但我发现在有些机子中会出问题所以优先选择这个
//拍照我们用Action为MediaStore.ACTION_IMAGE_CAPTURE
//有些人使用其他的Action但我发现在有些机子中会出问题所以优先选择这个
/* Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
@@ -124,10 +126,10 @@ public class SelectPicDanimicActivity extends Activity implements OnClickListene
Environment.getExternalStorageDirectory(), "temp.jpg")));
System.out.println("=============" + Environment.getExternalStorageDirectory());*/
} catch (Exception e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners
android:radius="30dp"/>
<!-- <gradient
android:angle="45"
android:endColor="#72cb60"
android:startColor="#72cb60" />-->
<solid android:color="@color/radiobuttoncol" />
<stroke
android:width="1sp"
android:color="@color/radiobuttoncol" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -2,90 +2,47 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:paddingLeft="40px"
android:paddingRight="40px"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="286dp"
android:layout_height="408dp"
android:layout_gravity="center"
android:background="@drawable/dialogwhite"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginRight="35dp"
android:background="@mipmap/icon_renlian">
<LinearLayout
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="70dp"
android:visibility="invisible"
android:layout_marginTop="70dp"
android:background="@drawable/close" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginTop="50dp"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn_oreder_back"
android:layout_width="match_parent"
android:layout_height="359dp"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginRight="35dp"
android:layout_centerHorizontal="true"
android:gravity="center"
android:background="@drawable/bg_btn_yellow"
android:textColor="@color/white"
android:text="好的,去上传人脸照片" />
/>
</RelativeLayout>
<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="200dp"
android:layout_height="260dp"
android:background="@mipmap/icon_renlian"
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>
</LinearLayout>

View File

@@ -0,0 +1,44 @@
<?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"
android:paddingLeft="40px"
android:paddingRight="40px"
android:gravity="center_vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_renlian">
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="70dp"
android:visibility="invisible"
android:layout_marginTop="70dp"
android:background="@drawable/close" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginTop="50dp"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn_oreder_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center"
android:background="@drawable/bg_btn_yellow"
android:textColor="@color/white"
android:text="好的,去上传人脸照片" />
/>
</RelativeLayout>
</LinearLayout>