Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/CallFragment.java

Issue 1820113003: Add Mic Toggle button to AppRTCDemo (Android). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 13 matching lines...) Expand all
24 24
25 /** 25 /**
26 * Fragment for call control. 26 * Fragment for call control.
27 */ 27 */
28 public class CallFragment extends Fragment { 28 public class CallFragment extends Fragment {
29 private View controlView; 29 private View controlView;
30 private TextView contactView; 30 private TextView contactView;
31 private ImageButton disconnectButton; 31 private ImageButton disconnectButton;
32 private ImageButton cameraSwitchButton; 32 private ImageButton cameraSwitchButton;
33 private ImageButton videoScalingButton; 33 private ImageButton videoScalingButton;
34 private ImageButton toggleMuteButton;
34 private TextView captureFormatText; 35 private TextView captureFormatText;
35 private SeekBar captureFormatSlider; 36 private SeekBar captureFormatSlider;
36 private OnCallEvents callEvents; 37 private OnCallEvents callEvents;
37 private ScalingType scalingType; 38 private ScalingType scalingType;
38 private boolean videoCallEnabled = true; 39 private boolean videoCallEnabled = true;
39 40
40 /** 41 /**
41 * Call control interface for container activity. 42 * Call control interface for container activity.
42 */ 43 */
43 public interface OnCallEvents { 44 public interface OnCallEvents {
44 public void onCallHangUp(); 45 public void onCallHangUp();
45 public void onCameraSwitch(); 46 public void onCameraSwitch();
46 public void onVideoScalingSwitch(ScalingType scalingType); 47 public void onVideoScalingSwitch(ScalingType scalingType);
47 public void onCaptureFormatChange(int width, int height, int framerate); 48 public void onCaptureFormatChange(int width, int height, int framerate);
49 public boolean onToggleMic();
48 } 50 }
49 51
50 @Override 52 @Override
51 public View onCreateView(LayoutInflater inflater, ViewGroup container, 53 public View onCreateView(LayoutInflater inflater, ViewGroup container,
52 Bundle savedInstanceState) { 54 Bundle savedInstanceState) {
53 controlView = 55 controlView =
54 inflater.inflate(R.layout.fragment_call, container, false); 56 inflater.inflate(R.layout.fragment_call, container, false);
55 57
56 // Create UI controls. 58 // Create UI controls.
57 contactView = 59 contactView =
58 (TextView) controlView.findViewById(R.id.contact_name_call); 60 (TextView) controlView.findViewById(R.id.contact_name_call);
59 disconnectButton = 61 disconnectButton =
60 (ImageButton) controlView.findViewById(R.id.button_call_disconnect); 62 (ImageButton) controlView.findViewById(R.id.button_call_disconnect);
61 cameraSwitchButton = 63 cameraSwitchButton =
62 (ImageButton) controlView.findViewById(R.id.button_call_switch_camera); 64 (ImageButton) controlView.findViewById(R.id.button_call_switch_camera);
63 videoScalingButton = 65 videoScalingButton =
64 (ImageButton) controlView.findViewById(R.id.button_call_scaling_mode); 66 (ImageButton) controlView.findViewById(R.id.button_call_scaling_mode);
67 toggleMuteButton =
68 (ImageButton) controlView.findViewById(R.id.button_call_toggle_mic);
65 captureFormatText = 69 captureFormatText =
66 (TextView) controlView.findViewById(R.id.capture_format_text_call); 70 (TextView) controlView.findViewById(R.id.capture_format_text_call);
67 captureFormatSlider = 71 captureFormatSlider =
68 (SeekBar) controlView.findViewById(R.id.capture_format_slider_call); 72 (SeekBar) controlView.findViewById(R.id.capture_format_slider_call);
69 73
70 // Add buttons click events. 74 // Add buttons click events.
71 disconnectButton.setOnClickListener(new View.OnClickListener() { 75 disconnectButton.setOnClickListener(new View.OnClickListener() {
72 @Override 76 @Override
73 public void onClick(View view) { 77 public void onClick(View view) {
74 callEvents.onCallHangUp(); 78 callEvents.onCallHangUp();
(...skipping 17 matching lines...) Expand all
92 } else { 96 } else {
93 videoScalingButton.setBackgroundResource( 97 videoScalingButton.setBackgroundResource(
94 R.drawable.ic_action_return_from_full_screen); 98 R.drawable.ic_action_return_from_full_screen);
95 scalingType = ScalingType.SCALE_ASPECT_FILL; 99 scalingType = ScalingType.SCALE_ASPECT_FILL;
96 } 100 }
97 callEvents.onVideoScalingSwitch(scalingType); 101 callEvents.onVideoScalingSwitch(scalingType);
98 } 102 }
99 }); 103 });
100 scalingType = ScalingType.SCALE_ASPECT_FILL; 104 scalingType = ScalingType.SCALE_ASPECT_FILL;
101 105
106 toggleMuteButton.setOnClickListener(new View.OnClickListener() {
107 @Override
108 public void onClick(View view) {
109 boolean enabled = callEvents.onToggleMic();
110 toggleMuteButton.setAlpha(enabled ? 1.0f : 0.3f);
111 }
112 });
113
102 return controlView; 114 return controlView;
103 } 115 }
104 116
105 @Override 117 @Override
106 public void onStart() { 118 public void onStart() {
107 super.onStart(); 119 super.onStart();
108 120
109 boolean captureSliderEnabled = false; 121 boolean captureSliderEnabled = false;
110 Bundle args = getArguments(); 122 Bundle args = getArguments();
111 if (args != null) { 123 if (args != null) {
(...skipping 15 matching lines...) Expand all
127 } 139 }
128 } 140 }
129 141
130 @Override 142 @Override
131 public void onAttach(Activity activity) { 143 public void onAttach(Activity activity) {
132 super.onAttach(activity); 144 super.onAttach(activity);
133 callEvents = (OnCallEvents) activity; 145 callEvents = (OnCallEvents) activity;
134 } 146 }
135 147
136 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698