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