This commit is contained in:
2021-05-08 17:59:22 +08:00
parent 49e6423ca2
commit 83f57675e3
8 changed files with 140 additions and 37 deletions

View File

@@ -156,6 +156,8 @@ android {
implementation 'com.lzy.net:okgo:3.0.4'
implementation 'cn.jiguang.sdk:jpush:3.6.6'
implementation 'cn.jiguang.sdk:jcore:2.3.8'
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar'
api 'io.reactivex.rxjava2:rxjava:2.1.5'
}
}

View File

@@ -104,16 +104,16 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding> implements
setToast(getString(R.string.me_input_password_tip));
return;
}
if (!mDataBinding.agreewhitemeg.isChecked()) {
setToast("请先同意注册协议");
return;
}
if (!mDataBinding.agreewhitemegy.isChecked()) {
setToast("请先同意隐私政策");
return;
}
// if (!mDataBinding.agreewhitemeg.isChecked()) {
// setToast("请先同意注册协议");
//
// return;
// }
// if (!mDataBinding.agreewhitemegy.isChecked()) {
// setToast("请先同意隐私政策");
//
// return;
// }
Map<String, String> map = new HashMap<>();
map.put("phone", phone);
map.put("password", password);

View File

@@ -24,10 +24,13 @@ import android.widget.TextView;
import android.widget.Toast;
import com.sl.house_property.R;
import com.tbruyelle.rxpermissions2.RxPermissions;
import java.io.File;
import java.io.IOException;
import io.reactivex.disposables.Disposable;
public class SelectPicDanimicActivity extends Activity implements OnClickListener {
private TextView btn_take_photo, btn_pick_photo, btn_cancel;
@@ -53,17 +56,18 @@ public class SelectPicDanimicActivity extends Activity implements OnClickListene
setContentView(R.layout.activity_select_pic_danimic);
final String permission = Manifest.permission.CAMERA; //相机权限
final String permission1 = Manifest.permission.WRITE_EXTERNAL_STORAGE; //写入数据权限
if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(this, permission1) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 2);
}
}
// final String permission = Manifest.permission.CAMERA; //相机权限
// final String permission1 = Manifest.permission.WRITE_EXTERNAL_STORAGE; //写入数据权限
// if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED
// || ContextCompat.checkSelfPermission(this, permission1) != PackageManager.PERMISSION_GRANTED) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// requestPermissions(new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
// }
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 2);
// }
// }
getPermissions();
intent = getIntent();
btn_take_photo = (Button) this.findViewById(R.id.btn_take_photo);
btn_pick_photo = (Button) this.findViewById(R.id.btn_pick_photo);
@@ -106,19 +110,60 @@ public class SelectPicDanimicActivity extends Activity implements OnClickListene
fileolod = Environment.getExternalStorageDirectory().getPath() + string + filelodother;
break;
}
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);
//拍照我们用Action为MediaStore.ACTION_IMAGE_CAPTURE
//有些人使用其他的Action但我发现在有些机子中会出问题所以优先选择这个
// if(entertype==100){
// try {
//
//
// Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// intent.putExtra("android.intent.extras.CAMERA_FACING", 1); // 调用前置摄像头
// 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但我发现在有些机子中会出问题所以优先选择这个
//
//
// /* Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(
// Environment.getExternalStorageDirectory(), "temp.jpg")));
// System.out.println("=============" + Environment.getExternalStorageDirectory());*/
//
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
final String permission = Manifest.permission.CAMERA; //相机权限
final String permission1 = Manifest.permission.WRITE_EXTERNAL_STORAGE; //写入数据权限
if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(this, permission1) != PackageManager.PERMISSION_GRANTED) { //先判断是否被赋予权限,没有则申请权限
if (ActivityCompat.shouldShowRequestPermissionRationale(this, permission)) { //给出权限申请说明
Toast.makeText(SelectPicDanimicActivity.this, "No pemission", Toast.LENGTH_SHORT).show();
}else {
}
}else {
if(entertype==100){
try {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra("android.intent.extras.CAMERA_FACING", 1); // 调用前置摄像头
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但我发现在有些机子中会出问题所以优先选择这个
/* Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
@@ -126,12 +171,68 @@ 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();
}
}
}
}
private void getPermissions() {
RxPermissions rxPermissions = new RxPermissions(this);
rxPermissions.request(Manifest.permission.CAMERA,Manifest.permission.WRITE_EXTERNAL_STORAGE)
.subscribe(new io.reactivex.Observer<Boolean>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Boolean aBoolean) {
if (aBoolean) {
if(entertype==100){
try {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra("android.intent.extras.CAMERA_FACING", 1); // 调用前置摄像头
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但我发现在有些机子中会出问题所以优先选择这个
/* Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(
Environment.getExternalStorageDirectory(), "temp.jpg")));
System.out.println("=============" + Environment.getExternalStorageDirectory());*/
} catch (Exception e) {
e.printStackTrace();
}
}
} else {
Toast.makeText(SelectPicDanimicActivity.this, "获取权限失败,请重新授权", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
@Override
public boolean onTouchEvent(MotionEvent event) {

View File

@@ -97,7 +97,7 @@
android:layout_marginLeft="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/fangchan"
android:src="@mipmap/icon_dianzan"
/>
<TextView
@@ -179,7 +179,7 @@
android:layout_marginLeft="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/fangchan"
android:src="@mipmap/icon_renzheng"
/>
<TextView
@@ -221,7 +221,7 @@
android:layout_marginLeft="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/fangchan"
android:src="@mipmap/icon_shezhi"
/>
<TextView
@@ -262,7 +262,7 @@
android:layout_marginLeft="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/fangchan"
android:src="@mipmap/icon_privacy"
/>
<TextView
@@ -303,7 +303,7 @@
android:layout_marginLeft="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/fangchan"
android:src="@mipmap/icon_privacy"
/>
<TextView

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB