From e0a89d51494abd1fdddc9e7c47c522b2400dd658 Mon Sep 17 00:00:00 2001 From: Aran Zaiger Date: Fri, 8 Jul 2016 14:23:13 +0300 Subject: [PATCH] added settings screen also added camera connection --- app/src/main/AndroidManifest.xml | 5 + .../sagi/thesocialnotework/MainActivity.java | 4 + .../thesocialnotework/SettingsFragment.java | 144 ++++++++++++++++++ app/src/main/res/layout/fragment_settings.xml | 20 +++ app/src/main/res/values/strings.xml | 2 +- 5 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/SettingsFragment.java create mode 100644 app/src/main/res/layout/fragment_settings.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 68d785a..6927407 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,6 +12,11 @@ + + + + + +// * See the Android Training lesson Communicating with Other Fragments for more information. +// */ +// public interface OnFragmentInteractionListener { +// // TODO: Update argument type and name +// void onFragmentInteraction(Uri uri); +// } + + + + + private View.OnClickListener cameraBtnListener = new View.OnClickListener() + { + + public void onClick(View v) + { + + Log.d(TAG, "in camera Button"); + Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); + startActivityForResult(intent, REQUEST_IMAGE_CAPTURE); + + } + + }; + + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + Log.d(TAG, "on activity result"); + Log.d(TAG, "requestCode: "+requestCode); + Log.d(TAG, "resultCode: "+resultCode); + Log.d(TAG, "Activity.RESULT_OK: "+Activity.RESULT_OK); + if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == Activity.RESULT_OK) { + Log.d(TAG, "inside if"); + + Bundle extras = data.getExtras(); + Bitmap imageBitmap= (Bitmap) extras.get("data"); + Log.d(TAG, "bitmap: "+imageBitmap.toString()); + +// Bitmap imageBitmap = (Bitmap) extras.get("data"); + avatarImage.setImageBitmap(imageBitmap); + } + } + + +} diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml new file mode 100644 index 0000000..799fe50 --- /dev/null +++ b/app/src/main/res/layout/fragment_settings.xml @@ -0,0 +1,20 @@ + + + +