diff options
Diffstat (limited to 'tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java')
-rw-r--r-- | tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java index a6585ba..8796c9f 100644 --- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java +++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java @@ -29,6 +29,7 @@ import android.service.voice.VoiceInteractionSession; import android.util.Log; import android.view.View; import android.widget.Button; +import android.widget.CheckBox; import android.widget.ImageView; import android.widget.TextView; @@ -45,6 +46,10 @@ public class MainInteractionSession extends VoiceInteractionSession Button mTreeButton; Button mTextButton; Button mStartButton; + CheckBox mOptionsCheck; + View mOptionsContainer; + CheckBox mDisallowAssist; + CheckBox mDisallowScreenshot; ImageView mScreenshot; ImageView mFullScreenshot; Button mConfirmButton; @@ -122,15 +127,34 @@ public class MainInteractionSession extends VoiceInteractionSession mScreenshot = (ImageView)mContentView.findViewById(R.id.screenshot); mScreenshot.setOnClickListener(this); mFullScreenshot = (ImageView)mContentView.findViewById(R.id.full_screenshot); + mOptionsCheck = (CheckBox)mContentView.findViewById(R.id.show_options); + mOptionsCheck.setOnClickListener(this); + mOptionsContainer = mContentView.findViewById(R.id.options); + mDisallowAssist = (CheckBox)mContentView.findViewById(R.id.disallow_structure); + mDisallowAssist.setOnClickListener(this); + mDisallowScreenshot = (CheckBox)mContentView.findViewById(R.id.disallow_screenshot); + mDisallowScreenshot.setOnClickListener(this); mConfirmButton = (Button)mContentView.findViewById(R.id.confirm); mConfirmButton.setOnClickListener(this); mCompleteButton = (Button)mContentView.findViewById(R.id.complete); mCompleteButton.setOnClickListener(this); mAbortButton = (Button)mContentView.findViewById(R.id.abort); mAbortButton.setOnClickListener(this); + refreshOptions(); return mContentView; } + void refreshOptions() { + if (mOptionsCheck.isChecked()) { + mOptionsContainer.setVisibility(View.VISIBLE); + int flags = getDisabledShowContext(); + mDisallowAssist.setChecked((flags & SHOW_WITH_ASSIST) != 0); + mDisallowScreenshot.setChecked((flags & SHOW_WITH_SCREENSHOT) != 0); + } else { + mOptionsContainer.setVisibility(View.GONE); + } + } + public void onHandleAssist(Bundle assistBundle) { } @@ -202,6 +226,24 @@ public class MainInteractionSession extends VoiceInteractionSession if (mAssistVisualizer != null) { mAssistVisualizer.logText(); } + } else if (v == mOptionsCheck) { + refreshOptions(); + } else if (v == mDisallowAssist) { + int flags = getDisabledShowContext(); + if (mDisallowAssist.isChecked()) { + flags |= SHOW_WITH_ASSIST; + } else { + flags &= ~SHOW_WITH_ASSIST; + } + setDisabledShowContext(flags); + } else if (v == mDisallowScreenshot) { + int flags = getDisabledShowContext(); + if (mDisallowScreenshot.isChecked()) { + flags |= SHOW_WITH_SCREENSHOT; + } else { + flags &= ~SHOW_WITH_SCREENSHOT; + } + setDisabledShowContext(flags); } else if (v == mStartButton) { mState = STATE_LAUNCHING; updateState(); |