mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-11 18:10:44 +00:00
Improve call control buttons
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
726ffa6520
commit
823b08f4c0
@ -40,7 +40,6 @@ import android.view.MotionEvent;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
@ -117,6 +116,7 @@ import butterknife.BindView;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
import butterknife.OnLongClick;
|
import butterknife.OnLongClick;
|
||||||
|
import eu.davidea.flipview.FlipView;
|
||||||
import io.reactivex.Observer;
|
import io.reactivex.Observer;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
@ -152,11 +152,11 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
@BindView(R.id.call_controls)
|
@BindView(R.id.call_controls)
|
||||||
RelativeLayout callControls;
|
RelativeLayout callControls;
|
||||||
@BindView(R.id.call_control_microphone)
|
@BindView(R.id.call_control_microphone)
|
||||||
ImageButton microphoneControlButton;
|
FlipView microphoneControlButton;
|
||||||
@BindView(R.id.call_control_camera)
|
@BindView(R.id.call_control_camera)
|
||||||
ImageButton cameraControlButton;
|
FlipView cameraControlButton;
|
||||||
@BindView(R.id.call_control_switch_camera)
|
@BindView(R.id.call_control_switch_camera)
|
||||||
ImageButton cameraSwitchButton;
|
FlipView cameraSwitchButton;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
NcApi ncApi;
|
NcApi ncApi;
|
||||||
@ -228,7 +228,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
microphoneControlButton.setOnTouchListener(new microphoneButtonTouchListener());
|
microphoneControlButton.setOnTouchListener(new microphoneButtonTouchListener());
|
||||||
videoOnClickListener = new videoClickListener();
|
videoOnClickListener = new videoClickListener();
|
||||||
|
|
||||||
pulseAnimation = PulseAnimation.create().with(microphoneControlButton)
|
pulseAnimation = PulseAnimation.create().with(microphoneControlButton.getFrontImageView())
|
||||||
.setDuration(310)
|
.setDuration(310)
|
||||||
.setRepeatCount(PulseAnimation.INFINITE)
|
.setRepeatCount(PulseAnimation.INFINITE)
|
||||||
.setRepeatMode(PulseAnimation.REVERSE);
|
.setRepeatMode(PulseAnimation.REVERSE);
|
||||||
@ -393,14 +393,14 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
audioOn = !audioOn;
|
audioOn = !audioOn;
|
||||||
|
|
||||||
if (audioOn) {
|
if (audioOn) {
|
||||||
microphoneControlButton.setImageResource(R.drawable.ic_mic_white_24px);
|
microphoneControlButton.getFrontImageView().setImageResource(R.drawable.ic_mic_white_24px);
|
||||||
} else {
|
} else {
|
||||||
microphoneControlButton.setImageResource(R.drawable.ic_mic_off_white_24px);
|
microphoneControlButton.getFrontImageView().setImageResource(R.drawable.ic_mic_off_white_24px);
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleMedia(audioOn, false);
|
toggleMedia(audioOn, false);
|
||||||
} else {
|
} else {
|
||||||
microphoneControlButton.setImageResource(R.drawable.ic_mic_white_24px);
|
microphoneControlButton.getFrontImageView().setImageResource(R.drawable.ic_mic_white_24px);
|
||||||
pulseAnimation.start();
|
pulseAnimation.start();
|
||||||
toggleMedia(true, false);
|
toggleMedia(true, false);
|
||||||
}
|
}
|
||||||
@ -431,9 +431,13 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
videoOn = !videoOn;
|
videoOn = !videoOn;
|
||||||
|
|
||||||
if (videoOn) {
|
if (videoOn) {
|
||||||
cameraControlButton.setImageResource(R.drawable.ic_videocam_white_24px);
|
cameraControlButton.getFrontImageView().setImageResource(R.drawable.ic_videocam_white_24px);
|
||||||
|
cameraSwitchButton.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
cameraControlButton.setImageResource(R.drawable.ic_videocam_off_white_24px);
|
cameraControlButton.getFrontImageView().setImageResource(R.drawable.ic_videocam_off_white_24px);
|
||||||
|
if (cameraEnumerator.getDeviceNames().length > 1) {
|
||||||
|
cameraSwitchButton.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleMedia(videoOn, true);
|
toggleMedia(videoOn, true);
|
||||||
@ -566,7 +570,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
onCameraClick();
|
onCameraClick();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cameraControlButton.setImageResource(R.drawable.ic_videocam_off_white_24px);
|
cameraControlButton.getFrontImageView().setImageResource(R.drawable.ic_videocam_off_white_24px);
|
||||||
if (cameraSwitchButton != null) {
|
if (cameraSwitchButton != null) {
|
||||||
cameraSwitchButton.setVisibility(View.GONE);
|
cameraSwitchButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
@ -577,7 +581,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
onMicrophoneClick();
|
onMicrophoneClick();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
microphoneControlButton.setImageResource(R.drawable.ic_mic_off_white_24px);
|
microphoneControlButton.getFrontImageView().setImageResource(R.drawable.ic_mic_off_white_24px);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inCall) {
|
if (!inCall) {
|
||||||
@ -1409,7 +1413,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
super.onAnimationEnd(animation);
|
super.onAnimationEnd(animation);
|
||||||
if (callControls != null) {
|
if (callControls != null) {
|
||||||
if (!show) {
|
if (!show) {
|
||||||
callControls.setVisibility(View.INVISIBLE);
|
callControls.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
handler.postDelayed(new Runnable() {
|
handler.postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -1441,7 +1445,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
v.onTouchEvent(event);
|
v.onTouchEvent(event);
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP && isPTTActive) {
|
if (event.getAction() == MotionEvent.ACTION_UP && isPTTActive) {
|
||||||
isPTTActive = false;
|
isPTTActive = false;
|
||||||
microphoneControlButton.setImageResource(R.drawable.ic_mic_off_white_24px);
|
microphoneControlButton.getFrontImageView().setImageResource(R.drawable.ic_mic_off_white_24px);
|
||||||
pulseAnimation.stop();
|
pulseAnimation.stop();
|
||||||
toggleMedia(false, false);
|
toggleMedia(false, false);
|
||||||
animateCallControls(false, 5000);
|
animateCallControls(false, 5000);
|
||||||
|
@ -51,50 +51,57 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginBottom="16dp">
|
android:layout_marginBottom="16dp"
|
||||||
|
android:animateLayoutChanges="true">
|
||||||
|
|
||||||
<ImageButton
|
<com.nextcloud.talk.utils.MagicFlipView
|
||||||
android:id="@+id/call_control_hangup"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_marginEnd="30dp"
|
|
||||||
android:background="?android:selectableItemBackgroundBorderless"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/ic_call_end_white_24px"
|
|
||||||
android:tint="@color/nc_darkRed"
|
|
||||||
android:tintMode="src_in"/>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/call_control_microphone"
|
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_marginEnd="24dp"
|
|
||||||
android:layout_toEndOf="@id/call_control_hangup"
|
|
||||||
android:alpha="0.7"
|
|
||||||
android:background="?android:selectableItemBackgroundBorderless"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/ic_mic_off_white_24px"/>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/call_control_camera"
|
android:id="@+id/call_control_camera"
|
||||||
android:layout_width="30dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="60dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:layout_toEndOf="@id/call_control_microphone"
|
app:alpha="0.7"
|
||||||
android:alpha="0.7"
|
app:checked="false"
|
||||||
android:background="?android:selectableItemBackgroundBorderless"
|
app:enableInitialAnimation="false"
|
||||||
android:scaleType="centerCrop"
|
app:frontBackgroundColor="@color/colorPrimary"
|
||||||
android:src="@drawable/ic_videocam_off_white_24px"/>
|
app:frontImage="@drawable/ic_videocam_off_white_24px"/>
|
||||||
|
|
||||||
<ImageButton
|
<com.nextcloud.talk.utils.MagicFlipView
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/call_control_switch_camera"
|
android:id="@+id/call_control_switch_camera"
|
||||||
android:layout_width="38dp"
|
android:layout_width="60dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
android:layout_toEndOf="@id/call_control_camera"
|
android:layout_toEndOf="@id/call_control_camera"
|
||||||
android:background="?android:selectableItemBackgroundBorderless"
|
app:alpha="0.7"
|
||||||
android:scaleType="centerCrop"
|
app:checked="false"
|
||||||
android:src="@drawable/ic_switch_video_white_24px"
|
app:enableInitialAnimation="false"
|
||||||
android:visibility="invisible"/>
|
app:frontBackgroundColor="@color/colorPrimary"
|
||||||
|
app:frontImage="@drawable/ic_switch_video_white_24px"/>
|
||||||
|
|
||||||
|
<com.nextcloud.talk.utils.MagicFlipView
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/call_control_microphone"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_toEndOf="@id/call_control_switch_camera"
|
||||||
|
app:alpha="0.7"
|
||||||
|
app:checked="false"
|
||||||
|
app:enableInitialAnimation="false"
|
||||||
|
app:frontBackgroundColor="@color/colorPrimary"
|
||||||
|
app:frontImage="@drawable/ic_mic_off_white_24px"/>
|
||||||
|
|
||||||
|
<com.nextcloud.talk.utils.MagicFlipView
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/call_control_hangup"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_toEndOf="@+id/call_control_microphone"
|
||||||
|
app:checked="false"
|
||||||
|
app:enableInitialAnimation="false"
|
||||||
|
app:frontBackgroundColor="@color/nc_darkRed"
|
||||||
|
app:frontImage="@drawable/ic_call_end_white_24px"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user