完成记录-已提交的布局展示

This commit is contained in:
md
2021-06-15 18:25:53 +08:00
parent 396eb2f2b0
commit 84b4eaca1e
27 changed files with 1076 additions and 204 deletions

View File

@@ -14,15 +14,18 @@ import com.navinfo.outdoor.fragment.FindFragment;
import com.navinfo.outdoor.fragment.ForgetPawFragment;
import com.navinfo.outdoor.fragment.GatheringFragment;
import com.navinfo.outdoor.fragment.GradeFragment;
import com.navinfo.outdoor.fragment.HasSubmitFragment;
import com.navinfo.outdoor.fragment.IssueFragment;
import com.navinfo.outdoor.fragment.IssueWebFragment;
import com.navinfo.outdoor.fragment.MapDownloadFragment;
import com.navinfo.outdoor.fragment.MineFragment;
import com.navinfo.outdoor.fragment.PoiFragment;
import com.navinfo.outdoor.fragment.PoiTaskFragment;
import com.navinfo.outdoor.fragment.PrivilegeFragment;
import com.navinfo.outdoor.fragment.RecordFragment;
import com.navinfo.outdoor.fragment.RoadFragment;
import com.navinfo.outdoor.fragment.SetFragment;
import com.navinfo.outdoor.fragment.StaySubmitFragment;
import com.navinfo.outdoor.fragment.TaskExWebFragment;
import com.navinfo.outdoor.fragment.TaskExplainFragment;
import com.navinfo.outdoor.fragment.TaskExplainFragment2;
@@ -75,6 +78,9 @@ public class FragmentManagement extends BaseActivity {
private WithdrawalRecordFragment withdrawalRecordFragment;//我的-提现-提现记录的fragment -26
private PoiFragment poiFragment;//寻宝-上传-POI的fragment -27
private RoadFragment roadFragment;//寻宝-上传-道路的fragment -28
private StaySubmitFragment staySubmitFragment;//记录-待提交的fragment -29
private HasSubmitFragment hasSubmitFragment;//记录-已提交的fragment -30
//private PoiTaskFragment poiTaskFragment;//记录-已提交-POI任务列表的fragment -31
@Override
protected int getLayout() {
@@ -150,6 +156,10 @@ public class FragmentManagement extends BaseActivity {
fragmentTransaction.hide(poiFragment);
if (roadFragment !=null) //寻宝-上传-道路的fragment -28
fragmentTransaction.hide(roadFragment);
if (staySubmitFragment !=null) //记录-待提交的fragment -29
fragmentTransaction.hide(staySubmitFragment);
if (hasSubmitFragment !=null) //记录-已提交的fragment -30
fragmentTransaction.hide(hasSubmitFragment);
@@ -386,6 +396,22 @@ public class FragmentManagement extends BaseActivity {
fragmentTransaction.show(roadFragment);
}
break;
case 29:////记录-待提交的fragment -29
if (staySubmitFragment ==null){
staySubmitFragment =new StaySubmitFragment();
fragmentTransaction.add(R.id.frame_layout, staySubmitFragment);
}else {
fragmentTransaction.show(staySubmitFragment);
}
break;
case 30://记录-已提交的fragment
if (hasSubmitFragment ==null){
hasSubmitFragment =new HasSubmitFragment();
fragmentTransaction.add(R.id.frame_layout, hasSubmitFragment);
}else {
fragmentTransaction.show(hasSubmitFragment);
}
break;
}
fragmentTransaction.commit();
}
@@ -478,6 +504,12 @@ public class FragmentManagement extends BaseActivity {
case 28:
roadFragment.onActivityResult(requestCode,resultCode,data);
break;
case 29:
staySubmitFragment.onActivityResult(requestCode,resultCode,data);
break;
case 30:
hasSubmitFragment.onActivityResult(requestCode,resultCode,data);
break;
}
}

View File

