diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-07-28 14:46:44 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-08-06 10:23:05 +0100 |
commit | dd2b94db437ef74af3681bebe286886e433e23bc (patch) | |
tree | 471aed563c1c915bb588a28cd3966725ff55cd9b | |
parent | 863ae327df416bcad34fc5bb30ae9bb5327c36d5 (diff) |
Enabled switching slides with volume buttons.
Change-Id: Iedfacd8c0834c9273a7e805658e82180f748f81b
-rw-r--r-- | android/sdremote/res/xml/preferences.xml | 11 | ||||
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java | 22 |
2 files changed, 31 insertions, 2 deletions
diff --git a/android/sdremote/res/xml/preferences.xml b/android/sdremote/res/xml/preferences.xml index b475ca617fc4..e03999512e45 100644 --- a/android/sdremote/res/xml/preferences.xml +++ b/android/sdremote/res/xml/preferences.xml @@ -1,7 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > - <SwitchPreference android:defaultValue="false" android:title="@string/options_autodecline"/> - <SwitchPreference android:defaultValue="false" android:title="@string/options_volumeswitching"/> + <!-- <SwitchPreference android:defaultValue="false" android:title="@string/options_autodecline" android:key="option_autodecline"/> --> + <SwitchPreference + android:defaultValue="false" + android:key="option_volumeswitching" + android:title="@string/options_volumeswitching" /> + + <Preference + android:key="option_switchcomputer" + android:title="@string/options_switchcomputer" /> </PreferenceScreen>
\ No newline at end of file diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java index 8cbfcfdfa4d6..dbcc2e7e6638 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java @@ -69,6 +69,28 @@ public class PresentationActivity extends Activity { fragmentTransaction.commit(); } + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + if (mPresentationFragment.isVisible() || mThumbnailFragment.isVisible()) { + + int action = event.getAction(); + int keyCode = event.getKeyCode(); + switch (keyCode) { + case KeyEvent.KEYCODE_VOLUME_UP: + if (action == KeyEvent.ACTION_UP) { + mCommunicationService.getTransmitter().nextTransition(); + } + return true; + case KeyEvent.KEYCODE_VOLUME_DOWN: + if (action == KeyEvent.ACTION_DOWN) { + mCommunicationService.getTransmitter().previousTransition(); + } + return true; + } + } + return super.dispatchKeyEvent(event); + } + private ServiceConnection mConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName aClassName, |