Skip to content

Commit

Permalink
Bug/gallery remove external providers (#324)
Browse files Browse the repository at this point in the history
* - Remove external providers (google drive) to avoid crashes

* - Fix crash when taking video in landscape mode
  • Loading branch information
shirbr510 authored Jun 25, 2017
1 parent dbd45b9 commit 7dbda59
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
15 changes: 10 additions & 5 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

Expand All @@ -30,9 +31,9 @@
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<meta-data
android:name="io.fabric.ApiKey"
android:value="073fbe796531c6ef71a3c78ed34e237691bf78bf"
/>
android:name="io.fabric.ApiKey"
android:value="073fbe796531c6ef71a3c78ed34e237691bf78bf" />

<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
Expand All @@ -48,7 +49,9 @@
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<activity android:name=".Activities.cameraRecorderActivity" />
<activity
android:name=".Activities.cameraRecorderActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.afollestad.materialcamera.CaptureActivity"
android:screenOrientation="portrait"
Expand All @@ -63,8 +66,10 @@
android:theme="@style/AppTheme2" />
<activity
android:name="com.infash.Activities.TrimmerActivity"
android:screenOrientation="portrait" android:theme="@style/AppTheme2"/> <!-- optional (needed if default theme has no action bar) -->
android:screenOrientation="portrait"
android:theme="@style/AppTheme2" /> <!-- optional (needed if default theme has no action bar) -->
android:theme="@style/AppTheme2"
/> <!-- optional (needed if default theme has no action bar) -->


</application>
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/java/com/infash/modules/CameraUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,14 @@ private void openGallery() {

if (Build.VERSION.SDK_INT < 19) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
intent.setType("image/* video/*");
getCurrentActivity().startActivityForResult(Intent.createChooser(intent, "select a file to upload"), PICK_GALLERY);
} else {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
intent.putExtra(Intent.EXTRA_MIME_TYPES, fileTypesObject);
getCurrentActivity().startActivityForResult(intent, PICK_GALLERY);
}
Expand Down
2 changes: 1 addition & 1 deletion android/libs/camera/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest package="com.afollestad.materialcamera">

<application />
<application />

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ protected void setImageRes(ImageView iv, @DrawableRes int res) {
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

Log.d("martin", "created");

mIsVideoAllowed = MaterialCamera.mAllowVideo;
// just one line to try and make it works
mDelayStartCountdown = (TextView) view.findViewById(R.id.delayStartCountdown);
Expand All @@ -160,7 +162,12 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
mButtonVideo.setOnClickListener(this);
mButtonStillshot.setOnClickListener(this);
mButtonFacing.setOnClickListener(this);
mGallery.setOnClickListener(this);



if (mGallery != null){
mGallery.setOnClickListener(this);
}
mButtonFlash.setOnClickListener(this);

int primaryColor = getArguments().getInt(CameraIntentKey.PRIMARY_COLOR);
Expand All @@ -174,8 +181,13 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
d = DrawableCompat.wrap(d.mutate());

mButtonFacing.setImageDrawable(d);
mGallery.setBackgroundResource(R.drawable.gallery);
mRecordIconIndicator.setBackgroundResource(R.drawable.red_circle);
if (mGallery != null) {
mGallery.setBackgroundResource(R.drawable.gallery);
}

if(mRecordIconIndicator != null) {
mRecordIconIndicator.setBackgroundResource(R.drawable.red_circle);
}

if (mMediaRecorder != null && mIsRecording) {
mButtonVideo.setBackgroundResource(R.drawable.red_circle);
Expand Down Expand Up @@ -275,13 +287,15 @@ public void onDestroyView() {
mButtonVideo = null;
mButtonStillshot = null;
mButtonFacing = null;
mGallery = null;
mButtonFlash = null;
mRecordDuration = null;
}

@Override
public void onResume() {
super.onResume();
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
if (mInterface != null && mInterface.hasLengthLimit()) {
if (mInterface.countdownImmediately() || mInterface.getRecordingStart() > -1) {
if (mInterface.getRecordingStart() == -1)
Expand Down Expand Up @@ -396,7 +410,7 @@ public boolean startRecordingVideo() {
}

public void stopRecordingVideo(boolean reachedZero) {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
//getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}

@Override
Expand Down

0 comments on commit 7dbda59

Please sign in to comment.