Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-19769] (5_2_X) Android: Fix for fullscreen behavior in Camera #7663

Merged
merged 4 commits into from Feb 2, 2016

Conversation

ashcoding
Copy link
Contributor

Jira: https://jira.appcelerator.org/browse/TIMOB-19769
PR #7552 caused an edge case issue for Camera.

Code to test:-

var self = Ti.UI.createWindow();
    var cameraOverlay = Titanium.UI.createView({
        backgroundColor: '#FF00FFAA'
    });

    var cameraOverlayButton = Titanium.UI.createImageView({
        bottom: 100,
        image: '/appcelerator_small.png',
    });
    cameraOverlay.add(cameraOverlayButton);

    cameraOverlay.addEventListener('click', function(e){
        Ti.API.info("taking pic");
        Ti.Media.takePicture();
    });

    self.addEventListener("postlayout", postlayoutHandler);
    function postlayoutHandler(e) {
        self.removeEventListener("postlayout", postlayoutHandler);
        Titanium.Media.showCamera({
            overlay: cameraOverlay,
            showControls: false,
            success: function(e) {
                  Ti.API.info('# SUCCESS : '+ JSON.stringify(e));
            },
            cancel: function(e) {
                  Ti.API.info('# CANCEL : '+e.error);

            },
            error: function(e) {
                  Ti.API.info('# ERROR : '+ e.code +' : '+ e.error);

            },
            mediaTypes:Ti.Media.MEDIA_TYPE_PHOTO,
        });
    }
    self.open();

@ashcoding
Copy link
Contributor Author

This is for 5_2_X. Will add a Master branch PR once this is approved.

@ashcoding ashcoding changed the title [TIMOB-19769] Android: Fix for fullscreen behavior in Camera [TIMOB-19769] (5_2_X) Android: Fix for fullscreen behavior in Camera Feb 2, 2016
@@ -134,7 +137,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
@Override
public void onCreate(Bundle savedInstanceState)
{
setFullscreen(true);
setFullscreenForCamera(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since base class should be agnostic of derived classes, adding camera specific method in base class is not advised.

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); can be moved here. Also this is being used specifically for TiCameraActivity only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved the setFullscreenForCamera method into this class to address this in the updated commit.

@sriks
Copy link
Contributor

sriks commented Feb 2, 2016

@ashcoding please address the review comments.

@ashcoding
Copy link
Contributor Author

Comments addressed @sriks. Please review again. Thank you.

@@ -161,6 +164,13 @@ public void onCreate(Bundle savedInstanceState)

}

public void setFullscreenForCamera(boolean fullscreen)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking for truth value is not required since we never set back from fullscreen.

@ashcoding
Copy link
Contributor Author

@sriks, Comments addressed.

sriks added a commit that referenced this pull request Feb 2, 2016
[TIMOB-19769] (5_2_X) Android: Fix for fullscreen behavior in Camera
@sriks sriks merged commit 65ccc05 into tidev:5_2_X Feb 2, 2016
@sriks
Copy link
Contributor

sriks commented Feb 2, 2016

PR reviewed and merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants