| Index: remoting/android/java/src/org/chromium/chromoting/cardboard/DesktopActivity.java
|
| diff --git a/remoting/android/java/src/org/chromium/chromoting/cardboard/DesktopActivity.java b/remoting/android/java/src/org/chromium/chromoting/cardboard/DesktopActivity.java
|
| index 1f37082f2bbd1a605737227beb25953dabd6de65..8a651991777833485b8edafb1c1a34aacb159b2c 100644
|
| --- a/remoting/android/java/src/org/chromium/chromoting/cardboard/DesktopActivity.java
|
| +++ b/remoting/android/java/src/org/chromium/chromoting/cardboard/DesktopActivity.java
|
| @@ -16,6 +16,7 @@ import com.google.vrtoolkit.cardboard.CardboardView;
|
|
|
| import org.chromium.chromoting.R;
|
| import org.chromium.chromoting.TouchInputHandler;
|
| +import org.chromium.chromoting.jni.Client;
|
| import org.chromium.chromoting.jni.JniInterface;
|
|
|
| import java.util.ArrayList;
|
| @@ -28,6 +29,7 @@ public class DesktopActivity extends CardboardActivity {
|
| // desktop activity.
|
| private boolean mSwitchToDesktopActivity;
|
|
|
| + private Client mClient;
|
| private CardboardRenderer mRenderer;
|
| private SpeechRecognizer mSpeechRecognizer;
|
|
|
| @@ -38,9 +40,12 @@ public class DesktopActivity extends CardboardActivity {
|
| public void onCreate(Bundle savedInstanceState) {
|
| super.onCreate(savedInstanceState);
|
| setContentView(R.layout.cardboard_desktop);
|
| +
|
| + mClient = JniInterface.getClient();
|
| +
|
| mSwitchToDesktopActivity = false;
|
| CardboardView cardboardView = (CardboardView) findViewById(R.id.cardboard_view);
|
| - mRenderer = new CardboardRenderer(this);
|
| + mRenderer = new CardboardRenderer(this, mClient);
|
| mIsListening = false;
|
|
|
| // Associate a CardboardView.StereoRenderer with cardboard view.
|
| @@ -75,9 +80,9 @@ public class DesktopActivity extends CardboardActivity {
|
| } else {
|
| if (mRenderer.isLookingAtDesktop()) {
|
| PointF coordinates = mRenderer.getMouseCoordinates();
|
| - JniInterface.sendMouseEvent((int) coordinates.x, (int) coordinates.y,
|
| + mClient.sendMouseEvent((int) coordinates.x, (int) coordinates.y,
|
| TouchInputHandler.BUTTON_LEFT, true);
|
| - JniInterface.sendMouseEvent((int) coordinates.x, (int) coordinates.y,
|
| + mClient.sendMouseEvent((int) coordinates.x, (int) coordinates.y,
|
| TouchInputHandler.BUTTON_LEFT, false);
|
| } else {
|
| if (mRenderer.isLookingFarawayFromDesktop()) {
|
| @@ -92,14 +97,14 @@ public class DesktopActivity extends CardboardActivity {
|
| @Override
|
| protected void onStart() {
|
| super.onStart();
|
| - JniInterface.enableVideoChannel(true);
|
| + mClient.enableVideoChannel(true);
|
| }
|
|
|
| @Override
|
| protected void onPause() {
|
| super.onPause();
|
| if (!mSwitchToDesktopActivity) {
|
| - JniInterface.enableVideoChannel(false);
|
| + mClient.enableVideoChannel(false);
|
| }
|
| if (mSpeechRecognizer != null) {
|
| mSpeechRecognizer.stopListening();
|
| @@ -109,7 +114,7 @@ public class DesktopActivity extends CardboardActivity {
|
| @Override
|
| protected void onResume() {
|
| super.onResume();
|
| - JniInterface.enableVideoChannel(true);
|
| + mClient.enableVideoChannel(true);
|
| }
|
|
|
| @Override
|
| @@ -118,7 +123,7 @@ public class DesktopActivity extends CardboardActivity {
|
| if (mSwitchToDesktopActivity) {
|
| mSwitchToDesktopActivity = false;
|
| } else {
|
| - JniInterface.enableVideoChannel(false);
|
| + mClient.enableVideoChannel(false);
|
| }
|
| if (mSpeechRecognizer != null) {
|
| mSpeechRecognizer.stopListening();
|
| @@ -186,7 +191,7 @@ public class DesktopActivity extends CardboardActivity {
|
| ArrayList<String> data =
|
| results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
|
| if (!data.isEmpty()) {
|
| - JniInterface.sendTextEvent(data.get(0));
|
| + mClient.sendTextEvent(data.get(0));
|
| }
|
| }
|
|
|
|
|