Hi Junior,

Thanks for the updated patch, there were still some minor niggles though
which I had to fix (see bottom of email).


Currently your patch only changes the sound settings at the start of a
presentation, I'm not sure if we'd want to change back to the original
volume settings once the presentation is finished though?


The minor issues:

- android:defaultValue="true" was removed for two CheckBoxPreference
settings -- I assume this was unintentional (possibly an overly keen IDE
removing things automatically)?

- Some trailing spaces and mixes of tabs/spaces left over -- git
complains about both of these when applying patches:

Since you aren't doing a full build the git commit hooks aren't being
installed, meaning you aren't warned when there are issues with
spacing/tabs/formatting -- you can force installation of the hooks by
running "./g -z" in the LibreOffice tree. (However anyone with the
commit hooks in place, i.e. most LO devs, will have warnings shown which
prevent use of the commit until the issues are fixed -- which is what I
had to do to test the patch.)

(The cleaned up patch is attached.)

Cheers,

        Andrzej

On Thu, 2013-10-03 at 14:10 -0300, Junior Cesar Oliveira wrote:
> Hi, we fixed the patch and send again.
> 
> 
> Thanks.
> 
> 
> Att Junior
> 
> 
> 2013/10/1 Andrzej Hunt <andr...@ahunt.org>
>         Hi Junior,
>         
>         Unfortunately your patch includes a lot of unnecessary
>         reformatting
>         (space indentation replaced with tab-stops),
>         specifically in SlideShowActivity.java it's impossible to see
>         what has
>         changed since the whole file has had all space-indentation
>         replaced with
>         tab-indentation (i.e. git thinks the whole file has been
>         removed and
>         recreated).
>         
>         (There are also a few cases of lines with trailing space which
>         the git
>         commit-hooks would usually complain about.)
>         
>         No idea which editor/IDE you use, but if you could change back
>         to space
>         indentation that would be hugely simplify reviewing the patch
>         -- it
>         should probably be enough to configure it to use spaces for
>         indentation
>         (four spaces per tab) and then reformat the file (I'm guessing
>         you might
>         be using Eclipse?) which would remove most of the reformatting
>         in the
>         patch.
>         
>         Cheers,
>         
>         Andrzej
>         
>         On Tue, 2013-10-01 at 14:49 -0300, Junior Cesar Oliveira
>         wrote:
>         > I declare that all of my past & future contributions to
>         LibreOffice
>         > may be licensed under
>         > the MPL/LGPLv3+ dual license.
>         >
>         >
>         > Hello, the patch is attached to the resolution of bug 61570
>         SDremote
>         > project. The patch has been created for the following
>         academic
>         > UTFPR-Brazil: Junior Cesar de Oliveira, Ana Claudia Maciel,
>         Willyan
>         > Schultz Dworak.
>         >
>         >
>         >
>         >
>         >
>         > Junior.
>         
>         > _______________________________________________
>         > LibreOffice mailing list
>         > LibreOffice@lists.freedesktop.org
>         > http://lists.freedesktop.org/mailman/listinfo/libreoffice
>         
>         
>         
> 
> 

>From 411b32dd8e9246f342bb845dcf811a23670ae76d Mon Sep 17 00:00:00 2001
From: juniorcesar <juniorcesar.ut...@gmail.com>
Date: Thu, 3 Oct 2013 14:02:06 -0300
Subject: [PATCH] Adding silent mode to start the slideshow

Change-Id: I9ced79c8d62567a32b3ad33094195a60380fd8f5
---
 android/sdremote/res/values/strings.xml               |  2 ++
 android/sdremote/res/xml/preferences.xml              |  5 +++++
 .../impressremote/activity/SlideShowActivity.java     | 19 +++++++++++++++++++
 .../libreoffice/impressremote/util/Preferences.java   |  1 +
 4 files changed, 27 insertions(+)

diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml
index cf84a3a..0c36383 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -64,6 +64,8 @@
     <string name="preferences_volume_keys_actions_summary">Switch slides and activate animations using volume keys</string>
     <string name="preferences_keep_screen_on_title">Keep screen on</string>
     <string name="preferences_keep_screen_on_summary">Prevent phone from sleeping while presenting</string>
+    <string name="preferences_keep_silent_mode_on_title">Silent mode on</string>
+    <string name="preferences_keep_silent_mode_on_summary">Keep silent mode on while presenting</string>
 
     <string name="requirements_libreoffice_version">LibreOffice version 4.0.3 or higher running on a computer.</string>
     <string name="requirements_libreoffice_general_enabled">Impress Remote enabled at “Tools → Options → LibreOffice Impress → General” in LibreOffice Impress.</string>
diff --git a/android/sdremote/res/xml/preferences.xml b/android/sdremote/res/xml/preferences.xml
index 104c528..cfc1c42 100644
--- a/android/sdremote/res/xml/preferences.xml
+++ b/android/sdremote/res/xml/preferences.xml
@@ -13,4 +13,9 @@
         android:title="@string/preferences_keep_screen_on_title"
         android:summary="@string/preferences_keep_screen_on_summary"/>
 
+    <CheckBoxPreference
+        android:key="keep_silent_mode_on"
+        android:summary="@string/preferences_keep_silent_mode_on_summary"
+        android:title="@string/preferences_keep_silent_mode_on_title"/>
+
 </PreferenceScreen>
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
index 3c41ecc..302e792 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
@@ -38,6 +38,7 @@ import org.libreoffice.impressremote.util.Fragments;
 import org.libreoffice.impressremote.util.Intents;
 import org.libreoffice.impressremote.util.Preferences;
 import org.libreoffice.impressremote.util.SavedStates;
+import android.media.AudioManager;
 
 public class SlideShowActivity extends SherlockFragmentActivity implements ServiceConnection {
     public static enum Mode {
@@ -48,6 +49,8 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
 
     private CommunicationService mCommunicationService;
     private IntentsReceiver mIntentsReceiver;
+    private AudioManager audioManager;
+    private int ringerMode;
 
     @Override
     protected void onCreate(Bundle aSavedInstanceState) {
@@ -58,6 +61,7 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
         setUpHomeButton();
         setUpFragment();
         setUpKeepingScreenOn();
+        setUpKeepingSilentModeOn();
 
         bindService();
     }
@@ -534,6 +538,21 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
     public void onServiceDisconnected(ComponentName aComponentName) {
         mCommunicationService = null;
     }
+
+    private void setUpKeepingSilentModeOn() {
+        audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
+        ringerMode = audioManager.getRingerMode();
+        if (!isKeepingSilentModeOnRequired()) {
+        audioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
+        } else {
+        audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
+        }
+    }
+
+    private boolean isKeepingSilentModeOnRequired() {
+        Preferences aPreferences = Preferences.getSettingsInstance(this);
+        return aPreferences.getBoolean(Preferences.Keys.KEEP_SILENT_MODE_ON);
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java b/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java
index 5a9b0c7..7ade4db 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java
@@ -32,6 +32,7 @@ public final class Preferences {
 
         public static final String VOLUME_KEYS_ACTIONS = "volume_keys_actions";
         public static final String KEEP_SCREEN_ON = "keep_screen_on";
+        public static final String KEEP_SILENT_MODE_ON = "keep_silent_mode_on";
     }
 
     private static final class Defaults {
-- 
1.8.1.4

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to