@@ -6,10 +6,12 @@ import androidx.annotation.Nullable;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.location.Location;
import android.media.Image;
import android.os.Looper;
import android.os.Message;
import android.util.DisplayMetrics;
@@ -19,6 +21,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;
import com.navinfo.outdoor.R;
@@ -35,6 +38,7 @@ import com.otaliastudios.cameraview.CameraView;
import com.otaliastudios.cameraview.FileCallback;
import com.otaliastudios.cameraview.PictureResult;
import com.otaliastudios.cameraview.VideoResult;
import com.otaliastudios.cameraview.controls.Engine;
import com.otaliastudios.cameraview.controls.Mode;
import com.otaliastudios.cameraview.size.AspectRatio;
@@ -71,29 +75,27 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
private ImageButton capturePicture;
private long captureTime = 0;
private android.widget.Button btnSwitch;
private android.widget.ImageView ivPic;
private boolean USE_FRAME_PROCESSOR = false;
private boolean DECODE_BITMAP = false;
private TencentMap tencentMap;
private TencentLocationManager locationManager;
private TencentLocationRequest locationRequest;
private MyLocationStyle locationStyle;
private OnLocationChangedListener locationChangedListener;
private MapView ivMap;
private ImageButton captureVideo;
private Button captureVideo;
private Button btnVideo;
private ImageView ivPic;
@Override
protected int getLayout() {
return R.layout.activity_camera;
return R.layout.activity_picture;
}
@Override
protected void initView() {
super.initView();
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ivMap = (MapView) findViewById(R.id.iv_map);
ivPic = findViewById(R.id.iv_pic);
btnVideo = findViewById(R.id.btn_video);
btnVideo.setOnClickListener(this::onClick);
btnSwitch = (Button) findViewById(R.id.btn_switch);
@@ -103,22 +105,23 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
camera = findViewById(R.id.camera);
camera.setOnClickListener(this::onClick);
captureVideo = findViewById(R.id.captureVideo);
captureVideo = findViewById(R.id.capuretVideo);
captureVideo.setOnClickListener(this::onClick);
//拍照权限
camera.setLifecycleOwner(this);
camera.setEngine(Engine.CAMERA1);
//设置拍照的宽高
//camera.setVideoSize(SizeSelectors.or(SizeSelectors.maxHeight(1000), SizeSelectors.smallest(), SizeSelectors.aspectRatio(AspectRatio.of(1, 1), 0)));
// Intent intent = getIntent();
// String pic = intent.getStringExtra("pic");
// camera.setVideoSize(SizeSelectors.or(SizeSelectors.maxHeight(Integer.parseInt(pic)),SizeSelectors.aspectRatio(AspectRatio.of(1, 1), 0)));
//设置拍照的宽高
//camera.setVideoSize(SizeSelectors.or(SizeSelectors.maxHeight(1000), SizeSelectors.smallest(), SizeSelectors.aspectRatio(AspectRatio.of(1, 1), 0)));
camera.setVideoSize(SizeSelectors.or(SizeSelectors.maxHeight(Integer.parseInt(getIntent().getStringExtra("pic"))), SizeSelectors.aspectRatio(AspectRatio.of(1, 1), 0)));
//
SdkFolderCreate.mkdirs(Constant.PICTURE_FOLDER);
//获取地图
tencentMap = ivMap.getMap();
//地图定位
initLocation();
//相机预览监听
//相机预览监听
camera.addCameraListener(new CameraListener() {
@Override
public void onPictureTaken(@NonNull @NotNull PictureResult result) {
@@ -151,16 +154,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
super.onVideoTaken(result);
Toast.makeText(PictureActivity.this, "停止摄像", Toast.LENGTH_SHORT).show();
finish();
// DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Calendar calendar = Calendar.getInstance();
// calendar.setTimeInMillis(System.currentTimeMillis());
// String format = formatter.format(calendar.getTime());
//文件
// File file = new File(Constant.PICTURE_FOLDER, format + ".mp4");
// camera.takeVideo(file,5000);
// VideoPreviewActivity.Companion.setVideoResult(result);
// Intent videoIntent = new Intent(PictureActivity.this, VideoPreviewActivity.class);
// startActivity(videoIntent);
}
@Override
@@ -207,13 +200,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
case R.id.btn_switch:
btnSwich();
break;
case R.id.captureVideo:
Intent intent = getIntent();
String pic = intent.getStringExtra("pic");
Log.d("lllllllllll", pic + "");
if (pic!=null){
camera.setVideoSize(SizeSelectors.or(SizeSelectors.maxHeight(Integer.parseInt(pic))));
}
case R.id.capuretVideo:
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
@@ -221,11 +208,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
//文件
File file = new File(Constant.PICTURE_FOLDER, format + ".mp4");
camera.takeVideo(file, 15000);
break;
}
}
@@ -281,7 +264,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
tencentMap.setMyLocationStyle(locationStyle);
}
public void btnSwich() {
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
@@ -290,10 +272,11 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
ViewGroup.LayoutParams layoutParams = ivMap.getLayoutParams();//地图的宽高
int height = layoutParams.height;
int width = layoutParams.width;
ViewGroup.LayoutParams layoutParams1 = camera.getLayoutParams();
ViewGroup.LayoutParams layoutParams1 = camera.getLayoutParams();//相机的宽高
int height1 = layoutParams1.height;
int width1 = layoutParams1.width;
if (width > width1) {
ivPic.setVisibility(View.GONE);
layoutParams1.width = dm.widthPixels;
layoutParams1.height = dm.heightPixels;
layoutParams.height = height1;
@@ -305,15 +288,12 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
layoutParams.width = dm.widthPixels;
layoutParams1.height = height;
layoutParams1.width = width;
camera.setLayoutParams(layoutParams1);
ivMap.setLayoutParams(layoutParams);
camera.setLayoutParams(layoutParams);
ivMap.setLayoutParams(layoutParams1);
}
}
@Override
protected void onResume() {
super.onResume();
camera.open();
}

