hsiao 7 years ago
commit
db635e9ff6
60 changed files with 2004 additions and 0 deletions
  1. 9
    0
      .gitignore
  2. 18
    0
      .idea/gradle.xml
  3. 33
    0
      .idea/misc.xml
  4. 9
    0
      .idea/modules.xml
  5. 12
    0
      .idea/runConfigurations.xml
  6. 1
    0
      app/.gitignore
  7. 25
    0
      app/build.gradle
  8. 21
    0
      app/proguard-rules.pro
  9. 26
    0
      app/src/androidTest/java/cn/gov/gxch/abc/noapp/ExampleInstrumentedTest.java
  10. 39
    0
      app/src/main/AndroidManifest.xml
  11. 128
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/AudioRecordActivity.java
  12. 170
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/CameraActivity.java
  13. 69
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/CameraPreview.java
  14. 107
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/DrawPanel.java
  15. 103
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/LocationActivity.java
  16. 21
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/LoginActivity.java
  17. 22
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/MainActivity.java
  18. 32
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/MediaPlayerActivity.java
  19. 89
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/OperateMedia.java
  20. 21
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/VideoPlayerActivity2.java
  21. 151
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/VideoRecordActivity.java
  22. 40
    0
      app/src/main/java/cn/gov/gxch/abc/noapp/WebViewActivity.java
  23. 34
    0
      app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  24. 170
    0
      app/src/main/res/drawable/ic_launcher_background.xml
  25. 9
    0
      app/src/main/res/layout/activity_audio_rec.xml
  26. 9
    0
      app/src/main/res/layout/activity_camera.xml
  27. 9
    0
      app/src/main/res/layout/activity_camera2.xml
  28. 17
    0
      app/src/main/res/layout/activity_draw_panel.xml
  29. 32
    0
      app/src/main/res/layout/activity_location.xml
  30. 102
    0
      app/src/main/res/layout/activity_login.xml
  31. 18
    0
      app/src/main/res/layout/activity_main.xml
  32. 9
    0
      app/src/main/res/layout/activity_media_player.xml
  33. 19
    0
      app/src/main/res/layout/activity_record_audio.xml
  34. 35
    0
      app/src/main/res/layout/activity_record_video.xml
  35. 17
    0
      app/src/main/res/layout/activity_video_player2.xml
  36. 13
    0
      app/src/main/res/layout/activity_web_view.xml
  37. 17
    0
      app/src/main/res/layout/camera_layout.xml
  38. 5
    0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  39. 5
    0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  40. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  41. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  42. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.png
  43. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_round.png
  44. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher.png
  45. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
  46. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  47. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
  48. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  49. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  50. 6
    0
      app/src/main/res/values/colors.xml
  51. 3
    0
      app/src/main/res/values/strings.xml
  52. 11
    0
      app/src/main/res/values/styles.xml
  53. 17
    0
      app/src/test/java/cn/gov/gxch/abc/noapp/ExampleUnitTest.java
  54. 27
    0
      build.gradle
  55. 17
    0
      gradle.properties
  56. BIN
      gradle/wrapper/gradle-wrapper.jar
  57. 6
    0
      gradle/wrapper/gradle-wrapper.properties
  58. 160
    0
      gradlew
  59. 90
    0
      gradlew.bat
  60. 1
    0
      settings.gradle

+ 9
- 0
.gitignore View File

@@ -0,0 +1,9 @@
1
+*.iml
2
+.gradle
3
+/local.properties
4
+/.idea/workspace.xml
5
+/.idea/libraries
6
+.DS_Store
7
+/build
8
+/captures
9
+.externalNativeBuild

+ 18
- 0
.idea/gradle.xml View File

@@ -0,0 +1,18 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="GradleSettings">
4
+    <option name="linkedExternalProjectsSettings">
5
+      <GradleProjectSettings>
6
+        <option name="distributionType" value="DEFAULT_WRAPPED" />
7
+        <option name="externalProjectPath" value="$PROJECT_DIR$" />
8
+        <option name="modules">
9
+          <set>
10
+            <option value="$PROJECT_DIR$" />
11
+            <option value="$PROJECT_DIR$/app" />
12
+          </set>
13
+        </option>
14
+        <option name="resolveModulePerSourceSet" value="false" />
15
+      </GradleProjectSettings>
16
+    </option>
17
+  </component>
18
+</project>

+ 33
- 0
.idea/misc.xml View File

@@ -0,0 +1,33 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="NullableNotNullManager">
4
+    <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
5
+    <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
6
+    <option name="myNullables">
7
+      <value>
8
+        <list size="4">
9
+          <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
10
+          <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
11
+          <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
12
+          <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
13
+        </list>
14
+      </value>
15
+    </option>
16
+    <option name="myNotNulls">
17
+      <value>
18
+        <list size="4">
19
+          <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
20
+          <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
21
+          <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
22
+          <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
23
+        </list>
24
+      </value>
25
+    </option>
26
+  </component>
27
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
28
+    <output url="file://$PROJECT_DIR$/build/classes" />
29
+  </component>
30
+  <component name="ProjectType">
31
+    <option name="id" value="Android" />
32
+  </component>
33
+</project>

+ 9
- 0
.idea/modules.xml View File

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/NoApp.iml" filepath="$PROJECT_DIR$/NoApp.iml" />
6
+      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
7
+    </modules>
8
+  </component>
9
+</project>

+ 12
- 0
.idea/runConfigurations.xml View File

@@ -0,0 +1,12 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="RunConfigurationProducerService">
4
+    <option name="ignoredProducers">
5
+      <set>
6
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
7
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
8
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
9
+      </set>
10
+    </option>
11
+  </component>
12
+</project>

+ 1
- 0
app/.gitignore View File

@@ -0,0 +1 @@
1
+/build

+ 25
- 0
app/build.gradle View File

@@ -0,0 +1,25 @@
1
+apply plugin: 'com.android.application'
2
+
3
+android {
4
+    compileSdkVersion 26
5
+    defaultConfig {
6
+        applicationId "cn.gov.gxch.abc.noapp"
7
+        minSdkVersion 25
8
+        targetSdkVersion 26
9
+        versionCode 1
10
+        versionName "1.0"
11
+        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12
+    }
13
+    buildTypes {
14
+        release {
15
+            minifyEnabled false
16
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17
+        }
18
+    }
19
+}
20
+
21
+dependencies {
22
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
23
+    implementation 'com.android.support:appcompat-v7:26.1.0'
24
+    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
25
+}

+ 21
- 0
app/proguard-rules.pro View File

@@ -0,0 +1,21 @@
1
+# Add project specific ProGuard rules here.
2
+# You can control the set of applied configuration files using the
3
+# proguardFiles setting in build.gradle.
4
+#
5
+# For more details, see
6
+#   http://developer.android.com/guide/developing/tools/proguard.html
7
+
8
+# If your project uses WebView with JS, uncomment the following
9
+# and specify the fully qualified class name to the JavaScript interface
10
+# class:
11
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12
+#   public *;
13
+#}
14
+
15
+# Uncomment this to preserve the line number information for
16
+# debugging stack traces.
17
+#-keepattributes SourceFile,LineNumberTable
18
+
19
+# If you keep the line number information, uncomment this to
20
+# hide the original source file name.
21
+#-renamesourcefileattribute SourceFile

+ 26
- 0
app/src/androidTest/java/cn/gov/gxch/abc/noapp/ExampleInstrumentedTest.java View File

@@ -0,0 +1,26 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import android.content.Context;
4
+import android.support.test.InstrumentationRegistry;
5
+import android.support.test.runner.AndroidJUnit4;
6
+
7
+import org.junit.Test;
8
+import org.junit.runner.RunWith;
9
+
10
+import static org.junit.Assert.*;
11
+
12
+/**
13
+ * Instrumented test, which will execute on an Android device.
14
+ *
15
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16
+ */
17
+@RunWith(AndroidJUnit4.class)
18
+public class ExampleInstrumentedTest {
19
+    @Test
20
+    public void useAppContext() throws Exception {
21
+        // Context of the app under test.
22
+        Context appContext = InstrumentationRegistry.getTargetContext();
23
+
24
+        assertEquals("cn.gov.gxch.abc.noapp", appContext.getPackageName());
25
+    }
26
+}

+ 39
- 0
app/src/main/AndroidManifest.xml View File

@@ -0,0 +1,39 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+    package="cn.gov.gxch.abc.noapp">
4
+
5
+    <uses-feature android:glEsVersion="0x00020000" />
6
+
7
+    <uses-permission android:name="android.permission.INTERNET"/>
8
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
9
+    <uses-permission android:name="android.permission.RECORD_AUDIO" />
10
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
11
+    <uses-permission android:name="android.permission.CAMERA" />
12
+    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
13
+
14
+    <application
15
+        android:allowBackup="true"
16
+        android:icon="@mipmap/ic_launcher"
17
+        android:label="@string/app_name"
18
+        android:roundIcon="@mipmap/ic_launcher_round"
19
+        android:supportsRtl="true"
20
+        android:theme="@style/AppTheme">
21
+        <activity android:name=".MainActivity">
22
+            <intent-filter>
23
+                <action android:name="android.intent.action.MAIN" />
24
+
25
+                <category android:name="android.intent.category.LAUNCHER" />
26
+            </intent-filter>
27
+        </activity>
28
+        <activity android:name=".LoginActivity" />
29
+        <activity android:name=".DrawPanel" />
30
+        <activity android:name=".MediaPlayerActivity" />
31
+        <activity android:name=".AudioRecordActivity" />
32
+        <activity android:name=".VideoRecordActivity" />
33
+        <activity android:name=".VideoPlayerActivity2" />
34
+        <activity android:name=".LocationActivity" />
35
+        <activity android:name=".CameraActivity" />
36
+        <activity android:name=".WebViewActivity" android:theme="@style/Theme.AppCompat.NoActionBar"></activity>
37
+    </application>
38
+
39
+</manifest>

