修改拍照界面,

This commit is contained in:
wangdongsheng 2021-10-11 18:18:18 +08:00
parent 482eaf31a1
commit f7e8289b90
10 changed files with 70 additions and 38 deletions

View File

@ -40,6 +40,8 @@ import com.otaliastudios.cameraview.CameraView;
import com.otaliastudios.cameraview.FileCallback;
import com.otaliastudios.cameraview.PictureResult;
import com.otaliastudios.cameraview.controls.Mode;
import com.otaliastudios.cameraview.size.Size;
import com.otaliastudios.cameraview.size.SizeSelector;
import com.tencent.map.geolocation.TencentLocation;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
@ -140,19 +142,20 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
cameraView = findViewById(R.id.camera);
cameraView.setOnClickListener(this);
Button btnCapturePicture = findViewById(R.id.capture_picture);
btnCapturePicture.setOnClickListener(this);
ImageView ivCapturePicture = findViewById(R.id.capture_picture);
ivCapturePicture.setOnClickListener(this);
cameraView.addCameraListener(new CameraListener() {
@Override
public void onPictureTaken(@NonNull PictureResult result) {
super.onPictureTaken(result);
if (oration!=1){
if (oration == 1) {
if (Objects.requireNonNull(cameraView.getPictureSize()).getWidth() < cameraView.getPictureSize().getHeight()) {
Toast.makeText(PhotographActivity.this, "不允许竖向拍摄...", Toast.LENGTH_SHORT).show();
photographBuilder.append("cameraView 用户竖向拍摄 ,");
}else {
photographBuilder.append("cameraView 用户横屏拍摄 ,");
return;
}
}
File file = new File(photo_path);
result.toFile(file, new FileCallback() {
@Override
@ -169,6 +172,7 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
}
});
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
@ -177,8 +181,10 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
obtain.obj = true;
EventBus.getDefault().post(obtain);
}
@Subscribe
public void onEvent(Message data) { }
public void onEvent(Message data) {
}
@Override
protected void onResume() {

View File

@ -207,7 +207,7 @@ public class Constant {
public static TencentMap.OnMarkerClickListener markerClickListener=null;
public static final String NAVIN_FO="10.08";//版本日期
public static final String NAVIN_FO="10.11";//版本日期
/*联系我们的QQ群名称和QQ群号
*/
public static String REGION_JIG_NAME = "京津冀晋蒙-地图寻宝群";

View File

@ -913,18 +913,21 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
case R.id.rl_panorama:
Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
File panoramaFile = PhotoUtils.showPhotoFile("a", latLng);
intentPanorama.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, panoramaFile.getPath());
startActivityForResult(intentPanorama, 101);
break;
case R.id.rl_coding:
Intent intentCoding = new Intent(getActivity(), PhotographActivity.class);
File codingFile = PhotoUtils.showPhotoFile("b", latLng);
intentCoding.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentCoding.putExtra(Constant.INTENT_PHOTO_PATH, codingFile.getPath());
startActivityForResult(intentCoding, 102);
break;
case R.id.rl_equipment:
Intent intentEquipment = new Intent(getActivity(), PhotographActivity.class);
File equipmentFile = PhotoUtils.showPhotoFile("c", latLng);
intentEquipment.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentEquipment.putExtra(Constant.INTENT_PHOTO_PATH, equipmentFile.getPath());
startActivityForResult(intentEquipment, 103);
@ -932,42 +935,49 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
case R.id.rl_facility:
Intent intentFacility = new Intent(getActivity(), PhotographActivity.class);
File facilityFile = PhotoUtils.showPhotoFile("c", latLng);
intentFacility.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentFacility.putExtra(Constant.INTENT_PHOTO_PATH, facilityFile.getPath());
startActivityForResult(intentFacility, 104);
break;
case R.id.rl_scutcheon:
Intent intentScutcheon = new Intent(getActivity(), PhotographActivity.class);
File scutcheonFile = PhotoUtils.showPhotoFile("c", latLng);
intentScutcheon.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentScutcheon.putExtra(Constant.INTENT_PHOTO_PATH, scutcheonFile.getPath());
startActivityForResult(intentScutcheon, 105);
break;
case R.id.rl_device:
Intent intentDevice = new Intent(getActivity(), PhotographActivity.class);
File deviceFile = PhotoUtils.showPhotoFile("c", latLng);
intentDevice.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentDevice.putExtra(Constant.INTENT_PHOTO_PATH, deviceFile.getPath());
startActivityForResult(intentDevice, 106);
break;
case R.id.rl_usable:
Intent intentUsable = new Intent(getActivity(), PhotographActivity.class);
File usableFile = PhotoUtils.showPhotoFile("d", latLng);
intentUsable.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentUsable.putExtra(Constant.INTENT_PHOTO_PATH, usableFile.getPath());
startActivityForResult(intentUsable, 107);
break;
case R.id.rl_available:
Intent intentAvailable = new Intent(getActivity(), PhotographActivity.class);
File availableFile = PhotoUtils.showPhotoFile("d", latLng);
intentAvailable.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentAvailable.putExtra(Constant.INTENT_PHOTO_PATH, availableFile.getPath());
startActivityForResult(intentAvailable, 108);
break;
case R.id.rl_parking:
Intent intentParking = new Intent(getActivity(), PhotographActivity.class);
File parkingFile = PhotoUtils.showPhotoFile("e", latLng);
intentParking.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentParking.putExtra(Constant.INTENT_PHOTO_PATH, parkingFile.getPath());
startActivityForResult(intentParking, 109);
break;
case R.id.rl_number:
Intent intentNumber = new Intent(getActivity(), PhotographActivity.class);
File numberFile = PhotoUtils.showPhotoFile("e", latLng);
intentNumber.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentNumber.putExtra(Constant.INTENT_PHOTO_PATH, numberFile.getPath());
startActivityForResult(intentNumber, 110);
break;

View File

@ -97,7 +97,6 @@ import okhttp3.Response;
* 2021-5-25
*/
public class ChargingStationFragment extends BaseDrawerFragment implements View.OnClickListener {
private EditText editDescribe;
private RelativeLayout rlPanorama, rlName, rlInternalPhotos, rlElse, rlScutcheon, rlNull;
private ImageView ivPanorama, ivName, ivInternal, ivElse, ivScutcheon;
@ -245,11 +244,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
tvInternal = findViewById(R.id.tv_internal);
tvNamePic = findViewById(R.id.tv_name_pic);
tvScutcheon = findViewById(R.id.tv_scutcheon);
/* recyclerPhone = findViewById(R.id.recycler_phone);
recyclerPhone.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
poiRecycleAdapter = new PoiRecycleAdapter(getContext());
recyclerPhone.setAdapter(poiRecycleAdapter);*/
RecyclerView recyclerStation = findViewById(R.id.recycler_station);
recyclerStation.setLayoutManager(new GridLayoutManager(getContext(), 3));
chargingPileAdapter = new ChargingPileAdapter(getContext());
@ -880,30 +881,35 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
case R.id.rl_panorama:
Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
File PanoramaFile = PhotoUtils.showPhotoFile("a", latLng);
intentPanorama.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, PanoramaFile.getPath());
startActivityForResult(intentPanorama, 101);
break;
case R.id.rl_name:
Intent intentName = new Intent(getActivity(), PhotographActivity.class);
File nameFile = PhotoUtils.showPhotoFile("b", latLng);
intentName.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentName.putExtra(Constant.INTENT_PHOTO_PATH, nameFile.getPath());
startActivityForResult(intentName, 102);
break;
case R.id.rl_internal_photos:
Intent intentInternal = new Intent(getActivity(), PhotographActivity.class);
File internalFile = PhotoUtils.showPhotoFile("c", latLng);
intentInternal.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentInternal.putExtra(Constant.INTENT_PHOTO_PATH, internalFile.getPath());
startActivityForResult(intentInternal, 103);
break;
case R.id.rl_else:
Intent intentElse = new Intent(getActivity(), PhotographActivity.class);
File elseFile = PhotoUtils.showPhotoFile("d", latLng);
intentElse.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentElse.putExtra(Constant.INTENT_PHOTO_PATH, elseFile.getPath());
startActivityForResult(intentElse, 104);
break;
case R.id.rl_scutcheon:
Intent intentScutcheon = new Intent(getActivity(), PhotographActivity.class);
File scutcheonFile = PhotoUtils.showPhotoFile("e", latLng);
intentScutcheon.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentScutcheon.putExtra(Constant.INTENT_PHOTO_PATH, scutcheonFile.getPath());
startActivityForResult(intentScutcheon, 105);
break;
@ -1366,6 +1372,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
new Thread(new Runnable() {
@Override
public void run() {
if (showPoiEntity.getId()!=null){
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(getActivity()).getChargingPileDao().getChargingPileByStationId(showPoiEntity.getId());
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
for (ChargingPileEntity chargingPileEntity : chargingPileEntityList) {
@ -1383,6 +1390,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
chargingPileDao.deleteChargingFidPileEntity(showPoiEntity.getId());
}
}
}).start();
} else {
Message obtain = Message.obtain();

View File

@ -417,12 +417,14 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
Intent intentPicture = new Intent(getActivity(), PhotographActivity.class);
File file = PhotoUtils.showPhotoFile("a", latLng);
intentPicture.putExtra(Constant.INTENT_PHOTO_PATH, file.getPath());
intentPicture.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
startActivityForResult(intentPicture, 101);
break;
case R.id.rl_pictures:
Intent intentPictures = new Intent(getActivity(), PhotographActivity.class);
File files = PhotoUtils.showPhotoFile("b", latLng);
intentPictures.putExtra(Constant.INTENT_PHOTO_PATH, files.getPath());
intentPictures.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
startActivityForResult(intentPictures, 102);
break;
case R.id.btn_other_local:

View File

@ -656,30 +656,35 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
case R.id.rl_panorama:
Intent intentPanorama = new Intent(getActivity(), PhotographActivity.class);
File filePanorama = PhotoUtils.showPhotoFile("a", latLng);
intentPanorama.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentPanorama.putExtra(Constant.INTENT_PHOTO_PATH, filePanorama.getPath());
startActivityForResult(intentPanorama, 101);
break;
case R.id.rl_name:
Intent intentName = new Intent(getActivity(), PhotographActivity.class);
File fileName = PhotoUtils.showPhotoFile("b", latLng);
intentName.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentName.putExtra(Constant.INTENT_PHOTO_PATH, fileName.getPath());
startActivityForResult(intentName, 102);
break;
case R.id.rl_internal_photos:
Intent intentInternal = new Intent(getActivity(), PhotographActivity.class);
File fileInternal = PhotoUtils.showPhotoFile("c", latLng);
intentInternal.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentInternal.putExtra(Constant.INTENT_PHOTO_PATH, fileInternal.getPath());
startActivityForResult(intentInternal, 103);
break;
case R.id.rl_card:
Intent intentCard = new Intent(getActivity(), PhotographActivity.class);
File fileCard = PhotoUtils.showPhotoFile("d", latLng);
intentCard.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentCard.putExtra(Constant.INTENT_PHOTO_PATH, fileCard.getPath());
startActivityForResult(intentCard, 104);
break;
case R.id.rl_else:
Intent intentElse = new Intent(getActivity(), PhotographActivity.class);
File fileElse = PhotoUtils.showPhotoFile("e", latLng);
intentElse.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
intentElse.putExtra(Constant.INTENT_PHOTO_PATH, fileElse.getPath());
startActivityForResult(intentElse, 105);
break;

View File

@ -159,18 +159,21 @@ public class UserAttestationFragment extends BaseFragment implements View.OnC
case R.id.iv_attestation1:
Intent ivAttestationIntent1 = new Intent(getActivity(), PhotographActivity.class);
File attestationFile1 = PhotoUtils.showPhotoFile("a", null);
ivAttestationIntent1.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
ivAttestationIntent1.putExtra(Constant.INTENT_PHOTO_PATH, attestationFile1.getPath());
startActivityForResult(ivAttestationIntent1, 121);
break;
case R.id.iv_attestation2:
Intent ivAttestationIntent2 = new Intent(getActivity(), PhotographActivity.class);
File attestationFile2 = PhotoUtils.showPhotoFile("b", null);
ivAttestationIntent2.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
ivAttestationIntent2.putExtra(Constant.INTENT_PHOTO_PATH, attestationFile2.getPath());
startActivityForResult(ivAttestationIntent2, 122);
break;
case R.id.iv_attestation3:
Intent ivAttestationIntent3 = new Intent(getActivity(), PhotographActivity.class);
File attestationFile3 = PhotoUtils.showPhotoFile("c", null);
ivAttestationIntent3.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
ivAttestationIntent3.putExtra(Constant.INTENT_PHOTO_PATH, attestationFile3.getPath());
startActivityForResult(ivAttestationIntent3, 123);
break;
@ -192,6 +195,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnC
case R.id.user_attestation_camera:
Intent userCameraIntent = new Intent(getActivity(), PhotographActivity.class);
File file = PhotoUtils.showPhotoFile("d", null);
userCameraIntent.putExtra(Constant.INTENT_VIDEO_OBLATION, 1);
userCameraIntent.putExtra(Constant.INTENT_PHOTO_PATH, file.getPath());
startActivityForResult(userCameraIntent, 124);
break;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -26,17 +26,14 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
<ImageView
android:id="@+id/capture_picture"
style="@style/user_data_style"
android:layout_width="100dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:background="@drawable/user_style"
android:layout_marginEnd="24dp"
android:gravity="center"
android:padding="@dimen/fab_margin"
android:text="拍照"
android:src="@drawable/icon_camera"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>