OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 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 |
11 package org.appspot.apprtc; | 11 package org.appspot.apprtc; |
12 | 12 |
13 import android.app.Activity; | 13 import android.app.Activity; |
14 import android.content.SharedPreferences; | 14 import android.content.SharedPreferences; |
15 import android.content.SharedPreferences.OnSharedPreferenceChangeListener; | 15 import android.content.SharedPreferences.OnSharedPreferenceChangeListener; |
16 import android.os.Bundle; | 16 import android.os.Bundle; |
17 import android.preference.Preference; | 17 import android.preference.Preference; |
18 | 18 |
19 /** | 19 /** |
20 * Settings activity for AppRTC. | 20 * Settings activity for AppRTC. |
21 */ | 21 */ |
22 public class SettingsActivity extends Activity | 22 public class SettingsActivity extends Activity |
23 implements OnSharedPreferenceChangeListener{ | 23 implements OnSharedPreferenceChangeListener{ |
24 private SettingsFragment settingsFragment; | 24 private SettingsFragment settingsFragment; |
25 private String keyprefVideoCall; | 25 private String keyprefVideoCall; |
26 private String keyprefResolution; | 26 private String keyprefResolution; |
27 private String keyprefFps; | 27 private String keyprefFps; |
| 28 private String keyprefCaptureQualitySlider; |
28 private String keyprefStartVideoBitrateType; | 29 private String keyprefStartVideoBitrateType; |
29 private String keyprefStartVideoBitrateValue; | 30 private String keyprefStartVideoBitrateValue; |
30 private String keyPrefVideoCodec; | 31 private String keyPrefVideoCodec; |
31 private String keyprefHwCodec; | 32 private String keyprefHwCodec; |
32 | 33 |
33 private String keyprefStartAudioBitrateType; | 34 private String keyprefStartAudioBitrateType; |
34 private String keyprefStartAudioBitrateValue; | 35 private String keyprefStartAudioBitrateValue; |
35 private String keyPrefAudioCodec; | 36 private String keyPrefAudioCodec; |
36 private String keyprefNoAudioProcessing; | 37 private String keyprefNoAudioProcessing; |
37 | 38 |
38 private String keyprefCpuUsageDetection; | 39 private String keyprefCpuUsageDetection; |
39 private String keyPrefRoomServerUrl; | 40 private String keyPrefRoomServerUrl; |
40 private String keyPrefDisplayHud; | 41 private String keyPrefDisplayHud; |
41 | 42 |
42 @Override | 43 @Override |
43 protected void onCreate(Bundle savedInstanceState) { | 44 protected void onCreate(Bundle savedInstanceState) { |
44 super.onCreate(savedInstanceState); | 45 super.onCreate(savedInstanceState); |
45 keyprefVideoCall = getString(R.string.pref_videocall_key); | 46 keyprefVideoCall = getString(R.string.pref_videocall_key); |
46 keyprefResolution = getString(R.string.pref_resolution_key); | 47 keyprefResolution = getString(R.string.pref_resolution_key); |
47 keyprefFps = getString(R.string.pref_fps_key); | 48 keyprefFps = getString(R.string.pref_fps_key); |
| 49 keyprefCaptureQualitySlider = getString(R.string.pref_capturequalityslider_k
ey); |
48 keyprefStartVideoBitrateType = getString(R.string.pref_startvideobitrate_key
); | 50 keyprefStartVideoBitrateType = getString(R.string.pref_startvideobitrate_key
); |
49 keyprefStartVideoBitrateValue = getString(R.string.pref_startvideobitrateval
ue_key); | 51 keyprefStartVideoBitrateValue = getString(R.string.pref_startvideobitrateval
ue_key); |
50 keyPrefVideoCodec = getString(R.string.pref_videocodec_key); | 52 keyPrefVideoCodec = getString(R.string.pref_videocodec_key); |
51 keyprefHwCodec = getString(R.string.pref_hwcodec_key); | 53 keyprefHwCodec = getString(R.string.pref_hwcodec_key); |
52 | 54 |
53 keyprefStartAudioBitrateType = getString(R.string.pref_startaudiobitrate_key
); | 55 keyprefStartAudioBitrateType = getString(R.string.pref_startaudiobitrate_key
); |
54 keyprefStartAudioBitrateValue = getString(R.string.pref_startaudiobitrateval
ue_key); | 56 keyprefStartAudioBitrateValue = getString(R.string.pref_startaudiobitrateval
ue_key); |
55 keyPrefAudioCodec = getString(R.string.pref_audiocodec_key); | 57 keyPrefAudioCodec = getString(R.string.pref_audiocodec_key); |
56 keyprefNoAudioProcessing = getString(R.string.pref_noaudioprocessing_key); | 58 keyprefNoAudioProcessing = getString(R.string.pref_noaudioprocessing_key); |
57 | 59 |
(...skipping 11 matching lines...) Expand all Loading... |
69 @Override | 71 @Override |
70 protected void onResume() { | 72 protected void onResume() { |
71 super.onResume(); | 73 super.onResume(); |
72 // Set summary to be the user-description for the selected value | 74 // Set summary to be the user-description for the selected value |
73 SharedPreferences sharedPreferences = | 75 SharedPreferences sharedPreferences = |
74 settingsFragment.getPreferenceScreen().getSharedPreferences(); | 76 settingsFragment.getPreferenceScreen().getSharedPreferences(); |
75 sharedPreferences.registerOnSharedPreferenceChangeListener(this); | 77 sharedPreferences.registerOnSharedPreferenceChangeListener(this); |
76 updateSummaryB(sharedPreferences, keyprefVideoCall); | 78 updateSummaryB(sharedPreferences, keyprefVideoCall); |
77 updateSummary(sharedPreferences, keyprefResolution); | 79 updateSummary(sharedPreferences, keyprefResolution); |
78 updateSummary(sharedPreferences, keyprefFps); | 80 updateSummary(sharedPreferences, keyprefFps); |
| 81 updateSummaryB(sharedPreferences, keyprefCaptureQualitySlider); |
79 updateSummary(sharedPreferences, keyprefStartVideoBitrateType); | 82 updateSummary(sharedPreferences, keyprefStartVideoBitrateType); |
80 updateSummaryBitrate(sharedPreferences, keyprefStartVideoBitrateValue); | 83 updateSummaryBitrate(sharedPreferences, keyprefStartVideoBitrateValue); |
81 setVideoBitrateEnable(sharedPreferences); | 84 setVideoBitrateEnable(sharedPreferences); |
82 updateSummary(sharedPreferences, keyPrefVideoCodec); | 85 updateSummary(sharedPreferences, keyPrefVideoCodec); |
83 updateSummaryB(sharedPreferences, keyprefHwCodec); | 86 updateSummaryB(sharedPreferences, keyprefHwCodec); |
84 | 87 |
85 updateSummary(sharedPreferences, keyprefStartAudioBitrateType); | 88 updateSummary(sharedPreferences, keyprefStartAudioBitrateType); |
86 updateSummaryBitrate(sharedPreferences, keyprefStartAudioBitrateValue); | 89 updateSummaryBitrate(sharedPreferences, keyprefStartAudioBitrateValue); |
87 setAudioBitrateEnable(sharedPreferences); | 90 setAudioBitrateEnable(sharedPreferences); |
88 updateSummary(sharedPreferences, keyPrefAudioCodec); | 91 updateSummary(sharedPreferences, keyPrefAudioCodec); |
(...skipping 20 matching lines...) Expand all Loading... |
109 || key.equals(keyprefStartVideoBitrateType) | 112 || key.equals(keyprefStartVideoBitrateType) |
110 || key.equals(keyPrefVideoCodec) | 113 || key.equals(keyPrefVideoCodec) |
111 || key.equals(keyprefStartAudioBitrateType) | 114 || key.equals(keyprefStartAudioBitrateType) |
112 || key.equals(keyPrefAudioCodec) | 115 || key.equals(keyPrefAudioCodec) |
113 || key.equals(keyPrefRoomServerUrl)) { | 116 || key.equals(keyPrefRoomServerUrl)) { |
114 updateSummary(sharedPreferences, key); | 117 updateSummary(sharedPreferences, key); |
115 } else if (key.equals(keyprefStartVideoBitrateValue) | 118 } else if (key.equals(keyprefStartVideoBitrateValue) |
116 || key.equals(keyprefStartAudioBitrateValue)) { | 119 || key.equals(keyprefStartAudioBitrateValue)) { |
117 updateSummaryBitrate(sharedPreferences, key); | 120 updateSummaryBitrate(sharedPreferences, key); |
118 } else if (key.equals(keyprefVideoCall) | 121 } else if (key.equals(keyprefVideoCall) |
| 122 || key.equals(keyprefCaptureQualitySlider) |
119 || key.equals(keyprefHwCodec) | 123 || key.equals(keyprefHwCodec) |
120 || key.equals(keyprefNoAudioProcessing) | 124 || key.equals(keyprefNoAudioProcessing) |
121 || key.equals(keyprefCpuUsageDetection) | 125 || key.equals(keyprefCpuUsageDetection) |
122 || key.equals(keyPrefDisplayHud)) { | 126 || key.equals(keyPrefDisplayHud)) { |
123 updateSummaryB(sharedPreferences, key); | 127 updateSummaryB(sharedPreferences, key); |
124 } | 128 } |
125 if (key.equals(keyprefStartVideoBitrateType)) { | 129 if (key.equals(keyprefStartVideoBitrateType)) { |
126 setVideoBitrateEnable(sharedPreferences); | 130 setVideoBitrateEnable(sharedPreferences); |
127 } | 131 } |
128 if (key.equals(keyprefStartAudioBitrateType)) { | 132 if (key.equals(keyprefStartAudioBitrateType)) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 String bitrateTypeDefault = getString(R.string.pref_startaudiobitrate_defaul
t); | 172 String bitrateTypeDefault = getString(R.string.pref_startaudiobitrate_defaul
t); |
169 String bitrateType = sharedPreferences.getString( | 173 String bitrateType = sharedPreferences.getString( |
170 keyprefStartAudioBitrateType, bitrateTypeDefault); | 174 keyprefStartAudioBitrateType, bitrateTypeDefault); |
171 if (bitrateType.equals(bitrateTypeDefault)) { | 175 if (bitrateType.equals(bitrateTypeDefault)) { |
172 bitratePreferenceValue.setEnabled(false); | 176 bitratePreferenceValue.setEnabled(false); |
173 } else { | 177 } else { |
174 bitratePreferenceValue.setEnabled(true); | 178 bitratePreferenceValue.setEnabled(true); |
175 } | 179 } |
176 } | 180 } |
177 } | 181 } |
OLD | NEW |