+ 128
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/AudioRecordActivity.java View File

@@ -0,0 +1,128 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import java.io.File;
4
+import android.app.Activity;
5
+import android.media.MediaRecorder;
6
+import android.media.MediaRecorder.OnErrorListener;
7
+import android.os.Bundle;
8
+import android.os.Environment;
9
+import android.view.View;
10
+import android.view.View.OnClickListener;
11
+import android.widget.Button;
12
+import android.widget.Toast;
13
+
14
+import cn.gov.gxch.abc.noapp.R;
15
+
16
+public class AudioRecordActivity extends Activity {
17
+    private Button btn_RecordStart, btn_RecordStop;
18
+    private MediaRecorder mediaRecorder;
19
+    private boolean isRecording;
20
+    @Override
21
+    protected void onCreate(Bundle savedInstanceState) {
22
+        // TODO Auto-generated method stub
23
+        super.onCreate(savedInstanceState);
24
+        setContentView(R.layout.activity_record_audio);
25
+
26
+        btn_RecordStart = (Button) findViewById(R.id.btn_audio_RecordStart);
27
+        btn_RecordStop = (Button) findViewById(R.id.btn_audio_RecordStop);
28
+
29
+        btn_RecordStop.setEnabled(false);
30
+
31
+        btn_RecordStart.setOnClickListener(click);
32
+        btn_RecordStop.setOnClickListener(click);
33
+    }
34
+
35
+    private View.OnClickListener click = new OnClickListener() {
36
+
37
+        @Override
38
+        public void onClick(View v) {
39
+            switch (v.getId()) {
40
+                case R.id.btn_audio_RecordStart:
41
+                    start();
42
+                    break;
43
+                case R.id.btn_audio_RecordStop:
44
+                    stop();
45
+                    break;
46
+                default:
47
+                    break;
48
+            }
49
+        }
50
+    };
51
+
52
+    /**
53
+     * 开始录音
54
+     */
55
+    protected void start() {
56
+        try {
57
+            Toast.makeText(this,Environment.getExternalStorageDirectory().getPath(),Toast.LENGTH_SHORT).show();
58
+            File file = new File(Environment.getExternalStorageDirectory().getPath()+"/mediarecorder.amr");
59
+            if (file.exists()) {
60
+                // 如果文件存在,删除它,演示代码保证设备上只有一个录音文件
61
+                file.delete();
62
+            }
63
+            mediaRecorder = new MediaRecorder();
64
+            // 设置音频录入源
65
+            mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
66
+            // 设置录制音频的输出格式
67
+            mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
68
+            // 设置音频的编码格式
69
+            mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
70
+            // 设置录制音频文件输出文件路径
71
+            mediaRecorder.setOutputFile(file.getAbsolutePath());
72
+
73
+            mediaRecorder.setOnErrorListener(new OnErrorListener() {
74
+
75
+                @Override
76
+                public void onError(MediaRecorder mr, int what, int extra) {
77
+                    // 发生错误,停止录制
78
+                    mediaRecorder.stop();
79
+                    mediaRecorder.release();
80
+                    mediaRecorder = null;
81
+                    isRecording=false;
82
+                    btn_RecordStart.setEnabled(true);
83
+                    btn_RecordStop.setEnabled(false);
84
+                    Toast.makeText(AudioRecordActivity.this, "录音发生错误", Toast.LENGTH_SHORT).show();
85
+                }
86
+            });
87
+
88
+            // 准备、开始
89
+            mediaRecorder.prepare();
90
+            mediaRecorder.start();
91
+
92
+            isRecording=true;
93
+            btn_RecordStart.setEnabled(false);
94
+            btn_RecordStop.setEnabled(true);
95
+            Toast.makeText(AudioRecordActivity.this, "开始录音",Toast.LENGTH_SHORT).show();
96
+        } catch (Exception e) {
97
+            e.printStackTrace();
98
+        }
99
+    }
100
+
101
+    /**
102
+     * 录音结束
103
+     */
104
+    protected void stop() {
105
+        if (isRecording) {
106
+            // 如果正在录音,停止并释放资源
107
+            mediaRecorder.stop();
108
+            mediaRecorder.release();
109
+            mediaRecorder = null;
110
+            isRecording=false;
111
+            btn_RecordStart.setEnabled(true);
112
+            btn_RecordStop.setEnabled(false);
113
+            Toast.makeText(AudioRecordActivity.this, "录音结束", Toast.LENGTH_SHORT).show();
114
+        }
115
+    }
116
+
117
+    @Override
118
+    protected void onDestroy() {
119
+        if (isRecording) {
120
+            // 如果正在录音,停止并释放资源
121
+            mediaRecorder.stop();
122
+            mediaRecorder.release();
123
+            mediaRecorder = null;
124
+        }
125
+        super.onDestroy();
126
+    }
127
+
128
+}

+ 170
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/CameraActivity.java View File

@@ -0,0 +1,170 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import android.graphics.Bitmap;
4
+import android.graphics.BitmapFactory;
5
+import android.graphics.ImageFormat;
6
+import android.hardware.Camera;
7
+import android.os.Bundle;
8
+import android.support.v7.app.AppCompatActivity;
9
+import android.view.SurfaceHolder;
10
+import android.view.SurfaceView;
11
+import android.view.View;
12
+import android.widget.ImageView;
13
+import android.widget.Toast;
14
+
15
+import java.io.FileOutputStream;
16
+import java.io.IOException;
17
+
18
+import cn.gov.gxch.abc.noapp.R;
19
+
20
+public class CameraActivity extends AppCompatActivity implements View.OnClickListener {
21
+
22
+    private SurfaceView mSurfaceView;
23
+    private SurfaceHolder mSurfaceHolder;
24
+    private Camera mCamera;
25
+    private ImageView iv_show;
26
+    private int viewWidth, viewHeight;//mSurfaceView的宽和高
27
+
28
+    @Override
29
+    protected void onCreate(Bundle savedInstanceState) {
30
+        super.onCreate(savedInstanceState);
31
+        setContentView(R.layout.camera_layout);
32
+        initView();
33
+    }
34
+
35
+    /**
36
+     * 初始化控件
37
+     */
38
+    private void initView() {
39
+        iv_show = (ImageView) findViewById(R.id.iv_show_camera2_activity);
40
+        //mSurfaceView
41
+        mSurfaceView = (SurfaceView) findViewById(R.id.surface_view_camera2_activity);
42
+        mSurfaceHolder = mSurfaceView.getHolder();
43
+        // mSurfaceView 不需要自己的缓冲区
44
+        mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
45
+        // mSurfaceView添加回调
46
+        mSurfaceHolder.addCallback(new SurfaceHolder.Callback() {
47
+            @Override
48
+            public void surfaceCreated(SurfaceHolder holder) { //SurfaceView创建
49
+                // 初始化Camera
50
+                initCamera();
51
+            }
52
+
53
+            @Override
54
+            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
55
+            }
56
+
57
+            @Override
58
+            public void surfaceDestroyed(SurfaceHolder holder) { //SurfaceView销毁
59
+                // 释放Camera资源
60
+                if (mCamera != null) {
61
+                    mCamera.stopPreview();
62
+                    mCamera.release();
63
+                }
64
+            }
65
+        });
66
+        //设置点击监听
67
+        mSurfaceView.setOnClickListener(this);
68
+    }
69
+
70
+    @Override
71
+    public void onWindowFocusChanged(boolean hasFocus) {
72
+        super.onWindowFocusChanged(hasFocus);
73
+        if (mSurfaceView != null) {
74
+            viewWidth = mSurfaceView.getWidth();
75
+            viewHeight = mSurfaceView.getHeight();
76
+        }
77
+    }
78
+
79
+    /**
80
+     * SurfaceHolder 回调接口方法
81
+     */
82
+    private void initCamera() {
83
+        mCamera = Camera.open();//默认开启后置
84
+        mCamera.setDisplayOrientation(90);//摄像头进行旋转90°
85
+        if (mCamera != null) {
86
+            try {
87
+                Camera.Parameters parameters = mCamera.getParameters();
88
+                //设置预览照片的大小
89
+                parameters.setPreviewFpsRange(viewWidth, viewHeight);
90
+                //设置相机预览照片帧数
91
+                parameters.setPreviewFpsRange(4, 10);
92
+                //设置图片格式
93
+                parameters.setPictureFormat(ImageFormat.JPEG);
94
+                //设置图片的质量
95
+                parameters.set("jpeg-quality", 90);
96
+                //设置照片的大小
97
+                parameters.setPictureSize(viewWidth, viewHeight);
98
+                //通过SurfaceView显示预览
99
+                mCamera.setPreviewDisplay(mSurfaceHolder);
100
+                //开始预览
101
+                mCamera.startPreview();
102
+            } catch (IOException e) {
103
+                e.printStackTrace();
104
+            }
105
+        }
106
+    }
107
+
108
+    /**
109
+     * 点击回调方法
110
+     */
111
+    @Override
112
+    public void onClick(View v) {
113
+        if (mCamera == null) return;
114
+        //自动对焦后拍照
115
+        mCamera.autoFocus(autoFocusCallback);
116
+
117
+    }
118
+
119
+    private void savePictureData(byte[] data){
120
+        try {
121
+            FileOutputStream outputStream = new FileOutputStream("/sdcard/test.jpg");
122
+            outputStream.write(data);
123
+            outputStream.close();
124
+        }catch (Exception ex){
125
+            ex.printStackTrace();
126
+        }
127
+    }
128
+
129
+    /**
130
+     * 自动对焦 对焦成功后 就进行拍照
131
+     */
132
+    Camera.AutoFocusCallback autoFocusCallback = new Camera.AutoFocusCallback() {
133
+        @Override
134
+        public void onAutoFocus(boolean success, Camera camera) {
135
+            if (success) {//对焦成功
136
+                camera.takePicture(new Camera.ShutterCallback() {//按下快门
137
+                    @Override
138
+                    public void onShutter() {
139
+                        //按下快门瞬间的操作
140
+                    }
141
+                }, new Camera.PictureCallback() {
142
+                    @Override
143
+                    public void onPictureTaken(byte[] data, Camera camera) {//是否保存原始图片的信息
144
+
145
+                    }
146
+                }, pictureCallback);
147
+            }
148
+        }
149
+    };
150
+    /**
151
+     * 获取图片
152
+     */
153
+    Camera.PictureCallback pictureCallback = new Camera.PictureCallback() {
154
+        @Override
155
+        public void onPictureTaken(byte[] data, Camera camera) {
156
+            final Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
157
+            if (bitmap == null) {
158
+                Toast.makeText(CameraActivity.this, "拍照失败", Toast.LENGTH_SHORT).show();
159
+            }
160
+             if (bitmap != null && iv_show != null && iv_show.getVisibility() == View.GONE) {
161
+                mCamera.stopPreview();
162
+                iv_show.setVisibility(View.VISIBLE);
163
+                mSurfaceView.setVisibility(View.GONE);
164
+                Toast.makeText(CameraActivity.this, "拍照", Toast.LENGTH_SHORT).show();
165
+                iv_show.setImageBitmap(bitmap);
166
+            }
167
+            savePictureData(data);
168
+        }
169
+    };
170
+}

