diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml index 6d7064d87a5b..714b05fd2cbd 100644 --- a/android/sdremote/AndroidManifest.xml +++ b/android/sdremote/AndroidManifest.xml @@ -37,17 +37,17 @@ - - - + + + diff --git a/android/sdremote/res/drawable-hdpi/ic_action_resume.png b/android/sdremote/res/drawable-hdpi/ic_action_resume.png new file mode 100755 index 000000000000..df8a2ca28e1e Binary files /dev/null and b/android/sdremote/res/drawable-hdpi/ic_action_resume.png differ diff --git a/android/sdremote/res/drawable-mdpi/ic_action_resume.png b/android/sdremote/res/drawable-mdpi/ic_action_resume.png new file mode 100755 index 000000000000..6a40cd5f7bff Binary files /dev/null and b/android/sdremote/res/drawable-mdpi/ic_action_resume.png differ diff --git a/android/sdremote/res/drawable-xhdpi/ic_action_resume.png b/android/sdremote/res/drawable-xhdpi/ic_action_resume.png new file mode 100755 index 000000000000..51124993df10 Binary files /dev/null and b/android/sdremote/res/drawable-xhdpi/ic_action_resume.png differ diff --git a/android/sdremote/res/layout/fragment_empty_slide.xml b/android/sdremote/res/layout/fragment_empty_slide.xml new file mode 100644 index 000000000000..5e01fe3bc242 --- /dev/null +++ b/android/sdremote/res/layout/fragment_empty_slide.xml @@ -0,0 +1,23 @@ + + + + + + + + + + diff --git a/android/sdremote/res/menu/menu_action_bar_slide_show.xml b/android/sdremote/res/menu/menu_action_bar_slide_show.xml index eaa2b3d0ea3c..457e6bcfcb88 100644 --- a/android/sdremote/res/menu/menu_action_bar_slide_show.xml +++ b/android/sdremote/res/menu/menu_action_bar_slide_show.xml @@ -19,6 +19,17 @@ android:icon="@drawable/ic_action_timer" android:showAsAction="ifRoom"/> + + + + #55ffffff @color/background_action_bar #7f000000 + @android:color/black #65000000 #35000000 diff --git a/android/sdremote/res/values/dimens.xml b/android/sdremote/res/values/dimens.xml index 05c730363378..9b1e885533f7 100644 --- a/android/sdremote/res/values/dimens.xml +++ b/android/sdremote/res/values/dimens.xml @@ -14,6 +14,7 @@ 8dp 16dp 8dp + 16dp 8dp 40dp diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml index 02e2cde11066..9fd81f9cd67b 100644 --- a/android/sdremote/res/values/strings.xml +++ b/android/sdremote/res/values/strings.xml @@ -12,7 +12,7 @@ Requirements Connection Creation - Slide Show + Slide show Timer Open source licenses @@ -25,6 +25,8 @@ Slides pager Timer Stop slide show + Pause slide show + Resume slide show Cancel Save @@ -40,6 +42,7 @@ Time is up! Make sure LibreOffice is running on a computer on the same WiFi network. Make sure LibreOffice is running on a computer with Bluetooth enabled. + Paused IP address Name (optional) @@ -54,6 +57,7 @@ Slide preview Slide preview + Empty slide Volume keys actions Switch slides and activate animations using volume keys diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java index a29d817cd405..19b7dbbbf1d2 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java @@ -29,6 +29,7 @@ import org.libreoffice.impressremote.R; import org.libreoffice.impressremote.communication.CommunicationService; import org.libreoffice.impressremote.communication.SlideShow; import org.libreoffice.impressremote.communication.Timer; +import org.libreoffice.impressremote.fragment.EmptySlideFragment; import org.libreoffice.impressremote.fragment.SlidesGridFragment; import org.libreoffice.impressremote.fragment.SlidesPagerFragment; import org.libreoffice.impressremote.fragment.TimerEditingDialog; @@ -40,7 +41,7 @@ import org.libreoffice.impressremote.util.SavedStates; public class SlideShowActivity extends SherlockFragmentActivity implements ServiceConnection { private static enum Mode { - PAGER, GRID + PAGER, GRID, EMPTY } private Mode mMode; @@ -85,6 +86,9 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi case GRID: return SlidesGridFragment.newInstance(); + case EMPTY: + return EmptySlideFragment.newInstance(); + default: return SlidesPagerFragment.newInstance(); } @@ -314,16 +318,26 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi public boolean onPrepareOptionsMenu(Menu aMenu) { MenuItem aSlidesPagerMenuItem = aMenu.findItem(R.id.menu_slides_pager); MenuItem aSlidesGridMenuItem = aMenu.findItem(R.id.menu_slides_grid); + MenuItem aSlideShowResumeMenuItem = aMenu.findItem(R.id.menu_resume_slide_show); switch (mMode) { case PAGER: + setMenuItemsVisibility(aMenu, true); aSlidesPagerMenuItem.setVisible(false); aSlidesGridMenuItem.setVisible(true); + aSlideShowResumeMenuItem.setVisible(false); break; case GRID: + setMenuItemsVisibility(aMenu, true); aSlidesPagerMenuItem.setVisible(true); aSlidesGridMenuItem.setVisible(false); + aSlideShowResumeMenuItem.setVisible(false); + break; + + case EMPTY: + setMenuItemsVisibility(aMenu, false); + aSlideShowResumeMenuItem.setVisible(true); break; default: @@ -333,38 +347,47 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi return super.onPrepareOptionsMenu(aMenu); } + private void setMenuItemsVisibility(Menu aMenu, boolean aAreItemsVisible) { + for (int aItemIndex = 0; aItemIndex < aMenu.size(); aItemIndex++) { + aMenu.getItem(aItemIndex).setVisible(aAreItemsVisible); + } + } + @Override public boolean onOptionsItemSelected(MenuItem aMenuItem) { switch (aMenuItem.getItemId()) { case android.R.id.home: navigateUp(); - return true; case R.id.menu_slides_grid: - mMode = Mode.GRID; - - setUpFragment(); - refreshActionBarMenu(); - + changeMode(Mode.GRID); return true; case R.id.menu_slides_pager: - mMode = Mode.PAGER; - - setUpFragment(); - refreshActionBarMenu(); - + changeMode(Mode.PAGER); return true; case R.id.menu_timer: callTimer(); + return true; + case R.id.menu_resume_slide_show: + changeMode(Mode.PAGER); + setUpSlideShowInformation(); + resumeSlideShow(); + resumeTimer(); + return true; + + case R.id.menu_pause_slide_show: + changeMode(Mode.EMPTY); + setUpSlideShowPausedInformation(); + pauseSlideShow(); + pauseTimer(); return true; case R.id.menu_stop_slide_show: stopSlideShow(); - return true; default: @@ -376,6 +399,13 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi finish(); } + private void changeMode(Mode aMode) { + mMode = aMode; + + setUpFragment(); + refreshActionBarMenu(); + } + private void refreshActionBarMenu() { supportInvalidateOptionsMenu(); } @@ -410,6 +440,25 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi aTimerDialog.show(getSupportFragmentManager(), TimerSettingDialog.TAG); } + private void resumeSlideShow() { + mCommunicationService.getTransmitter().resumePresentation(); + } + + private void pauseSlideShow() { + mCommunicationService.getTransmitter().setUpBlankScreen(); + } + + private void setUpSlideShowPausedInformation() { + ActionBar aActionBar = getSupportActionBar(); + + aActionBar.setTitle(R.string.title_slide_show); + aActionBar.setSubtitle(R.string.message_paused); + } + + private void pauseTimer() { + mCommunicationService.getSlideShow().getTimer().pause(); + } + private void stopSlideShow() { mCommunicationService.getTransmitter().stopPresentation(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/EmptySlideFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/EmptySlideFragment.java new file mode 100644 index 000000000000..014ad7fb9a70 --- /dev/null +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/EmptySlideFragment.java @@ -0,0 +1,30 @@ +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.libreoffice.impressremote.fragment; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.actionbarsherlock.app.SherlockFragment; +import org.libreoffice.impressremote.R; + +public class EmptySlideFragment extends SherlockFragment { + public static EmptySlideFragment newInstance() { + return new EmptySlideFragment(); + } + + @Override + public View onCreateView(LayoutInflater aInflater, ViewGroup aContainer, Bundle aSavedInstance) { + return aInflater.inflate(R.layout.fragment_empty_slide, aContainer, false); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java index ae53035d054f..e3c921076d39 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java @@ -69,6 +69,10 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn } private void setUpSlidesPager() { + if (!isServiceBound()) { + return; + } + if (!isAdded()) { return; }