View File

@@ -0,0 +1,79 @@
package com.navinfo.outdoor.fragment;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.base.BaseFragment;
/**
* 记录-已提交
*/
public class HasSubmitFragment extends BaseFragment implements View.OnClickListener {
private ConstraintLayout clPoi;
private TextView auditProcess;
private TextView auditThrough;
private TextView auditNotThrough;
private ConstraintLayout clCharging;
private TextView tvCharging;
private TextView chargingAuditProcess;
private TextView chargingAuditThrough;
private TextView chargingAuditNotThrough;
private ConstraintLayout clRoad;
private TextView tvRoad;
private TextView roadAuditProcess;
private TextView roadAuditThrough;
private TextView roadAuditNotThrough;
private ConstraintLayout clOther;
private TextView otherAuditProcess;
private TextView otherAuditThrough;
private TextView otherAuditNotThrough;
@Override
protected int getLayout() {
return R.layout.fragment_has_submit;
}
@Override
protected void initView() {
super.initView();
clPoi = (ConstraintLayout) findViewById(R.id.cl_poi);
clPoi.setOnClickListener(this::onClick);
auditProcess = (TextView) findViewById(R.id.audit_process);
auditThrough = (TextView) findViewById(R.id.audit_through);
auditNotThrough = (TextView) findViewById(R.id.audit_not_through);
clCharging = (ConstraintLayout) findViewById(R.id.cl_charging);
chargingAuditProcess = (TextView) findViewById(R.id.charging_audit_process);
chargingAuditThrough = (TextView) findViewById(R.id.charging_audit_through);
chargingAuditNotThrough = (TextView) findViewById(R.id.charging_audit_not_through);
clRoad = (ConstraintLayout) findViewById(R.id.cl_road);
roadAuditProcess = (TextView) findViewById(R.id.road_audit_process);
roadAuditThrough = (TextView) findViewById(R.id.road_audit_through);
roadAuditNotThrough = (TextView) findViewById(R.id.road_audit_not_through);
clOther = (ConstraintLayout) findViewById(R.id.cl_other);
otherAuditProcess = (TextView) findViewById(R.id.other_audit_process);
otherAuditThrough = (TextView) findViewById(R.id.other_audit_through);
otherAuditNotThrough = (TextView) findViewById(R.id.other_audit_not_through);
}
@Override
protected void initData() {
super.initData();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_poi:
// Intent hasIntent = new Intent(getContext(), FragmentManagement.class);
break;
}
}
}

View File

