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

Commit 78552434 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Camera: Change multi lens switch icon

parent af091387
Loading
Loading
Loading
Loading
Loading
+34 −13
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.SeekBar;
@@ -2224,20 +2225,8 @@ public class MainActivity extends AppCompatActivity {
            Log.e(TAG, "getNextMultiCameraId() called but not in multi-cam mode");
            throw new RuntimeException("getNextMultiCameraId() called but not in multi-cam mode");
        }
        List<Integer> camera_set;
        // don't use preview.getCameraController(), as it may be null if user quickly switches between cameras
        int currCameraId = getActualCameraId();
        switch( preview.getCameraControllerManager().getFacing(currCameraId) ) {
            case FACING_BACK:
                camera_set = back_camera_ids;
                break;
            case FACING_FRONT:
                camera_set = front_camera_ids;
                break;
            default:
                camera_set = other_camera_ids;
                break;
        }
        List<Integer> camera_set = getCameraSet(currCameraId);
        int cameraId;
        int indx = camera_set.indexOf(currCameraId);
        if( indx == -1 ) {
@@ -2254,6 +2243,24 @@ public class MainActivity extends AppCompatActivity {
        return cameraId;
    }

    private List<Integer> getCameraSet(int currCameraId) {
        // don't use preview.getCameraController(), as it may be null if user quickly switches between cameras
        List<Integer> camera_set;
        switch( preview.getCameraControllerManager().getFacing(currCameraId) ) {
            case FACING_BACK:
                camera_set = back_camera_ids;
                break;
            case FACING_FRONT:
                camera_set = front_camera_ids;
                break;
            default:
                camera_set = other_camera_ids;
                break;
        }

        return camera_set;
    }

    private void pushCameraIdToast(int cameraId) {
        if( MyDebug.LOG )
            Log.d(TAG, "pushCameraIdToast: " + cameraId);
@@ -2338,6 +2345,18 @@ public class MainActivity extends AppCompatActivity {
        }
    }

    private void updateMultiCameraIcon() {
        Button multiCameraButton = findViewById(R.id.switch_multi_camera);

        if (multiCameraButton.getVisibility() != View.GONE) {
            int currCameraId = getActualCameraId();
            List<Integer> camera_set = getCameraSet(currCameraId);
            int index = camera_set.indexOf(currCameraId);
            String text = getString(R.string.switch_multi_camera_lens) + " " + (index + 1);
            multiCameraButton.setText(text);
        }
    }

    /**
     * Toggles Photo/Video mode
     */
@@ -3146,6 +3165,8 @@ public class MainActivity extends AppCompatActivity {
            View button = findViewById(R.id.switch_multi_camera);
            changed = changed || (button.getVisibility() != View.GONE);
            button.setVisibility(View.GONE);
        } else {
            updateMultiCameraIcon();
        }
        if( MyDebug.LOG )
            Log.d(TAG, "checkDisableGUIIcons: " + changed);
+9 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="65dp"
    android:height="27dp"
    android:viewportWidth="65"
    android:viewportHeight="27">
  <path
      android:pathData="M13.496,0.88L51.496,0.88A13,13 0,0 1,64.496 13.88L64.496,13.88A13,13 0,0 1,51.496 26.88L13.496,26.88A13,13 0,0 1,0.496 13.88L0.496,13.88A13,13 0,0 1,13.496 0.88z"
      android:fillColor="@color/e_disabled_color_light" />
</vector>
+0 −25
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="37dp"
    android:height="37dp"
    android:viewportWidth="37"
    android:viewportHeight="37">
    <path
        android:fillAlpha="0.38"
        android:fillColor="@android:color/black"
        android:pathData="M18.3701,0.1182L18.3701,0.1182A18,18 0,0 1,36.3701 18.1182L36.3701,18.1182A18,18 0,0 1,18.3701 36.1182L18.3701,36.1182A18,18 0,0 1,0.3701 18.1182L0.3701,18.1182A18,18 0,0 1,18.3701 0.1182z" />
    <group>
        <clip-path android:pathData="M7.3701,7.1182h22v22h-22z" />
        <path
            android:fillColor="@color/color_default_icon"
            android:pathData="M22.0368,13.5348H21.1201L20.2035,12.6182H16.5368L15.6201,13.5348H14.7035C13.6951,13.5348 12.8701,14.3598 12.8701,15.3682V20.8682C12.8701,21.8765 13.6951,22.7015 14.7035,22.7015H22.0368C23.0451,22.7015 23.8701,21.8765 23.8701,20.8682V15.3682C23.8701,14.3598 23.0451,13.5348 22.0368,13.5348ZM22.0368,20.8682H14.7035V15.3682H16.381L17.2976,14.4515H19.4426L20.3593,15.3682H22.0368V20.8682Z" />
        <path
            android:fillColor="@color/color_default_icon"
            android:pathData="M18.3701,19.9515C19.3826,19.9515 20.2035,19.1307 20.2035,18.1182C20.2035,17.1056 19.3826,16.2848 18.3701,16.2848C17.3576,16.2848 16.5368,17.1056 16.5368,18.1182C16.5368,19.1307 17.3576,19.9515 18.3701,19.9515Z" />
        <path
            android:fillColor="@color/color_default_icon"
            android:pathData="M15.226,7.5948L19.3326,11.7015L20.6251,10.409L19.2135,8.9973C23.5951,9.3732 27.106,12.8382 27.5368,17.2015H29.3701C28.7835,10.1432 21.8443,5.5873 15.226,7.5948Z" />
        <path
            android:fillColor="@color/color_default_icon"
            android:pathData="M16.1151,25.8273L17.5268,27.239C13.1451,26.8632 9.6343,23.3982 9.2035,19.0348H7.3701C7.9568,26.0932 14.896,30.649 21.5143,28.6415L17.4076,24.5348L16.1151,25.8273Z" />
    </group>
</vector>
+4 −5
Original line number Diff line number Diff line
@@ -135,15 +135,14 @@
        android:layout_height="wrap_content"
        android:background="@color/navigation_background"/>

    <ImageButton
    <Button
        android:id="@+id/switch_multi_camera"
        android:layout_width="@dimen/onscreen_bottom_button_size"
        android:layout_height="@dimen/onscreen_bottom_button_size"
        android:background="@null"
        android:layout_width="65dp"
        android:layout_height="27dp"
        android:background="@drawable/ic_lens_background"
        android:contentDescription="@string/switch_multi_camera"
        android:onClick="clickedSwitchMultiCamera"
        android:scaleType="fitCenter"
        android:src="@drawable/ic_switch_multi_camera"
        android:visibility="gone"

        />
+2 −0
Original line number Diff line number Diff line
@@ -1083,4 +1083,6 @@
    <string name="back_button_label">Back</string>
    <string name="next_button_label">Next</string>
    <string name="skip_button_label">Skip</string>

    <string name="switch_multi_camera_lens">LENS</string>
</resources>