mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-31 03:22:03 +00:00
Add fancy spotlight for push-to-talk
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
828a0a504e
commit
64adf81e13
@ -148,6 +148,8 @@ dependencies {
|
||||
|
||||
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
|
||||
|
||||
implementation 'com.github.wooplr:Spotlight:1.2.3'
|
||||
|
||||
implementation 'com.github.Kennyc1012:BottomSheet:2.4.0'
|
||||
implementation 'eu.davidea:flipview:1.1.3'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
|
@ -29,6 +29,7 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
@ -73,6 +74,7 @@ import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
import com.nextcloud.talk.webrtc.MagicAudioManager;
|
||||
import com.nextcloud.talk.webrtc.MagicPeerConnectionWrapper;
|
||||
import com.nextcloud.talk.webrtc.MagicWebRTCUtils;
|
||||
import com.wooplr.spotlight.SpotlightView;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -205,6 +207,8 @@ public class CallActivity extends AppCompatActivity {
|
||||
|
||||
private boolean initialPermissionsCheck = true;
|
||||
|
||||
private SpotlightView spotlightView;
|
||||
|
||||
private static int getSystemUiVisibility() {
|
||||
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
@ -391,6 +395,28 @@ public class CallActivity extends AppCompatActivity {
|
||||
@OnClick(R.id.call_control_microphone)
|
||||
public void onMicrophoneClick() {
|
||||
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_MICROPHONE)) {
|
||||
|
||||
spotlightView = new SpotlightView.Builder(this)
|
||||
.introAnimationDuration(300)
|
||||
.enableRevealAnimation(true)
|
||||
.performClick(false)
|
||||
.fadeinTextDuration(400)
|
||||
.headingTvColor(getResources().getColor(R.color.colorPrimary))
|
||||
.headingTvSize(20)
|
||||
.headingTvText(getString(R.string.nc_push_to_talk))
|
||||
.subHeadingTvColor(getResources().getColor(R.color.nc_white_color_complete))
|
||||
.subHeadingTvSize(16)
|
||||
.subHeadingTvText(getString(R.string.nc_push_to_talk_desc))
|
||||
.maskColor(Color.parseColor("#dc000000"))
|
||||
.target(microphoneControlButton)
|
||||
.lineAnimDuration(400)
|
||||
.lineAndArcColor(getResources().getColor(R.color.colorPrimary))
|
||||
.enableDismissAfterShown(true)
|
||||
.dismissOnBackPress(true)
|
||||
.usageId("pushToTalk")
|
||||
.show();
|
||||
|
||||
|
||||
if (!isPTTActive) {
|
||||
audioOn = !audioOn;
|
||||
|
||||
@ -1404,7 +1430,13 @@ public class CallActivity extends AppCompatActivity {
|
||||
callControls.setAlpha(0.0f);
|
||||
callControls.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
handler.postDelayed(() -> animateCallControls(false, 0), 5000);
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
animateCallControls(false, 0);
|
||||
|
||||
}
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -1425,6 +1457,9 @@ public class CallActivity extends AppCompatActivity {
|
||||
if (callControls != null) {
|
||||
if (!show) {
|
||||
callControls.setVisibility(View.GONE);
|
||||
if (spotlightView.getVisibility() != View.GONE) {
|
||||
spotlightView.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
|
@ -132,6 +132,8 @@
|
||||
|
||||
<!-- Magical stuff -->
|
||||
<string name="nc_empty"></string>
|
||||
<string name="nc_push_to_talk">Push-to-talk</string>
|
||||
<string name="nc_push_to_talk_desc">With microphone disabled, click&hold to use Push-to-talk</string>
|
||||
<string name="nc_store_short_desc">Have private video calls and chat using your own server.</string>
|
||||
<string name="nc_store_full_desc">Use Nextcloud Talk to have one-on-one or group audio or video calls, create or join web conferences and send chat messages. All communication is fully encrypted and mediated by your own server, providing the highest degree of privacy possible.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user