OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 */ | 43 */ |
44 public interface OnCallEvents { | 44 public interface OnCallEvents { |
45 void onCallHangUp(); | 45 void onCallHangUp(); |
46 void onCameraSwitch(); | 46 void onCameraSwitch(); |
47 void onVideoScalingSwitch(ScalingType scalingType); | 47 void onVideoScalingSwitch(ScalingType scalingType); |
48 void onCaptureFormatChange(int width, int height, int framerate); | 48 void onCaptureFormatChange(int width, int height, int framerate); |
49 boolean onToggleMic(); | 49 boolean onToggleMic(); |
50 } | 50 } |
51 | 51 |
52 @Override | 52 @Override |
53 public View onCreateView(LayoutInflater inflater, ViewGroup container, | 53 public View onCreateView( |
54 Bundle savedInstanceState) { | 54 LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
55 controlView = | 55 controlView = inflater.inflate(R.layout.fragment_call, container, false); |
56 inflater.inflate(R.layout.fragment_call, container, false); | |
57 | 56 |
58 // Create UI controls. | 57 // Create UI controls. |
59 contactView = | 58 contactView = (TextView) controlView.findViewById(R.id.contact_name_call); |
60 (TextView) controlView.findViewById(R.id.contact_name_call); | 59 disconnectButton = (ImageButton) controlView.findViewById(R.id.button_call_d
isconnect); |
61 disconnectButton = | 60 cameraSwitchButton = (ImageButton) controlView.findViewById(R.id.button_call
_switch_camera); |
62 (ImageButton) controlView.findViewById(R.id.button_call_disconnect); | 61 videoScalingButton = (ImageButton) controlView.findViewById(R.id.button_call
_scaling_mode); |
63 cameraSwitchButton = | 62 toggleMuteButton = (ImageButton) controlView.findViewById(R.id.button_call_t
oggle_mic); |
64 (ImageButton) controlView.findViewById(R.id.button_call_switch_camera); | 63 captureFormatText = (TextView) controlView.findViewById(R.id.capture_format_
text_call); |
65 videoScalingButton = | 64 captureFormatSlider = (SeekBar) controlView.findViewById(R.id.capture_format
_slider_call); |
66 (ImageButton) controlView.findViewById(R.id.button_call_scaling_mode); | |
67 toggleMuteButton = | |
68 (ImageButton) controlView.findViewById(R.id.button_call_toggle_mic); | |
69 captureFormatText = | |
70 (TextView) controlView.findViewById(R.id.capture_format_text_call); | |
71 captureFormatSlider = | |
72 (SeekBar) controlView.findViewById(R.id.capture_format_slider_call); | |
73 | 65 |
74 // Add buttons click events. | 66 // Add buttons click events. |
75 disconnectButton.setOnClickListener(new View.OnClickListener() { | 67 disconnectButton.setOnClickListener(new View.OnClickListener() { |
76 @Override | 68 @Override |
77 public void onClick(View view) { | 69 public void onClick(View view) { |
78 callEvents.onCallHangUp(); | 70 callEvents.onCallHangUp(); |
79 } | 71 } |
80 }); | 72 }); |
81 | 73 |
82 cameraSwitchButton.setOnClickListener(new View.OnClickListener() { | 74 cameraSwitchButton.setOnClickListener(new View.OnClickListener() { |
83 @Override | 75 @Override |
84 public void onClick(View view) { | 76 public void onClick(View view) { |
85 callEvents.onCameraSwitch(); | 77 callEvents.onCameraSwitch(); |
86 } | 78 } |
87 }); | 79 }); |
88 | 80 |
89 videoScalingButton.setOnClickListener(new View.OnClickListener() { | 81 videoScalingButton.setOnClickListener(new View.OnClickListener() { |
90 @Override | 82 @Override |
91 public void onClick(View view) { | 83 public void onClick(View view) { |
92 if (scalingType == ScalingType.SCALE_ASPECT_FILL) { | 84 if (scalingType == ScalingType.SCALE_ASPECT_FILL) { |
93 videoScalingButton.setBackgroundResource( | 85 videoScalingButton.setBackgroundResource(R.drawable.ic_action_full_scr
een); |
94 R.drawable.ic_action_full_screen); | |
95 scalingType = ScalingType.SCALE_ASPECT_FIT; | 86 scalingType = ScalingType.SCALE_ASPECT_FIT; |
96 } else { | 87 } else { |
97 videoScalingButton.setBackgroundResource( | 88 videoScalingButton.setBackgroundResource(R.drawable.ic_action_return_f
rom_full_screen); |
98 R.drawable.ic_action_return_from_full_screen); | |
99 scalingType = ScalingType.SCALE_ASPECT_FILL; | 89 scalingType = ScalingType.SCALE_ASPECT_FILL; |
100 } | 90 } |
101 callEvents.onVideoScalingSwitch(scalingType); | 91 callEvents.onVideoScalingSwitch(scalingType); |
102 } | 92 } |
103 }); | 93 }); |
104 scalingType = ScalingType.SCALE_ASPECT_FILL; | 94 scalingType = ScalingType.SCALE_ASPECT_FILL; |
105 | 95 |
106 toggleMuteButton.setOnClickListener(new View.OnClickListener() { | 96 toggleMuteButton.setOnClickListener(new View.OnClickListener() { |
107 @Override | 97 @Override |
108 public void onClick(View view) { | 98 public void onClick(View view) { |
(...skipping 28 matching lines...) Expand all Loading... |
137 captureFormatText.setVisibility(View.GONE); | 127 captureFormatText.setVisibility(View.GONE); |
138 captureFormatSlider.setVisibility(View.GONE); | 128 captureFormatSlider.setVisibility(View.GONE); |
139 } | 129 } |
140 } | 130 } |
141 | 131 |
142 @Override | 132 @Override |
143 public void onAttach(Activity activity) { | 133 public void onAttach(Activity activity) { |
144 super.onAttach(activity); | 134 super.onAttach(activity); |
145 callEvents = (OnCallEvents) activity; | 135 callEvents = (OnCallEvents) activity; |
146 } | 136 } |
147 | |
148 } | 137 } |
OLD | NEW |