+ 69
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/CameraPreview.java View File

@@ -0,0 +1,69 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import java.io.IOException;
4
+import android.content.Context;
5
+import android.hardware.Camera;
6
+import android.util.Log;
7
+import android.view.SurfaceHolder;
8
+import android.view.SurfaceView;
9
+
10
+/**
11
+ * 定义一个预览类
12
+ */
13
+public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
14
+    private static final String TAG = "main";
15
+    private SurfaceHolder mHolder;
16
+    private Camera mCamera;
17
+
18
+    public CameraPreview(Context context, Camera camera) {
19
+        super(context);
20
+        mCamera = camera;
21
+
22
+        // 通过SurfaceView获得SurfaceHolder
23
+        mHolder = getHolder();
24
+        // 为SurfaceHolder指定回调
25
+        mHolder.addCallback(this);
26
+        // 设置Surface不维护自己的缓冲区,而是等待屏幕的渲染引擎将内容推送到界面 在Android3.0之后弃用
27
+        mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
28
+    }
29
+
30
+    public void surfaceCreated(SurfaceHolder holder) {
31
+        // 当Surface被创建之后,开始Camera的预览
32
+        try {
33
+            mCamera.setPreviewDisplay(holder);
34
+            mCamera.startPreview();
35
+        } catch (IOException e) {
36
+            Log.d(TAG, "预览失败");
37
+        }
38
+    }
39
+
40
+    public void surfaceDestroyed(SurfaceHolder holder) {
41
+
42
+    }
43
+
44
+    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
45
+        // Surface发生改变的时候将被调用,第一次显示到界面的时候也会被调用
46
+        if (mHolder.getSurface() == null){
47
+            // 如果Surface为空,不继续操作
48
+            return;
49
+        }
50
+
51
+        // 停止Camera的预览
52
+        try {
53
+            mCamera.stopPreview();
54
+        } catch (Exception e){
55
+            Log.d(TAG, "当Surface改变后,停止预览出错");
56
+        }
57
+
58
+        // 在预览前可以指定Camera的各项参数
59
+
60
+        // 重新开始预览
61
+        try {
62
+            mCamera.setPreviewDisplay(mHolder);
63
+            mCamera.startPreview();
64
+
65
+        } catch (Exception e){
66
+            Log.d(TAG, "预览Camera出错");
67
+        }
68
+    }
69
+}

+ 107
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/DrawPanel.java View File

@@ -0,0 +1,107 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import android.opengl.GLSurfaceView;
4
+import android.support.v7.app.AppCompatActivity;
5
+import android.os.Bundle;
6
+import android.view.SurfaceView;
7
+
8
+import java.nio.ByteBuffer;
9
+import java.nio.ByteOrder;
10
+import java.nio.FloatBuffer;
11
+import java.nio.IntBuffer;
12
+
13
+import javax.microedition.khronos.egl.EGLConfig;
14
+import javax.microedition.khronos.opengles.GL10;
15
+
16
+public class DrawPanel extends AppCompatActivity {
17
+
18
+     private float rotateTri = 0.5f;
19
+     private GLSurfaceView surfaceView;
20
+
21
+    int one=0x10000;
22
+    private FloatBuffer vertTri;
23
+    private FloatBuffer vertColor;
24
+//    //三角形的一个顶点
25
+//    private IntBuffer triggerBuffer=IntBuffer.wrap(new int[]{
26
+//            0,one,0,     //上顶点
27
+//            -one,-one,0,    //左顶点
28
+//            one,-one,0    //右下点
29
+//    });
30
+//
31
+//    private IntBuffer colorBuffer=IntBuffer.wrap(new int[]{
32
+//            one,0,0,one,
33
+//            0,one,0,one,
34
+//            0,0,one,one
35
+//    });
36
+//
37
+
38
+
39
+    @Override
40
+    protected void onCreate(Bundle savedInstanceState) {
41
+        super.onCreate(savedInstanceState);
42
+        this.surfaceView = new GLSurfaceView(this);
43
+        this.surfaceView.setRenderer(new MyRenderer());
44
+        this.setContentView(this.surfaceView);
45
+
46
+        ByteBuffer vert = ByteBuffer.allocateDirect(36);
47
+        vert.order(ByteOrder.nativeOrder());
48
+        vertTri = vert.asFloatBuffer();
49
+        vertTri.put(new float[]{
50
+                0,0,0,     //上顶点
51
+                -1f,-1f,0,    //左顶点
52
+                1f,-1f,0    //右下点
53
+        });
54
+
55
+        ByteBuffer vert2 = ByteBuffer.allocateDirect(48);
56
+        vert2.order(ByteOrder.nativeOrder());
57
+        vertColor = vert2.asFloatBuffer();
58
+        vertColor.put(new float[]{
59
+                1,0,0,one,
60
+                0,1,0,one,
61
+                0,0,1,one
62
+        });
63
+
64
+    }
65
+
66
+    private class MyRenderer implements GLSurfaceView.Renderer {
67
+        @Override
68
+        public void onSurfaceCreated(GL10 gl, EGLConfig eglConfig) {
69
+            gl.glClearColor(0f, 0.5f, 0f, 0f);
70
+        }
71
+
72
+        @Override
73
+        public void onSurfaceChanged(GL10 gl, int width, int height) {
74
+            gl.glViewport(0, 0, 50, 50);
75
+        }
76
+
77
+        float r,g,b;
78
+        @Override
79
+        public void onDrawFrame(GL10 gl) {
80
+            gl.glClearColor(r, g, b, 0f);
81
+            r= r+0.001f;
82
+            g = g+0.0001f;
83
+            b = b +0.002f;
84
+
85
+            gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
86
+            gl.glLoadIdentity();
87
+
88
+//            // 左移 1.5 单位,并移入屏幕 6.0
89
+//            gl.glTranslatef(-1.5f, 0.0f, -6.0f);
90
+//            //设置旋转
91
+//            gl.glRotatef(rotateTri, 0.0f, 1.0f, 0.0f);
92
+//            //设置定点数组
93
+            gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
94
+//            //设置颜色数组
95
+           gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
96
+            gl.glColorPointer(4, GL10.GL_FIXED, 0, vertColor);
97
+//            // 设置三角形顶点
98
+            gl.glVertexPointer(3, GL10.GL_FIXED, 0, vertTri);
99
+
100
+//            //绘制三角形
101
+           gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 3);
102
+           gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
103
+//            //绘制三角形结束
104
+            gl.glFinish();
105
+        }
106
+    }
107
+}

+ 103
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/LocationActivity.java View File

