Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 048a61c7 authored by Doris Liu's avatar Doris Liu
Browse files

Improve black bar to keep camera controls in place

Bug: 8340996

Change-Id: Ibca4a9f1ed84bd59e29cc988df346f1567de2a5b
parent 8ce4df01
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -13,13 +13,13 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.camera.ui.RotatableLayout
<com.android.camera.ui.CameraControls
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/camera_controls"
    style="@style/CameraControls"
    android:layout_gravity="center" >

        <com.android.camera.ui.SwitcherBackgroundView
        <View
            android:id="@+id/blocker"
            android:layout_height="match_parent"
            android:layout_width="@dimen/switcher_size"
@@ -58,4 +58,4 @@
            android:focusable="true"
            android:scaleType="center"
            android:src="@drawable/btn_new_shutter" />
</com.android.camera.ui.RotatableLayout>
</com.android.camera.ui.CameraControls>
+3 −3
Original line number Diff line number Diff line
@@ -13,13 +13,13 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.camera.ui.RotatableLayout
<com.android.camera.ui.CameraControls
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/camera_controls"
    style="@style/CameraControls"
    android:layout_gravity="center" >

        <com.android.camera.ui.SwitcherBackgroundView
        <View
            android:id="@+id/blocker"
            android:layout_width="match_parent"
            android:layout_height="@dimen/switcher_size"
@@ -59,4 +59,4 @@
            android:scaleType="center"
            android:src="@drawable/btn_new_shutter" />

</com.android.camera.ui.RotatableLayout>
 No newline at end of file
</com.android.camera.ui.CameraControls>
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -13,7 +13,8 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.android.camera.ui.CameraRootView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/content"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
@@ -29,4 +30,4 @@
        style="@style/CameraControls"
        android:layout_centerInParent="true" />

</RelativeLayout>
 No newline at end of file
</com.android.camera.ui.CameraRootView>
 No newline at end of file
+0 −16
Original line number Diff line number Diff line
@@ -118,7 +118,6 @@ public class CameraActivity extends ActivityBase

    public void init() {
        boolean landscape = Util.getDisplayRotation(this) % 180 == 90;
        setMargins(landscape);
        mControlsBackground = findViewById(R.id.blocker);
        mCameraControls = findViewById(R.id.camera_controls);
        mShutter = (ShutterButton) findViewById(R.id.shutter_button);
@@ -318,24 +317,9 @@ public class CameraActivity extends ActivityBase
    @Override
    public void onConfigurationChanged(Configuration config) {
        super.onConfigurationChanged(config);
        boolean landscape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE);
        setMargins(landscape);
        mCurrentModule.onConfigurationChanged(config);
    }

    private void setMargins(boolean landscape) {
        ViewGroup appRoot = (ViewGroup) findViewById(R.id.content);
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) appRoot.getLayoutParams();
        int navBarWidth = getResources().getDimensionPixelSize(R.dimen.navigation_bar_width);
        int navBarHeight = getResources().getDimensionPixelSize(R.dimen.navigation_bar_height);
        if (landscape) {
            lp.setMargins(navBarHeight, 0, navBarHeight - navBarWidth, 0);
        } else {
            lp.setMargins(0, navBarHeight, 0, 0);
        }
        appRoot.setLayoutParams(lp);
    }

    @Override
    public void onPause() {
        mPaused = true;
+2 −0
Original line number Diff line number Diff line
@@ -115,6 +115,8 @@ public class PhotoUI implements PieListener,
                h = width;
            }
            if (mPreviewWidth != w || mPreviewHeight != h) {
                mPreviewWidth = w;
                mPreviewHeight = h;
                mController.onScreenSizeChanged(width, height, w, h);
            }
        }
Loading