mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
fix issue with camera controls going missing
fixes #3775 Closes #3823 // FREEBIE
This commit is contained in:
parent
8fbc14b191
commit
5cf95f5b3d
@ -29,6 +29,7 @@ import org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout;
|
||||
import org.thoughtcrime.securesms.components.camera.QuickCamera.QuickCameraListener;
|
||||
import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
public class QuickAttachmentDrawer extends ViewGroup implements InputView {
|
||||
private static final String TAG = QuickAttachmentDrawer.class.getSimpleName();
|
||||
@ -112,9 +113,8 @@ public class QuickAttachmentDrawer extends ViewGroup implements InputView {
|
||||
}
|
||||
|
||||
private void updateControlsView() {
|
||||
int controlsIndex = indexOfChild(controls);
|
||||
if (controlsIndex > -1) removeView(controls);
|
||||
controls = LayoutInflater.from(getContext()).inflate(isLandscape() ? R.layout.quick_camera_controls_land
|
||||
Log.w(TAG, "updateControlsView()");
|
||||
View controls = LayoutInflater.from(getContext()).inflate(isLandscape() ? R.layout.quick_camera_controls_land
|
||||
: R.layout.quick_camera_controls,
|
||||
this, false);
|
||||
shutterButton = (ImageButton) controls.findViewById(R.id.shutter_button);
|
||||
@ -126,8 +126,8 @@ public class QuickAttachmentDrawer extends ViewGroup implements InputView {
|
||||
}
|
||||
shutterButton.setOnClickListener(new ShutterClickListener());
|
||||
fullScreenButton.setOnClickListener(new FullscreenClickListener());
|
||||
controls.setVisibility(INVISIBLE);
|
||||
addView(controls, controlsIndex > -1 ? controlsIndex : indexOfChild(quickCamera) + 1);
|
||||
ViewUtil.swapChildInPlace(this, this.controls, controls, indexOfChild(quickCamera) + 1);
|
||||
this.controls = controls;
|
||||
}
|
||||
|
||||
private boolean isLandscape() {
|
||||
@ -499,7 +499,7 @@ public class QuickAttachmentDrawer extends ViewGroup implements InputView {
|
||||
COLLAPSED, HALF_EXPANDED, FULL_EXPANDED;
|
||||
|
||||
public boolean isVisible() {
|
||||
return this == HALF_EXPANDED || this == FULL_EXPANDED;
|
||||
return this != COLLAPSED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ package org.thoughtcrime.securesms.util;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
public class ViewUtil {
|
||||
public static void setBackgroundSavingPadding(View v, Drawable drawable) {
|
||||
@ -38,4 +39,10 @@ public class ViewUtil {
|
||||
v.setBackgroundResource(resId);
|
||||
v.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
|
||||
}
|
||||
|
||||
public static void swapChildInPlace(ViewGroup parent, View toRemove, View toAdd, int defaultIndex) {
|
||||
int childIndex = parent.indexOfChild(toRemove);
|
||||
if (childIndex > -1) parent.removeView(toRemove);
|
||||
parent.addView(toAdd, childIndex > -1 ? childIndex : defaultIndex);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user