@@ -0,0 +1,103 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import android.Manifest;
4
+import android.content.Context;
5
+import android.content.pm.PackageManager;
6
+import android.location.Location;
7
+import android.location.LocationListener;
8
+import android.location.LocationManager;
9
+import android.location.LocationProvider;
10
+import android.support.annotation.NonNull;
11
+import android.support.v4.app.ActivityCompat;
12
+import android.support.v7.app.AppCompatActivity;
13
+import android.os.Bundle;
14
+import android.util.Log;
15
+import android.view.View;
16
+import android.widget.Button;
17
+import android.widget.EditText;
18
+import android.widget.TextView;
19
+import android.widget.Toast;
20
+
21
+import java.util.List;
22
+
23
+public class LocationActivity extends AppCompatActivity implements LocationListener{
24
+
25
+    private final String TAG = "Noapp";
26
+    private LocationManager locationMgr;
27
+    private String locationProvider;
28
+    private TextView txtLocationInfo;
29
+    private Button getBtn;
30
+    @Override
31
+    protected void onCreate(Bundle savedInstanceState) {
32
+        super.onCreate(savedInstanceState);
33
+        setContentView(R.layout.activity_location);
34
+        this.txtLocationInfo = findViewById(R.id.txt_location_info);
35
+        this.getBtn = findViewById(R.id.btn_get_location);
36
+        locationMgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
37
+
38
+        List<String> locationProviders = locationMgr.getProviders(true);
39
+        Log.i(TAG, "可用位置服务:" + locationProviders);
40
+        if (locationProviders.contains(LocationManager.GPS_PROVIDER)) {
41
+            this.locationProvider = LocationManager.GPS_PROVIDER;
42
+        } else if(locationProviders.contains(LocationManager.NETWORK_PROVIDER)){
43
+            this.locationProvider = LocationManager.NETWORK_PROVIDER;
44
+        }else{
45
+            Log.e(TAG,"没有位置服务提供");
46
+            return;
47
+        }
48
+
49
+        getBtn.setOnClickListener(new View.OnClickListener() {
50
+            @Override
51
+            public void onClick(View view) {
52
+                if (ActivityCompat.checkSelfPermission(LocationActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(LocationActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
53
+                    requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION},0);
54
+                    return;
55
+                }
56
+
57
+                Location lastLocation = locationMgr.getLastKnownLocation(locationProvider);
58
+
59
+                updateLocationText(lastLocation);
60
+            }
61
+        });
62
+
63
+        locationMgr.requestLocationUpdates(locationProvider,1000L,0.0001f, this);
64
+
65
+    }
66
+
67
+    private  void updateLocationText(Location loc){
68
+        StringBuffer buf = new StringBuffer();
69
+        buf.append("经度:")
70
+                .append(loc.getLongitude())
71
+                .append(", 纬度:"+loc.getLatitude())
72
+                .append(",速度:"+loc.getSpeed())
73
+                .append(",精度:"+loc.getAccuracy());
74
+
75
+        txtLocationInfo.setText(buf.toString());
76
+    }
77
+
78
+    @Override
79
+    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
80
+        
81
+    }
82
+
83
+    @Override
84
+    public void onLocationChanged(Location location) {
85
+        updateLocationText(location);
86
+    }
87
+
88
+    @Override
89
+    public void onStatusChanged(String s, int i, Bundle bundle) {
90
+        Toast.makeText(this,"status: "+s,Toast.LENGTH_LONG).show();
91
+
92
+    }
93
+
94
+    @Override
95
+    public void onProviderEnabled(String s) {
96
+        Toast.makeText(this,"位置服务已启用",Toast.LENGTH_LONG).show();
97
+    }
98
+
99
+    @Override
100
+    public void onProviderDisabled(String s) {
101
+        Toast.makeText(this,"位置服务已不可用",Toast.LENGTH_LONG).show();
102
+    }
103
+}

+ 21
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/LoginActivity.java View File

@@ -0,0 +1,21 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import android.support.v7.app.AppCompatActivity;
4
+import android.os.Bundle;
5
+import android.widget.Button;
6
+import android.widget.EditText;
7
+
8
+public class LoginActivity extends AppCompatActivity {
9
+
10
+    @Override
11
+    protected void onCreate(Bundle savedInstanceState) {
12
+        super.onCreate(savedInstanceState);
13
+        setContentView(R.layout.activity_login);
14
+        EditText txtAccount = this.findViewById(R.id.txt_account);
15
+        EditText txtPasswd = this.findViewById(R.id.txt_passwd);
16
+        EditText txtVCode = this.findViewById(R.id.txt_vcode);
17
+        Button btnLogin = this.findViewById(R.id.btn_login);
18
+
19
+
20
+    }
21
+}

+ 22
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/MainActivity.java View File

@@ -0,0 +1,22 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import android.content.Intent;
4
+import android.media.MediaPlayer;
5
+import android.support.v7.app.AppCompatActivity;
6
+import android.os.Bundle;
7
+
8
+public class MainActivity extends AppCompatActivity {
9
+
10
+    @Override
11
+    protected void onCreate(Bundle savedInstanceState) {
12
+        super.onCreate(savedInstanceState);
13
+        setContentView(R.layout.activity_main);
14
+    }
15
+
16
+    @Override
17
+    protected void onResume() {
18
+        super.onResume();
19
+        Intent intent = new Intent(this, WebViewActivity.class);
20
+        startActivity(intent);
21
+    }
22
+}

+ 32
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/MediaPlayerActivity.java View File

@@ -0,0 +1,32 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import android.media.MediaDataSource;
4
+import android.media.MediaPlayer;
5
+import android.support.v7.app.AppCompatActivity;
6
+import android.os.Bundle;
7
+
8
+import java.io.IOException;
9
+
10
+public class MediaPlayerActivity extends AppCompatActivity {
11
+
12
+    @Override
13
+    protected void onCreate(Bundle savedInstanceState) {
14
+        super.onCreate(savedInstanceState);
15
+        setContentView(R.layout.activity_media_player);
16
+
17
+        MediaPlayer player = new MediaPlayer();
18
+        player.reset();
19
+        try {
20
+            player.setDataSource("/sdcard/mediarecorder.amr");
21
+
22
+        } catch (IOException e) {
23
+            e.printStackTrace();
24
+        }
25
+        try {
26
+            player.prepare();
27
+        } catch (IOException e) {
28
+            e.printStackTrace();
29
+        }
30
+        player.start();
31
+    }
32
+}

+ 89
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/OperateMedia.java View File