@@ -0,0 +1,26 @@
package com.navinfo.outdoor.fragment;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.base.BaseFragment;
/**
* 记录-已提交-poi任务列表
*/
public class PoiTaskFragment extends BaseFragment {
@Override
protected int getLayout() {
return R.layout.fragment_poi_task;
}
}

View File

@@ -1,29 +1,75 @@
package com.navinfo.outdoor.fragment;
import android.view.Gravity;
import android.graphics.Color;
import android.view.View;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.util.NoSlideViewPager;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
/**
* 记录的Fragment
* 2021-5-25
*/
public class RecordFragment extends BaseFragment {
public class RecordFragment extends BaseFragment implements View.OnClickListener {
private TabLayout tabRecord;
private NoSlideViewPager vpRecord;
private final String[] names = {"待提交", "已提交"};
@Override
protected int getLayout() {
return R.layout.record_fragment;
}
@Override
protected void initView() {
super.initView();
tabRecord = (TabLayout) findViewById(R.id.tab_record);
vpRecord = (NoSlideViewPager) findViewById(R.id.vp_record);
ArrayList<Fragment> fragments = new ArrayList<>();
fragments.add(new StaySubmitFragment());
fragments.add(new HasSubmitFragment());
vpRecord.setAdapter(new FragmentPagerAdapter(getFragmentManager()) {
@NonNull
@NotNull
@Override
public Fragment getItem(int position) {
return fragments.get(position);
}
@Override
public int getCount() {
return fragments.size();
}
});
tabRecord.setupWithViewPager(vpRecord);
tabRecord.getTabAt(0).setText(names[0]);
tabRecord.getTabAt(1).setText(names[1]);
}
@Override
protected void initData() {
super.initData();
}
@Override
public void onClick(View v) {
}
}

View File

@@ -17,6 +17,7 @@ import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.PictureActivity;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseFragment;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@@ -24,9 +25,10 @@ import org.greenrobot.eventbus.ThreadMode;
/**
* 寻宝-点击上传弹窗-道路
*/
public class RoadFragment extends BaseFragment implements View.OnClickListener {
public class RoadFragment extends BaseFragment {
private TextView tvPictures;
private EditText etHeight;
@Override
protected int getLayout() {
return R.layout.fragment_road;
@@ -35,36 +37,23 @@ public class RoadFragment extends BaseFragment implements View.OnClickListener {
@Override
protected void initView() {
super.initView();
tvPictures = (TextView) findViewById(R.id.tv_pictures);
tvPictures.setOnClickListener(this::onClick);
etHeight = (EditText) findViewById(R.id.et_height);
etHeight.setOnClickListener(this::onClick);
tvPictures.setOnClickListener(v -> {
String trim = etHeight.getText().toString().trim();
Intent intent = new Intent(getContext(), PictureActivity.class);
if (trim != null) {
intent.putExtra("pic", trim);
}else {
intent.putExtra("pic", 1000);
}
startActivity(intent);
});
}
@Override
protected void initData() {
super.initData();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_pictures:
Intent picturesIntent = new Intent(getContext(), PictureActivity.class);
startActivity(picturesIntent);
break;
case R.id.et_height:
String ssss = etHeight.getText().toString();
if (ssss != null && !ssss.isEmpty()) {
Intent intent = new Intent(getContext(), PictureActivity.class);
// PictureActivity activity = (PictureActivity) getActivity();
// activity.
intent.putExtra("pic", etHeight.getText().toString());
startActivity(intent);
} else {
Toast.makeText(getContext(), "不能为空", Toast.LENGTH_SHORT).show();
}
break;
}
}
}

View File

@@ -0,0 +1,39 @@
package com.navinfo.outdoor.fragment;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.base.BaseFragment;
/**
* 记录-待提交的fragment
*/
public class StaySubmitFragment extends BaseFragment implements View.OnClickListener {
@Override
protected int getLayout() {
return R.layout.fragment_stay_submit;
}
@Override
protected void initView() {
super.initView();
}
@Override
protected void initData() {
super.initData();
}
@Override
public void onClick(View v) {
}
}

View File

@@ -237,11 +237,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
}
// @Override
// public boolean onBackPressed() {
//
// return BackHandlerHelper.handleBackPress(supportFragmentManager);
// }
/**
* 设置定位图标样式