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

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

Camera: Change multi lens switch icon

parent db39f545
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ android {

    defaultConfig {
        applicationId "foundation.e.camera"
        minSdkVersion 15
        minSdkVersion 25
        targetSdkVersion 34
        //compileSdkVersion 31 // needed to support appcompat:1.4.0 (which we need for emoji policy support, and not yet ready to target SDK 30)

@@ -65,6 +65,8 @@ dependencies {

    implementation "org.greenrobot:eventbus:3.3.1"

    implementation 'foundation.e:elib:0.0.1-alpha11'

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    implementation 'androidx.exifinterface:exifinterface:1.3.7'
+34 −13
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.SeekBar;
@@ -2375,20 +2376,8 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
            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 ) {
@@ -2412,6 +2401,24 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        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);
@@ -2562,6 +2569,18 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        showAlert(alertDialog.create());
    }

    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
     */
@@ -3433,6 +3452,8 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
            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>
+8 −11
Original line number Diff line number Diff line
@@ -41,22 +41,19 @@
        android:backgroundTintMode="src_in"
        />

    <ImageButton
    <Button
        android:id="@+id/switch_multi_camera"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:paddingLeft="15dp"
        android:paddingRight="15dp"
        android:paddingTop="12dp"
        android:paddingBottom="18dp"
        android:layout_width="65dp"
        android:layout_height="65dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        android:scaleType="fitCenter"
        android:contentDescription="@string/switch_multi_camera"
        app:srcCompat="@drawable/baseline_add_a_photo_white_48"
        android:onClick="clickedSwitchMultiCamera"
        android:stateListAnimator="@animator/button_animation"
        android:background="@drawable/circle_background"
        android:backgroundTint="@color/icons_background_tint"
        android:backgroundTintMode="src_in"
        android:background="@drawable/ic_lens_background"
        android:visibility="gone"
        />

+2 −0
Original line number Diff line number Diff line
@@ -1103,4 +1103,6 @@
        - Support for Camera2 API\n
        - Panorama, including for front camera.</string>
    <string name="preferences_service_terms">Terms of service</string>

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