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

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

Issue 1361083002: Android AppRTCDemo: Add slider for changing camera capture quality during call (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/examples/androidapp/src/org/appspot/apprtc/CallFragment.java
diff --git a/webrtc/examples/androidapp/src/org/appspot/apprtc/CallFragment.java b/webrtc/examples/androidapp/src/org/appspot/apprtc/CallFragment.java
index 35013f7948af6011f2387aba9da909c25d689be3..9f261d20152246c3eaa06cb4be920dd6d6cea79d 100644
--- a/webrtc/examples/androidapp/src/org/appspot/apprtc/CallFragment.java
+++ b/webrtc/examples/androidapp/src/org/appspot/apprtc/CallFragment.java
@@ -13,10 +13,14 @@ package org.appspot.apprtc;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
+import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.SeekBar;
import android.widget.TextView;
import org.webrtc.RendererCommon.ScalingType;
@@ -41,6 +45,7 @@ public class CallFragment extends Fragment {
public void onCallHangUp();
public void onCameraSwitch();
public void onVideoScalingSwitch(ScalingType scalingType);
+ public void onCaptureFormatChange(int width, int height, int framerate);
}
@Override
@@ -98,15 +103,56 @@ public class CallFragment extends Fragment {
public void onStart() {
super.onStart();
+ boolean captureSliderEnabled = false;
Bundle args = getArguments();
if (args != null) {
String contactName = args.getString(CallActivity.EXTRA_ROOMID);
contactView.setText(contactName);
videoCallEnabled = args.getBoolean(CallActivity.EXTRA_VIDEO_CALL, true);
+ captureSliderEnabled = videoCallEnabled
+ && args.getBoolean(CallActivity.EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED, false);
}
if (!videoCallEnabled) {
cameraSwitchButton.setVisibility(View.INVISIBLE);
}
+ if (captureSliderEnabled) {
+ final TextView captureFormatText = new TextView(getActivity());
AlexG 2015/09/23 23:56:38 I think it may be better to move most of these pro
magjed_webrtc 2015/09/24 15:08:17 Done.
+ final SeekBar captureQualitySeekBar = new SeekBar(getActivity());
+ final LinearLayout buttonsContainer =
+ (LinearLayout) controlView.findViewById(R.id.buttons_call_container);
+ captureFormatText.setId(1);
+ captureQualitySeekBar.setId(2);
+
+ final RelativeLayout.LayoutParams textParams =
+ new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
+ RelativeLayout.LayoutParams.WRAP_CONTENT);
+ textParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
+ textParams.addRule(RelativeLayout.ABOVE, captureQualitySeekBar.getId());
+ captureFormatText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
+
+ final RelativeLayout.LayoutParams seekBarParams =
+ new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
+ RelativeLayout.LayoutParams.WRAP_CONTENT);
+ seekBarParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
+ seekBarParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
+ final int margin32dp = (int) TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, 32, getResources().getDisplayMetrics());
+ seekBarParams.setMargins(margin32dp, 0, margin32dp, margin32dp);
+ captureQualitySeekBar.setProgress(50);
+
+ final RelativeLayout parentView = (RelativeLayout) buttonsContainer.getParent();
+ parentView.addView(captureFormatText, textParams);
+ parentView.addView(captureQualitySeekBar, seekBarParams);
+
+ RelativeLayout.LayoutParams buttonsContainerParams =
+ (RelativeLayout.LayoutParams) buttonsContainer.getLayoutParams();
+ buttonsContainerParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
+ buttonsContainerParams.addRule(RelativeLayout.ABOVE, captureFormatText.getId());
+ buttonsContainer.setLayoutParams(buttonsContainerParams);
+
+ captureQualitySeekBar.setOnSeekBarChangeListener(
+ new CaptureQualityController(captureFormatText, callEvents));
+ }
}
@Override

Powered by Google App Engine
This is Rietveld 408576698