修改我的页面布局优化

This commit is contained in:
md 2021-08-06 11:13:15 +08:00
parent 1cae1f0252
commit a8d78281ed
17 changed files with 192 additions and 30 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
ndkVersion '21.0.6113669'
ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"

View File

@ -1,6 +1,8 @@
package com.navinfo.outdoor.activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.text.TextUtils;
import android.util.Log;
@ -59,6 +61,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
private String userphone;
private String usermailbox;
private String region_id;
private SharedPreferences navInfo;
@Override
@ -76,6 +79,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
protected void initView() {
super.initView();
initJsonData();
navInfo = getSharedPreferences("navInfo", Context.MODE_PRIVATE);
ivUser = findViewById(R.id.iv_user);
ivUser.setOnClickListener(this::onClick);
btnAttestation = findViewById(R.id.btn_attestation);
@ -103,6 +107,11 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
finish();
break;
case R.id.btn_gathering:
String attestationName = navInfo.getString("attestationName", null);
if (attestationName == null || attestationName.equals("")) {
Toast.makeText(this, "请先实名认证", Toast.LENGTH_SHORT).show();
return;
}
Intent gatheringIntent = new Intent(this, FragmentManagement.class);
gatheringIntent.putExtra("tag", 24);
startActivity(gatheringIntent);

View File

@ -86,7 +86,6 @@ public class Constant {
public static final int EVENT_STAY_REFRESH = 44; // 刷新记录页面
public static final int EVENT_WORK_HOME = 45; //切换到寻宝
public static String USER_ATTESTATION_NAME; //实名认证姓名 银行卡
public static int NUMBER = 200; //任务个数
public static int LIMIT_TTPE = -1; //权限类型普通任务-0专属任务-1
public static int TASK_TYPE = -1; // 任务类型

View File

@ -9,11 +9,13 @@ import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.FragmentBackHandler;
import com.navinfo.outdoor.util.GPSUtils;
@ -114,4 +116,28 @@ public abstract class BaseDrawerFragment extends BaseFragment {
public View getScrollerView() {
return findViewById(R.id.scroller_view);
}
protected abstract PoiEntity initPoiEntityByUI();
protected abstract PoiCheckResult checkPoiEntity(PoiEntity entity);
public class PoiCheckResult {
private int code; // 0 检查成功
private String msg;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
}

View File

@ -1360,5 +1360,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
super.onDestroy();
}
@Override
protected PoiEntity initPoiEntityByUI() {
return null;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
return null;
}
}

View File

@ -1468,4 +1468,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
}).start();
}
@Override
protected PoiEntity initPoiEntityByUI() {
return null;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
return null;
}
}

View File

@ -468,4 +468,14 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
super.onDestroy();
}
@Override
protected PoiEntity initPoiEntityByUI() {
return null;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
return null;
}
}

View File

