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

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

Camera: Change multi lens switch icon

parent 21bba04e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,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.4.1'
+20 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -107,6 +108,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;
@@ -747,6 +749,8 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen

        if( MyDebug.LOG )
            Log.d(TAG, "onCreate: total time for Activity startup: " + (System.currentTimeMillis() - debug_time));

        updateMultiCameraIcon(0, null);
    }

    @Override
@@ -2486,11 +2490,24 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        }
    }

    private void updateMultiCameraIcon(int cameraId, String cameraIdSPhysical) {
        Button switchMultiCameraButton = findViewById(R.id.switch_multi_camera);
        if (switchMultiCameraButton == null) return;

        String displayId = Objects.requireNonNullElse(
                cameraIdSPhysical,
                String.valueOf(cameraId)
        );

        String text = getString(R.string.switch_multi_camera_lens) + " " + displayId;
        switchMultiCameraButton.setText(text);
    }

    public void userSwitchToCamera(int cameraId, String cameraIdSPhysical) {
        if( MyDebug.LOG )
            Log.d(TAG, "userSwitchToCamera: " + cameraId + " / " + cameraIdSPhysical);
        View switchCameraButton = findViewById(R.id.switch_camera);
        View switchMultiCameraButton = findViewById(R.id.switch_multi_camera);
        Button switchMultiCameraButton = findViewById(R.id.switch_multi_camera);
        // prevent slowdown if user repeatedly clicks:
        switchCameraButton.setEnabled(false);
        switchMultiCameraButton.setEnabled(false);
@@ -2513,6 +2530,7 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        }
        this.preview.setCamera(cameraId, cameraIdSPhysical);
        switchCameraButton.setEnabled(true);
        updateMultiCameraIcon(cameraId, cameraIdSPhysical);
        switchMultiCameraButton.setEnabled(true);
        // no need to call mainUI.setSwitchCameraContentDescription - this will be called from Preview.cameraSetup when the
        // new camera is opened
@@ -3681,7 +3699,7 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        if( !showSwitchMultiCamIcon() ) {
            // also handle the multi-cam icon here, as this can change when switching between front/back cameras
            // (e.g., if say a device only has multiple back cameras)
            View button = findViewById(R.id.switch_multi_camera);
            Button button = findViewById(R.id.switch_multi_camera);
            changed = changed || (button.getVisibility() != View.GONE);
            button.setVisibility(View.GONE);
        }
+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"
        />

+1 −0
Original line number Diff line number Diff line
@@ -16,4 +16,5 @@
        - Panorama, including for front camera.
    </string>
    <string name="preferences_service_terms">Terms of service</string>
    <string name="switch_multi_camera_lens" translatable="false">LENS</string>
</resources>
Loading