Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/acomminos/Plumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Comminos <andrew@comminos.com>2016-11-12 05:52:43 +0300
committerAndrew Comminos <andrew@comminos.com>2016-11-12 05:52:43 +0300
commit22d3a9456aed7429b288d758e99aff9d6b3339b8 (patch)
tree52e28e165d0577c9b61cc8658336e80b01d3ad47
parentfb0729d9c995a11d1e00a03857583d6ec3a9bd8f (diff)
Issue #158 - Hide PTT when muted.
-rw-r--r--app/src/main/java/com/morlunk/mumbleclient/channel/ChannelFragment.java58
-rw-r--r--app/src/main/res/anim/slide_down.xml22
-rw-r--r--app/src/main/res/anim/slide_up.xml22
m---------libraries/Jumble0
4 files changed, 56 insertions, 46 deletions
diff --git a/app/src/main/java/com/morlunk/mumbleclient/channel/ChannelFragment.java b/app/src/main/java/com/morlunk/mumbleclient/channel/ChannelFragment.java
index 8f46a13..1b007c3 100644
--- a/app/src/main/java/com/morlunk/mumbleclient/channel/ChannelFragment.java
+++ b/app/src/main/java/com/morlunk/mumbleclient/channel/ChannelFragment.java
@@ -17,6 +17,7 @@
package com.morlunk.mumbleclient.channel;
+import android.animation.Animator;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.os.Bundle;
@@ -35,6 +36,9 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.AnimationSet;
+import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
@@ -75,6 +79,9 @@ public class ChannelFragment extends JumbleServiceFragment implements SharedPref
/** Chat target listeners, notified when the chat target is changed. */
private List<OnChatTargetSelectedListener> mChatTargetListeners = new ArrayList<OnChatTargetSelectedListener>();
+ /** True iff the talk button has been hidden (e.g. when muted) */
+ private boolean mTalkButtonHidden;
+
private JumbleObserver mObserver = new JumbleObserver() {
@Override
public void onUserTalkStateUpdated(IUser user) {
@@ -95,6 +102,13 @@ public class ChannelFragment extends JumbleServiceFragment implements SharedPref
}
@Override
+ public void onUserStateUpdated(IUser user) {
+ if (user != null && user.getSession() == getService().getSession()) {
+ configureInput();
+ }
+ }
+
+ @Override
public void onVoiceTargetChanged(VoiceTargetMode mode) {
configureTargetPanel();
}
@@ -233,6 +247,7 @@ public class ChannelFragment extends JumbleServiceFragment implements SharedPref
public void onServiceBound(IJumbleService service) {
super.onServiceBound(service);
configureTargetPanel();
+ configureInput();
}
private void configureTargetPanel() {
@@ -264,8 +279,47 @@ public class ChannelFragment extends JumbleServiceFragment implements SharedPref
params.height = settings.getPTTButtonHeight();
mTalkButton.setLayoutParams(params);
- boolean showPttButton = settings.isPushToTalkButtonShown() && settings.getInputMethod().equals(Settings.ARRAY_INPUT_METHOD_PTT);
- mTalkView.setVisibility(showPttButton ? View.VISIBLE : View.GONE);
+ IUser user = getService().getSessionUser();
+ boolean muted = false;
+ if (user != null) {
+ muted = user.isMuted() || user.isSuppressed() || user.isSelfMuted();
+ }
+ boolean showPttButton =
+ !muted &&
+ settings.isPushToTalkButtonShown() &&
+ settings.getInputMethod().equals(Settings.ARRAY_INPUT_METHOD_PTT);
+ setTalkButtonHidden(!showPttButton);
+ }
+
+ private void setTalkButtonHidden(final boolean hidden) {
+ if (hidden ^ mTalkButtonHidden) {
+ Settings settings = Settings.getInstance(getActivity());
+ mTalkView.animate()
+ .setDuration(300)
+ .translationY(hidden ? settings.getPTTButtonHeight() : 0)
+ .setListener(new Animator.AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ mTalkView.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mTalkView.setVisibility(hidden ? View.GONE : View.VISIBLE);
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+
+ }
+
+ @Override
+ public void onAnimationRepeat(Animator animation) {
+
+ }
+ });
+ }
+ mTalkButtonHidden = hidden;
}
@Override
diff --git a/app/src/main/res/anim/slide_down.xml b/app/src/main/res/anim/slide_down.xml
deleted file mode 100644
index dea3272..0000000
--- a/app/src/main/res/anim/slide_down.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- ~ Copyright (C) 2014 Andrew Comminos
- ~
- ~ This program is free software: you can redistribute it and/or modify
- ~ it under the terms of the GNU General Public License as published by
- ~ the Free Software Foundation, either version 3 of the License, or
- ~ (at your option) any later version.
- ~
- ~ This program is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ~ GNU General Public License for more details.
- ~
- ~ You should have received a copy of the GNU General Public License
- ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android">
- <translate android:fromYDelta="-100%" android:toYDelta="0%" android:duration="300" android:interpolator="@android:anim/decelerate_interpolator"/>
-</set> \ No newline at end of file
diff --git a/app/src/main/res/anim/slide_up.xml b/app/src/main/res/anim/slide_up.xml
deleted file mode 100644
index 836ec33..0000000
--- a/app/src/main/res/anim/slide_up.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- ~ Copyright (C) 2014 Andrew Comminos
- ~
- ~ This program is free software: you can redistribute it and/or modify
- ~ it under the terms of the GNU General Public License as published by
- ~ the Free Software Foundation, either version 3 of the License, or
- ~ (at your option) any later version.
- ~
- ~ This program is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ~ GNU General Public License for more details.
- ~
- ~ You should have received a copy of the GNU General Public License
- ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
-
-<set xmlns:android="http://schemas.android.com/apk/res/android">
- <translate android:fromYDelta="0%" android:toYDelta="-100%" android:duration="300" android:interpolator="@android:anim/accelerate_interpolator"/>
-</set> \ No newline at end of file
diff --git a/libraries/Jumble b/libraries/Jumble
-Subproject 4de76b7395cee235cd4f537ec295b3c9bdc2ba5
+Subproject 9933c8a0caa2bbd1a8fb28ab4c985bde73a7684