Add ability to pause and resume a slide show.
Change-Id: I5c93cc0b2ad1aa68529ae1e278bd2cb7ad54359d
This commit is contained in:
@@ -37,17 +37,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">
|
||||
|
BIN
android/sdremote/res/drawable-hdpi/ic_action_resume.png
Executable file
BIN
android/sdremote/res/drawable-hdpi/ic_action_resume.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
android/sdremote/res/drawable-mdpi/ic_action_resume.png
Executable file
BIN
android/sdremote/res/drawable-mdpi/ic_action_resume.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
android/sdremote/res/drawable-xhdpi/ic_action_resume.png
Executable file
BIN
android/sdremote/res/drawable-xhdpi/ic_action_resume.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
23
android/sdremote/res/layout/fragment_empty_slide.xml
Normal file
23
android/sdremote/res/layout/fragment_empty_slide.xml
Normal file
@@ -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>
|
||||
|
@@ -19,6 +19,17 @@
|
||||
android:icon="@drawable/ic_action_timer"
|
||||
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"
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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: */
|
@@ -69,6 +69,10 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn
|
||||
}
|
||||
|
||||
private void setUpSlidesPager() {
|
||||
if (!isServiceBound()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isAdded()) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user