@ -1,7 +1,9 @@
package com.navinfo.outdoor.fragment;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
@ -61,6 +63,8 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
private ArrayList<File> gatheringList;
private ArrayList<BankPathBean> jsonBean;
private String value;
private SharedPreferences navInfo;
private SharedPreferences.Editor navInfoEditor;
public static GatheringFragment newInstance(Bundle bundle) {
@ -78,6 +82,8 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
@Override
protected void initView() {
super.initView();
navInfoEditor = getActivity().getSharedPreferences("navInfo", Context.MODE_PRIVATE).edit();
navInfo = getActivity().getSharedPreferences("navInfo", Context.MODE_PRIVATE);
ivGathering = findViewById(R.id.iv_gathering);
ivGathering.setOnClickListener(this::onClick);
imageBank = findViewById(R.id.iv_bank);
@ -87,8 +93,9 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
btnBank = findViewById(R.id.btn_bank);
btnBank.setOnClickListener(this::onClick);
tvName = (TextView) findViewById(R.id.tv_name);
if (Constant.USER_ATTESTATION_NAME != null) {
tvName.setText(Constant.USER_ATTESTATION_NAME);
String attestationName = navInfo.getString("attestationName", null);
if (attestationName!= null&&!attestationName.equals("")) {
tvName.setText(attestationName);
}
etBankNum = (EditText) findViewById(R.id.et_bank_num);
gatheringCamera = (ImageView) findViewById(R.id.gathering_camera);
@ -153,21 +160,20 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
}
private void gatheringNetWork() {
showLoadingDialog();
if (ivGathering.getTag()==null){
Toast.makeText(getContext(), "银行卡照片不能为空", Toast.LENGTH_SHORT).show();
gatheringList = new ArrayList<>();
File gatheringFile = new File(gatheringPath);
if (!gatheringFile.exists()) {
Toast.makeText(getContext(), "身份证照片不能为空", Toast.LENGTH_SHORT).show();
return;
}
gatheringList = new ArrayList<>();
String ivGatheringTag = (String) ivGathering.getTag();
gatheringList.add(new File(ivGatheringTag));
gatheringList.add(gatheringFile);
String etBankAccount = etBankNum.getText().toString().trim();
if (etBankAccount == null || etBankAccount.equals("")) {
Toast.makeText(getContext(), "银行卡号不能为空", Toast.LENGTH_SHORT).show();
return;
}
showLoadingDialog();
OkGo
// 请求方式和请求url
.<BankPhoneBean>post(HttpInterface.USER_BANKCARD_UP_DATA)
@ -182,16 +188,17 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
public void onSuccess(Response<BankPhoneBean> response) {
dismissLoadingDialog();
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
if (response.body().equals("0")) {
MessageDialog.show((AppCompatActivity) getActivity(), "是否绑定银行卡", "取消", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
if (response.code() == 200) {
MessageDialog.show((AppCompatActivity) getActivity(), "绑定成功", "确定", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
navInfoEditor.putString("bankAccount",value);
navInfoEditor.commit();
return false;
}
});
} else {
MessageDialog.show((AppCompatActivity) getActivity(), "是否绑定银行卡", "确定", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
MessageDialog.show((AppCompatActivity) getActivity(), "绑定失败", "取消", "取消", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();

View File

@ -692,4 +692,14 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
}).start();
}
@Override
protected PoiEntity initPoiEntityByUI() {
return null;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
return null;
}
}

View File

@ -1057,5 +1057,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}).start();
}
@Override
protected PoiEntity initPoiEntityByUI() {
return null;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
return null;
}
}

View File

@ -715,4 +715,21 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
}).start();
}
@Override
protected PoiEntity initPoiEntityByUI() {
return showPoiEntity;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
PoiCheckResult poiCheckResult = new PoiCheckResult();
if (entity.getName() == null) {
poiCheckResult.setCode(-1);
poiCheckResult.setMsg("name不能为空");
return poiCheckResult;
}
return poiCheckResult;
}
}

View File

@ -750,4 +750,14 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
}).start();
}
@Override
protected PoiEntity initPoiEntityByUI() {
return null;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
return null;
}
}

View File

@ -1,6 +1,8 @@
package com.navinfo.outdoor.fragment;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
@ -54,6 +56,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
private TextView tvCard2;
private ImageView ivHera3;
private TextView tvCard3;
private SharedPreferences.Editor navInfoEditor;
public static UserAttestationFragment newInstance(Bundle bundle) {
@ -79,6 +82,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
@Override
protected void initView() {
super.initView();
navInfoEditor = getActivity().getSharedPreferences("navInfo", Context.MODE_PRIVATE).edit();
ivAttestation = findViewById(R.id.iv_attestation);
ivAttestation.setOnClickListener(this);
ivAttestation1 = findViewById(R.id.iv_attestation1);
@ -204,26 +208,23 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
@Override
public void onSuccess(Response<NameAuthenticationBean> response) {
dismissLoadingDialog();
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
if (response.body().equals("0")) {
if (response.code()==200) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
// Toast.makeText(getContext(), "点击了确定", Toast.LENGTH_SHORT).show();
//传值给持卡人
Constant.USER_ATTESTATION_NAME = attestationName;
return false;
}
});
} else {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Constant.USER_ATTESTATION_NAME = attestationName;
navInfoEditor.putString("attestationName",attestationName);
navInfoEditor.commit();
return false;
}
});