@@ -0,0 +1,89 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import android.content.Context;
4
+import android.content.res.AssetFileDescriptor;
5
+import android.media.AudioManager;
6
+import android.media.MediaPlayer;
7
+import android.view.SurfaceHolder;
8
+import android.view.SurfaceView;
9
+
10
+import java.io.IOException;
11
+
12
+public class OperateMedia  {
13
+    private int position = 0;// 保存播放的的位置
14
+    private SurfaceView surfaceView;// surfaceVie对象
15
+    private Context context;// 上下文对象
16
+    private MediaPlayer mediaPlayer;// mediaplayer对象
17
+    private int currentPlay = 0;// 保存当前正在播放的视频 0表示还没有记录
18
+    private boolean justBack = false;// 是否刚才另外一个界面跳回,fasle 表示不是
19
+
20
+    public OperateMedia(Context context, MediaPlayer mediaPlayer,
21
+                        SurfaceView surfaceView) {
22
+        // TODO Auto-generated constructor stub
23
+        this.context = context;
24
+        this.mediaPlayer = mediaPlayer;
25
+        this.surfaceView = surfaceView;
26
+        // mediaPlayer的设置
27
+        this.mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
28
+
29
+        // surfaceView的设置
30
+        this.surfaceView.getHolder().setKeepScreenOn(true);
31
+        this.surfaceView.getHolder().setType(
32
+                SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
33
+        this.surfaceView.getHolder().addCallback(new SurfaceCallback()); // surfaceView的回调
34
+
35
+    }
36
+
37
+    // 设置播放不同的视频
38
+    public void loadSrc() {
39
+        // 如果在次播放的是不同的视频,那么就将position初始化,并且reset,重新设置视频源
40
+            try {
41
+                mediaPlayer.reset();
42
+                mediaPlayer.setDataSource("/sdcard/video_record.mp4");
43
+                mediaPlayer.prepare();
44
+
45
+                mediaPlayer.seekTo(5000);
46
+                mediaPlayer.start();
47
+                mediaPlayer.setDisplay(surfaceView.getHolder());// 设置屏幕
48
+            } catch (IllegalArgumentException e) {
49
+                // TODO Auto-generated catch block
50
+                e.printStackTrace();
51
+            } catch (IllegalStateException e) {
52
+                // TODO Auto-generated catch block
53
+                e.printStackTrace();
54
+            } catch (IOException e) {
55
+                // TODO Auto-generated catch block
56
+                e.printStackTrace();
57
+            }
58
+            return;// 中断当前程序
59
+
60
+    }
61
+
62
+    //
63
+    public void onBufferingUpdate(MediaPlayer mp, int percent)
64
+            throws IllegalStateException {
65
+    }
66
+
67
+    // SurfaceView的callBack
68
+    private class SurfaceCallback implements SurfaceHolder.Callback {
69
+        public void surfaceChanged(SurfaceHolder holder, int format, int width,
70
+                                   int height) {
71
+        }
72
+
73
+        public void surfaceCreated(SurfaceHolder holder) {
74
+                loadSrc();
75
+        }
76
+
77
+        public void surfaceDestroyed(SurfaceHolder holder) {
78
+            // 界面销毁,即将跳转到另外一个界面
79
+            if (mediaPlayer.isPlaying()) {
80
+                justBack = true;
81
+                position = mediaPlayer.getCurrentPosition();
82
+                mediaPlayer.stop();
83
+            }
84
+        }
85
+
86
+    }
87
+
88
+
89
+}

+ 21
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/VideoPlayerActivity2.java View File

@@ -0,0 +1,21 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import android.media.MediaPlayer;
4
+import android.support.v7.app.AppCompatActivity;
5
+import android.os.Bundle;
6
+import android.view.SurfaceView;
7
+import android.view.View;
8
+
9
+public class VideoPlayerActivity2 extends AppCompatActivity {
10
+
11
+    @Override
12
+    protected void onCreate(Bundle savedInstanceState) {
13
+        super.onCreate(savedInstanceState);
14
+        setContentView(R.layout.activity_video_player2);
15
+
16
+        SurfaceView sv = this.findViewById(R.id.surfaceView2);
17
+        MediaPlayer player = new MediaPlayer();
18
+        OperateMedia opt = new OperateMedia(this,player,sv);
19
+        //opt.loadSrc();
20
+    }
21
+}

+ 151
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/VideoRecordActivity.java View File

@@ -0,0 +1,151 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import java.io.File;
4
+import java.io.IOException;
5
+
6
+import android.app.Activity;
7
+import android.media.MediaRecorder;
8
+import android.media.MediaRecorder.OnErrorListener;
9
+import android.os.Bundle;
10
+import android.view.SurfaceHolder;
11
+import android.view.SurfaceView;
12
+import android.view.View;
13
+import android.view.View.OnClickListener;
14
+import android.widget.Button;
15
+import android.widget.EditText;
16
+import android.widget.Toast;
17
+
18
+import cn.gov.gxch.abc.noapp.R;
19
+
20
+public class VideoRecordActivity extends Activity {
21
+    private Button btn_VideoStart, btn_VideoStop;
22
+    private SurfaceView sv_view;
23
+    private boolean isRecording;
24
+    private MediaRecorder mediaRecorder;
25
+    private EditText fileNameContrl;
26
+
27
+    @Override
28
+    protected void onCreate(Bundle savedInstanceState) {
29
+        super.onCreate(savedInstanceState);
30
+        setContentView(R.layout.activity_record_video);
31
+
32
+        this.fileNameContrl = findViewById(R.id.txt_video_filename);
33
+        btn_VideoStart = (Button) findViewById(R.id.btn_video_VideoStart);
34
+        btn_VideoStop = (Button) findViewById(R.id.btn_video_VideoStop);
35
+        sv_view = (SurfaceView) findViewById(R.id.sv_video_view);
36
+
37
+        btn_VideoStop.setEnabled(false);
38
+
39
+        btn_VideoStart.setOnClickListener(click);
40
+        btn_VideoStop.setOnClickListener(click);
41
+
42
+        // 声明Surface不维护自己的缓冲区,针对Android3.0以下设备支持
43
+        sv_view.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
44
+    }
45
+
46
+    private View.OnClickListener click = new OnClickListener() {
47
+
48
+        @Override
49
+        public void onClick(View v) {
50
+            switch (v.getId()) {
51
+                case R.id.btn_video_VideoStart:
52
+                    start();
53
+                    break;
54
+                case R.id.btn_video_VideoStop:
55
+                    stop();
56
+                    break;
57
+                default:
58
+                    break;
59
+            }
60
+        }
61
+    };
62
+
63
+    protected void start() {
64
+        try {
65
+            String fileName = fileNameContrl.getText().toString();
66
+            if(fileName == null || "".equals(fileName.trim())){
67
+                Toast.makeText(this,"请命名!!!!!",Toast.LENGTH_SHORT).show();
68
+                return;
69
+            }
70
+
71
+            File file = new File("/sdcard/"+fileName);
72
+            if (file.exists()) {
73
+                // 如果文件存在,删除它,演示代码保证设备上只有一个录音文件
74
+                file.delete();
75
+            }
76
+
77
+            mediaRecorder = new MediaRecorder();
78
+            mediaRecorder.reset();
79
+            // 设置音频录入源
80
+            mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
81
+            // 设置视频图像的录入源
82
+            mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
83
+            // 设置录入媒体的输出格式
84
+            mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
85
+            // 设置音频的编码格式
86
+            mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
87
+            // 设置视频的编码格式
88
+            mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
89
+            // 设置视频的采样率,每秒4帧
90
+            mediaRecorder.setVideoFrameRate(4);
91
+            //mediaRecorder.setAudioEncodingBitRate(16);
92
+            //mediaRecorder.setAudioSamplingRate();
93
+            //mediaRecorder.setCaptureRate(30);
94
+            //mediaRecorder.set
95
+            // 设置录制视频文件的输出路径
96
+            mediaRecorder.setOutputFile(file.getAbsolutePath());
97
+            // 设置捕获视频图像的预览界面
98
+            mediaRecorder.setPreviewDisplay(sv_view.getHolder().getSurface());
99
+            mediaRecorder.setOnErrorListener(new OnErrorListener() {
100
+
101
+                @Override
102
+                public void onError(MediaRecorder mr, int what, int extra) {
103
+                    // 发生错误,停止录制
104
+                    mediaRecorder.stop();
105
+                    mediaRecorder.release();
106
+                    mediaRecorder = null;
107
+                    isRecording=false;
108
+                    btn_VideoStart.setEnabled(true);
109
+                    btn_VideoStop.setEnabled(false);
110
+                    Toast.makeText(VideoRecordActivity.this, "录制出错", Toast.LENGTH_SHORT).show();
111
+                }
112
+            });
113
+
114
+            // 准备、开始
115
+            mediaRecorder.prepare();
116
+            mediaRecorder.start();
117
+
118
+            btn_VideoStart.setEnabled(false);
119
+            btn_VideoStop.setEnabled(true);
120
+            isRecording = true;
121
+            Toast.makeText(VideoRecordActivity.this, "开始录像", Toast.LENGTH_SHORT).show();
122
+        } catch (Exception e) {
123
+            e.printStackTrace();
124
+        }
125
+
126
+    }
127
+
128
+    protected void stop() {
129
+        if (isRecording) {
130
+            // 如果正在录制,停止并释放资源
131
+            mediaRecorder.stop();
132
+            mediaRecorder.release();
133
+            mediaRecorder = null;
134
+            isRecording=false;
135
+            btn_VideoStart.setEnabled(true);
136
+            btn_VideoStop.setEnabled(false);
137
+            Toast.makeText(VideoRecordActivity.this, "停止录像,并保存文件", Toast.LENGTH_SHORT).show();
138
+        }
139
+    }
140
+
141
+    @Override
142
+    protected void onDestroy() {
143
+        if (isRecording) {
144
+            mediaRecorder.stop();
145
+            mediaRecorder.release();
146
+            mediaRecorder = null;
147
+        }
148
+        super.onDestroy();
149
+    }
150
+
151
+}

+ 40
- 0
app/src/main/java/cn/gov/gxch/abc/noapp/WebViewActivity.java View File

@@ -0,0 +1,40 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import android.support.v7.app.AppCompatActivity;
4
+import android.os.Bundle;
5
+import android.view.WindowManager;
6
+import android.webkit.WebResourceRequest;
7
+import android.webkit.WebSettings;
8
+import android.webkit.WebView;
9
+import android.webkit.WebViewClient;
10
+
11
+public class WebViewActivity extends AppCompatActivity {
12
+
13
+    @Override
14
+    protected void onCreate(Bundle savedInstanceState) {
15
+        super.onCreate(savedInstanceState);
16
+        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
17
+
18
+        setContentView(R.layout.activity_web_view);
19
+        WebView webView = findViewById(R.id.web_view);
20
+        webView.setWebViewClient(new MyClient());
21
+        WebSettings settings = webView.getSettings();
22
+        settings.setJavaScriptEnabled(true);
23
+
24
+        settings.setGeolocationEnabled(true);
25
+        settings.setAppCacheEnabled(true);
26
+        //settings.set
27
+        //webView.loadUrl("http://reefun.cn/test.html");
28
+        webView.loadData("<div>hello world</div>","text/html","utf-8");
29
+    }
30
+
31
+    class MyClient extends WebViewClient{
32
+        @Override
33
+        public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
34
+            //view.loadUrl(request.getUrl().getScheme()+"://"+request.getUrl().getPort()+request.getUrl().getPath()+request.getUrl().getQuery());
35
+            //view.loadData();
36
+            //view.loadUrl(request.getUrl().toString());
37
+            return  true;
38
+        }
39
+    }
40
+}

+ 34
- 0
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
File diff suppressed because it is too large
View File


+ 170
- 0
app/src/main/res/drawable/ic_launcher_background.xml View File

