refactor video autotest java code

Review URL: http://webrtc-codereview.appspot.com/24013

git-svn-id: http://webrtc.googlecode.com/svn/trunk@49 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
leozwang@google.com 2011-06-07 17:21:58 +00:00
parent d2c7bff3a1
commit e90067aca5

View File

@ -30,20 +30,20 @@ public class ViEAutotest extends Activity
AdapterView.OnItemSelectedListener, AdapterView.OnItemSelectedListener,
View.OnClickListener { View.OnClickListener {
private Thread _testThread; private Thread testThread;
private Spinner _testSpinner; private Spinner testSpinner;
private Spinner _subtestSpinner; private Spinner subtestSpinner;
private int _testSelection; private int testSelection;
private int _subTestSelection; private int subTestSelection;
// View for remote video // View for remote video
private LinearLayout _remoteSurface = null; private LinearLayout remoteSurface = null;
private GLSurfaceView _glSurfaceView = null; private GLSurfaceView glSurfaceView = null;
private SurfaceView _surfaceView = null; private SurfaceView surfaceView = null;
private LinearLayout _localSurface = null; private LinearLayout localSurface = null;
private GLSurfaceView _glLocalSurfaceView = null; private GLSurfaceView glLocalSurfaceView = null;
private SurfaceView _localSurfaceView = null; private SurfaceView localSurfaceView = null;
/** Called when the activity is first created. */ /** Called when the activity is first created. */
@Override @Override
@ -59,38 +59,38 @@ public class ViEAutotest extends Activity
buttonStart.setOnClickListener(this); buttonStart.setOnClickListener(this);
// Set test spinner // Set test spinner
_testSpinner = (Spinner) findViewById(R.id.testSpinner); testSpinner = (Spinner) findViewById(R.id.testSpinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter<CharSequence> adapter =
ArrayAdapter.createFromResource(this, R.array.test_array, ArrayAdapter.createFromResource(this, R.array.test_array,
android.R.layout.simple_spinner_item); android.R.layout.simple_spinner_item);
int resource = android.R.layout.simple_spinner_dropdown_item; int resource = android.R.layout.simple_spinner_dropdown_item;
adapter.setDropDownViewResource(resource); adapter.setDropDownViewResource(resource);
_testSpinner.setAdapter(adapter); testSpinner.setAdapter(adapter);
_testSpinner.setOnItemSelectedListener(this); testSpinner.setOnItemSelectedListener(this);
// Set sub test spinner // Set sub test spinner
_subtestSpinner = (Spinner) findViewById(R.id.subtestSpinner); subtestSpinner = (Spinner) findViewById(R.id.subtestSpinner);
ArrayAdapter<CharSequence> subtestAdapter = ArrayAdapter<CharSequence> subtestAdapter =
ArrayAdapter.createFromResource(this, R.array.subtest_array, ArrayAdapter.createFromResource(this, R.array.subtest_array,
android.R.layout.simple_spinner_item); android.R.layout.simple_spinner_item);
subtestAdapter.setDropDownViewResource(resource); subtestAdapter.setDropDownViewResource(resource);
_subtestSpinner.setAdapter(subtestAdapter); subtestSpinner.setAdapter(subtestAdapter);
_subtestSpinner.setOnItemSelectedListener(this); subtestSpinner.setOnItemSelectedListener(this);
_remoteSurface = (LinearLayout) findViewById(R.id.RemoteView); remoteSurface = (LinearLayout) findViewById(R.id.RemoteView);
_surfaceView = new SurfaceView(this); surfaceView = new SurfaceView(this);
_remoteSurface.addView(_surfaceView); remoteSurface.addView(surfaceView);
_localSurface = (LinearLayout) findViewById(R.id.LocalView); localSurface = (LinearLayout) findViewById(R.id.LocalView);
_localSurfaceView = new SurfaceView(this); localSurfaceView = new SurfaceView(this);
_localSurfaceView.setZOrderMediaOverlay(true); localSurfaceView.setZOrderMediaOverlay(true);
_localSurface.addView(_localSurfaceView); localSurface.addView(localSurfaceView);
// Set members // Set members
_testSelection = 0; testSelection = 0;
_subTestSelection = 0; subTestSelection = 0;
} }
public void onClick(View v) { public void onClick(View v) {
@ -100,8 +100,8 @@ public class ViEAutotest extends Activity
new Thread(new Runnable() { new Thread(new Runnable() {
public void run() { public void run() {
Log.d("*WEBRTC*", "Calling RunTest..."); Log.d("*WEBRTC*", "Calling RunTest...");
RunTest(_testSelection, _subTestSelection, RunTest(testSelection, subTestSelection,
_localSurfaceView, _surfaceView); localSurfaceView, surfaceView);
Log.d("*WEBRTC*", "RunTest done"); Log.d("*WEBRTC*", "RunTest done");
} }
}).start(); }).start();
@ -112,9 +112,9 @@ public class ViEAutotest extends Activity
int position, long id) { int position, long id) {
if (parent == (Spinner) findViewById(R.id.testSpinner)) { if (parent == (Spinner) findViewById(R.id.testSpinner)) {
_testSelection = position; testSelection = position;
} else { } else {
_subTestSelection = position; subTestSelection = position;
} }
} }