7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # VideoSensors
2 |
3 |
4 | App that records video and motion data from an android smartphone simultaneously.
5 | The app lets you choose the video quality and the rate at which data is saved.
6 | It can be used to record video and accelerometer, gyroscope, compass, GPS data at the same time.
7 | At the moment it records the following data,
8 | - Latitude
9 | - Longitude
10 | - Speed
11 | - Distance
12 | - Time
13 | - Accelerometer data - X axis
14 | - Accelerometer data - Y axis
15 | - Accelerometer data - Z axis
16 | - Heading
17 | - Gyroscope data - X axis
18 | - Gyroscope data - Y axis
19 | - Gyroscope data - Z axis
20 |
21 |
22 | ## Installation
23 | ### Method 1
24 |
25 | - Download Android Studio.
26 | - Import this repository into Android Studio.
27 | - Wait for the project to be loaded.
28 | - Connect your android device. Make sure it has developer options enabled.
29 | - Run the app and choose the android deive when prompted.
30 | - Android Studio will then install the app on the device.
31 |
32 | ### Method 2
33 |
34 | - Download the apk file.
35 | - The name of the file is "app-debug.apk".
36 | - Make sure your phone allows installation of apps from unknown sources.
37 | - Copy the app to your phone memory.
38 | - Now on the phone, find the app in phone memory and click on it.
39 | - Andorid will now install.
40 |
41 | ## To make changes to code:
42 |
43 | - Download Android Studio.
44 | - Import this repository into Android Studio.
45 | - Wait for the project to be loaded.
46 | - MainActivity.java contains code that runs the data and the video.
47 | - activity_main.xml is the file that contains code that shows how the UI will look like.
48 | - Make desired changes and click on the 'play' button or 'run' from the toolbar.
49 |
50 |
51 |
52 | ### License
53 |
54 | MIT
55 |
--------------------------------------------------------------------------------
/Tools/frame-extractor/Codes/comb-video-data.lua:
--------------------------------------------------------------------------------
1 | -------------------------------------------------
2 | -- VideoSensor data extractor -------------------
3 | -- Data extracted from VideoSensors by Raaghav Karthik (koolrags)--
4 | -------------------------------------------------
5 | -- Jarvis Du ------------------------------------
6 | -- June 9, 2015 ---------------------------------
7 | -------------------------------------------------
8 |
9 | -- Requires -------------------------------------
10 | require 'sys'
11 | require 'image'
12 | video_decoder = require('libvideo_decoder')
13 |
14 | -- Parse args -----------------------------------
15 | op = xlua.OptionParser('%prog [options]')
16 | op:option{'-vd', '--video_data', action='store', dest='vd', help='Video & data folder to process', default='../elab/'}
17 | op:option{'-l', '--loc', action='store', dest='location', help='Destination folder', default='../'}
18 | opt, args = op:parse()
19 |
20 | -- Function definitions ------------------------
21 | function VideoRead(videoPath)
22 | status, height, width, length, fps = video_decoder.init(videoPath)
23 | end
24 |
25 | -- Make files for frames and information -------
26 | function mkNewfolders(folder)
27 | folName = {'frames', 'frames_info'}
28 | for i = 1, 2 do
29 | folOp = io.open(folder .. folName[i])
30 | if (folOp == nil) then
31 | print('mkdir ' .. folder .. folName[i])
32 | os.execute('mkdir ' .. folder .. folName[i])
33 | end
34 | end
35 | end
36 |
37 | -- Get file names -------------------------------
38 | function getFilenames(folder)
39 | list = {}
40 | i = 0
41 | for name in io.popen('ls ' .. folder):lines() do
42 | i = i + 1
43 | list[i] = name
44 | end
45 | return list
46 | end
47 |
48 | -- Retrieve inputs ------------------------------
49 | mkNewfolders(opt.location)
50 | videoList = getFilenames(opt.vd)
51 |
52 | -- Process videos -------------------------------
53 | io.write('--- Start processing data...\n')
54 | for nv = 1, #videoList do
55 | name = videoList[nv]
56 | io.write('------ Current video folder: ' .. name .. '\n')
57 | -- Make folders within data folders
58 | os.execute('mkdir ' .. opt.location .. 'frames/' .. name)
59 | os.execute('mkdir ' .. opt.location .. 'frames_info/' .. name)
60 | datafile = io.open(opt.vd .. name .. '/' .. name .. '.csv'):lines()
61 | titles = datafile(1)
62 | VideoRead(opt.vd .. name .. '/' .. name .. '.mp4') -- Read video by libvideo_decoder
63 | local nb_frames = length -- Retrieve video length
64 | for f = 0, nb_frames do -- For every frame
65 | io.flush()
66 | dst = torch.ByteTensor(3, height, width)
67 | video_decoder.frame_rgb(dst) -- Get frames
68 | image.save(string.format(opt.location .. 'frames/' .. name .. '/%s-%04d.png', name, f), dst:float()/255.0)
69 | writefileID = io.open(string.format(opt.location .. 'frames_info/' .. name .. '/%s-%04d.txt', name, f), 'w')
70 | writefileID:write(titles .. '\n')
71 | writefileID:write(datafile(f+2) .. '\n')
72 | writefileID.close()
73 | -- Progressbar
74 | n_sp = math.floor(100*f/nb_frames)
75 | io.write('\r[' .. string.rep('#', n_sp) .. string.rep('-', 100-n_sp) .. string.format('] (%d/%d)', f, nb_frames))
76 | end
77 | io.write('\n')
78 | video_decoder.exit()
79 | end
80 | io.write('------ Videos all processed successfully.\n')
81 |
--------------------------------------------------------------------------------
/Tools/frame-extractor/README.md:
--------------------------------------------------------------------------------
1 | # VideoSensors frame extractor for Lua / Torch
2 |
3 | The frame extractor is mainly used to extract the video and data (.csv) file frame by frame.
4 |
5 | ## How to run
6 |
7 | ```bash
8 | cd Codes
9 | th comb-video-data.lua
10 | ```
11 |
12 | ## Arguments
13 |
14 | The frame extractor has the following arguments.
15 |
16 | ```bash
17 | th comb-video-data.lua --video_data --loc
18 | ```
19 |
20 | ```
21 | video (default ../elab/) Folder containing all the videos and datafiles to be processed, separated in different folders, and '/' needed at the end
22 | data (default ../) Target folder to save the frame pictures and datafiles, '/' needed at the end
23 | ```
24 |
25 | ## Results
26 |
27 | Results of the extractor are saved in
28 |
29 | ```bash
30 | location/frames
31 | ```
32 |
33 | and
34 |
35 | ```bash
36 | location/frames_info
37 | ```
38 |
39 | with file names of separate frames. `location` is the target folder specified in the arguments as `--loc`.
40 |
--------------------------------------------------------------------------------
/app-debug.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e-lab/VideoSensors/6e11b3aaf8460f73b107ec86a448668937140d7c/app-debug.apk
--------------------------------------------------------------------------------
/app-release-unsigned.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e-lab/VideoSensors/6e11b3aaf8460f73b107ec86a448668937140d7c/app-release-unsigned.apk
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 21
5 | buildToolsVersion "21.1.2"
6 |
7 | defaultConfig {
8 | applicationId "com.example.juju.e_labvideoapp"
9 | minSdkVersion 14
10 | targetSdkVersion 21
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile 'com.android.support:appcompat-v7:21.0.3'
25 | }
26 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/Juju/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/juju/e_labvideoapp/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.example.juju.e_labvideoapp;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/juju/e_labvideoapp/CameraPreview.java:
--------------------------------------------------------------------------------
1 | package com.example.juju.e_labvideoapp;
2 |
3 |
4 | import java.io.IOException;
5 |
6 | import android.content.Context;
7 | import android.hardware.Camera;
8 | import android.util.Log;
9 | import android.view.SurfaceHolder;
10 | import android.view.SurfaceView;
11 |
12 | public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
13 | private SurfaceHolder mHolder;
14 | private Camera mCamera;
15 |
16 | public CameraPreview(Context context, Camera camera) {
17 | super(context);
18 | mCamera = camera;
19 | mHolder = getHolder();
20 | mHolder.addCallback(this);
21 | // deprecated setting, but required on Android versions prior to 3.0
22 | mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
23 | }
24 |
25 | public void surfaceCreated(SurfaceHolder holder) {
26 | try {
27 | // create the surface and start camera preview
28 | if (mCamera == null) {
29 | mCamera.setPreviewDisplay(holder);
30 | mCamera.startPreview();
31 | }
32 | } catch (IOException e) {
33 | Log.d(VIEW_LOG_TAG, "Error setting camera preview: " + e.getMessage());
34 | }
35 | }
36 |
37 | public void refreshCamera(Camera camera) {
38 | if (mHolder.getSurface() == null) {
39 | // preview surface does not exist
40 | return;
41 | }
42 | // stop preview before making changes
43 | try {
44 | mCamera.stopPreview();
45 | } catch (Exception e) {
46 | // ignore: tried to stop a non-existent preview
47 | }
48 | // set preview size and make any resize, rotate or
49 | // reformatting changes here
50 | // start preview with new settings
51 | setCamera(camera);
52 | try {
53 | mCamera.setPreviewDisplay(mHolder);
54 | mCamera.startPreview();
55 | } catch (Exception e) {
56 | Log.d(VIEW_LOG_TAG, "Error starting camera preview: " + e.getMessage());
57 | }
58 | }
59 |
60 | public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
61 | // If your preview can change or rotate, take care of those events here.
62 | // Make sure to stop the preview before resizing or reformatting it.
63 | refreshCamera(mCamera);
64 | }
65 |
66 | public void setCamera(Camera camera) {
67 | //method to set a camera instance
68 | mCamera = camera;
69 | }
70 |
71 | @Override
72 | public void surfaceDestroyed(SurfaceHolder holder) {
73 | // TODO Auto-generated method stub
74 | // mCamera.release();
75 |
76 | }
77 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/juju/e_labvideoapp/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.juju.e_labvideoapp;
2 |
3 | import java.io.File;
4 | import java.io.FileNotFoundException;
5 | import java.io.IOException;
6 | import java.io.PrintWriter;
7 | import java.text.SimpleDateFormat;
8 | import java.util.ArrayList;
9 | import java.util.Arrays;
10 | import java.util.Date;
11 |
12 | import android.app.Activity;
13 | import android.app.AlertDialog;
14 | import android.content.Context;
15 | import android.content.DialogInterface;
16 | import android.content.pm.PackageManager;
17 | import android.hardware.Camera;
18 | import android.hardware.Camera.CameraInfo;
19 | import android.hardware.Sensor;
20 | import android.hardware.SensorEvent;
21 | import android.hardware.SensorEventListener;
22 | import android.hardware.SensorManager;
23 | import android.media.CamcorderProfile;
24 | import android.media.MediaRecorder;
25 | import android.os.Bundle;
26 | import android.os.Environment;
27 | import android.os.SystemClock;
28 | import android.telephony.TelephonyManager;
29 | import android.view.View;
30 | import android.view.View.OnClickListener;
31 | import android.view.WindowManager;
32 | import android.widget.Button;
33 | import android.widget.Chronometer;
34 | import android.widget.FrameLayout;
35 | import android.widget.ImageButton;
36 | import android.widget.LinearLayout;
37 | import android.widget.TextView;
38 | import android.widget.Toast;
39 |
40 | import android.text.InputType;
41 | import android.view.inputmethod.EditorInfo;
42 | import android.view.*; //?
43 | import android.content.Context;
44 | import android.location.Location;
45 | import android.location.LocationManager;
46 | import android.location.LocationListener;
47 |
48 | import android.location.GpsStatus.Listener;
49 | import android.os.Bundle;
50 | import android.view.WindowManager;
51 | import android.view.inputmethod.InputMethodManager;
52 | import android.widget.EditText;
53 | import java.util.Locale;
54 | import java.util.Timer;
55 | import java.util.TimerTask;
56 |
57 | public class MainActivity extends Activity implements SensorEventListener {
58 | private Camera mCamera;
59 | private CameraPreview mPreview;
60 | private MediaRecorder mediaRecorder;
61 | private ImageButton capture, vid;
62 | private Context myContext;
63 | private FrameLayout cameraPreview;
64 | private Chronometer chrono;
65 | private TextView tv;
66 | private TextView txt;
67 |
68 | int quality = 0;
69 | int rate = 100;
70 | String timeStampFile;
71 | int clickFlag = 0;
72 | Timer timer;
73 | int VideoFrameRate = 24;
74 |
75 | LocationListener locationListener;
76 | LocationManager LM;
77 | @Override
78 | public void onCreate(Bundle savedInstanceState) {
79 | super.onCreate(savedInstanceState);
80 | setContentView(R.layout.activity_main);
81 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
82 | myContext = this;
83 | sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
84 | //accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
85 | //head = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
86 | //gyro = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
87 | rotv = sensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR);
88 |
89 | cameraPreview = (FrameLayout) findViewById(R.id.camera_preview);
90 |
91 | mPreview = new CameraPreview(myContext, mCamera);
92 | cameraPreview.addView(mPreview);
93 |
94 | capture = (ImageButton) findViewById(R.id.button_capture);
95 | capture.setOnClickListener(captureListener);
96 |
97 | chrono = (Chronometer) findViewById(R.id.chronometer);
98 | txt = (TextView) findViewById(R.id.txt1);
99 | txt.setTextColor(-16711936);
100 |
101 | vid = (ImageButton) findViewById(R.id.imageButton);
102 | vid.setVisibility(View.GONE);
103 |
104 | /*
105 | tv = (TextView) findViewById(R.id.textViewHeading);
106 | String setTextText = "Heading: " + heading + " Speed: " + speed;
107 | tv.setText(setTextText);
108 | */
109 |
110 |
111 | }
112 |
113 |
114 | private int findBackFacingCamera() {
115 | int cameraId = -1;
116 | // Search for the back facing camera
117 | // get the number of cameras
118 | int numberOfCameras = Camera.getNumberOfCameras();
119 | // for every camera check
120 | for (int i = 0; i < numberOfCameras; i++) {
121 | CameraInfo info = new CameraInfo();
122 | Camera.getCameraInfo(i, info);
123 | if (info.facing == CameraInfo.CAMERA_FACING_BACK) {
124 | cameraId = i;
125 | break;
126 | }
127 | }
128 | return cameraId;
129 | }
130 |
131 | public void onResume() {
132 | super.onResume();
133 | if (!checkCameraHardware(myContext)) {
134 | Toast toast = Toast.makeText(myContext, "Phone doesn't have a camera!", Toast.LENGTH_LONG);
135 | toast.show();
136 | finish();
137 | }
138 | if (mCamera == null) {
139 | mCamera = Camera.open(findBackFacingCamera());
140 | mPreview.refreshCamera(mCamera);
141 | }
142 | //sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL);
143 | //sensorManager.registerListener(this, head, SensorManager.SENSOR_DELAY_GAME);
144 | //sensorManager.registerListener(this, gyro, SensorManager.SENSOR_DELAY_NORMAL);
145 | sensorManager.registerListener(this, rotv, SensorManager.SENSOR_DELAY_NORMAL);
146 |
147 |
148 |
149 | locationListener = new LocationListener() {
150 | public void onLocationChanged(Location location) {
151 | // Called when a new location is found by the network location provider.
152 |
153 | latitude = location.getLatitude();
154 | longitude = location.getLongitude();
155 |
156 | if(location.hasSpeed()) {
157 | speed = location.getSpeed();
158 | }
159 | location.distanceBetween(latitude_original, longitude_original, latitude, longitude, dist);
160 | }
161 |
162 | public void onStatusChanged(String provider, int status, Bundle extras) {}
163 |
164 | public void onProviderEnabled(String provider) {}
165 |
166 | public void onProviderDisabled(String provider) {}
167 | };
168 |
169 | // Acquire a reference to the system Location Manager
170 | LM = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
171 |
172 | // Register the listener with the Location Manager to receive location updates
173 | LM.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
174 | }
175 |
176 | @Override
177 | protected void onPause() {
178 | super.onPause();
179 | // when on Pause, release camera in order to be used from other
180 | // applications
181 | releaseCamera();
182 | sensorManager.unregisterListener(this);
183 |
184 | }
185 |
186 | private boolean checkCameraHardware(Context context) {
187 | if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)){
188 | // this device has a camera
189 | return true;
190 | } else {
191 | // no camera on this device
192 | return false;
193 | }
194 | }
195 |
196 |
197 | boolean recording = false;
198 | OnClickListener captureListener = new OnClickListener() {
199 | @Override
200 | public void onClick(View v) {
201 |
202 | if (recording) {
203 | // stop recording and release camera
204 | mediaRecorder.stop(); // stop the recording
205 | releaseMediaRecorder(); // release the MediaRecorder object
206 | Toast.makeText(MainActivity.this, "Video captured!", Toast.LENGTH_LONG).show();
207 | recording = false;
208 | //d.exportData();
209 | chrono.stop();
210 | chrono.setBase(SystemClock.elapsedRealtime());
211 |
212 | chrono.start();
213 | chrono.stop();
214 | txt.setTextColor(-16711936);
215 | //chrono.setBackgroundColor(0);
216 | enddata();
217 | /*
218 | if(clickFlag == 1){
219 | clickFlag = 0;
220 | capture.performClick();
221 | }
222 | */
223 | } else {
224 | timeStampFile = String.valueOf((new Date()).getTime());
225 | File wallpaperDirectory = new File(Environment.getExternalStorageDirectory().getPath()+"/elab/");
226 | wallpaperDirectory.mkdirs();
227 |
228 | File wallpaperDirectory1 = new File(Environment.getExternalStorageDirectory().getPath()+"/elab/"+timeStampFile);
229 | wallpaperDirectory1.mkdirs();
230 | if (!prepareMediaRecorder()) {
231 | Toast.makeText(MainActivity.this, "Fail in prepareMediaRecorder()!\n - Ended -", Toast.LENGTH_LONG).show();
232 | finish();
233 | }
234 |
235 | // work on UiThread for better performance
236 | runOnUiThread(new Runnable() {
237 | public void run() {
238 | try {
239 | mediaRecorder.start();
240 | } catch (final Exception ex) {
241 | }
242 | }
243 | });
244 | Toast.makeText(MainActivity.this, "Recording...", Toast.LENGTH_LONG).show();
245 |
246 | Camera.Parameters params = mCamera.getParameters();
247 | params.setPreviewFpsRange( 30000, 30000 ); // 30 fps
248 | if ( params.isAutoExposureLockSupported() )
249 | params.setAutoExposureLock( true );
250 |
251 | params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
252 | mCamera.setParameters(params);
253 | //d.beginData();
254 | storeData();
255 | chrono.setBase(SystemClock.elapsedRealtime());
256 |
257 | chrono.start();
258 | //chrono.setBackgroundColor(-65536);
259 | txt.setTextColor(-65536);
260 | recording = true;
261 |
262 | }
263 | }
264 | };
265 |
266 | private void releaseMediaRecorder() {
267 | if (mediaRecorder != null) {
268 | mediaRecorder.reset(); // clear recorder configuration
269 | mediaRecorder.release(); // release the recorder object
270 | mediaRecorder = null;
271 | mCamera.lock(); // lock camera for later use
272 | }
273 | }
274 |
275 | private boolean prepareMediaRecorder() {
276 |
277 | mediaRecorder = new MediaRecorder();
278 |
279 | mCamera.unlock();
280 | mediaRecorder.setCamera(mCamera);
281 |
282 | mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
283 | mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
284 | if(quality == 0)
285 | mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_1080P));
286 | else if(quality == 1)
287 | mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_720P));
288 | else if(quality == 2)
289 | mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_480P));
290 |
291 | //String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
292 |
293 | mediaRecorder.setOutputFile(Environment.getExternalStorageDirectory().getPath()+"/elab/" + timeStampFile + "/" + timeStampFile + ".mp4");
294 | mediaRecorder.setVideoFrameRate(VideoFrameRate);
295 | //mediaRecorder.setMaxDuration(5000);
296 |
297 | try {
298 | mediaRecorder.prepare();
299 | } catch (IllegalStateException e) {
300 | releaseMediaRecorder();
301 | return false;
302 | } catch (IOException e) {
303 | releaseMediaRecorder();
304 | return false;
305 | }
306 | return true;
307 |
308 | }
309 |
310 | private void releaseCamera() {
311 | // stop and release camera
312 | if (mCamera != null) {
313 | mCamera.release();
314 | mCamera = null;
315 | }
316 | }
317 |
318 | /* --------------------- Data Section ----------------------------*/
319 |
320 | Location location;
321 | LocationManager lm;
322 | double latitude = 0;
323 | double longitude = 0;
324 |
325 | double latitude_original = 0;
326 | double longitude_original = 0;
327 | //float distance = 0;
328 | float speed = 0;
329 | float dist[] = {0,0,0};
330 | PrintWriter writer = null;
331 | long timechecker = 5000;
332 |
333 | class SayHello extends TimerTask {
334 | public void run() {
335 | lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
336 | location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
337 | //lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 100, 0, locationListener );
338 | //longitude = location.getLongitude();
339 | //latitude = location.getLatitude();
340 | //if(location.hasSpeed()) {
341 | // speed = location.getSpeed();
342 | //}
343 | //dist[0] = (float) 0.0;
344 | /*
345 | long elapsedMillis = SystemClock.elapsedRealtime() - chrono.getBase();
346 | if(elapsedMillis >= timechecker){
347 | clickFlag = 1;
348 | timechecker = timechecker + 5000;
349 | timer.cancel();
350 | timer.purge();
351 | }*/
352 |
353 | /*
354 | writer.println(longitude_original + "," + latitude_original + "," + speed + "," + dist[0] + "," + timeStamp + "," + linear_acc_x + "," + linear_acc_y + "," + linear_acc_z + "," +
355 | heading + "," + gyro_x + "," + gyro_y + "," + gyro_z);
356 | */
357 | String timeStamp = String.valueOf((new Date()).getTime());
358 | writer.println(timeStamp + "," +
359 | longitude_original + "," + latitude_original + "," +
360 | rotv_x + "," + rotv_y + "," + rotv_z + "," + rotv_w + "," + rotv_accuracy);
361 | }
362 | }
363 |
364 | public void storeData() {
365 |
366 | String filePath = Environment.getExternalStorageDirectory().getPath()+"/elab/" + timeStampFile + "/" + timeStampFile + ".csv";
367 | try {
368 | writer = new PrintWriter(filePath);
369 | } catch (FileNotFoundException e) {
370 | e.printStackTrace();
371 | }
372 |
373 | //writer.println("Longitude" + "," + "Latitude" + "," + "Speed" + "," + "Distance" + "," + "Time" + "," + "Acc X" + "," + "Acc Y" + "," + "Acc Z" + "," + "Heading"
374 | // + "," + "gyro_x" + "," + "gyro_y" + "," + "gyro_z");
375 | writer.println("Timestamp" + "," +
376 | "Longitude" + "," + "Latitude" + "," +
377 | "RotationV X" + "," + "RotationV Y" + "," + "RotationV Z" + "," + "RotationV W" + "," + "RotationV Acc");
378 | LocationManager original = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
379 | Location original_location = original.getLastKnownLocation(LocationManager.GPS_PROVIDER);
380 | if(original.getLastKnownLocation(LocationManager.GPS_PROVIDER) != null){
381 | latitude_original = original_location.getLatitude();
382 | longitude_original = original_location.getLongitude();
383 | }
384 | //String setTextText = "Heading: " + heading + " Speed: " + speed;
385 | //tv.setText(setTextText);
386 | timer = new Timer();
387 | timer.schedule(new SayHello(), 0, rate);
388 | /*if(clickFlag == 1) {
389 | capture.performClick();
390 | }
391 | */
392 | }
393 |
394 | public void enddata() {
395 | writer.close();
396 | }
397 |
398 |
399 | /* ---------------------- Sensor data ------------------- */
400 |
401 | private SensorManager sensorManager;
402 |
403 | //private Sensor accelerometer;
404 | //private Sensor head;
405 | //private Sensor gyro;
406 | private Sensor rotv;
407 |
408 | /*
409 | float linear_acc_x = 0;
410 | float linear_acc_y = 0;
411 | float linear_acc_z = 0;
412 |
413 | float heading = 0;
414 |
415 | float gyro_x = 0;
416 | float gyro_y = 0;
417 | float gyro_z = 0;
418 | */
419 |
420 | float rotv_x = 0;
421 | float rotv_y = 0;
422 | float rotv_z = 0;
423 | float rotv_w = 0;
424 | float rotv_accuracy = 0;
425 |
426 | @Override
427 | public void onAccuracyChanged(Sensor sensor, int accuracy) {
428 | }
429 |
430 | @Override
431 | public void onSensorChanged(SensorEvent event) {
432 | if(event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
433 | rotv_x = event.values[0];
434 | rotv_y = event.values[1];
435 | rotv_z = event.values[2];
436 | rotv_w = event.values[3];
437 | rotv_accuracy = event.values[4];
438 | }
439 | /*
440 | if(event.sensor.getType() == Sensor.TYPE_LINEAR_ACCELERATION) {
441 | linear_acc_x = event.values[0];
442 | linear_acc_y = event.values[1];
443 | linear_acc_z = event.values[2];
444 | }
445 | else if (event.sensor.getType() == Sensor.TYPE_ORIENTATION) {
446 | heading = Math.round(event.values[0]);
447 | if(heading >= 270){
448 | heading = heading + 90;
449 | heading = heading - 360;
450 | }
451 | else{
452 | heading = heading + 90;
453 | }
454 | }
455 | else if (event.sensor.getType() == Sensor.TYPE_GYROSCOPE){
456 | gyro_x = event.values[0];
457 | gyro_y = event.values[1];
458 | gyro_z = event.values[2];
459 | }
460 | String setTextText = "Heading: " + heading + " Speed: " + speed;
461 | tv.setText(setTextText);
462 | */
463 | }
464 | String[] options = {"1080p","720p","480p"};
465 | String[] options1 = {"15 Hz","10 Hz"};
466 | String[] options2 = {"10 fps","20 fps","30 fps"};
467 |
468 |
469 | public void addQuality(View view){
470 | AlertDialog.Builder builder = new AlertDialog.Builder(this);
471 | String setting = new String();
472 | if(quality == 0) {
473 | setting = "1080p";
474 | }
475 | else if(quality == 1){
476 | setting = "720p";
477 | }
478 | else if(quality == 2){
479 | setting = "480p";
480 | }
481 | builder.setTitle("Pick Quality, Current setting: " + setting)
482 | .setItems(options, new DialogInterface.OnClickListener() {
483 | public void onClick(DialogInterface dialog, int which) {
484 | // The 'which' argument contains the index position
485 | // of the selected item
486 | if(which == 0){
487 | quality = 0;
488 | }
489 | else if (which == 1){
490 | quality = 1;
491 | }
492 | else if (which == 2){
493 | quality = 2;
494 | }
495 | }
496 | });
497 | builder.show();
498 | }
499 | public void addRate(View view)
500 | {
501 | AlertDialog.Builder builder = new AlertDialog.Builder(this);
502 | String setting = new String();
503 | if(rate == 100) {
504 | setting = "10 Hz";
505 | }
506 | else if(rate == 67){
507 | setting = "15 Hz";
508 | }
509 | builder.setTitle("Pick Data Save Rate, Current setting: " + setting)
510 | .setItems(options1, new DialogInterface.OnClickListener() {
511 | public void onClick(DialogInterface dialog, int which) {
512 | // The 'which' argument contains the index position
513 | // of the selected item
514 | if(which == 0){
515 | rate = 67 ;
516 | }
517 | else if (which == 1){
518 | rate = 100;
519 | }
520 | }
521 | });
522 | builder.show();
523 | }
524 | public void addFrameRate(View view)
525 | {
526 | AlertDialog.Builder builder = new AlertDialog.Builder(this);
527 | String setting = new String();
528 | if(VideoFrameRate == 10) {
529 | setting = "10 fps";
530 | }
531 | else if(VideoFrameRate == 20){
532 | setting = "20 fps";
533 | }
534 | else if(VideoFrameRate == 30){
535 | setting = "30 fps";
536 | }
537 | builder.setTitle("Pick Video fps, Current setting: " + setting)
538 | .setItems(options2, new DialogInterface.OnClickListener() {
539 | public void onClick(DialogInterface dialog, int which) {
540 | // The 'which' argument contains the index position
541 | // of the selected item
542 | if(which == 0){
543 | VideoFrameRate = 10 ;
544 | }
545 | else if (which == 1){
546 | VideoFrameRate = 20;
547 | }
548 | else if (which == 2){
549 | VideoFrameRate = 30;
550 | }
551 | }
552 | });
553 | builder.show();
554 | }
555 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/juju/e_labvideoapp/SplashScreen.java:
--------------------------------------------------------------------------------
1 | package com.example.juju.e_labvideoapp;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.os.Handler;
7 |
8 |
9 | public class SplashScreen extends Activity {
10 |
11 | // Splash screen timer
12 | private static int SPLASH_TIME_OUT = 1800;
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_splash);
18 |
19 | new Handler().postDelayed(new Runnable() {
20 |
21 | /*
22 | * Showing splash screen with a timer. This will be useful when you
23 | * want to show case your app logo / company
24 | */
25 |
26 | @Override
27 | public void run() {
28 | // This method will be executed once the timer is over
29 | // Start your app main activity
30 | Intent i = new Intent(SplashScreen.this, MainActivity.class);
31 | startActivity(i);
32 |
33 | // close this activity
34 | finish();
35 | }
36 | }, SPLASH_TIME_OUT);
37 | }
38 |
39 |
40 |
41 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/el.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e-lab/VideoSensors/6e11b3aaf8460f73b107ec86a448668937140d7c/app/src/main/res/drawable/el.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/elab1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e-lab/VideoSensors/6e11b3aaf8460f73b107ec86a448668937140d7c/app/src/main/res/drawable/elab1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/elab6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e-lab/VideoSensors/6e11b3aaf8460f73b107ec86a448668937140d7c/app/src/main/res/drawable/elab6.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
30 |
31 |
41 |
42 |
54 |
55 |
66 |
67 |
74 |
75 |
89 |
90 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
14 |
15 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e-lab/VideoSensors/6e11b3aaf8460f73b107ec86a448668937140d7c/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e-lab/VideoSensors/6e11b3aaf8460f73b107ec86a448668937140d7c/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e-lab/VideoSensors/6e11b3aaf8460f73b107ec86a448668937140d7c/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e-lab/VideoSensors/6e11b3aaf8460f73b107ec86a448668937140d7c/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | E-labVideoApp
3 |
4 | Hello world!
5 | Settings
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.1.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e-lab/VideoSensors/6e11b3aaf8460f73b107ec86a448668937140d7c/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
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-2.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
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 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
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
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------