@@ -0,0 +1,170 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:width="108dp"
4
+    android:height="108dp"
5
+    android:viewportHeight="108"
6
+    android:viewportWidth="108">
7
+    <path
8
+        android:fillColor="#26A69A"
9
+        android:pathData="M0,0h108v108h-108z" />
10
+    <path
11
+        android:fillColor="#00000000"
12
+        android:pathData="M9,0L9,108"
13
+        android:strokeColor="#33FFFFFF"
14
+        android:strokeWidth="0.8" />
15
+    <path
16
+        android:fillColor="#00000000"
17
+        android:pathData="M19,0L19,108"
18
+        android:strokeColor="#33FFFFFF"
19
+        android:strokeWidth="0.8" />
20
+    <path
21
+        android:fillColor="#00000000"
22
+        android:pathData="M29,0L29,108"
23
+        android:strokeColor="#33FFFFFF"
24
+        android:strokeWidth="0.8" />
25
+    <path
26
+        android:fillColor="#00000000"
27
+        android:pathData="M39,0L39,108"
28
+        android:strokeColor="#33FFFFFF"
29
+        android:strokeWidth="0.8" />
30
+    <path
31
+        android:fillColor="#00000000"
32
+        android:pathData="M49,0L49,108"
33
+        android:strokeColor="#33FFFFFF"
34
+        android:strokeWidth="0.8" />
35
+    <path
36
+        android:fillColor="#00000000"
37
+        android:pathData="M59,0L59,108"
38
+        android:strokeColor="#33FFFFFF"
39
+        android:strokeWidth="0.8" />
40
+    <path
41
+        android:fillColor="#00000000"
42
+        android:pathData="M69,0L69,108"
43
+        android:strokeColor="#33FFFFFF"
44
+        android:strokeWidth="0.8" />
45
+    <path
46
+        android:fillColor="#00000000"
47
+        android:pathData="M79,0L79,108"
48
+        android:strokeColor="#33FFFFFF"
49
+        android:strokeWidth="0.8" />
50
+    <path
51
+        android:fillColor="#00000000"
52
+        android:pathData="M89,0L89,108"
53
+        android:strokeColor="#33FFFFFF"
54
+        android:strokeWidth="0.8" />
55
+    <path
56
+        android:fillColor="#00000000"
57
+        android:pathData="M99,0L99,108"
58
+        android:strokeColor="#33FFFFFF"
59
+        android:strokeWidth="0.8" />
60
+    <path
61
+        android:fillColor="#00000000"
62
+        android:pathData="M0,9L108,9"
63
+        android:strokeColor="#33FFFFFF"
64
+        android:strokeWidth="0.8" />
65
+    <path
66
+        android:fillColor="#00000000"
67
+        android:pathData="M0,19L108,19"
68
+        android:strokeColor="#33FFFFFF"
69
+        android:strokeWidth="0.8" />
70
+    <path
71
+        android:fillColor="#00000000"
72
+        android:pathData="M0,29L108,29"
73
+        android:strokeColor="#33FFFFFF"
74
+        android:strokeWidth="0.8" />
75
+    <path
76
+        android:fillColor="#00000000"
77
+        android:pathData="M0,39L108,39"
78
+        android:strokeColor="#33FFFFFF"
79
+        android:strokeWidth="0.8" />
80
+    <path
81
+        android:fillColor="#00000000"
82
+        android:pathData="M0,49L108,49"
83
+        android:strokeColor="#33FFFFFF"
84
+        android:strokeWidth="0.8" />
85
+    <path
86
+        android:fillColor="#00000000"
87
+        android:pathData="M0,59L108,59"
88
+        android:strokeColor="#33FFFFFF"
89
+        android:strokeWidth="0.8" />
90
+    <path
91
+        android:fillColor="#00000000"
92
+        android:pathData="M0,69L108,69"
93
+        android:strokeColor="#33FFFFFF"
94
+        android:strokeWidth="0.8" />
95
+    <path
96
+        android:fillColor="#00000000"
97
+        android:pathData="M0,79L108,79"
98
+        android:strokeColor="#33FFFFFF"
99
+        android:strokeWidth="0.8" />
100
+    <path
101
+        android:fillColor="#00000000"
102
+        android:pathData="M0,89L108,89"
103
+        android:strokeColor="#33FFFFFF"
104
+        android:strokeWidth="0.8" />
105
+    <path
106
+        android:fillColor="#00000000"
107
+        android:pathData="M0,99L108,99"
108
+        android:strokeColor="#33FFFFFF"
109
+        android:strokeWidth="0.8" />
110
+    <path
111
+        android:fillColor="#00000000"
112
+        android:pathData="M19,29L89,29"
113
+        android:strokeColor="#33FFFFFF"
114
+        android:strokeWidth="0.8" />
115
+    <path
116
+        android:fillColor="#00000000"
117
+        android:pathData="M19,39L89,39"
118
+        android:strokeColor="#33FFFFFF"
119
+        android:strokeWidth="0.8" />
120
+    <path
121
+        android:fillColor="#00000000"
122
+        android:pathData="M19,49L89,49"
123
+        android:strokeColor="#33FFFFFF"
124
+        android:strokeWidth="0.8" />
125
+    <path
126
+        android:fillColor="#00000000"
127
+        android:pathData="M19,59L89,59"
128
+        android:strokeColor="#33FFFFFF"
129
+        android:strokeWidth="0.8" />
130
+    <path
131
+        android:fillColor="#00000000"
132
+        android:pathData="M19,69L89,69"
133
+        android:strokeColor="#33FFFFFF"
134
+        android:strokeWidth="0.8" />
135
+    <path
136
+        android:fillColor="#00000000"
137
+        android:pathData="M19,79L89,79"
138
+        android:strokeColor="#33FFFFFF"
139
+        android:strokeWidth="0.8" />
140
+    <path
141
+        android:fillColor="#00000000"
142
+        android:pathData="M29,19L29,89"
143
+        android:strokeColor="#33FFFFFF"
144
+        android:strokeWidth="0.8" />
145
+    <path
146
+        android:fillColor="#00000000"
147
+        android:pathData="M39,19L39,89"
148
+        android:strokeColor="#33FFFFFF"
149
+        android:strokeWidth="0.8" />
150
+    <path
151
+        android:fillColor="#00000000"
152
+        android:pathData="M49,19L49,89"
153
+        android:strokeColor="#33FFFFFF"
154
+        android:strokeWidth="0.8" />
155
+    <path
156
+        android:fillColor="#00000000"
157
+        android:pathData="M59,19L59,89"
158
+        android:strokeColor="#33FFFFFF"
159
+        android:strokeWidth="0.8" />
160
+    <path
161
+        android:fillColor="#00000000"
162
+        android:pathData="M69,19L69,89"
163
+        android:strokeColor="#33FFFFFF"
164
+        android:strokeWidth="0.8" />
165
+    <path
166
+        android:fillColor="#00000000"
167
+        android:pathData="M79,19L79,89"
168
+        android:strokeColor="#33FFFFFF"
169
+        android:strokeWidth="0.8" />
170
+</vector>

+ 9
- 0
app/src/main/res/layout/activity_audio_rec.xml View File

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context="cn.gov.gxch.abc.noapp.AudioRecActivity">
8
+
9
+</android.support.constraint.ConstraintLayout>

+ 9
- 0
app/src/main/res/layout/activity_camera.xml View File

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context="cn.gov.gxch.abc.noapp.CameraActivity">
8
+
9
+</android.support.constraint.ConstraintLayout>

+ 9
- 0
app/src/main/res/layout/activity_camera2.xml View File

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context="cn.gov.gxch.abc.noapp.CameraActivity">
8
+
9
+</android.support.constraint.ConstraintLayout>

+ 17
- 0
app/src/main/res/layout/activity_draw_panel.xml View File

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context="cn.gov.gxch.abc.noapp.DrawPanel">
8
+
9
+    <SurfaceView
10
+        android:id="@+id/surfaceView"
11
+        android:layout_width="0dp"
12
+        android:layout_height="0dp"
13
+        app:layout_constraintBottom_toBottomOf="parent"
14
+        app:layout_constraintEnd_toEndOf="parent"
15
+        app:layout_constraintStart_toStartOf="parent"
16
+        app:layout_constraintTop_toTopOf="parent" />
17
+</android.support.constraint.ConstraintLayout>

+ 32
- 0
app/src/main/res/layout/activity_location.xml View File

@@ -0,0 +1,32 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context="cn.gov.gxch.abc.noapp.LocationActivity">
8
+
9
+    <TextView
10
+        android:id="@+id/txt_location_info"
11
+        android:layout_width="0dp"
12
+        android:layout_height="wrap_content"
13
+        android:layout_marginEnd="8dp"
14
+        android:layout_marginStart="8dp"
15
+        android:layout_marginTop="8dp"
16
+        android:text="TextView"
17
+        app:layout_constraintEnd_toEndOf="parent"
18
+        app:layout_constraintStart_toStartOf="parent"
19
+        app:layout_constraintTop_toTopOf="parent" />
20
+
21
+    <Button
22
+        android:id="@+id/btn_get_location"
23
+        android:layout_width="0dp"
24
+        android:layout_height="47dp"
25
+        android:layout_marginEnd="8dp"
26
+        android:layout_marginStart="8dp"
27
+        android:layout_marginTop="8dp"
28
+        android:text="GET Location"
29
+        app:layout_constraintEnd_toEndOf="parent"
30
+        app:layout_constraintStart_toStartOf="parent"
31
+        app:layout_constraintTop_toBottomOf="@+id/txt_location_info" />
32
+</android.support.constraint.ConstraintLayout>

+ 102
- 0
app/src/main/res/layout/activity_login.xml View File