View File

@ -1,10 +1,14 @@
package com.navinfo.outdoor.fragment;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
@ -41,6 +45,8 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
private TextView chargingReportMoney;
private TextView otherPushMoney;
private TextView otherReportMoney;
private SharedPreferences navInfo;
private CheckBox checkBox;
public static WithdrawFragment newInstance(Bundle bundle) {
WithdrawFragment fragment = new WithdrawFragment();
@ -71,8 +77,34 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
ivWithDraw.setOnClickListener(this);
tvText = findViewById(R.id.tv_text);
tvText.setOnClickListener(this::onClick);
checkBox = findViewById(R.id.checkBox);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){
checkBox.setChecked(false);
navInfo = getActivity().getSharedPreferences("navInfo", Context.MODE_PRIVATE);
String bankAccount = navInfo.getString("bankAccount", null);
if (bankAccount==null||bankAccount.equals("")){
String attestationName = navInfo.getString("attestationName", null);
if (attestationName == null || attestationName.equals("")) {
Intent attestationIntent = new Intent(getContext(), FragmentManagement.class);
attestationIntent.putExtra("tag", 25);
startActivity(attestationIntent);
Toast.makeText(getContext(), "未实名认证,不能绑定银行卡", Toast.LENGTH_SHORT).show();
}else {
Intent gatheringIntent = new Intent(getContext(), FragmentManagement.class);
gatheringIntent.putExtra("tag", 24);
startActivity(gatheringIntent);
Toast.makeText(getContext(), "以实名认证,请绑定银行卡", Toast.LENGTH_SHORT).show();
}
}
}
}
});
btWithdraw = findViewById(R.id.button);
btWithdraw.setOnClickListener(this::onClick);
poiPushMoney = (TextView) findViewById(R.id.poi_push_money);
poiReportMoney = (TextView) findViewById(R.id.poi_report_money);
poiVideoPushMoney = (TextView) findViewById(R.id.poiVideo_push_money);
@ -148,6 +180,16 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
if (etAllPrice.getText().toString().equals("")) {
Toast.makeText(getContext(), "提现金额不能为空", Toast.LENGTH_SHORT).show();
}
String price = etAllPrice.getText().toString().trim();
Integer integer = Integer.valueOf(price);
if (integer!=null&&integer<10){
Toast.makeText(getContext(), "提现金额不能低于10元", Toast.LENGTH_SHORT).show();
return;
}
if (!checkBox.isChecked()){
Toast.makeText(getContext(), "请勾选银行卡", Toast.LENGTH_SHORT).show();
return;
}
immediatelyPrice();
break;
case R.id.tv_all:
@ -159,6 +201,7 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
private void immediatelyPrice() {
showLoadingDialog();
HttpParams httpParams = new HttpParams();
httpParams.put("exchangeMoney", etAllPrice.getText().toString());
httpParams.put("payType", "1");
OkGoBuilder.getInstance()
@ -173,7 +216,6 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
dismissLoadingDialog();
Toast.makeText(getContext(), response.getMessage(), Toast.LENGTH_SHORT).show();
etAllPrice.getText().clear();
Log.d("TAG", "onSuccess: " + response.toString() + "tttttttt");

View File

@ -266,7 +266,6 @@ public class PoiEntity implements Serializable {
this.detail = detail;
}
@Override
public String toString() {
return "PoiEntity{" +

View File

@ -298,7 +298,6 @@ public class AWMp4ParserHelper {
return latLngs;
}
StringBuilder filePathStringBuilder = new StringBuilder("");
for (int m = 0; m < videoFileList.size(); m++) {
File videoFile = videoFileList.get(m);

View File

@ -125,14 +125,17 @@
<EditText
android:id="@+id/et_bank_num"
android:layout_width="wrap_content"
android:layout_width="200dp"
android:layout_height="match_parent"
android:background="@null"
android:hint="银行卡号 "
android:hint="银行卡号"
android:digits="1234567890"
android:maxLength="19"
android:textSize="16sp" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="100dp"
android:layout_width="60dp"
android:layout_height="match_parent">
<ImageView