完成寻宝-道路拍照
This commit is contained in:
parent
e9e0c175f3
commit
128e55a4f7
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@ -41,5 +41,10 @@
|
|||||||
<option name="name" value="MavenRepo" />
|
<option name="name" value="MavenRepo" />
|
||||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven" />
|
||||||
|
<option name="name" value="maven" />
|
||||||
|
<option name="url" value="https://maven.aliyun.com/repository/apache-snapshots" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -1,14 +1,13 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 30
|
||||||
buildToolsVersion "30.0.3"
|
buildToolsVersion "30.0.3"
|
||||||
// ndkVersion '23.0.7123448'
|
ndkVersion '23.0.7123448'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.navinfo.outdoor"
|
applicationId "com.navinfo.outdoor"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 30
|
targetSdkVersion 22
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
@ -54,10 +53,10 @@ dependencies {
|
|||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
//友盟自动检测bug
|
||||||
implementation 'com.umeng.umsdk:common:9.3.8'
|
implementation 'com.umeng.umsdk:common:9.3.8'
|
||||||
implementation 'com.umeng.umsdk:asms:1.2.2'
|
implementation 'com.umeng.umsdk:asms:1.2.2'
|
||||||
implementation 'com.umeng.umsdk:apm:1.2.0'
|
implementation 'com.umeng.umsdk:apm:1.2.0'
|
||||||
|
|
||||||
//状态栏侵染
|
//状态栏侵染
|
||||||
|
|
||||||
// 基础依赖包,必须要依赖
|
// 基础依赖包,必须要依赖
|
||||||
@ -93,6 +92,8 @@ dependencies {
|
|||||||
implementation 'com.kongzue.dialog_v3x:dialog:3.2.4'
|
implementation 'com.kongzue.dialog_v3x:dialog:3.2.4'
|
||||||
//xRecyclerview下拉刷新控件
|
//xRecyclerview下拉刷新控件
|
||||||
implementation project(':xrecyclerview')
|
implementation project(':xrecyclerview')
|
||||||
|
//拍照功能
|
||||||
|
implementation 'com.otaliastudios:cameraview:2.7.0'
|
||||||
|
|
||||||
|
|
||||||
//腾讯地图
|
//腾讯地图
|
||||||
|
@ -1,47 +1,39 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.navinfo.outdoor">
|
package="com.navinfo.outdoor">
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" /> <!-- <uses-sdk android:minSdkVersion="8"></uses-sdk> -->
|
||||||
|
<!-- 友盟检测bug -->
|
||||||
<!-- <uses-sdk android:minSdkVersion="8"></uses-sdk>-->
|
|
||||||
<!--友盟检测bug-->
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" /> <!-- 腾讯地图 定位权限 -->
|
||||||
|
|
||||||
<!-- 腾讯地图 定位权限-->
|
|
||||||
<!-- 通过GPS得到精确位置 -->
|
<!-- 通过GPS得到精确位置 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- 通过网络得到粗略位置 -->
|
||||||
<!-- 通过网络得到粗略位置 -->
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 访问网络. 某些位置信息需要从网络服务器获取 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.INTERNET" /> <!-- 访问WiFi状态. 需要WiFi信息用于网络定位 -->
|
||||||
<!-- 访问网络. 某些位置信息需要从网络服务器获取 -->
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 修改WiFi状态. 发起WiFi扫描, 需要WiFi信息用于网络定位 -->
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 访问网络状态, 检测网络的可用性. 需要网络运营商相关信息用于网络定位 -->
|
||||||
<!-- 访问WiFi状态. 需要WiFi信息用于网络定位 -->
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 访问网络的变化, 需要某些信息用于网络定位 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 访问手机当前状态, 需要device id用于网络定位 -->
|
||||||
<!-- 修改WiFi状态. 发起WiFi扫描, 需要WiFi信息用于网络定位 -->
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- 访问蓝牙状态,需要蓝牙信息用于网络定位 -->
|
||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<!-- 访问网络状态, 检测网络的可用性. 需要网络运营商相关信息用于网络定位 -->
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- 支持A-GPS辅助定位 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 用于 log 日志 -->
|
||||||
<!-- 访问网络的变化, 需要某些信息用于网络定位 -->
|
|
||||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
|
||||||
<!-- 访问手机当前状态, 需要device id用于网络定位 -->
|
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
||||||
<!-- 访问蓝牙状态,需要蓝牙信息用于网络定位 -->
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH"/>
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
|
|
||||||
<!-- 支持A-GPS辅助定位 -->
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
|
||||||
<!-- 用于 log 日志 -->
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
||||||
|
|
||||||
|
<!-- <!– 在sdcard中创建/删除文件的权限 –>-->
|
||||||
|
<!-- <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />-->
|
||||||
|
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.hardware.camera"
|
||||||
|
android:required="true" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name="com.navinfo.outdoor.api.UserApplication"
|
android:name=".api.UserApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
@ -49,11 +41,25 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme.NoActionBar">
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
|
<activity android:name=".activity.camer.MyCamerActivity"
|
||||||
<!-- 腾讯地图申请Key 定位-->
|
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
|
||||||
<meta-data android:name="TencentMapSDK" android:value="EWWBZ-2PB62-6JXUL-CEX7G-N7UE6-XRB4V" />
|
android:launchMode="singleTop"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
>
|
||||||
|
|
||||||
|
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity android:name=".activity.PictureActivity"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
>
|
||||||
|
|
||||||
|
</activity>
|
||||||
|
<meta-data
|
||||||
|
android:name="TencentMapSDK"
|
||||||
|
android:value="EWWBZ-2PB62-6JXUL-CEX7G-N7UE6-XRB4V" />
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="design_width_in_dp"
|
android:name="design_width_in_dp"
|
||||||
android:value="480" />
|
android:value="480" />
|
||||||
@ -61,19 +67,21 @@
|
|||||||
android:name="design_height_in_dp"
|
android:name="design_height_in_dp"
|
||||||
android:value="800" />
|
android:value="800" />
|
||||||
|
|
||||||
<activity android:name="com.navinfo.outdoor.activity.MainActivity">
|
<activity android:name=".activity.MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.navinfo.outdoor.activity.LoginActivity"></activity>
|
<activity android:name=".activity.LoginActivity" />
|
||||||
<activity android:name="com.navinfo.outdoor.activity.HomeActivity"></activity>
|
<activity android:name=".activity.HomeActivity" />
|
||||||
<activity android:name="com.navinfo.outdoor.activity.WebActivity"></activity>
|
<activity android:name=".activity.WebActivity" />
|
||||||
<activity android:name="com.navinfo.outdoor.activity.FragmentManagement" android:windowSoftInputMode="adjustPan"/>
|
<activity
|
||||||
<activity android:name="com.navinfo.outdoor.activity.ImageShowActivity"></activity>
|
android:name=".activity.FragmentManagement"
|
||||||
<activity android:name="com.navinfo.outdoor.activity.UserActivity"></activity>
|
android:windowSoftInputMode="adjustPan" />
|
||||||
|
<activity android:name=".activity.ImageShowActivity" />
|
||||||
|
<activity android:name=".activity.UserActivity" />
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -76,8 +76,6 @@ public class FragmentManagement extends BaseActivity {
|
|||||||
private PoiFragment poiFragment;//寻宝-上传-POI的fragment -27
|
private PoiFragment poiFragment;//寻宝-上传-POI的fragment -27
|
||||||
private RoadFragment roadFragment;//寻宝-上传-道路的fragment -28
|
private RoadFragment roadFragment;//寻宝-上传-道路的fragment -28
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayout() {
|
protected int getLayout() {
|
||||||
return R.layout.management_fragment;
|
return R.layout.management_fragment;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.outdoor.activity;
|
package com.navinfo.outdoor.activity;
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
@ -8,6 +9,7 @@ import android.content.Intent;
|
|||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
|
|
||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
import com.navinfo.outdoor.base.BaseActivity;
|
import com.navinfo.outdoor.base.BaseActivity;
|
||||||
import com.kongzue.dialog.util.DialogSettings;
|
import com.kongzue.dialog.util.DialogSettings;
|
||||||
|
|
||||||
@ -52,8 +54,14 @@ public class MainActivity extends BaseActivity {
|
|||||||
Manifest.permission.READ_PHONE_STATE,
|
Manifest.permission.READ_PHONE_STATE,
|
||||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||||
};
|
};
|
||||||
ActivityCompat.requestPermissions(this, pers, 100);
|
ActivityCompat.requestPermissions(this, pers, Constant.PERMISSION_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable @org.jetbrains.annotations.Nullable Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
super.initView();
|
super.initView();
|
||||||
|
@ -0,0 +1,388 @@
|
|||||||
|
package com.navinfo.outdoor.activity;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.Matrix;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
|
import com.navinfo.outdoor.base.BaseActivity;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.util.SdkFolderCreate;
|
||||||
|
import com.navinfo.outdoor.util.ToastUtil;
|
||||||
|
import com.otaliastudios.cameraview.CameraException;
|
||||||
|
import com.otaliastudios.cameraview.CameraListener;
|
||||||
|
import com.otaliastudios.cameraview.CameraLogger;
|
||||||
|
|
||||||
|
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.Mode;
|
||||||
|
|
||||||
|
import com.otaliastudios.cameraview.size.AspectRatio;
|
||||||
|
import com.otaliastudios.cameraview.size.SizeSelectors;
|
||||||
|
import com.tencent.map.geolocation.TencentLocation;
|
||||||
|
import com.tencent.map.geolocation.TencentLocationListener;
|
||||||
|
import com.tencent.map.geolocation.TencentLocationManager;
|
||||||
|
import com.tencent.map.geolocation.TencentLocationRequest;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.LocationSource;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.MapView;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
|
||||||
|
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileDescriptor;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class PictureActivity extends BaseActivity implements View.OnClickListener, LocationSource, TencentLocationListener {
|
||||||
|
private static final CameraLogger LOG = CameraLogger.create("Picture");
|
||||||
|
private CameraView camera;
|
||||||
|
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 btnVideo;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayout() {
|
||||||
|
return R.layout.activity_camera;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
super.initView();
|
||||||
|
|
||||||
|
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
ivMap = (MapView) findViewById(R.id.iv_map);
|
||||||
|
btnVideo = findViewById(R.id.btn_video);
|
||||||
|
btnVideo.setOnClickListener(this::onClick);
|
||||||
|
btnSwitch = (Button) findViewById(R.id.btn_switch);
|
||||||
|
btnSwitch.setOnClickListener(this::onClick);
|
||||||
|
capturePicture = (ImageButton) findViewById(R.id.capturePicture);
|
||||||
|
capturePicture.setOnClickListener(this::onClick);
|
||||||
|
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
|
||||||
|
camera = findViewById(R.id.camera);
|
||||||
|
camera.setOnClickListener(this::onClick);
|
||||||
|
captureVideo = findViewById(R.id.captureVideo);
|
||||||
|
captureVideo.setOnClickListener(this::onClick);
|
||||||
|
|
||||||
|
|
||||||
|
camera.setLifecycleOwner(this);
|
||||||
|
|
||||||
|
//设置拍照的宽高
|
||||||
|
//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)));
|
||||||
|
|
||||||
|
SdkFolderCreate.mkdirs(Constant.PICTURE_FOLDER);
|
||||||
|
|
||||||
|
//相机预览监听
|
||||||
|
camera.addCameraListener(new CameraListener() {
|
||||||
|
@Override
|
||||||
|
public void onPictureTaken(@NonNull @NotNull PictureResult result) {
|
||||||
|
super.onPictureTaken(result);
|
||||||
|
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 + ".jpg");
|
||||||
|
|
||||||
|
result.toFile(file, new FileCallback() {
|
||||||
|
@Override
|
||||||
|
public void onFileReady(@Nullable @org.jetbrains.annotations.Nullable File file) {
|
||||||
|
Toast.makeText(PictureActivity.this, "保存成功:" + file.getPath(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (camera.isTakingVideo()) {
|
||||||
|
message("Captured while taking video. Size=" + result.getSize(), false);
|
||||||
|
}
|
||||||
|
long callbackTime = System.currentTimeMillis();
|
||||||
|
captureTime = callbackTime - 300;
|
||||||
|
Log.d("captureTime", captureTime + "");
|
||||||
|
//
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//录像监听
|
||||||
|
@Override
|
||||||
|
public void onVideoTaken(@NonNull @NotNull VideoResult result) {
|
||||||
|
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
|
||||||
|
public void onCameraError(@NonNull @NotNull CameraException exception) {
|
||||||
|
super.onCameraError(exception);
|
||||||
|
Toast.makeText(PictureActivity.this, exception.toString(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void message(String content, Boolean important) {
|
||||||
|
if (important) {
|
||||||
|
LOG.w(content);
|
||||||
|
Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
LOG.i(content);
|
||||||
|
Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
super.initData();
|
||||||
|
|
||||||
|
camera.setMode(Mode.VIDEO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
switch (v.getId()) {
|
||||||
|
case R.id.capturePicture:
|
||||||
|
camera.setMode(Mode.PICTURE);
|
||||||
|
if (!camera.isTakingPicture()) {
|
||||||
|
captureTime = System.currentTimeMillis();
|
||||||
|
message("Capturing picture...", false);
|
||||||
|
camera.takePicture();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case R.id.btn_video:
|
||||||
|
// camera.stopVideo();
|
||||||
|
break;
|
||||||
|
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))));
|
||||||
|
}
|
||||||
|
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, 15000);
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定位的一些初始化设置
|
||||||
|
*/
|
||||||
|
private void initLocation() {
|
||||||
|
//用于访问腾讯定位服务的类, 周期性向客户端提供位置更新
|
||||||
|
locationManager = TencentLocationManager.getInstance(this);
|
||||||
|
//设置坐标系
|
||||||
|
locationManager.setCoordinateType(TencentLocationManager.COORDINATE_TYPE_GCJ02);
|
||||||
|
//创建定位请求
|
||||||
|
locationRequest = TencentLocationRequest.create();
|
||||||
|
//设置定位周期(位置监听器回调周期)为3s
|
||||||
|
// locationRequest.setInterval(3000);
|
||||||
|
//地图上设置定位数据源
|
||||||
|
tencentMap.setLocationSource(this);
|
||||||
|
//设置当前位置可见
|
||||||
|
tencentMap.setMyLocationEnabled(true);
|
||||||
|
//设置定位图标样式
|
||||||
|
setLocMarkerStyle();
|
||||||
|
// locationStyle = locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);
|
||||||
|
tencentMap.setMyLocationStyle(locationStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Bitmap getBitMap(int resourceId) {
|
||||||
|
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
|
||||||
|
int width = bitmap.getWidth();
|
||||||
|
int height = bitmap.getHeight();
|
||||||
|
int newWidth = 55;
|
||||||
|
int newHeight = 55;
|
||||||
|
float widthScale = ((float) newWidth) / width;
|
||||||
|
float heightScale = ((float) newHeight) / height;
|
||||||
|
Matrix matrix = new Matrix();
|
||||||
|
matrix.postScale(widthScale, heightScale);
|
||||||
|
bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置定位图标样式
|
||||||
|
*/
|
||||||
|
private void setLocMarkerStyle() {
|
||||||
|
locationStyle = new MyLocationStyle();
|
||||||
|
//创建图标
|
||||||
|
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(R.drawable.location));
|
||||||
|
locationStyle.icon(bitmapDescriptor);
|
||||||
|
//设置定位圆形区域的边框宽度;
|
||||||
|
locationStyle.strokeWidth(1);
|
||||||
|
//设置圆区域的颜色
|
||||||
|
// locationStyle.fillColor(R.color.colormap);
|
||||||
|
// locationStyle.anchor(1000,2000);
|
||||||
|
tencentMap.setMyLocationStyle(locationStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void btnSwich() {
|
||||||
|
DisplayMetrics dm = new DisplayMetrics();
|
||||||
|
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||||
|
System.out.println("width-display :" + dm.widthPixels);
|
||||||
|
System.out.println("heigth-display :" + dm.heightPixels);
|
||||||
|
ViewGroup.LayoutParams layoutParams = ivMap.getLayoutParams();//地图的宽高
|
||||||
|
int height = layoutParams.height;
|
||||||
|
int width = layoutParams.width;
|
||||||
|
ViewGroup.LayoutParams layoutParams1 = camera.getLayoutParams();
|
||||||
|
int height1 = layoutParams1.height;
|
||||||
|
int width1 = layoutParams1.width;
|
||||||
|
if (width > width1) {
|
||||||
|
layoutParams1.width = dm.widthPixels;
|
||||||
|
layoutParams1.height = dm.heightPixels;
|
||||||
|
layoutParams.height = height1;
|
||||||
|
layoutParams.width = width1;
|
||||||
|
camera.setLayoutParams(layoutParams1);
|
||||||
|
ivMap.setLayoutParams(layoutParams);
|
||||||
|
} else {
|
||||||
|
layoutParams.height = dm.heightPixels;
|
||||||
|
layoutParams.width = dm.widthPixels;
|
||||||
|
layoutParams1.height = height;
|
||||||
|
layoutParams1.width = width;
|
||||||
|
camera.setLayoutParams(layoutParams1);
|
||||||
|
ivMap.setLayoutParams(layoutParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
|
||||||
|
super.onResume();
|
||||||
|
camera.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
camera.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
camera.destroy();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void activate(OnLocationChangedListener onLocationChangedListener) {
|
||||||
|
locationChangedListener = onLocationChangedListener;
|
||||||
|
int err = locationManager.requestLocationUpdates(locationRequest, this, Looper.myLooper());
|
||||||
|
switch (err) {
|
||||||
|
case 1:
|
||||||
|
ToastUtil.showShort(this, Constant.GET_ERR_MESSAGE1);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
ToastUtil.showShort(this, Constant.GET_ERR_MESSAGE2);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
ToastUtil.showShort(this, Constant.GET_ERR_MESSAGE3);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivate() {
|
||||||
|
locationManager.removeUpdates(this);
|
||||||
|
locationManager = null;
|
||||||
|
locationRequest = null;
|
||||||
|
locationChangedListener = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLocationChanged(TencentLocation tencentLocation, int i, String s) {
|
||||||
|
if (i == TencentLocation.ERROR_OK && locationChangedListener != null) {
|
||||||
|
Location location = new Location(tencentLocation.getProvider());
|
||||||
|
//设置经纬度以及精度
|
||||||
|
location.setLatitude(tencentLocation.getLatitude());
|
||||||
|
location.setLongitude(tencentLocation.getLongitude());
|
||||||
|
location.setAccuracy(tencentLocation.getAccuracy());
|
||||||
|
locationChangedListener.onLocationChanged(location);
|
||||||
|
Constant.currentLocation = tencentLocation;
|
||||||
|
//显示回调的实时位置信息
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//打印tencentLocation的json字符串
|
||||||
|
// Toast.makeText(getApplicationContext(), new Gson().toJson(location), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStatusUpdate(String s, int i, String s1) {
|
||||||
|
Log.v("State changed", s + "===" + s1);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,430 @@
|
|||||||
|
package com.navinfo.outdoor.activity.camer
|
||||||
|
|
||||||
|
import android.animation.ValueAnimator
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.pm.ActivityInfo
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import android.graphics.*
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ImageButton
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
|
import com.navinfo.outdoor.R
|
||||||
|
import com.otaliastudios.cameraview.*
|
||||||
|
import com.otaliastudios.cameraview.controls.Facing
|
||||||
|
import com.otaliastudios.cameraview.controls.Mode
|
||||||
|
import com.otaliastudios.cameraview.controls.Preview
|
||||||
|
import com.otaliastudios.cameraview.filter.Filters
|
||||||
|
import com.otaliastudios.cameraview.frame.Frame
|
||||||
|
import com.otaliastudios.cameraview.frame.FrameProcessor
|
||||||
|
import com.tencent.map.geolocation.TencentLocationManager
|
||||||
|
import com.tencent.map.geolocation.TencentLocationRequest
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.TencentMap
|
||||||
|
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle
|
||||||
|
import kotlinx.android.synthetic.main.activity_camera.*
|
||||||
|
import kotlinx.android.synthetic.main.activity_my_camer.*
|
||||||
|
import kotlinx.android.synthetic.main.activity_my_camer.capturePicture
|
||||||
|
import kotlinx.android.synthetic.main.activity_my_camer.capturePictureSnapshot
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class MyCamerActivity : AppCompatActivity(), View.OnClickListener, OptionView.Callback {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val LOG = CameraLogger.create("DemoApp")
|
||||||
|
private const val USE_FRAME_PROCESSOR = false
|
||||||
|
private const val DECODE_BITMAP = false
|
||||||
|
}
|
||||||
|
|
||||||
|
private var locationManager: TencentLocationManager? = null
|
||||||
|
private var locationRequest: TencentLocationRequest? = null
|
||||||
|
private val tencentMap: TencentMap? = null
|
||||||
|
private var locationStyle: MyLocationStyle? = null
|
||||||
|
private val camera: CameraView by lazy { findViewById(R.id.camera) }
|
||||||
|
private val edit : ImageButton by lazy { findViewById(R.id.edit) }
|
||||||
|
private val ivmap: ImageView by lazy { findViewById(R.id.iv_map) }
|
||||||
|
// private val ivmap: MapView by lazy { findViewById(R.id.iv_map) }
|
||||||
|
|
||||||
|
private val controlPanel: ViewGroup by lazy { findViewById(R.id.controls) }
|
||||||
|
private var captureTime: Long = 0
|
||||||
|
|
||||||
|
private var currentFilter = 0
|
||||||
|
private val allFilters = Filters.values()
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_camera)
|
||||||
|
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE)
|
||||||
|
camera.setLifecycleOwner(this)
|
||||||
|
camera.addCameraListener(Listener())
|
||||||
|
if (USE_FRAME_PROCESSOR) {
|
||||||
|
camera.addFrameProcessor(object : FrameProcessor {
|
||||||
|
private var lastTime = System.currentTimeMillis()
|
||||||
|
override fun process(frame: Frame) {
|
||||||
|
val newTime = frame.time
|
||||||
|
val delay = newTime - lastTime
|
||||||
|
lastTime = newTime
|
||||||
|
LOG.v("Frame delayMillis:", delay, "FPS:", 1000 / delay)
|
||||||
|
if (DECODE_BITMAP) {
|
||||||
|
if (frame.format == ImageFormat.NV21
|
||||||
|
&& frame.dataClass == ByteArray::class.java) {
|
||||||
|
val data = frame.getData<ByteArray>()
|
||||||
|
val yuvImage = YuvImage(data,
|
||||||
|
frame.format,
|
||||||
|
frame.size.width,
|
||||||
|
frame.size.height,
|
||||||
|
null)
|
||||||
|
val jpegStream = ByteArrayOutputStream()
|
||||||
|
yuvImage.compressToJpeg(Rect(0, 0,
|
||||||
|
frame.size.width,
|
||||||
|
frame.size.height), 100, jpegStream)
|
||||||
|
val jpegByteArray = jpegStream.toByteArray()
|
||||||
|
val bitmap = BitmapFactory.decodeByteArray(jpegByteArray,
|
||||||
|
0, jpegByteArray.size)
|
||||||
|
bitmap.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
edit.setOnClickListener(this)
|
||||||
|
capturePicture.setOnClickListener(this)
|
||||||
|
capturePictureSnapshot.setOnClickListener(this)
|
||||||
|
btn_switch.setOnClickListener(this)
|
||||||
|
// captureVideo.setOnClickListener(this)
|
||||||
|
// captureVideoSnapshot.setOnClickListener(this)
|
||||||
|
// toggleCamera.setOnClickListener(this)
|
||||||
|
|
||||||
|
val group = controlPanel.getChildAt(0) as ViewGroup
|
||||||
|
// val watermark = findViewById<View>( R.id.watermark)
|
||||||
|
val options: List<Option<*>> = listOf(
|
||||||
|
// Layout
|
||||||
|
Option.Width(), Option.Height(),
|
||||||
|
// Engine and preview
|
||||||
|
Option.Mode(), Option.Engine(), Option.Preview(),
|
||||||
|
// Some controls
|
||||||
|
Option.Flash(), Option.WhiteBalance(), Option.Hdr(),
|
||||||
|
Option.PictureMetering(), Option.PictureSnapshotMetering(),
|
||||||
|
Option.PictureFormat(),
|
||||||
|
// Video recording
|
||||||
|
Option.PreviewFrameRate(), Option.VideoCodec(), Option.Audio(), Option.AudioCodec(),
|
||||||
|
// Gestures
|
||||||
|
Option.Pinch(), Option.HorizontalScroll(), Option.VerticalScroll(),
|
||||||
|
Option.Tap(), Option.LongTap(),
|
||||||
|
// Watermarks
|
||||||
|
// Option.OverlayInPreview(watermark),
|
||||||
|
// Option.OverlayInPictureSnapshot(watermark),
|
||||||
|
// Option.OverlayInVideoSnapshot(watermark),
|
||||||
|
// Frame Processing
|
||||||
|
Option.FrameProcessingFormat(),
|
||||||
|
// Other
|
||||||
|
Option.Grid(), Option.GridColor(), Option.UseDeviceOrientation()
|
||||||
|
)
|
||||||
|
val dividers = listOf(
|
||||||
|
// Layout
|
||||||
|
false, true,
|
||||||
|
// Engine and preview
|
||||||
|
false, false, true,
|
||||||
|
// Some controls
|
||||||
|
false, false, false, false, false, true,
|
||||||
|
// Video recording
|
||||||
|
false, false, false, true,
|
||||||
|
// Gestures
|
||||||
|
false, false, false, false, true,
|
||||||
|
// Watermarks
|
||||||
|
// false, false, true,
|
||||||
|
// Frame Processing
|
||||||
|
true,
|
||||||
|
// Other
|
||||||
|
false, false, true
|
||||||
|
)
|
||||||
|
for (i in options.indices) {
|
||||||
|
val view = OptionView<Any>(this)
|
||||||
|
view.setOption(options[i] as Option<Any>, this)
|
||||||
|
view.setHasDivider(dividers[i])
|
||||||
|
group.addView(view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
}
|
||||||
|
controlPanel.viewTreeObserver.addOnGlobalLayoutListener {
|
||||||
|
BottomSheetBehavior.from(controlPanel).state = BottomSheetBehavior.STATE_HIDDEN
|
||||||
|
}
|
||||||
|
|
||||||
|
// Animate the watermark just to show we record the animation in video snapshots
|
||||||
|
val animator = ValueAnimator.ofFloat(1f, 0.8f)
|
||||||
|
animator.duration = 300
|
||||||
|
animator.repeatCount = ValueAnimator.INFINITE
|
||||||
|
animator.repeatMode = ValueAnimator.REVERSE
|
||||||
|
// animator.addUpdateListener { animation ->
|
||||||
|
// val scale = animation.animatedValue as Float
|
||||||
|
// watermark.scaleX = scale
|
||||||
|
// watermark.scaleY = scale
|
||||||
|
// watermark.rotation = watermark.rotation + 2
|
||||||
|
// }
|
||||||
|
animator.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun message(content: String, important: Boolean) {
|
||||||
|
if (important) {
|
||||||
|
LOG.w(content)
|
||||||
|
Toast.makeText(this, content, Toast.LENGTH_LONG).show()
|
||||||
|
} else {
|
||||||
|
LOG.i(content)
|
||||||
|
Toast.makeText(this, content, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private inner class Listener : CameraListener() {
|
||||||
|
override fun onCameraOpened(options: CameraOptions) {
|
||||||
|
val group = controlPanel.getChildAt(0) as ViewGroup
|
||||||
|
for (i in 0 until group.childCount) {
|
||||||
|
val view = group.getChildAt(i) as OptionView<*>
|
||||||
|
view.onCameraOpened(camera, options)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCameraError(exception: CameraException) {
|
||||||
|
super.onCameraError(exception)
|
||||||
|
message("Got CameraException #" + exception.reason, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPictureTaken(result: PictureResult) {
|
||||||
|
super.onPictureTaken(result)
|
||||||
|
if (camera.isTakingVideo) {
|
||||||
|
message("Captured while taking video. Size=" + result.size, false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// This can happen if picture was taken with a gesture.
|
||||||
|
val callbackTime = System.currentTimeMillis()
|
||||||
|
if (captureTime == 0L) captureTime = callbackTime - 300
|
||||||
|
LOG.w("onPictureTaken called! Launching activity. Delay:", callbackTime - captureTime)
|
||||||
|
PicturePreviewActivity.pictureResult = result
|
||||||
|
val intent = Intent(this@MyCamerActivity, PicturePreviewActivity::class.java)
|
||||||
|
intent.putExtra("delay", callbackTime - captureTime)
|
||||||
|
startActivity(intent)
|
||||||
|
captureTime = 0
|
||||||
|
LOG.w("onPictureTaken called! Launched activity.")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onVideoTaken(result: VideoResult) {
|
||||||
|
super.onVideoTaken(result)
|
||||||
|
LOG.w("onVideoTaken called! Launching activity.")
|
||||||
|
VideoPreviewActivity.videoResult = result
|
||||||
|
val intent = Intent(this@MyCamerActivity, VideoPreviewActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
LOG.w("onVideoTaken called! Launched activity.")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onVideoRecordingStart() {
|
||||||
|
super.onVideoRecordingStart()
|
||||||
|
LOG.w("onVideoRecordingStart!")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onVideoRecordingEnd() {
|
||||||
|
super.onVideoRecordingEnd()
|
||||||
|
message("Video taken. Processing...", false)
|
||||||
|
LOG.w("onVideoRecordingEnd!")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onExposureCorrectionChanged(newValue: Float, bounds: FloatArray, fingers: Array<PointF>?) {
|
||||||
|
super.onExposureCorrectionChanged(newValue, bounds, fingers)
|
||||||
|
message("Exposure correction:$newValue", false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onZoomChanged(newValue: Float, bounds: FloatArray, fingers: Array<PointF>?) {
|
||||||
|
super.onZoomChanged(newValue, bounds, fingers)
|
||||||
|
message("Zoom:$newValue", false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(view: View) {
|
||||||
|
when (view.id) {
|
||||||
|
R.id.edit -> edit()
|
||||||
|
R.id.capturePicture -> capturePicture()
|
||||||
|
R.id.capturePictureSnapshot -> capturePictureSnapshot()
|
||||||
|
R.id.btn_switch -> btnSwitch()
|
||||||
|
// R.id.captureVideo -> captureVideo()
|
||||||
|
// R.id.captureVideoSnapshot -> captureVideoSnapshot()
|
||||||
|
// R.id.toggleCamera -> toggleCamera()
|
||||||
|
// R.id.changeFilter -> changeCurrentFilter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
val b = BottomSheetBehavior.from(controlPanel)
|
||||||
|
if (b.state != BottomSheetBehavior.STATE_HIDDEN) {
|
||||||
|
b.state = BottomSheetBehavior.STATE_HIDDEN
|
||||||
|
return
|
||||||
|
}
|
||||||
|
super.onBackPressed()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun edit() {
|
||||||
|
BottomSheetBehavior.from(controlPanel).state = BottomSheetBehavior.STATE_COLLAPSED
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun capturePicture() {
|
||||||
|
if (camera.mode == Mode.VIDEO) return run {
|
||||||
|
message("Can't take HQ pictures while in VIDEO mode.", false)
|
||||||
|
}
|
||||||
|
if (camera.isTakingPicture) return
|
||||||
|
captureTime = System.currentTimeMillis()
|
||||||
|
message("Capturing picture...", false)
|
||||||
|
camera.takePicture()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun capturePictureSnapshot() {
|
||||||
|
if (camera.isTakingPicture) return
|
||||||
|
if (camera.preview != Preview.GL_SURFACE) return run {
|
||||||
|
message("Picture snapshots are only allowed with the GL_SURFACE preview.", true)
|
||||||
|
}
|
||||||
|
captureTime = System.currentTimeMillis()
|
||||||
|
message("Capturing picture snapshot...", false)
|
||||||
|
camera.takePictureSnapshot()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun captureVideo() {
|
||||||
|
if (camera.mode == Mode.PICTURE) return run {
|
||||||
|
message("Can't record HQ videos while in PICTURE mode.", false)
|
||||||
|
}
|
||||||
|
if (camera.isTakingPicture || camera.isTakingVideo) return
|
||||||
|
message("Recording for 5 seconds...", true)
|
||||||
|
camera.takeVideo(File(filesDir, "video.mp4"), 5000)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun captureVideoSnapshot() {
|
||||||
|
if (camera.isTakingVideo) return run {
|
||||||
|
message("Already taking video.", false)
|
||||||
|
}
|
||||||
|
if (camera.preview != Preview.GL_SURFACE) return run {
|
||||||
|
message("Video snapshots are only allowed with the GL_SURFACE preview.", true)
|
||||||
|
}
|
||||||
|
message("Recording snapshot for 5 seconds...", true)
|
||||||
|
camera.takeVideoSnapshot(File(filesDir, "video.mp4"), 5000)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun toggleCamera() {
|
||||||
|
if (camera.isTakingPicture || camera.isTakingVideo) return
|
||||||
|
when (camera.toggleFacing()) {
|
||||||
|
Facing.BACK -> message("Switched to back camera!", false)
|
||||||
|
Facing.FRONT -> message("Switched to front camera!", false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//动态设置地图 相机切换的宽高
|
||||||
|
private fun btnSwitch() {
|
||||||
|
val layoutParams = ivmap.getLayoutParams()
|
||||||
|
val height = layoutParams.height
|
||||||
|
val width = layoutParams.width
|
||||||
|
val layoutParams1 = camera.getLayoutParams()
|
||||||
|
val height1 = layoutParams1.height
|
||||||
|
val width1 = layoutParams1.width
|
||||||
|
if (width > width1) {
|
||||||
|
layoutParams1.height = height
|
||||||
|
layoutParams1.width = width
|
||||||
|
camera.setLayoutParams(layoutParams1)
|
||||||
|
} else {
|
||||||
|
layoutParams.height = height1
|
||||||
|
layoutParams.width = width1
|
||||||
|
ivmap.setLayoutParams(layoutParams1)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun changeCurrentFilter() {
|
||||||
|
if (camera.preview != Preview.GL_SURFACE) return run {
|
||||||
|
message("Filters are supported only when preview is Preview.GL_SURFACE.", true)
|
||||||
|
}
|
||||||
|
if (currentFilter < allFilters.size - 1) {
|
||||||
|
currentFilter++
|
||||||
|
} else {
|
||||||
|
currentFilter = 0
|
||||||
|
}
|
||||||
|
val filter = allFilters[currentFilter]
|
||||||
|
message(filter.toString(), false)
|
||||||
|
|
||||||
|
// Normal behavior:
|
||||||
|
camera.filter = filter.newInstance()
|
||||||
|
|
||||||
|
// To test MultiFilter:
|
||||||
|
// DuotoneFilter duotone = new DuotoneFilter();
|
||||||
|
// duotone.setFirstColor(Color.RED);
|
||||||
|
// duotone.setSecondColor(Color.GREEN);
|
||||||
|
// camera.setFilter(new MultiFilter(duotone, filter.newInstance()));
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun <T : Any> onValueChanged(option: Option<T>, value: T, name: String): Boolean {
|
||||||
|
if (option is Option.Width || option is Option.Height) {
|
||||||
|
val preview = camera.preview
|
||||||
|
val wrapContent = value as Int == ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
if (preview == Preview.SURFACE && !wrapContent) {
|
||||||
|
message("The SurfaceView preview does not support width or height changes. " +
|
||||||
|
"The view will act as WRAP_CONTENT by default.", true)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
option.set(camera, value)
|
||||||
|
BottomSheetBehavior.from(controlPanel).state = BottomSheetBehavior.STATE_HIDDEN
|
||||||
|
message("Changed " + option.name + " to " + name, false)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String?>, grantResults: IntArray) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||||
|
val valid = grantResults.all { it == PackageManager.PERMISSION_GRANTED }
|
||||||
|
if (valid && !camera.isOpened) {
|
||||||
|
camera.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定位的一些初始化设置
|
||||||
|
*/
|
||||||
|
// private fun initLocation() {
|
||||||
|
////用于访问腾讯定位服务的类, 周期性向客户端提供位置更新
|
||||||
|
// locationManager = TencentLocationManager.getInstance(getContext())
|
||||||
|
// //设置坐标系
|
||||||
|
// locationManager.setCoordinateType(TencentLocationManager.COORDINATE_TYPE_GCJ02)
|
||||||
|
// //创建定位请求
|
||||||
|
// locationRequest = TencentLocationRequest.create()
|
||||||
|
// //设置定位周期(位置监听器回调周期)为3s
|
||||||
|
// // locationRequest.setInterval(3000);
|
||||||
|
// //地图上设置定位数据源
|
||||||
|
// tencentMap.setLocationSource(this)
|
||||||
|
// //设置当前位置可见
|
||||||
|
// tencentMap.setMyLocationEnabled(true)
|
||||||
|
// //设置定位图标样式
|
||||||
|
// setLocMarkerStyle()
|
||||||
|
// // locationStyle = locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);
|
||||||
|
// tencentMap.setMyLocationStyle(locationStyle)
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置定位图标样式
|
||||||
|
*/
|
||||||
|
// private fun setLocMarkerStyle() {
|
||||||
|
// locationStyle = MyLocationStyle()
|
||||||
|
// //创建图标
|
||||||
|
// val bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(R.drawable.location))
|
||||||
|
// locationStyle.icon(bitmapDescriptor)
|
||||||
|
// //设置定位圆形区域的边框宽度;
|
||||||
|
// locationStyle.strokeWidth(1)
|
||||||
|
// //设置圆区域的颜色
|
||||||
|
// // locationStyle.fillColor(R.color.colormap);
|
||||||
|
// // locationStyle.anchor(1000,2000);
|
||||||
|
// tencentMap!!.setMyLocationStyle(locationStyle)
|
||||||
|
// }
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
/**
|
||||||
|
* 设置为横屏
|
||||||
|
*/
|
||||||
|
if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
}
|
||||||
|
super.onResume()
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.navinfo.outdoor.api;
|
package com.navinfo.outdoor.api;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.util.SdkFolderCreate;
|
||||||
import com.tencent.map.geolocation.TencentLocation;
|
import com.tencent.map.geolocation.TencentLocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,6 +21,15 @@ public class Constant {
|
|||||||
public static final String GET_ERR_MESSAGE1 = "设备缺少使用腾讯定位服务需要的基本条件";
|
public static final String GET_ERR_MESSAGE1 = "设备缺少使用腾讯定位服务需要的基本条件";
|
||||||
public static final String GET_ERR_MESSAGE2 = "manifest 中配置的 key 不正确";
|
public static final String GET_ERR_MESSAGE2 = "manifest 中配置的 key 不正确";
|
||||||
public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败";
|
public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败";
|
||||||
|
public static final String BASE_FOLDER = SdkFolderCreate.getSDPath()+"/navinfoOutDoor";
|
||||||
|
// 保存图片的目录
|
||||||
|
public static final String PICTURE_FOLDER = BASE_FOLDER+"/picture";
|
||||||
|
// 申请权限的RequestCode
|
||||||
|
public static final int PERMISSION_REQUEST_CODE = 0x100;
|
||||||
|
|
||||||
|
public static final int ROAD_PICTURE = 101;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户当前位置
|
* 用户当前位置
|
||||||
|
@ -1,22 +1,35 @@
|
|||||||
package com.navinfo.outdoor.fragment;
|
package com.navinfo.outdoor.fragment;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Message;
|
||||||
import androidx.fragment.app.Fragment;
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
|
import com.navinfo.outdoor.activity.PictureActivity;
|
||||||
|
import com.navinfo.outdoor.api.Constant;
|
||||||
import com.navinfo.outdoor.base.BaseFragment;
|
import com.navinfo.outdoor.base.BaseFragment;
|
||||||
|
import com.otaliastudios.cameraview.size.AspectRatio;
|
||||||
|
import com.otaliastudios.cameraview.size.SizeSelectors;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 寻宝-点击上传弹窗-道路
|
* 寻宝-点击上传弹窗-道路
|
||||||
*/
|
*/
|
||||||
public class RoadFragment extends BaseFragment implements View.OnClickListener {
|
public class RoadFragment extends BaseFragment implements View.OnClickListener {
|
||||||
|
private TextView tvPictures;
|
||||||
|
private EditText etHeight;
|
||||||
@Override
|
@Override
|
||||||
protected int getLayout() {
|
protected int getLayout() {
|
||||||
return R.layout.fragment_road;
|
return R.layout.fragment_road;
|
||||||
@ -25,15 +38,38 @@ public class RoadFragment extends BaseFragment implements View.OnClickListener {
|
|||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
super.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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
super.initData();
|
super.initData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
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());
|
||||||
|
Log.d("TAG", "onClick: jjjjjj"+etHeight.getText()+"");
|
||||||
|
startActivity(intent);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getContext(), "不能为空", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
16
app/src/main/java/com/navinfo/outdoor/util/PictureName.java
Normal file
16
app/src/main/java/com/navinfo/outdoor/util/PictureName.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package com.navinfo.outdoor.util;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
public class PictureName {
|
||||||
|
public static String pictureDay() {
|
||||||
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
|
String format = formatter.format(calendar.getTime());
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
42
app/src/main/java/com/navinfo/outdoor/util/PictureUtil.java
Normal file
42
app/src/main/java/com/navinfo/outdoor/util/PictureUtil.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package com.navinfo.outdoor.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class PictureUtil {
|
||||||
|
//保存bitmap图片到本地
|
||||||
|
public static void saveBitmap(Bitmap bitmap, Context context, String path, String saveName) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
File dirFile = new File(path);
|
||||||
|
if (!dirFile.exists()) { //如果不存在,那就建立这个文件夹
|
||||||
|
dirFile.mkdirs();
|
||||||
|
}
|
||||||
|
File file = new File(path, saveName);
|
||||||
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
|
||||||
|
fos.flush();
|
||||||
|
fos.close();
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// 把文件插入到系统图库
|
||||||
|
// try {
|
||||||
|
// MediaStore.Images.Media.insertImage(context.getContentResolver(),
|
||||||
|
// file.getAbsolutePath(), fileName, null);
|
||||||
|
// } catch (FileNotFoundException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// // 通知图库更新
|
||||||
|
// context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
|
||||||
|
// Uri.parse("file://" + "/sdcard/namecard/")));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.navinfo.outdoor.util;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.navinfo.outdoor.R;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class SdkFolderCreate {
|
||||||
|
//获取SDK根目录
|
||||||
|
public static String getSDPath() {
|
||||||
|
File sdDir = null;
|
||||||
|
boolean sdCardExist = Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);// 判断sd卡是否存在
|
||||||
|
if (sdCardExist) {
|
||||||
|
sdDir = Environment.getExternalStorageDirectory();// 获取跟目录
|
||||||
|
}
|
||||||
|
return sdDir.toString();
|
||||||
|
}
|
||||||
|
public static String mkdirs(String path) {
|
||||||
|
String sdcard = getSDPath();
|
||||||
|
if (path.indexOf(getSDPath()) == -1) {
|
||||||
|
path = sdcard + (path.indexOf("/") == 0 ? "" : "/") + path;
|
||||||
|
}
|
||||||
|
File destDir = new File(path);
|
||||||
|
if (!destDir.exists()) {
|
||||||
|
boolean result = destDir.mkdirs();
|
||||||
|
System.out.println("文件夹创建:"+result);
|
||||||
|
// path = makedir(path);
|
||||||
|
// if (path == null) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
//创建文件夹
|
||||||
|
private static String makedir(String path) {
|
||||||
|
String sdPath = getSDPath();
|
||||||
|
String[] dirs = path.replace(sdPath, "").split("/");
|
||||||
|
StringBuffer filePath = new StringBuffer(sdPath);
|
||||||
|
for (String dir : dirs) {
|
||||||
|
if (!"".equals(dir) && !dir.equals(sdPath)) {
|
||||||
|
filePath.append("/").append(dir);
|
||||||
|
File destDir = new File(filePath.toString());
|
||||||
|
if (!destDir.exists()) {
|
||||||
|
boolean b = destDir.mkdirs();
|
||||||
|
if (!b) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filePath.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
6
app/src/main/res/drawable/background.xml
Normal file
6
app/src/main/res/drawable/background.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="@color/colorAccent"/>
|
||||||
|
</shape>
|
9
app/src/main/res/drawable/ic_edit.xml
Normal file
9
app/src/main/res/drawable/ic_edit.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||||
|
</vector>
|
6
app/src/main/res/drawable/ic_filters.xml
Normal file
6
app/src/main/res/drawable/ic_filters.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<vector android:height="24dp" android:viewportHeight="480.3"
|
||||||
|
android:viewportWidth="480.3" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FFFFFF" android:pathData="M254.15,234.1V13.5c0,-7.5 -6,-13.5 -13.5,-13.5s-13.5,6 -13.5,13.5v220.6c-31.3,6.3 -55,34 -55,67.2s23.7,60.9 55,67.2v98.2c0,7.5 6,13.5 13.5,13.5s13.5,-6 13.5,-13.5v-98.2c31.3,-6.3 55,-34 55,-67.2C309.15,268.2 285.55,240.4 254.15,234.1zM240.65,342.8c-22.9,0 -41.5,-18.6 -41.5,-41.5s18.6,-41.5 41.5,-41.5s41.5,18.6 41.5,41.5S263.55,342.8 240.65,342.8z"/>
|
||||||
|
<path android:fillColor="#FFFFFF" android:pathData="M88.85,120.9V13.5c0,-7.5 -6,-13.5 -13.5,-13.5s-13.5,6 -13.5,13.5v107.4c-31.3,6.3 -55,34 -55,67.2s23.7,60.9 55,67.2v211.4c0,7.5 6,13.5 13.5,13.5s13.5,-6 13.5,-13.5V255.2c31.3,-6.3 55,-34 55,-67.2S120.15,127.2 88.85,120.9zM75.35,229.6c-22.9,0 -41.5,-18.6 -41.5,-41.5s18.6,-41.5 41.5,-41.5s41.5,18.6 41.5,41.5S98.15,229.6 75.35,229.6z"/>
|
||||||
|
<path android:fillColor="#FFFFFF" android:pathData="M418.45,120.9V13.5c0,-7.5 -6,-13.5 -13.5,-13.5s-13.5,6 -13.5,13.5v107.4c-31.3,6.3 -55,34 -55,67.2s23.7,60.9 55,67.2v211.5c0,7.5 6,13.5 13.5,13.5s13.5,-6 13.5,-13.5V255.2c31.3,-6.3 55,-34 55,-67.2S449.85,127.2 418.45,120.9zM404.95,229.6c-22.9,0 -41.5,-18.6 -41.5,-41.5s18.6,-41.5 41.5,-41.5s41.5,18.6 41.5,41.5S427.85,229.6 404.95,229.6z"/>
|
||||||
|
</vector>
|
12
app/src/main/res/drawable/ic_photo.xml
Normal file
12
app/src/main/res/drawable/ic_photo.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
|
||||||
|
</vector>
|
5
app/src/main/res/drawable/ic_share.xml
Normal file
5
app/src/main/res/drawable/ic_share.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<vector android:autoMirrored="true" android:height="24dp"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FFFFFF" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_switch.xml
Normal file
9
app/src/main/res/drawable/ic_switch.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M20,4h-3.17L15,2L9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM15,15.5L15,13L9,13v2.5L5.5,12 9,8.5L9,11h6L15,8.5l3.5,3.5 -3.5,3.5z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_video.xml
Normal file
9
app/src/main/res/drawable/ic_video.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M17,10.5V7c0,-0.55 -0.45,-1 -1,-1H4c-0.55,0 -1,0.45 -1,1v10c0,0.55 0.45,1 1,1h12c0.55,0 1,-0.45 1,-1v-3.5l4,4v-11l-4,4z"/>
|
||||||
|
</vector>
|
156
app/src/main/res/layout/activity_camera.xml
Normal file
156
app/src/main/res/layout/activity_camera.xml
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#FF444444">
|
||||||
|
<com.otaliastudios.cameraview.CameraView
|
||||||
|
android:id="@+id/camera"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:keepScreenOn="true"
|
||||||
|
app:cameraAudio="on"
|
||||||
|
app:cameraAutoFocusMarker="@string/cameraview_default_autofocus_marker"
|
||||||
|
app:cameraEngine="camera2"
|
||||||
|
app:cameraExperimental="true"
|
||||||
|
app:cameraFacing="back"
|
||||||
|
app:cameraFlash="auto"
|
||||||
|
app:cameraGestureLongTap="none"
|
||||||
|
app:cameraGesturePinch="zoom"
|
||||||
|
app:cameraGestureScrollHorizontal="filterControl1"
|
||||||
|
app:cameraGestureScrollVertical="exposureCorrection"
|
||||||
|
app:cameraGestureTap="autoFocus"
|
||||||
|
app:cameraGrid="off"
|
||||||
|
app:cameraMode="picture"
|
||||||
|
app:cameraPlaySounds="true"
|
||||||
|
app:cameraPreview="glSurface"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/ll_iv"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.0"
|
||||||
|
tools:layout_editor_absoluteX="-76dp">
|
||||||
|
|
||||||
|
</com.otaliastudios.cameraview.CameraView>
|
||||||
|
|
||||||
|
<com.tencent.tencentmap.mapsdk.maps.MapView
|
||||||
|
android:id="@+id/iv_map"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="183dp"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_switch"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:text="切换"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
<Button
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_switch"
|
||||||
|
app:layout_constraintRight_toRightOf="@id/btn_switch"
|
||||||
|
android:id="@+id/btn_video"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="停止" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_pic"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@mipmap/take_pic_arrow"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_iv"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:weightSum="4"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/capturePicture"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
app:srcCompat="@drawable/ic_photo" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/capturePictureSnapshot"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:srcCompat="@drawable/ic_photo" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="SNAP"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/captureVideo"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
app:srcCompat="@drawable/ic_video" />
|
||||||
|
<!-- <LinearLayout-->
|
||||||
|
<!-- android:id="@+id/captureVideoSnapshot"-->
|
||||||
|
<!-- android:layout_width="56dp"-->
|
||||||
|
<!-- android:layout_height="56dp"-->
|
||||||
|
<!-- android:orientation="vertical"-->
|
||||||
|
<!-- android:background="?attr/selectableItemBackgroundBorderless"-->
|
||||||
|
<!-- android:gravity="center" >-->
|
||||||
|
<!-- <ImageView-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- app:srcCompat="@drawable/ic_video"/>-->
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:textColor="@android:color/white"-->
|
||||||
|
<!-- android:textStyle="bold"-->
|
||||||
|
<!-- android:textSize="10sp"-->
|
||||||
|
<!-- android:text="SNAP"/>-->
|
||||||
|
<!-- </LinearLayout>-->
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
93
app/src/main/res/layout/activity_picture.xml
Normal file
93
app/src/main/res/layout/activity_picture.xml
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.PictureActivity">
|
||||||
|
<com.otaliastudios.cameraview.CameraView
|
||||||
|
android:id="@+id/camera"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginBottom="88dp"
|
||||||
|
android:keepScreenOn="true"
|
||||||
|
app:cameraExperimental="true"
|
||||||
|
app:cameraEngine="camera2"
|
||||||
|
app:cameraPreview="glSurface"
|
||||||
|
app:cameraPlaySounds="true"
|
||||||
|
app:cameraGrid="off"
|
||||||
|
app:cameraFlash="auto"
|
||||||
|
app:cameraAudio="on"
|
||||||
|
app:cameraFacing="back"
|
||||||
|
app:cameraGestureTap="autoFocus"
|
||||||
|
app:cameraGestureLongTap="none"
|
||||||
|
app:cameraGesturePinch="zoom"
|
||||||
|
app:cameraGestureScrollHorizontal="filterControl1"
|
||||||
|
app:cameraGestureScrollVertical="exposureCorrection"
|
||||||
|
app:cameraMode="picture"
|
||||||
|
app:cameraAutoFocusMarker="@string/cameraview_default_autofocus_marker">
|
||||||
|
|
||||||
|
|
||||||
|
</com.otaliastudios.cameraview.CameraView>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- Controls -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:weightSum="4">
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/capturePicture"
|
||||||
|
android:layout_width="56dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
app:srcCompat="@drawable/ic_photo" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Edit -->
|
||||||
|
<!-- <androidx.core.widget.NestedScrollView-->
|
||||||
|
<!-- android:id="@+id/controls"-->
|
||||||
|
<!-- android:background="@android:color/white"-->
|
||||||
|
<!-- app:layout_behavior="@string/bottom_sheet_behavior"-->
|
||||||
|
<!-- app:behavior_hideable="true"-->
|
||||||
|
<!-- app:behavior_peekHeight="300dp"-->
|
||||||
|
<!-- app:behavior_skipCollapsed="false"-->
|
||||||
|
<!-- android:elevation="4dp"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content">-->
|
||||||
|
<!-- <LinearLayout-->
|
||||||
|
<!-- android:orientation="vertical"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content"/>-->
|
||||||
|
<!-- </androidx.core.widget.NestedScrollView>-->
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -131,12 +131,23 @@
|
|||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:background="@null" />
|
android:background="@null" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<!--<LinearLayout-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@+id/ll_name"-->
|
||||||
|
<!-- android:orientation="horizontal">-->
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:text="02.拍照方式"-->
|
||||||
|
<!-- -->
|
||||||
|
<!--</LinearLayout>-->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_pictures"
|
android:id="@+id/ll_pictures"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="20dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintLeft_toLeftOf="@id/tv_message"
|
app:layout_constraintLeft_toLeftOf="@id/tv_message"
|
||||||
app:layout_constraintTop_toBottomOf="@id/ll_name">
|
app:layout_constraintTop_toBottomOf="@id/ll_name">
|
||||||
@ -158,22 +169,39 @@
|
|||||||
android:text="拍照"
|
android:text="拍照"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_height"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:digits="1234567890"
|
||||||
|
android:hint="请输入高度"
|
||||||
|
android:inputType="number" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_road_picture"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
app:layout_constraintLeft_toLeftOf="@id/ll_pictures"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/ll_pictures" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_desc"
|
android:id="@+id/ll_desc"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintLeft_toLeftOf="@id/iv_road_picture"
|
||||||
app:layout_constraintLeft_toLeftOf="@id/ll_pictures"
|
app:layout_constraintTop_toBottomOf="@id/iv_road_picture">
|
||||||
app:layout_constraintTop_toBottomOf="@id/ll_pictures">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="20dp"
|
||||||
android:text="03.描述"
|
android:text="03.描述"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
@ -186,14 +214,13 @@
|
|||||||
android:background="@drawable/road_shape"
|
android:background="@drawable/road_shape"
|
||||||
android:hint=" 任务描述"
|
android:hint=" 任务描述"
|
||||||
android:paddingBottom="50dp"
|
android:paddingBottom="50dp"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_marginTop="30dp"
|
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintTop_toBottomOf="@id/ll_desc">
|
app:layout_constraintTop_toBottomOf="@id/ll_desc">
|
||||||
|
39
app/src/main/res/layout/option_view.xml
Normal file
39
app/src/main/res/layout/option_view.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<merge
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/TextAppearance.AppCompat.Subhead"
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/content"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/divider"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="#44AAAAAA" />
|
||||||
|
|
||||||
|
|
||||||
|
</merge>
|
8
app/src/main/res/layout/spinner_text.xml
Normal file
8
app/src/main/res/layout/spinner_text.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<TextView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
style="@style/TextAppearance.AppCompat.Medium"
|
||||||
|
android:padding="12dp"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
8
app/src/main/res/menu/share.xml
Normal file
8
app/src/main/res/menu/share.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item android:id="@+id/share"
|
||||||
|
android:title="Share"
|
||||||
|
app:showAsAction="always"
|
||||||
|
android:icon="@drawable/ic_share"/>
|
||||||
|
</menu>
|
BIN
app/src/main/res/mipmap-hdpi/logo_foreground.png
Normal file
BIN
app/src/main/res/mipmap-hdpi/logo_foreground.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
BIN
app/src/main/res/mipmap-ldpi/take_pic_arrow.png
Normal file
BIN
app/src/main/res/mipmap-ldpi/take_pic_arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
181
app/src/main/res/values/attrs.xml
Normal file
181
app/src/main/res/values/attrs.xml
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<declare-styleable name="CameraView">
|
||||||
|
<attr name="cameraPictureSizeMinWidth" format="integer|reference"/>
|
||||||
|
<attr name="cameraPictureSizeMaxWidth" format="integer|reference"/>
|
||||||
|
<attr name="cameraPictureSizeMinHeight" format="integer|reference"/>
|
||||||
|
<attr name="cameraPictureSizeMaxHeight" format="integer|reference"/>
|
||||||
|
<attr name="cameraPictureSizeMinArea" format="integer|reference" />
|
||||||
|
<attr name="cameraPictureSizeMaxArea" format="integer|reference" />
|
||||||
|
<attr name="cameraPictureSizeSmallest" format="boolean"/>
|
||||||
|
<attr name="cameraPictureSizeBiggest" format="boolean"/>
|
||||||
|
<attr name="cameraPictureSizeAspectRatio" format="string|reference"/>
|
||||||
|
|
||||||
|
<attr name="cameraVideoSizeMinWidth" format="integer|reference"/>
|
||||||
|
<attr name="cameraVideoSizeMaxWidth" format="integer|reference"/>
|
||||||
|
<attr name="cameraVideoSizeMinHeight" format="integer|reference"/>
|
||||||
|
<attr name="cameraVideoSizeMaxHeight" format="integer|reference"/>
|
||||||
|
<attr name="cameraVideoSizeMinArea" format="integer|reference" />
|
||||||
|
<attr name="cameraVideoSizeMaxArea" format="integer|reference" />
|
||||||
|
<attr name="cameraVideoSizeSmallest" format="boolean"/>
|
||||||
|
<attr name="cameraVideoSizeBiggest" format="boolean"/>
|
||||||
|
<attr name="cameraVideoSizeAspectRatio" format="string|reference"/>
|
||||||
|
|
||||||
|
<attr name="cameraSnapshotMaxWidth" format="integer|reference" />
|
||||||
|
<attr name="cameraSnapshotMaxHeight" format="integer|reference" />
|
||||||
|
|
||||||
|
<attr name="cameraFrameProcessingMaxWidth" format="integer|reference" />
|
||||||
|
<attr name="cameraFrameProcessingMaxHeight" format="integer|reference" />
|
||||||
|
<attr name="cameraFrameProcessingFormat" format="integer|reference" />
|
||||||
|
<attr name="cameraFrameProcessingPoolSize" format="integer|reference" />
|
||||||
|
<attr name="cameraFrameProcessingExecutors" format="integer|reference" />
|
||||||
|
|
||||||
|
<attr name="cameraVideoBitRate" format="integer|reference" />
|
||||||
|
<attr name="cameraAudioBitRate" format="integer|reference" />
|
||||||
|
<attr name="cameraPreviewFrameRate" format="integer|reference" />
|
||||||
|
<attr name="cameraPreviewFrameRateExact" format="boolean" />
|
||||||
|
|
||||||
|
<attr name="cameraGestureTap" format="enum">
|
||||||
|
<enum name="none" value="0" />
|
||||||
|
<enum name="autoFocus" value="1" />
|
||||||
|
<enum name="takePicture" value="2" />
|
||||||
|
<enum name="takePictureSnapshot" value="3" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraGestureLongTap" format="enum">
|
||||||
|
<enum name="none" value="0" />
|
||||||
|
<enum name="autoFocus" value="1" />
|
||||||
|
<enum name="takePicture" value="2" />
|
||||||
|
<enum name="takePictureSnapshot" value="3" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraGesturePinch" format="enum">
|
||||||
|
<enum name="none" value="0" />
|
||||||
|
<enum name="zoom" value="4" />
|
||||||
|
<enum name="exposureCorrection" value="5" />
|
||||||
|
<enum name="filterControl1" value="6" />
|
||||||
|
<enum name="filterControl2" value="7" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraGestureScrollHorizontal" format="enum">
|
||||||
|
<enum name="none" value="0" />
|
||||||
|
<enum name="zoom" value="4" />
|
||||||
|
<enum name="exposureCorrection" value="5" />
|
||||||
|
<enum name="filterControl1" value="6" />
|
||||||
|
<enum name="filterControl2" value="7" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraGestureScrollVertical" format="enum">
|
||||||
|
<enum name="none" value="0" />
|
||||||
|
<enum name="zoom" value="4" />
|
||||||
|
<enum name="exposureCorrection" value="5" />
|
||||||
|
<enum name="filterControl1" value="6" />
|
||||||
|
<enum name="filterControl2" value="7" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraEngine" format="enum">
|
||||||
|
<enum name="camera1" value="0" />
|
||||||
|
<enum name="camera2" value="1" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraPreview" format="enum">
|
||||||
|
<enum name="surface" value="0" />
|
||||||
|
<enum name="texture" value="1" />
|
||||||
|
<enum name="glSurface" value="2" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraFacing" format="enum">
|
||||||
|
<enum name="back" value="0" />
|
||||||
|
<enum name="front" value="1" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraHdr" format="enum">
|
||||||
|
<enum name="off" value="0" />
|
||||||
|
<enum name="on" value="1" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraFlash" format="enum">
|
||||||
|
<enum name="off" value="0" />
|
||||||
|
<enum name="on" value="1" />
|
||||||
|
<enum name="auto" value="2" />
|
||||||
|
<enum name="torch" value="3" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraWhiteBalance" format="enum">
|
||||||
|
<enum name="auto" value="0" />
|
||||||
|
<enum name="incandescent" value="1" />
|
||||||
|
<enum name="fluorescent" value="2" />
|
||||||
|
<enum name="daylight" value="3" />
|
||||||
|
<enum name="cloudy" value="4" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraMode" format="enum">
|
||||||
|
<enum name="picture" value="0" />
|
||||||
|
<enum name="video" value="1" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraAudio" format="enum">
|
||||||
|
<enum name="off" value="0" />
|
||||||
|
<enum name="on" value="1" />
|
||||||
|
<enum name="mono" value="2" />
|
||||||
|
<enum name="stereo" value="3" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraGrid" format="enum">
|
||||||
|
<enum name="off" value="0" />
|
||||||
|
<enum name="draw3x3" value="1" />
|
||||||
|
<enum name="draw4x4" value="2" />
|
||||||
|
<enum name="drawPhi" value="3" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraGridColor" format="color|reference"/>
|
||||||
|
|
||||||
|
<attr name="cameraPlaySounds" format="boolean" />
|
||||||
|
|
||||||
|
<attr name="cameraVideoMaxSize" format="float" />
|
||||||
|
|
||||||
|
<attr name="cameraVideoMaxDuration" format="integer" />
|
||||||
|
|
||||||
|
<attr name="cameraVideoCodec" format="enum">
|
||||||
|
<enum name="deviceDefault" value="0" />
|
||||||
|
<enum name="h263" value="1" />
|
||||||
|
<enum name="h264" value="2" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraAudioCodec" format="enum">
|
||||||
|
<enum name="deviceDefault" value="0" />
|
||||||
|
<enum name="aac" value="1" />
|
||||||
|
<enum name="heAac" value="2" />
|
||||||
|
<enum name="aacEld" value="3" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraAutoFocusResetDelay" format="integer|reference"/>
|
||||||
|
|
||||||
|
<attr name="cameraAutoFocusMarker" format="string|reference"/>
|
||||||
|
|
||||||
|
<attr name="cameraFilter" format="string|reference"/>
|
||||||
|
|
||||||
|
<attr name="cameraUseDeviceOrientation" format="boolean"/>
|
||||||
|
|
||||||
|
<attr name="cameraPictureMetering" format="boolean|reference"/>
|
||||||
|
<attr name="cameraPictureSnapshotMetering" format="boolean|reference"/>
|
||||||
|
|
||||||
|
<attr name="cameraPictureFormat" format="enum">
|
||||||
|
<enum name="jpeg" value="0" />
|
||||||
|
<enum name="dng" value="1" />
|
||||||
|
</attr>
|
||||||
|
|
||||||
|
<attr name="cameraRequestPermissions" format="boolean|reference"/>
|
||||||
|
<attr name="cameraExperimental" format="boolean|reference" />
|
||||||
|
|
||||||
|
<attr name="cameraDrawHardwareOverlays" format="boolean"/>
|
||||||
|
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
|
<declare-styleable name="CameraView_Layout">
|
||||||
|
<attr name="layout_drawOnPreview" format="boolean"/>
|
||||||
|
<attr name="layout_drawOnPictureSnapshot" format="boolean"/>
|
||||||
|
<attr name="layout_drawOnVideoSnapshot" format="boolean"/>
|
||||||
|
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
@ -1,5 +1,7 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
buildscript {
|
buildscript {
|
||||||
|
ext.anko_version = '0.10.1'//扩展库版本
|
||||||
|
// ext.kotlin_coroutines = '1.4.1'//协程版本需要findById()...
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
@ -13,6 +15,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.android.tools.build:gradle:4.0.0"
|
classpath "com.android.tools.build:gradle:4.0.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user