@@ -0,0 +1,102 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context="cn.gov.gxch.abc.noapp.LoginActivity">
8
+
9
+    <EditText
10
+        android:id="@+id/txt_account"
11
+        android:layout_width="0dp"
12
+        android:layout_height="wrap_content"
13
+        android:layout_marginEnd="8dp"
14
+        android:layout_marginStart="8dp"
15
+        android:layout_marginTop="8dp"
16
+        android:ems="10"
17
+        android:inputType="textPersonName"
18
+        app:layout_constraintEnd_toEndOf="parent"
19
+        app:layout_constraintStart_toEndOf="@+id/label_account"
20
+        app:layout_constraintTop_toTopOf="parent" />
21
+
22
+    <TextView
23
+        android:id="@+id/label_account"
24
+        android:layout_width="wrap_content"
25
+        android:layout_height="wrap_content"
26
+        android:layout_marginBottom="8dp"
27
+        android:layout_marginStart="8dp"
28
+        android:layout_marginTop="8dp"
29
+        android:text="账号"
30
+        app:layout_constraintBottom_toBottomOf="@+id/txt_account"
31
+        app:layout_constraintStart_toStartOf="parent"
32
+        app:layout_constraintTop_toTopOf="parent" />
33
+
34
+    <EditText
35
+        android:id="@+id/txt_passwd"
36
+        android:layout_width="0dp"
37
+        android:layout_height="wrap_content"
38
+        android:layout_marginEnd="8dp"
39
+        android:layout_marginStart="8dp"
40
+        android:layout_marginTop="8dp"
41
+        android:ems="10"
42
+        android:inputType="textPassword"
43
+        app:layout_constraintEnd_toEndOf="parent"
44
+        app:layout_constraintStart_toEndOf="@+id/label_passwd"
45
+        app:layout_constraintTop_toBottomOf="@+id/txt_account" />
46
+
47
+    <TextView
48
+        android:id="@+id/label_passwd"
49
+        android:layout_width="wrap_content"
50
+        android:layout_height="wrap_content"
51
+        android:layout_marginBottom="8dp"
52
+        android:layout_marginStart="8dp"
53
+        android:text="密码"
54
+        app:layout_constraintBottom_toBottomOf="@+id/txt_passwd"
55
+        app:layout_constraintStart_toStartOf="parent" />
56
+
57
+    <EditText
58
+        android:id="@+id/txt_vcode"
59
+        android:layout_width="0dp"
60
+        android:layout_height="wrap_content"
61
+        android:layout_marginStart="8dp"
62
+        android:layout_marginTop="8dp"
63
+        android:ems="10"
64
+        android:inputType="textPersonName"
65
+        app:layout_constraintEnd_toStartOf="@+id/btn_get_vcode"
66
+        app:layout_constraintStart_toEndOf="@+id/label_vcode"
67
+        app:layout_constraintTop_toBottomOf="@+id/txt_passwd" />
68
+
69
+    <TextView
70
+        android:id="@+id/label_vcode"
71
+        android:layout_width="wrap_content"
72
+        android:layout_height="wrap_content"
73
+        android:layout_marginBottom="8dp"
74
+        android:layout_marginStart="8dp"
75
+        android:text="验证码"
76
+        app:layout_constraintBottom_toBottomOf="@+id/txt_vcode"
77
+        app:layout_constraintStart_toStartOf="parent" />
78
+
79
+    <Button
80
+        android:id="@+id/btn_get_vcode"
81
+        android:layout_width="wrap_content"
82
+        android:layout_height="wrap_content"
83
+        android:layout_marginBottom="8dp"
84
+        android:layout_marginEnd="8dp"
85
+        android:text="获取验证码"
86
+        android:textSize="12sp"
87
+        app:layout_constraintBottom_toBottomOf="@+id/txt_vcode"
88
+        app:layout_constraintEnd_toEndOf="parent" />
89
+
90
+    <Button
91
+        android:id="@+id/btn_login"
92
+        android:layout_width="0dp"
93
+        android:layout_height="wrap_content"
94
+        android:layout_marginEnd="8dp"
95
+        android:layout_marginStart="8dp"
96
+        android:layout_marginTop="8dp"
97
+        android:text="登录"
98
+        app:layout_constraintEnd_toEndOf="parent"
99
+        app:layout_constraintStart_toStartOf="parent"
100
+        app:layout_constraintTop_toBottomOf="@+id/txt_vcode" />
101
+
102
+</android.support.constraint.ConstraintLayout>

+ 18
- 0
app/src/main/res/layout/activity_main.xml View File

@@ -0,0 +1,18 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context="cn.gov.gxch.abc.noapp.MainActivity">
8
+
9
+    <TextView
10
+        android:layout_width="wrap_content"
11
+        android:layout_height="wrap_content"
12
+        android:text="Hello World!"
13
+        app:layout_constraintBottom_toBottomOf="parent"
14
+        app:layout_constraintLeft_toLeftOf="parent"
15
+        app:layout_constraintRight_toRightOf="parent"
16
+        app:layout_constraintTop_toTopOf="parent" />
17
+
18
+</android.support.constraint.ConstraintLayout>

+ 9
- 0
app/src/main/res/layout/activity_media_player.xml View File

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context="cn.gov.gxch.abc.noapp.MediaPlayerActivity">
8
+
9
+</android.support.constraint.ConstraintLayout>

+ 19
- 0
app/src/main/res/layout/activity_record_audio.xml View File

@@ -0,0 +1,19 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:layout_width="match_parent"
4
+    android:layout_height="match_parent">
5
+
6
+    <Button
7
+        android:id="@+id/btn_audio_RecordStart"
8
+        android:layout_width="wrap_content"
9
+        android:layout_height="wrap_content"
10
+        android:layout_weight="1"
11
+        android:text="start" />
12
+
13
+    <Button
14
+        android:id="@+id/btn_audio_RecordStop"
15
+        android:layout_width="wrap_content"
16
+        android:layout_height="wrap_content"
17
+        android:layout_weight="1"
18
+        android:text="stop" />
19
+</LinearLayout>

+ 35
- 0
app/src/main/res/layout/activity_record_video.xml View File

@@ -0,0 +1,35 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:layout_width="match_parent"
4
+    android:layout_height="match_parent"
5
+    android:orientation="vertical">
6
+
7
+    <Button
8
+        android:id="@+id/btn_video_VideoStart"
9
+        android:layout_width="match_parent"
10
+        android:layout_height="wrap_content"
11
+        android:layout_weight="0"
12
+        android:text="start" />
13
+
14
+    <Button
15
+        android:id="@+id/btn_video_VideoStop"
16
+        android:layout_width="match_parent"
17
+        android:layout_height="wrap_content"
18
+        android:layout_weight="0"
19
+        android:text="stop" />
20
+
21
+    <EditText
22
+        android:id="@+id/txt_video_filename"
23
+        android:layout_width="match_parent"
24
+        android:layout_height="wrap_content"
25
+        android:layout_weight="0"
26
+        android:ems="10"
27
+        android:inputType="textPersonName"
28
+        android:text="video_record.mp4" />
29
+
30
+    <SurfaceView
31
+        android:id="@+id/sv_video_view"
32
+        android:layout_width="match_parent"
33
+        android:layout_height="wrap_content"
34
+        android:layout_weight="5" />
35
+</LinearLayout>

+ 17
- 0
app/src/main/res/layout/activity_video_player2.xml View File

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context="cn.gov.gxch.abc.noapp.VideoPlayerActivity2">
8
+
9
+    <SurfaceView
10
+        android:id="@+id/surfaceView2"
11
+        android:layout_width="0dp"
12
+        android:layout_height="0dp"
13
+        app:layout_constraintBottom_toBottomOf="parent"
14
+        app:layout_constraintEnd_toEndOf="parent"
15
+        app:layout_constraintStart_toStartOf="parent"
16
+        app:layout_constraintTop_toTopOf="parent" />
17
+</android.support.constraint.ConstraintLayout>

+ 13
- 0
app/src/main/res/layout/activity_web_view.xml View File

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:app="http://schemas.android.com/apk/res-auto"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context="cn.gov.gxch.abc.noapp.WebViewActivity">
8
+
9
+    <WebView
10
+        android:id="@+id/web_view"
11
+        android:layout_width="match_parent"
12
+        android:layout_height="match_parent" />
13
+</android.support.constraint.ConstraintLayout>

+ 17
- 0
app/src/main/res/layout/camera_layout.xml View File

@@ -0,0 +1,17 @@
1
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
+    android:layout_width="match_parent"
3
+    android:layout_height="match_parent">
4
+
5
+    <SurfaceView
6
+        android:id="@+id/surface_view_camera2_activity"
7
+        android:layout_width="match_parent"
8
+        android:layout_height="match_parent" />
9
+
10
+    <ImageView
11
+        android:id="@+id/iv_show_camera2_activity"
12
+        android:layout_width="180dp"
13
+        android:layout_height="320dp"
14
+        android:visibility="gone"
15
+        android:layout_centerInParent="true"
16
+        android:scaleType="centerCrop" />
17
+</RelativeLayout>

+ 5
- 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml View File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3
+    <background android:drawable="@drawable/ic_launcher_background" />
4
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
5
+</adaptive-icon>

+ 5
- 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml View File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3
+    <background android:drawable="@drawable/ic_launcher_background" />
4
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
5
+</adaptive-icon>

BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png View File


BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png View File


BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png View File


BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png View File


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png View File


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png View File


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png View File


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png View File


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png View File


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png View File


+ 6
- 0
app/src/main/res/values/colors.xml View File

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<resources>
3
+    <color name="colorPrimary">#3F51B5</color>
4
+    <color name="colorPrimaryDark">#303F9F</color>
5
+    <color name="colorAccent">#FF4081</color>
6
+</resources>

+ 3
- 0
app/src/main/res/values/strings.xml View File

@@ -0,0 +1,3 @@
1
+<resources>
2
+    <string name="app_name">NoApp</string>
3
+</resources>

+ 11
- 0
app/src/main/res/values/styles.xml View File

@@ -0,0 +1,11 @@
1
+<resources>
2
+
3
+    <!-- Base application theme. -->
4
+    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5
+        <!-- Customize your theme here. -->
6
+        <item name="colorPrimary">@color/colorPrimary</item>
7
+        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8
+        <item name="colorAccent">@color/colorAccent</item>
9
+    </style>
10
+
11
+</resources>

+ 17
- 0
app/src/test/java/cn/gov/gxch/abc/noapp/ExampleUnitTest.java View File

