From 7ce662a343e6cc9b18b4b68cdb862fcfdb1758f2 Mon Sep 17 00:00:00 2001 From: Liliya Yankova <ly00240@surrey.ac.uk> Date: Sat, 11 May 2019 17:24:21 +0100 Subject: [PATCH] Removed camera from master branch --- .../executionHistory/executionHistory.bin | Bin 7967281 -> 7967281 bytes .../executionHistory/executionHistory.lock | Bin 17 -> 17 bytes .gradle/5.1.1/fileHashes/fileHashes.bin | Bin 781090 -> 781090 bytes .gradle/5.1.1/fileHashes/fileHashes.lock | Bin 17 -> 17 bytes .../buildOutputCleanup.lock | Bin 17 -> 17 bytes .idea/caches/build_file_checksums.ser | Bin 457 -> 457 bytes .../unirides/ImageProperties.java | 134 ------------------ .../liliyayankova/unirides/Profile.java | 126 ---------------- unirides.iml | 37 +---- 9 files changed, 1 insertion(+), 296 deletions(-) delete mode 100644 src/main/java/com/example/liliyayankova/unirides/ImageProperties.java diff --git a/.gradle/5.1.1/executionHistory/executionHistory.bin b/.gradle/5.1.1/executionHistory/executionHistory.bin index 0569d149780b8eff29920aeab98e5e7a38d7eb94..ba2d72c3ba8393f3186a6e36a1b020c66cd48571 100644 GIT binary patch delta 624 zcmajc$u@!k0EXcdnP(X?S7wPy<{{&644DZPe<hW_RF17hdz&^bU4T}t9mh)7VcjKo z&v5~L=R7y?z3KN~MH(MALE{l!?w~K`w}{@ziz{F>i9snYT6|Hn?0?EvNk~XS0pw7i z5Jga;7$qo08Ol+CN>rg5HK;`$>d^od8qtJiv_Oqkw4ogx=tLK~p@9}U^q?1g=*IvC zF@$00F#-cdF$N<{Fk>7ROkfgIn8pldF^739U@;>J);D|JujJumD60BN<Wg2FVHqn} z#TwQjU;~@j!ZvoW3mf*Zj|13oh$9^11gAK|IWBMs2d;39n@ld{{4!|smet9UpANk` pk;^*af*ZHEg9s12@ZlbQJRpD|LU@FPFd}$D6fwjzx$Lv``w#R&7F+-T delta 624 zcmajc$u@!k0EXdGW|=c&E;Gqk=4AYhAu}OKn)@|jYti1OO-mP`Rcptw;ySGVOYolK z0{YH*Zs2<}Z@-ER-mQW*^6YiRy?&DzbSJ_AcOvTad7q4;C*qR*Px&GWNl}m^4+<!e zj{+2;2*oHtDaxQiIVw<zDpaEewNRrD^=LpNG-yIITF{C%w4(!B=+KESbfX8o=tDmS zFbF+{V8Ad&Fp4pZV**B)Fo`KlV+OOB!#vDb$clpH)t2)sxj7YzslSs_+JZ$aVHqn} z#To>xV*{Jm!Zvnb#V+=+4;v0}h$9^11gAK|IWAzwC9ZItmC}w+gDz)Tl`QpP*K3l} oj{`Sw;ubF4!Hs)(;Drx<1Q0|BVTgD@1X08gM<OfzJX*f~08@$>&;S4c diff --git a/.gradle/5.1.1/executionHistory/executionHistory.lock b/.gradle/5.1.1/executionHistory/executionHistory.lock index e69efdca4887cc4a36de279446f6127c9678a107..9f33aa90e3e0220cdd0d1c85532bece48878a572 100644 GIT binary patch literal 17 UcmZQJWKPof)nJ*#00zu%03sCwAOHXW literal 17 UcmZQJWKPof)nJ*#00zvC03r|r8vp<R diff --git a/.gradle/5.1.1/fileHashes/fileHashes.bin b/.gradle/5.1.1/fileHashes/fileHashes.bin index 0490918dd256f2dae3f3e6b8147c04b1dc0a612a..12f55ab44f93cbe656b0aa44a3e3e4c60644f67d 100644 GIT binary patch delta 55 zcmZ2<O@Glf{e~9C7N!>F7M2#)7Pc+ylC3PuH^u##ezAvHs@=Sm9f&!Am=lP(wwt$d HzfJ`JTDTP% delta 55 zcmZ2<O@Glf{e~9C7N!>F7M2#)7Pc+ylC3O@C$u+Bzu3bp)o$L(4#XTl%n8I?+s#|K HU#9{9O^p<y diff --git a/.gradle/5.1.1/fileHashes/fileHashes.lock b/.gradle/5.1.1/fileHashes/fileHashes.lock index d0621c5e5e109996347ccd93875e37e2005c02d6..63e886a010cb3a21c508729d899a2df59a157163 100644 GIT binary patch literal 17 VcmZQ>7u1+2U%PS#0~pk60RSjX1N#5~ literal 17 VcmZQ>7u1+2U%PS#0~pk+0stsT1NHy_ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 9dd744016c6ae26d6155f4abfbc76c8798afff75..896f9882ebec6b921514756fb8696f16cfca4d23 100644 GIT binary patch literal 17 UcmZR!tFm@qq@y0i00wG~03g@`^Z)<= literal 17 UcmZR!tFm@qq@y0i00wH703gr;>;M1& diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 9ec388aec003ad6212b676bb1608e4c5336064e6..f338b324f01d3c13587a61591a56edb279201a16 100644 GIT binary patch delta 15 XcmX@fe3E&>43_1a!nili(PabxGvNjL delta 15 XcmX@fe3E&>43@<cnrk-B(PabxHWmhQ diff --git a/src/main/java/com/example/liliyayankova/unirides/ImageProperties.java b/src/main/java/com/example/liliyayankova/unirides/ImageProperties.java deleted file mode 100644 index 42aeab4..0000000 --- a/src/main/java/com/example/liliyayankova/unirides/ImageProperties.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.example.liliyayankova.unirides; - -import android.media.ExifInterface; -import android.net.Uri; -import android.util.Log; - -class ImageProperties { - /** Path to the image we want to display... */ - private Uri imagePath; - - public ImageProperties( Uri imageUri) - { - imagePath = imageUri; - } - - /** - * Method for getting the orientation of the image to be displayed on the main scree. - * We use the ExifInterface class that gives access to the EXIF metadata of an image. - * - * @return The orientation of the image - */ - public int getCameraPhotoOrientation() - { - int rotate = 0; - try { - ExifInterface exif = new ExifInterface(imagePath.getPath()); - int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED); - - float longitude = convertToDegree(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE)); - - float latitude = convertToDegree(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE)); - //this is in a degree minute seconds format a - Log.i("Image Address", longitude + " ," + latitude); - - switch (orientation) { - case ExifInterface.ORIENTATION_ROTATE_270: - rotate = 270; - break; - case ExifInterface.ORIENTATION_ROTATE_180: - rotate = 180; - break; - case ExifInterface.ORIENTATION_ROTATE_90: - rotate = 90; - break; - } - } catch (Exception e) { - e.printStackTrace(); - } - //tells you how much rotation you need - - Log.v("ROTATION:", "Rotate Value: " + rotate); - return rotate; - } - - /** - * Method for returning the longitude of the image to be displayed. - * @return - */ - public Float getCameraAddressLong() - { - String longitude = null; - try { -// context.getContentResolver().notifyChange(imageUri, null); - // File imageFile = new File(imagePath); - - //reading the tags from the JPEG file - ExifInterface exif = new ExifInterface(imagePath.getPath()); - longitude = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE); - - - //this is in a degree minute seconds format a - Log.i("Image Address", convertToDegree(longitude) +"as double"); - - - - } catch (Exception e) { - e.printStackTrace(); - } - //tells you how much rotation you need - return convertToDegree(longitude); - } - - /** - * Method for returning the latitude of the image to be displayed. - * @return - */ - public Float getCameraAddressLat() - { - String latitude = null; - try { -// context.getContentResolver().notifyChange(imageUri, null); - // File imageFile = new File(imagePath); - - //reading the tags from the JPEG file - ExifInterface exif = new ExifInterface(imagePath.getPath()); - latitude = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE); - - - //this is in a degree minute seconds format a - Log.i("Image Address", convertToDegree(latitude) +"as double"); - - - - } catch (Exception e) { - e.printStackTrace(); - } - //tells you how much rotation you need - return convertToDegree(latitude); - } - - private Float convertToDegree(String stringDMS){ - Float result = null; - String[] DMS = stringDMS.split(",", 3); - - String[] stringD = DMS[0].split("/", 2); - Double D0 = new Double(stringD[0]); - Double D1 = new Double(stringD[1]); - Double FloatD = D0/D1; - - String[] stringM = DMS[1].split("/", 2); - Double M0 = new Double(stringM[0]); - Double M1 = new Double(stringM[1]); - Double FloatM = M0/M1; - - String[] stringS = DMS[2].split("/", 2); - Double S0 = new Double(stringS[0]); - Double S1 = new Double(stringS[1]); - Double FloatS = S0/S1; - - result = new Float(FloatD + (FloatM/60) + (FloatS/3600)); - - return result; - } -} diff --git a/src/main/java/com/example/liliyayankova/unirides/Profile.java b/src/main/java/com/example/liliyayankova/unirides/Profile.java index 23dda8c..6395cbb 100644 --- a/src/main/java/com/example/liliyayankova/unirides/Profile.java +++ b/src/main/java/com/example/liliyayankova/unirides/Profile.java @@ -36,27 +36,7 @@ public class Profile extends AppCompatActivity { private boolean isDriver; - /**Constant field for the result from the camera*/ - private static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 100; - - /** Identifiers for checking whether the captured file is an image or a video... */ - public static final int MEDIA_TYPE_IMAGE = 1; - - /**A variable for the file that will contain the pictures*/ - private Uri fileUri; - /**A variable for getting the data back*/ - private InputStream stream = null; - /**A variable for the image*/ - private Bitmap map; - - /**Constant fields for the permissions of the usage of camera and external storage*/ - private final int MY_PERMISSIONS_REQUEST_CAMERA = 1; - private final int MY_PERMISSIONS_REQUEST_EXTERNAL_STORAGE = 2; - private TextView text; - private Button cameraB; - private ImageView profile_img; - private ImageView imageV; @Override protected void onCreate(Bundle savedInstanceState) { @@ -83,35 +63,7 @@ public class Profile extends AppCompatActivity { } text = ( TextView )findViewById( R.id.profile_text ); - profile_img = ( ImageView )findViewById( R.id.profile_image ); - imageV = (ImageView) findViewById(R.id.picture_taken); - cameraB = ( Button )findViewById( R.id.profile_pic ); - cameraB.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - /**Checks whether the permissions for the usage of camera are given*/ - if (checkSelfPermission(Manifest.permission.CAMERA) - != PackageManager.PERMISSION_GRANTED) { - - requestPermissions(new String[]{Manifest.permission.CAMERA}, - MY_PERMISSIONS_REQUEST_CAMERA); - } - - - /** When the button is clicked a intent is created for opening the camera */ - Intent picIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); - - /**Creating a file to store the pictures*/ - fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); - /**Setting a name for the file*/ - picIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); - StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); - StrictMode.setVmPolicy(builder.build()); - /**Starting the activity and waiting for the result back*/ - startActivityForResult( picIntent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE ); - } - }); } //Override for the user_toolbar menu items @@ -122,84 +74,6 @@ public class Profile extends AppCompatActivity { return true; } - /**Method which compresses a picture. It is saved as a bitmap but converted to an array of bytes*/ - public static byte[] getPicture(Bitmap bitmap){ - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - bitmap.compress(Bitmap.CompressFormat.PNG, 0, byteArrayOutputStream); - return byteArrayOutputStream.toByteArray(); - } - - - /**Method which waits for the result of the camera*/ - protected void onActivityResult(int requestCode, int resultCode, Intent data) - { - /**Checks whether it is the intent from the camera*/ - if ( requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE && resultCode == RESULT_OK ) - { - try { - /**Getting the data returned*/ - stream = getContentResolver().openInputStream(fileUri); - map = BitmapFactory.decodeStream(stream); - - /**Object of type PictureProperties is created so the picture can be taken*/ - ImageProperties pic = new ImageProperties(fileUri); - - /**The rotation of the picture is set*/ - imageV.setRotation(pic.getCameraPhotoOrientation()); - - /**Displaying the image*/ - imageV.setImageBitmap(map); - /**Compressing it*/ - getPicture(map); - }catch ( Exception e ) - { - e.printStackTrace(); - } - } - } - - /**A file is created for saving an image*/ - @RequiresApi(api = Build.VERSION_CODES.M) - private Uri getOutputMediaFileUri(int type){ - return Uri.fromFile(getOutputMediaFile(type)); - } - - /** Create a File for saving an image */ - @RequiresApi(api = Build.VERSION_CODES.M) - private File getOutputMediaFile(int type){ - /**Checks for permissions for using the external storage - SD card*/ - if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) - != PackageManager.PERMISSION_GRANTED) { - - requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, - MY_PERMISSIONS_REQUEST_EXTERNAL_STORAGE); - } - - File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory( - Environment.DIRECTORY_PICTURES), "UniRides"); - - - /**Creates a directory for storage*/ - if (! mediaStorageDir.exists()){ - if (! mediaStorageDir.mkdirs()){ - Log.d("UniRides", "failed to create directory"); - return null; - } - } - - /**Creates a media file for the images*/ - String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); - File mediaFile; - if (type == MEDIA_TYPE_IMAGE){ - mediaFile = new File(mediaStorageDir.getPath() + File.separator + - "IMG_"+ timeStamp + ".jpg"); - }else { - return null; - } - - return mediaFile; - } - @Override public boolean onOptionsItemSelected(MenuItem item) { diff --git a/unirides.iml b/unirides.iml index 02c67ef..ef040d0 100644 --- a/unirides.iml +++ b/unirides.iml @@ -17,7 +17,7 @@ <option name="ALLOW_USER_CONFIGURATION" value="false" /> <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" /> <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" /> - <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/debug/res;file://$MODULE_DIR$/build/generated/res/google-services/debug;file://$MODULE_DIR$/build/generated/res/resValues/debug" /> + <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/debug/res;file://$MODULE_DIR$/build/generated/res/google-services/debug" /> <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" /> <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" /> </configuration> @@ -86,43 +86,8 @@ <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <excludeFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources" /> <excludeFolder url="file://$MODULE_DIR$/build/generated/source/r" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundle_manifest" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/duplicate_classes_check" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_app_manifest" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_app_info_output_file" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_split_apk_resources" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_jni_libs" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_shaders" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/metadata_feature_manifest" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/signing_config" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/validate_signing_config" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" /> </content> -- GitLab