summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorArtur Dryomov <artur.dryomov@gmail.com>2013-09-09 01:28:32 +0300
committerArtur Dryomov <artur.dryomov@gmail.com>2013-09-11 01:43:51 +0300
commitff802c08b5d45779fb8a361be4704c2f04bb8d4a (patch)
treeb61c78e6196b40e819289eae48d2dab6d0d128ca /android
parent21e5de7d5630605735f4572369e37d7bab0a5522 (diff)
Add ability to pause and resume a slide show.
Change-Id: I5c93cc0b2ad1aa68529ae1e278bd2cb7ad54359d
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/AndroidManifest.xml10
-rwxr-xr-xandroid/sdremote/res/drawable-hdpi/ic_action_resume.pngbin0 -> 1410 bytes
-rwxr-xr-xandroid/sdremote/res/drawable-mdpi/ic_action_resume.pngbin0 -> 1248 bytes
-rwxr-xr-xandroid/sdremote/res/drawable-xhdpi/ic_action_resume.pngbin0 -> 1620 bytes
-rw-r--r--android/sdremote/res/layout/fragment_empty_slide.xml23
-rw-r--r--android/sdremote/res/menu/menu_action_bar_slide_show.xml11
-rw-r--r--android/sdremote/res/values/colors.xml1
-rw-r--r--android/sdremote/res/values/dimens.xml1
-rw-r--r--android/sdremote/res/values/strings.xml6
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java75
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/fragment/EmptySlideFragment.java30
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java4
12 files changed, 142 insertions, 19 deletions
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
@@ -38,17 +38,17 @@
</activity>
<activity
- android:name=".activity.ComputerConnectionActivity"
- android:label="@string/title_connection">
- </activity>
-
- <activity
android:name=".activity.ComputerCreationActivity"
android:label="@string/title_creation"
android:theme="@style/Theme.ImpressRemote.ComputerCreation">
</activity>
<activity
+ android:name=".activity.ComputerConnectionActivity"
+ android:label="@string/title_connection">
+ </activity>
+
+ <activity
android:name=".activity.SlideShowActivity"
android:label="@string/title_slide_show">
</activity>
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
--- /dev/null
+++ b/android/sdremote/res/drawable-hdpi/ic_action_resume.png
Binary files 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
--- /dev/null
+++ b/android/sdremote/res/drawable-mdpi/ic_action_resume.png
Binary files 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
--- /dev/null
+++ b/android/sdremote/res/drawable-xhdpi/ic_action_resume.png
Binary files 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:gravity="center"
+ android:padding="@dimen/padding_empty_slide_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ImageView
+ android:src="@color/background_slide_empty"
+ android:contentDescription="@string/description_empty_slide"
+ android:layout_weight="4"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"/>
+
+
+ <View
+ android:layout_weight="3"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"/>
+
+</LinearLayout>
+
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
@@ -20,6 +20,17 @@
android:showAsAction="ifRoom"/>
<item
+ android:id="@+id/menu_resume_slide_show"
+ android:title="@string/menu_resume_slide_show"
+ android:icon="@drawable/ic_action_resume"
+ android:showAsAction="always"/>
+
+ <item
+ android:id="@+id/menu_pause_slide_show"
+ android:title="@string/menu_pause_slide_show"
+ android:showAsAction="never"/>
+
+ <item
android:id="@+id/menu_stop_slide_show"
android:title="@string/menu_stop_slide_show"
android:showAsAction="never"/>
diff --git a/android/sdremote/res/values/colors.xml b/android/sdremote/res/values/colors.xml
index f43e8f1e0caf..049c9b593d39 100644
--- a/android/sdremote/res/values/colors.xml
+++ b/android/sdremote/res/values/colors.xml
@@ -5,6 +5,7 @@
<color name="background_action_bar_divider">#55ffffff</color>
<color name="background_header">@color/background_action_bar</color>
<color name="background_slide_index">#7f000000</color>
+ <color name="background_slide_empty">@android:color/black</color>
<color name="stroke_grid_slide">#65000000</color>
<color name="stroke_pager_slide">#35000000</color>
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 @@
<dimen name="padding_slide_notes">8dp</dimen>
<dimen name="padding_help">16dp</dimen>
<dimen name="padding_section_item">8dp</dimen>
+ <dimen name="padding_empty_slide_layout">16dp</dimen>
<dimen name="padding_horizontal_list_item">8dp</dimen>
<dimen name="padding_horizontal_connection_layout">40dp</dimen>
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 @@
<string name="title_requirements">Requirements</string>
<string name="title_connection">Connection</string>
<string name="title_creation">Creation</string>
- <string name="title_slide_show">Slide Show</string>
+ <string name="title_slide_show">Slide show</string>
<string name="title_timer">Timer</string>
<string name="menu_licenses">Open source licenses</string>
@@ -25,6 +25,8 @@
<string name="menu_slides_pager">Slides pager</string>
<string name="menu_timer">Timer</string>
<string name="menu_stop_slide_show">Stop slide show</string>
+ <string name="menu_pause_slide_show">Pause slide show</string>
+ <string name="menu_resume_slide_show">Resume slide show</string>
<string name="button_cancel">Cancel</string>
<string name="button_save">Save</string>
@@ -40,6 +42,7 @@
<string name="message_time_is_up">Time is up!</string>
<string name="message_search_wifi">Make sure LibreOffice is running on a computer on the same WiFi network.</string>
<string name="message_search_bluetooth">Make sure LibreOffice is running on a computer with Bluetooth enabled.</string>
+ <string name="message_paused">Paused</string>
<string name="hint_ip_address">IP address</string>
<string name="hint_name">Name (optional)</string>
@@ -54,6 +57,7 @@
<string name="description_pager_slide">Slide preview</string>
<string name="description_grid_slide">Slide preview</string>
+ <string name="description_empty_slide">Empty slide</string>
<string name="preferences_volume_keys_actions_title">Volume keys actions</string>
<string name="preferences_volume_keys_actions_summary">Switch slides and activate animations using volume keys</string>
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;
}