@@ -0,0 +1,17 @@
1
+package cn.gov.gxch.abc.noapp;
2
+
3
+import org.junit.Test;
4
+
5
+import static org.junit.Assert.*;
6
+
7
+/**
8
+ * Example local unit test, which will execute on the development machine (host).
9
+ *
10
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11
+ */
12
+public class ExampleUnitTest {
13
+    @Test
14
+    public void addition_isCorrect() throws Exception {
15
+        assertEquals(4, 2 + 2);
16
+    }
17
+}

+ 27
- 0
build.gradle View File

@@ -0,0 +1,27 @@
1
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+buildscript {
4
+    
5
+    repositories {
6
+        google()
7
+        jcenter()
8
+    }
9
+    dependencies {
10
+        classpath 'com.android.tools.build:gradle:3.0.1'
11
+        
12
+
13
+        // NOTE: Do not place your application dependencies here; they belong
14
+        // in the individual module build.gradle files
15
+    }
16
+}
17
+
18
+allprojects {
19
+    repositories {
20
+        google()
21
+        jcenter()
22
+    }
23
+}
24
+
25
+task clean(type: Delete) {
26
+    delete rootProject.buildDir
27
+}

+ 17
- 0
gradle.properties View File

@@ -0,0 +1,17 @@
1
+# Project-wide Gradle settings.
2
+
3
+# IDE (e.g. Android Studio) users:
4
+# Gradle settings configured through the IDE *will override*
5
+# any settings specified in this file.
6
+
7
+# For more details on how to configure your build environment visit
8
+# http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+# Specifies the JVM arguments used for the daemon process.
11
+# The setting is particularly useful for tweaking memory settings.
12
+org.gradle.jvmargs=-Xmx1536m
13
+
14
+# When configured, Gradle will run in incubating parallel mode.
15
+# This option should only be used with decoupled projects. More details, visit
16
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17
+# org.gradle.parallel=true

BIN
gradle/wrapper/gradle-wrapper.jar View File


+ 6
- 0
gradle/wrapper/gradle-wrapper.properties View File

@@ -0,0 +1,6 @@
1
+#Sat May 05 14:10:13 CST 2018
2
+distributionBase=GRADLE_USER_HOME
3
+distributionPath=wrapper/dists
4
+zipStoreBase=GRADLE_USER_HOME
5
+zipStorePath=wrapper/dists
6
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

+ 160
- 0
gradlew View File

@@ -0,0 +1,160 @@
1
+#!/usr/bin/env bash
2
+
3
+##############################################################################
4
+##
5
+##  Gradle start up script for UN*X
6
+##
7
+##############################################################################
8
+
9
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
+DEFAULT_JVM_OPTS=""
11
+
12
+APP_NAME="Gradle"
13
+APP_BASE_NAME=`basename "$0"`
14
+
15
+# Use the maximum available, or set MAX_FD != -1 to use that value.
16
+MAX_FD="maximum"
17
+
18
+warn ( ) {
19
+    echo "$*"
20
+}
21
+
22
+die ( ) {
23
+    echo
24
+    echo "$*"
25
+    echo
26
+    exit 1
27
+}
28
+
29
+# OS specific support (must be 'true' or 'false').
30
+cygwin=false
31
+msys=false
32
+darwin=false
33
+case "`uname`" in
34
+  CYGWIN* )
35
+    cygwin=true
36
+    ;;
37
+  Darwin* )
38
+    darwin=true
39
+    ;;
40
+  MINGW* )
41
+    msys=true
42
+    ;;
43
+esac
44
+
45
+# Attempt to set APP_HOME
46
+# Resolve links: $0 may be a link
47
+PRG="$0"
48
+# Need this for relative symlinks.
49
+while [ -h "$PRG" ] ; do
50
+    ls=`ls -ld "$PRG"`
51
+    link=`expr "$ls" : '.*-> \(.*\)$'`
52
+    if expr "$link" : '/.*' > /dev/null; then
53
+        PRG="$link"
54
+    else
55
+        PRG=`dirname "$PRG"`"/$link"
56
+    fi
57
+done
58
+SAVED="`pwd`"
59
+cd "`dirname \"$PRG\"`/" >/dev/null
60
+APP_HOME="`pwd -P`"
61
+cd "$SAVED" >/dev/null
62
+
63
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64
+
65
+# Determine the Java command to use to start the JVM.
66
+if [ -n "$JAVA_HOME" ] ; then
67
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68
+        # IBM's JDK on AIX uses strange locations for the executables
69
+        JAVACMD="$JAVA_HOME/jre/sh/java"
70
+    else
71
+        JAVACMD="$JAVA_HOME/bin/java"
72
+    fi
73
+    if [ ! -x "$JAVACMD" ] ; then
74
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75
+
76
+Please set the JAVA_HOME variable in your environment to match the
77
+location of your Java installation."
78
+    fi
79
+else
80
+    JAVACMD="java"
81
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82
+
83
+Please set the JAVA_HOME variable in your environment to match the
84
+location of your Java installation."
85
+fi
86
+
87
+# Increase the maximum file descriptors if we can.
88
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89
+    MAX_FD_LIMIT=`ulimit -H -n`
90
+    if [ $? -eq 0 ] ; then
91
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92
+            MAX_FD="$MAX_FD_LIMIT"
93
+        fi
94
+        ulimit -n $MAX_FD
95
+        if [ $? -ne 0 ] ; then
96
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
97
+        fi
98
+    else
99
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100
+    fi
101
+fi
102
+
103
+# For Darwin, add options to specify how the application appears in the dock
104
+if $darwin; then
105
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106
+fi
107
+
108
+# For Cygwin, switch paths to Windows format before running java
109
+if $cygwin ; then
110
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112
+    JAVACMD=`cygpath --unix "$JAVACMD"`
113
+
114
+    # We build the pattern for arguments to be converted via cygpath
115
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116
+    SEP=""
117
+    for dir in $ROOTDIRSRAW ; do
118
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
119
+        SEP="|"
120
+    done
121
+    OURCYGPATTERN="(^($ROOTDIRS))"
122
+    # Add a user-defined pattern to the cygpath arguments
123
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125
+    fi
126
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
127
+    i=0
128
+    for arg in "$@" ; do
129
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
131
+
132
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
133
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134
+        else
135
+            eval `echo args$i`="\"$arg\""
136
+        fi
137
+        i=$((i+1))
138
+    done
139
+    case $i in
140
+        (0) set -- ;;
141
+        (1) set -- "$args0" ;;
142
+        (2) set -- "$args0" "$args1" ;;
143
+        (3) set -- "$args0" "$args1" "$args2" ;;
144
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150
+    esac
151
+fi
152
+
153
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154
+function splitJvmOpts() {
155
+    JVM_OPTS=("$@")
156
+}
157
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159
+
160
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

+ 90
- 0
gradlew.bat View File

@@ -0,0 +1,90 @@
1
+@if "%DEBUG%" == "" @echo off
2
+@rem ##########################################################################
3
+@rem
4
+@rem  Gradle startup script for Windows
5
+@rem
6
+@rem ##########################################################################
7
+
8
+@rem Set local scope for the variables with windows NT shell
9
+if "%OS%"=="Windows_NT" setlocal
10
+
11
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12
+set DEFAULT_JVM_OPTS=
13
+
14
+set DIRNAME=%~dp0
15
+if "%DIRNAME%" == "" set DIRNAME=.
16
+set APP_BASE_NAME=%~n0
17
+set APP_HOME=%DIRNAME%
18
+
19
+@rem Find java.exe
20
+if defined JAVA_HOME goto findJavaFromJavaHome
21
+
22
+set JAVA_EXE=java.exe
23
+%JAVA_EXE% -version >NUL 2>&1
24
+if "%ERRORLEVEL%" == "0" goto init
25
+
26
+echo.
27
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
+echo.
29
+echo Please set the JAVA_HOME variable in your environment to match the
30
+echo location of your Java installation.
31
+
32
+goto fail
33
+
34
+:findJavaFromJavaHome
35
+set JAVA_HOME=%JAVA_HOME:"=%
36
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
+
38
+if exist "%JAVA_EXE%" goto init
39
+
40
+echo.
41
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
+echo.
43
+echo Please set the JAVA_HOME variable in your environment to match the
44
+echo location of your Java installation.
45
+
46
+goto fail
47
+
48
+:init
49
+@rem Get command-line arguments, handling Windowz variants
50
+
51
+if not "%OS%" == "Windows_NT" goto win9xME_args
52
+if "%@eval[2+2]" == "4" goto 4NT_args
53
+
54
+:win9xME_args
55
+@rem Slurp the command line arguments.
56
+set CMD_LINE_ARGS=
57
+set _SKIP=2
58
+
59
+:win9xME_args_slurp
60
+if "x%~1" == "x" goto execute
61
+
62
+set CMD_LINE_ARGS=%*
63
+goto execute
64
+
65
+:4NT_args
66
+@rem Get arguments from the 4NT Shell from JP Software
67
+set CMD_LINE_ARGS=%$
68
+
69
+:execute
70
+@rem Setup the command line
71
+
72
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
+
74
+@rem Execute Gradle
75
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76
+
77
+:end
78
+@rem End local scope for the variables with windows NT shell
79
+if "%ERRORLEVEL%"=="0" goto mainEnd
80
+
81
+:fail
82
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83
+rem the _cmd.exe /c_ return code!
84
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85
+exit /b 1
86
+
87
+:mainEnd
88
+if "%OS%"=="Windows_NT" endlocal
89
+
90
+:omega

+ 1
- 0
settings.gradle View File

@@ -0,0 +1 @@
1
+include ':app'

Loading…
Cancel
Save