[PATCH] Add WiFi alert message, help button on connection failed. Na...

Siqi LIU (via Code Review) gerrit at gerrit.libreoffice.org
Fri Apr 12 12:54:37 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3364

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/64/3364/1

Add WiFi alert message, help button on connection failed. Navigating up fixes

Seperation of clients construction and initialization, which prevents interruption on pinValidation activity blocking the service.run() thread. And several minor fixes.

Change-Id: I4a97b0ae8e3d3e1a900f6a4ee1d23f3a0ce86681
---
M android/sdremote/AndroidManifest.xml
M android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java
M android/sdremote/src/org/libreoffice/impressremote/ActivityChangeBroadcastProcessor.java
M android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
M android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java
M android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
M android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
M android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
M android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
M android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java
M android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
M android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
M android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
M android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
M android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
M android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
M android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
M android/sdremote/src/org/libreoffice/impressremote/communication/ReconnectionActivity.java
M android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
M android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
M android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
M android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
22 files changed, 739 insertions(+), 449 deletions(-)



diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml
index d279fbb..8eaf63d 100644
--- a/android/sdremote/AndroidManifest.xml
+++ b/android/sdremote/AndroidManifest.xml
@@ -57,6 +57,11 @@
             android:icon="@drawable/icon_options"
             android:label="@string/options" >
         </activity>
+        <activity
+            android:name=".communication.ReconnectionActivity"
+            android:logo="@drawable/actionbar_icon_computer"
+            android:label="@string/reconnect" >
+        </activity>
     </application>
 
 </manifest>
diff --git a/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java b/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java
index 3fdc5a8..c24f3d6 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/AboutDialogBuilder.java
@@ -27,29 +27,28 @@
         super(aContext);
 
         LayoutInflater aInflater = (LayoutInflater) aContext
-                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         View aLayout = aInflater.inflate(R.layout.dialog_about, null);
 
         setView(aLayout);
 
-        //        setTitle(R.string.about);
+        // setTitle(R.string.about);
         setPositiveButton(
-                        aContext.getResources().getString(R.string.about_close),
-                        new DialogInterface.OnClickListener() {
-                            public void onClick(DialogInterface dialog, int id) {
-                                dialog.dismiss();
-                            }
-                        });
+                aContext.getResources().getString(R.string.about_close),
+                new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int id) {
+                        dialog.dismiss();
+                    }
+                });
 
         mVersionLabel = (TextView) aLayout.findViewById(R.id.about_version);
 
         try {
             PackageInfo aInfo = aContext.getPackageManager().getPackageInfo(
-                            aContext.getPackageName(), 0);
-            String aVersionString = MessageFormat.format(
-                            aContext.getResources().getString(
-                                            R.string.about_versionstring),
-                            aInfo.versionName, aInfo.versionCode);
+                    aContext.getPackageName(), 0);
+            String aVersionString = MessageFormat.format(aContext
+                    .getResources().getString(R.string.about_versionstring),
+                    aInfo.versionName, aInfo.versionCode);
             mVersionLabel.setText(aVersionString);
         } catch (NameNotFoundException e) {
             // Cannot logically happen
@@ -59,3 +58,11 @@
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+tFoundException e) {
+            // Cannot logically happen
+        }
+
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ActivityChangeBroadcastProcessor.java b/android/sdremote/src/org/libreoffice/impressremote/ActivityChangeBroadcastProcessor.java
index 92003bf..d1288d7 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ActivityChangeBroadcastProcessor.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ActivityChangeBroadcastProcessor.java
@@ -18,13 +18,10 @@
 /**
  * This class is used to centralise the processing of Broadcasts concerning
  * presentation/connection status changes which result in a change of activity.
- *
  * I.e. this will switch to the correct activity and correctly set up the
  * activity backstack when switching activity.
- *
  * To use create this on activity startup, and pass messages from your
  * BroadcastReceiver's onReceive.
- *
  */
 public class ActivityChangeBroadcastProcessor {
 
@@ -42,21 +39,21 @@
 
     public void onReceive(Context aContext, Intent aIntent) {
         if (aIntent.getAction().equals(
-                        CommunicationService.STATUS_CONNECTED_NOSLIDESHOW)) {
+                CommunicationService.STATUS_CONNECTED_NOSLIDESHOW)) {
             Intent nIntent = new Intent(mActivity,
-                            StartPresentationActivity.class);
+                    StartPresentationActivity.class);
             nIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
             mActivity.startActivity(nIntent);
-        } else if (aIntent
-                        .getAction()
-                        .equals(CommunicationService.STATUS_CONNECTED_SLIDESHOW_RUNNING)) {
+        } else if (aIntent.getAction().equals(
+                CommunicationService.STATUS_CONNECTED_SLIDESHOW_RUNNING)) {
             Intent nIntent = new Intent(mActivity, PresentationActivity.class);
             nIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
             mActivity.startActivity(nIntent);
         } else if (aIntent.getAction().equals(
-                        CommunicationService.STATUS_PAIRING_PINVALIDATION)) {
+                CommunicationService.STATUS_PAIRING_PINVALIDATION)) {
             Intent nIntent = new Intent(mActivity, PairingActivity.class);
-            nIntent.putExtras(aIntent.getExtras()); // Pass on pin and other info.
+            nIntent.putExtras(aIntent.getExtras()); // Pass on pin and other
+                                                    // info.
             mActivity.startActivity(nIntent);
         }
     }
diff --git a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
index 8f172e5..1f42979 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
@@ -10,6 +10,7 @@
 
 import org.libreoffice.impressremote.communication.CommunicationService;
 
+import android.annotation.SuppressLint;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.graphics.Color;
@@ -24,6 +25,7 @@
 
 import com.actionbarsherlock.app.SherlockFragment;
 
+ at SuppressLint("ValidFragment")
 public class BlankScreenFragment extends SherlockFragment {
 
     CommunicationService mCommunicationService;
@@ -34,13 +36,13 @@
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                    Bundle savedInstanceState) {
+            Bundle savedInstanceState) {
 
         View v = inflater.inflate(R.layout.fragment_blankscreen, container,
-                        false);
+                false);
 
         Bitmap aBitmap = mCommunicationService.getSlideShow().getImage(
-                        mCommunicationService.getSlideShow().getCurrentSlide());
+                mCommunicationService.getSlideShow().getCurrentSlide());
 
         // Process the image
         final int borderWidth = 8;
@@ -49,17 +51,16 @@
         p.setShadowLayer(borderWidth, 0, 0, Color.BLACK);
 
         RectF aRect = new RectF(borderWidth, borderWidth, borderWidth
-                        + aBitmap.getWidth(), borderWidth + aBitmap.getHeight());
+                + aBitmap.getWidth(), borderWidth + aBitmap.getHeight());
         Bitmap aOut = Bitmap.createBitmap(aBitmap.getWidth() + 2 * borderWidth,
-                        aBitmap.getHeight() + 2 * borderWidth,
-                        aBitmap.getConfig());
+                aBitmap.getHeight() + 2 * borderWidth, aBitmap.getConfig());
         Canvas canvas = new Canvas(aOut);
         canvas.drawColor(Color.TRANSPARENT);
         canvas.drawRect(aRect, p);
         canvas.drawBitmap(aBitmap, null, aRect, null);
 
         ImageView aImage = (ImageView) v
-                        .findViewById(R.id.blankscreen_slidepreview);
+                .findViewById(R.id.blankscreen_slidepreview);
         aImage.setImageBitmap(aOut);
 
         OnClickListener aListener = new OnClickListener() {
@@ -72,7 +73,7 @@
         };
 
         v.findViewById(R.id.blankscreen_slidepreview).setOnClickListener(
-                        aListener);
+                aListener);
         v.findViewById(R.id.blankscreen_return).setOnClickListener(aListener);
         mCommunicationService.getTransmitter().blankScreen();
         return v;
@@ -86,3 +87,4 @@
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+dtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java
index f9e6c92..d0c2297 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PairingActivity.java
@@ -10,18 +10,26 @@
 
 import java.text.MessageFormat;
 
+import org.libreoffice.impressremote.communication.CommunicationService;
+import org.libreoffice.impressremote.communication.CommunicationService.State;
+
 import android.content.BroadcastReceiver;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.ServiceConnection;
 import android.os.Bundle;
+import android.os.IBinder;
 import android.support.v4.content.LocalBroadcastManager;
 import android.widget.TextView;
 
 import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.MenuItem;
 
 public class PairingActivity extends SherlockActivity {
     private ActivityChangeBroadcastProcessor mBroadcastProcessor;
+    private CommunicationService mCommunicationService;
 
     /** Called when the activity is first created. */
     @Override
@@ -29,8 +37,8 @@
         super.onCreate(savedInstanceState);
 
         setContentView(R.layout.activity_pairing);
-
-        mBroadcastProcessor = new ActivityChangeBroadcastProcessor(this);
+        bindService(new Intent(this, CommunicationService.class), mConnection,
+                Context.BIND_IMPORTANT);
 
         IntentFilter aFilter = new IntentFilter();
 
@@ -38,7 +46,7 @@
         mBroadcastProcessor.addToFilter(aFilter);
 
         LocalBroadcastManager.getInstance(this).registerReceiver(mListener,
-                        aFilter);
+                aFilter);
 
         getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 
@@ -47,12 +55,27 @@
 
         ((TextView) findViewById(R.id.pairing_pin)).setText(aPin);
         ((TextView) findViewById(R.id.pairing_instruction2_deviceName))
-                        .setText(MessageFormat
-                                        .format(getResources()
-                                                        .getString(R.string.pairing_instructions_2_deviceName),
-                                                        aServerName));
+                .setText(MessageFormat.format(
+                        getResources().getString(
+                                R.string.pairing_instructions_2_deviceName),
+                        aServerName));
 
         getSupportActionBar().setTitle(aServerName);
+    }
+
+    @Override
+    public void onPause(){
+        super.onPause();
+        unbindService(mConnection);
+    }
+
+    @Override
+    public void onBackPressed() {
+        mCommunicationService.getClient().closeConnection();
+
+        Intent aIntent = new Intent(this, SelectorActivity.class);
+        aIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        startActivity(aIntent);
     }
 
     private BroadcastReceiver mListener = new BroadcastReceiver() {
@@ -63,6 +86,33 @@
         }
     };
 
+    private ServiceConnection mConnection = new ServiceConnection() {
+
+        @Override
+        public void onServiceConnected(ComponentName aClassName,
+                IBinder aService) {
+            mCommunicationService = ((CommunicationService.CBinder) aService)
+                    .getService();
+
+        }
+
+        @Override
+        public void onServiceDisconnected(ComponentName aClassName) {
+            mCommunicationService = null;
+        }
+    };
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+
+        switch (item.getItemId()) {
+        case android.R.id.home:
+            onBackPressed();
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 51e590f..72666c0 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -59,21 +59,23 @@
         super.onCreate(savedInstanceState);
 
         // bind preference defaults
-        PreferenceManager.setDefaultValues(this, R.xml.preferences,
-                                           false /* retain user settings */);
+        /*
+         * retain user settings
+         */
+        PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
 
         mBroadcastProcessor = new ActivityChangeBroadcastProcessor(this);
 
         bindService(new Intent(this, CommunicationService.class), mConnection,
-                        Context.BIND_IMPORTANT);
+                Context.BIND_IMPORTANT);
 
         IntentFilter aFilter = new IntentFilter();
         mBroadcastProcessor = new ActivityChangeBroadcastProcessor(this);
         mBroadcastProcessor.addToFilter(aFilter);
         LocalBroadcastManager.getInstance(this).registerReceiver(mListener,
-                        aFilter);
+                aFilter);
 
-        //((FrameLayout) findViewById(R.id.framelayout)).addView(mLayout);
+        // ((FrameLayout) findViewById(R.id.framelayout)).addView(mLayout);
         setContentView(R.layout.activity_presentation);
 
         mPresentationFragment = new PresentationFragment();
@@ -81,9 +83,9 @@
         FragmentManager fragmentManager = getSupportFragmentManager();
 
         FragmentTransaction fragmentTransaction = fragmentManager
-            .beginTransaction();
+                .beginTransaction();
         fragmentTransaction.replace(R.id.presentation_interceptor,
-                                    mPresentationFragment, "fragment_presentation");
+                mPresentationFragment, "fragment_presentation");
         fragmentTransaction.commit();
         mOuterLayout = (FrameLayout) findViewById(R.id.framelayout);
     }
@@ -97,7 +99,7 @@
         Intent aIntent = new Intent(this, SelectorActivity.class);
         aIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         startActivity(aIntent);
-        if ( mCommunicationService != null )
+        if (mCommunicationService != null)
             mCommunicationService.disconnect();
     }
 
@@ -111,13 +113,13 @@
     @Override
     public boolean dispatchKeyEvent(KeyEvent event) {
         SharedPreferences aPref = PreferenceManager
-                        .getDefaultSharedPreferences(this);
+                .getDefaultSharedPreferences(this);
         boolean aVolumeSwitching = aPref.getBoolean("option_volumeswitching",
-                        false);
+                false);
         boolean aRelevantFragmentVisible = ((mPresentationFragment != null) && mPresentationFragment
-                        .isVisible())
-                        || ((mThumbnailFragment != null) && mThumbnailFragment
-                                        .isVisible());
+                .isVisible())
+                || ((mThumbnailFragment != null) && mThumbnailFragment
+                        .isVisible());
         if (aVolumeSwitching && aRelevantFragmentVisible) {
 
             int action = event.getAction();
@@ -141,13 +143,13 @@
     private ServiceConnection mConnection = new ServiceConnection() {
         @Override
         public void onServiceConnected(ComponentName aClassName,
-                        IBinder aService) {
+                IBinder aService) {
             mCommunicationService = ((CommunicationService.CBinder) aService)
-                            .getService();
+                    .getService();
 
             if (mThumbnailFragment != null)
                 mThumbnailFragment
-                                .setCommunicationService(mCommunicationService);
+                        .setCommunicationService(mCommunicationService);
 
         }
 
@@ -168,7 +170,7 @@
 
     @Override
     public boolean onOptionsItemSelected(
-                    com.actionbarsherlock.view.MenuItem item) {
+            com.actionbarsherlock.view.MenuItem item) {
         Intent aIntent;
         switch (item.getItemId()) {
         case R.id.actionbar_presentation_submenu_options:
@@ -178,16 +180,16 @@
             return true;
         case R.id.actionbar_presentation_submenu_blank:
             boolean aRelevantFragmentVisible = (mPresentationFragment != null && mPresentationFragment
-                            .isVisible())
-                            || (mThumbnailFragment != null && mThumbnailFragment
-                                            .isVisible());
+                    .isVisible())
+                    || (mThumbnailFragment != null && mThumbnailFragment
+                            .isVisible());
             if (aRelevantFragmentVisible) {
 
                 BlankScreenFragment aFragment = new BlankScreenFragment(
-                                mCommunicationService);
+                        mCommunicationService);
 
                 FragmentTransaction ft = getSupportFragmentManager()
-                                .beginTransaction();
+                        .beginTransaction();
                 ft.replace(R.id.presentation_interceptor, aFragment);
                 ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
                 ft.addToBackStack(null);
@@ -199,14 +201,15 @@
             AlertDialog aDialog = aBuilder.create();
             aDialog.show();
             return true;
+
         default:
             return super.onOptionsItemSelected(item);
         }
     }
 
     private class ActionBarManager implements OnClickListener,
-                    FragmentManager.OnBackStackChangedListener,
-                    TextView.OnEditorActionListener {
+            FragmentManager.OnBackStackChangedListener,
+            TextView.OnEditorActionListener {
 
         private Handler timerHandler = new Handler();
 
@@ -230,9 +233,9 @@
         private Button mCountdownButton;
 
         private String aTimeFormat = getResources().getString(
-                        R.string.actionbar_timeformat);
+                R.string.actionbar_timeformat);
         private String aTimerFormat = getResources().getString(
-                        R.string.actionbar_timerformat);
+                R.string.actionbar_timerformat);
         /*
          * True if the timer is being used as a timer, false if we are showing a
          * clock.
@@ -250,11 +253,11 @@
             aBar.setCustomView(R.layout.presentation_actionbar);
 
             mThumbnailButton = (ToggleButton) aBar.getCustomView()
-                            .findViewById(R.id.actionbar_thumbnailtoggle);
+                    .findViewById(R.id.actionbar_thumbnailtoggle);
             mThumbnailButton.setOnClickListener(this);
 
             mTimeLabel = (ToggleButton) aBar.getCustomView().findViewById(
-                            R.id.actionbar_time);
+                    R.id.actionbar_time);
             mTimeLabel.setOnClickListener(this);
 
             setupClockBar();
@@ -282,34 +285,34 @@
             mClockBar = mOuterLayout.findViewById(R.id.clockbar);
 
             mClockBar_clockButton = (ToggleButton) mClockBar
-                            .findViewById(R.id.clockbar_toggle_clockmode);
+                    .findViewById(R.id.clockbar_toggle_clockmode);
             mClockBar_stopwatchButton = (ToggleButton) mClockBar
-                            .findViewById(R.id.clockbar_toggle_stopwatchmode);
+                    .findViewById(R.id.clockbar_toggle_stopwatchmode);
             mClockBar_countdownButton = (ToggleButton) mClockBar
-                            .findViewById(R.id.clockbar_toggle_countdownmode);
+                    .findViewById(R.id.clockbar_toggle_countdownmode);
             mClockBar_clockButton.setOnClickListener(this);
             mClockBar_stopwatchButton.setOnClickListener(this);
             mClockBar_countdownButton.setOnClickListener(this);
 
             // Stopwatch bar
             mStopwatchBar = mOuterLayout
-                            .findViewById(R.id.clockbar_stopwatchbar);
+                    .findViewById(R.id.clockbar_stopwatchbar);
 
             mStopwatchButtonRun = (Button) mStopwatchBar
-                            .findViewById(R.id.clockbar_stopwatch_run);
+                    .findViewById(R.id.clockbar_stopwatch_run);
             mStopwatchButtonReset = (Button) mStopwatchBar
-                            .findViewById(R.id.clockbar_stopwatch_reset);
+                    .findViewById(R.id.clockbar_stopwatch_reset);
             mStopwatchButtonRun.setOnClickListener(this);
             mStopwatchButtonReset.setOnClickListener(this);
 
             // Countdown bar
             mCountdownBar = mOuterLayout
-                            .findViewById(R.id.clockbar_countdownbar);
+                    .findViewById(R.id.clockbar_countdownbar);
 
             mCountdownEntry = (EditText) mCountdownBar
-                            .findViewById(R.id.clockbar_countdown_time);
+                    .findViewById(R.id.clockbar_countdown_time);
             mCountdownButton = (Button) mCountdownBar
-                            .findViewById(R.id.clockbar_countdown_button);
+                    .findViewById(R.id.clockbar_countdown_button);
             mCountdownButton.setOnClickListener(this);
             mCountdownEntry.setOnEditorActionListener(this);
 
@@ -324,30 +327,30 @@
             }
             mClockBar_clockButton.setChecked(!mTimerOn);
 
-            //            FrameLayout.LayoutParams aParams = (LayoutParams) mCountdownBar
-            //                            .getLayoutParams();
-            //            aParams.topMargin = mClockBar.getBottom();
-            //            //            aParams.height = mClockBar.getHeight();
-            //            //            aParams.bottomMargin = aParams.topMargin + aParams.height;
-            //            //            aParams.leftMargin = 100;
-            //            mCountdownBar.setLayoutParams(aParams);
-            //            mCountdownBar.setPadding(0, mClockBar.getBottom(), 0, 0);
-            //            mStopwatchBar.setPadding(0, mClockBar.getBottom(), 0, 0);
-            //            //            mCountdownBar.requestLayout();
-            //            //            mOuterLayout.requestLayout();
-            //            //            mOuterLayout.invalidate();
-            //            //            aParams = (LayoutParams) mStopwatchBar.getLayoutParams();
-            //            //            aParams.topMargin = mClockBar.getHeight();
-            //            //            mOuterLayout.invalidate();
-            //            //            mStopwatchBar.setY(mClockBar.getHeight());
+            // FrameLayout.LayoutParams aParams = (LayoutParams) mCountdownBar
+            // .getLayoutParams();
+            // aParams.topMargin = mClockBar.getBottom();
+            // // aParams.height = mClockBar.getHeight();
+            // // aParams.bottomMargin = aParams.topMargin + aParams.height;
+            // // aParams.leftMargin = 100;
+            // mCountdownBar.setLayoutParams(aParams);
+            // mCountdownBar.setPadding(0, mClockBar.getBottom(), 0, 0);
+            // mStopwatchBar.setPadding(0, mClockBar.getBottom(), 0, 0);
+            // // mCountdownBar.requestLayout();
+            // // mOuterLayout.requestLayout();
+            // // mOuterLayout.invalidate();
+            // // aParams = (LayoutParams) mStopwatchBar.getLayoutParams();
+            // // aParams.topMargin = mClockBar.getHeight();
+            // // mOuterLayout.invalidate();
+            // // mStopwatchBar.setY(mClockBar.getHeight());
 
             boolean aIsCountdown = mCommunicationService.getSlideShow()
-                            .getTimer().isCountdown();
+                    .getTimer().isCountdown();
             // Stopwatch
             boolean aStopwatchMode = mTimerOn && !aIsCountdown;
             mClockBar_stopwatchButton.setChecked(aStopwatchMode);
             mStopwatchBar.setVisibility(aStopwatchMode ? View.VISIBLE
-                            : View.GONE);
+                    : View.GONE);
             mStopwatchBar.bringToFront();
             if (aStopwatchMode) {
                 Timer aTimer = mCommunicationService.getSlideShow().getTimer();
@@ -364,7 +367,7 @@
             boolean aCountdownMode = mTimerOn && aIsCountdown;
             mClockBar_countdownButton.setChecked(mTimerOn && aIsCountdown);
             mCountdownBar.setVisibility(mTimerOn && aIsCountdown ? View.VISIBLE
-                            : View.GONE);
+                    : View.GONE);
             mCountdownBar.bringToFront();
             if (aCountdownMode) {
                 Timer aTimer = mCommunicationService.getSlideShow().getTimer();
@@ -385,7 +388,7 @@
                 long aTime = System.currentTimeMillis();
                 if (mTimerOn && mCommunicationService != null) {
                     aTime = mCommunicationService.getSlideShow().getTimer()
-                                    .getTimeMillis();
+                            .getTimeMillis();
                     aTimeString = DateFormat.format(aTimerFormat, aTime);
                 } else {
                     aTimeString = DateFormat.format(aTimeFormat, aTime);
@@ -403,18 +406,18 @@
             if (aSource == mThumbnailButton) {
                 if (mThumbnailFragment == null) {
                     mThumbnailFragment = (ThumbnailFragment) getSupportFragmentManager()
-                                    .findFragmentByTag("ThumbnailFragment");
+                            .findFragmentByTag("ThumbnailFragment");
                     if (mThumbnailFragment == null) {
                         mThumbnailFragment = new ThumbnailFragment();
                         mThumbnailFragment
-                                        .setCommunicationService(mCommunicationService);
+                                .setCommunicationService(mCommunicationService);
                     }
                 }
                 if (!mThumbnailFragment.isVisible()) {
                     FragmentTransaction ft = getSupportFragmentManager()
-                                    .beginTransaction();
+                            .beginTransaction();
                     ft.replace(R.id.presentation_interceptor,
-                                    mThumbnailFragment, "ThumbnailFragment");
+                            mThumbnailFragment, "ThumbnailFragment");
                     ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
                     ft.addToBackStack(null);
                     ft.commit();
@@ -492,7 +495,7 @@
                     SimpleDateFormat aFormat = new SimpleDateFormat("HH:mm:ss");
                     aFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
                     aTime = aFormat.parse(mCountdownEntry.getText().toString())
-                                    .getTime();
+                            .getTime();
                 } catch (ParseException e) {
                 }
                 if (aTime == 0) {
@@ -500,13 +503,12 @@
                         SimpleDateFormat aFormat = new SimpleDateFormat("mm:ss");
                         aFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
                         aTime = aFormat.parse(
-                                        mCountdownEntry.getText().toString())
-                                        .getTime();
+                                mCountdownEntry.getText().toString()).getTime();
                     } catch (ParseException e) {
                     }
                 }
                 mCommunicationService.getSlideShow().getTimer()
-                                .setCountdownTime(aTime);
+                        .setCountdownTime(aTime);
                 return true;
             }
             return false;
@@ -514,8 +516,33 @@
     }
 
     /**
-     * Intermediate layout that catches all touches, used in order to hide
-     * the clock menu as appropriate.
+     * Intermediate layout that catches all touches, used in order to hide the
+     * clock menu as appropriate.
+     */
+    public static class InterceptorLayout extends FrameLayout {
+
+        public InterceptorLayout(Context context, AttributeSet aAttrs) {
+            super(context, aAttrs);
+        }
+
+        @Override
+        public boolean onInterceptTouchEvent(MotionEvent aEvent) {
+            mActionBarManager.hidePopups();
+            return super.onInterceptTouchEvent(aEvent);
+        }
+    }
+
+    private BroadcastReceiver mListener = new BroadcastReceiver() {
+
+        @Override
+        public void onReceive(Context aContext, Intent aIntent) {
+            mBroadcastProcessor.onReceive(aContext, aIntent);
+        }
+    };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+    * the clock menu as appropriate.
      *
      */
     public static class InterceptorLayout extends FrameLayout {
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 8f1ba7d..6c5e468 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -58,20 +58,20 @@
     private ServiceConnection mConnection = new ServiceConnection() {
         @Override
         public void onServiceConnected(ComponentName aClassName,
-                        IBinder aService) {
+                IBinder aService) {
             mCommunicationService = ((CommunicationService.CBinder) aService)
-                            .getService();
+                    .getService();
 
             if (mTopView != null) {
                 mTopView.setAdapter(new ThumbnailAdapter(mContext,
-                                mCommunicationService.getSlideShow()));
+                        mCommunicationService.getSlideShow()));
                 mTopView.setSelection(mCommunicationService.getSlideShow()
-                                .getCurrentSlide(), true);
+                        .getCurrentSlide(), true);
                 mTopView.setOnItemSelectedListener(new ClickListener());
             }
 
             updateSlideNumberDisplay(mCommunicationService.getSlideShow()
-                            .getCurrentSlide());
+                    .getCurrentSlide());
 
         }
 
@@ -82,16 +82,16 @@
     };
 
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                    Bundle savedInstanceState) {
+            Bundle savedInstanceState) {
         setRetainInstance(true);
         getActivity().bindService(
-                        new Intent(getActivity().getApplicationContext(),
-                                        CommunicationService.class),
-                        mConnection, Context.BIND_IMPORTANT);
+                new Intent(getActivity().getApplicationContext(),
+                        CommunicationService.class), mConnection,
+                Context.BIND_IMPORTANT);
         mContext = getActivity().getApplicationContext();
-        //        container.removeAllViews();
+        // container.removeAllViews();
         View v = inflater.inflate(R.layout.fragment_presentation, container,
-                        false);
+                false);
 
         mNotes = (WebView) v.findViewById(R.id.presentation_notes);
 
@@ -114,8 +114,8 @@
 
         if (mNewCoverflowHeight != 0) {
             ThumbnailAdapter aAdapter = (ThumbnailAdapter) mTopView
-                            .getAdapter();
-            if ( aAdapter != null ) {
+                    .getAdapter();
+            if (aAdapter != null) {
                 aAdapter.setHeight(mNewCoverflowHeight);
                 mTopView.setImageHeight(mNewCoverflowHeight);
                 aAdapter.setWidth(mNewCoverflowWidth);
@@ -127,12 +127,12 @@
         }
 
         IntentFilter aFilter = new IntentFilter(
-                        CommunicationService.MSG_SLIDE_CHANGED);
+                CommunicationService.MSG_SLIDE_CHANGED);
         aFilter.addAction(CommunicationService.MSG_SLIDE_NOTES);
         aFilter.addAction(CommunicationService.MSG_SLIDE_PREVIEW);
         LocalBroadcastManager
-                        .getInstance(getActivity().getApplicationContext())
-                        .registerReceiver(mListener, aFilter);
+                .getInstance(getActivity().getApplicationContext())
+                .registerReceiver(mListener, aFilter);
 
         return v;
     }
@@ -142,18 +142,18 @@
         getActivity().unbindService(mConnection);
         super.onDestroyView();
         LocalBroadcastManager
-                        .getInstance(getActivity().getApplicationContext())
-                        .unregisterReceiver(mListener);
+                .getInstance(getActivity().getApplicationContext())
+                .unregisterReceiver(mListener);
         mTopView = null;
         mContext = null;
     }
 
     private void updateSlideNumberDisplay(int aPosition) {
-        //        int aSlide = mCommunicationService.getSlideShow().getCurrentSlide();
+        // int aSlide = mCommunicationService.getSlideShow().getCurrentSlide();
         mNumberText.setText((aPosition + 1) + "/"
-                        + mCommunicationService.getSlideShow().getSize());
+                + mCommunicationService.getSlideShow().getSize());
         mNotes.loadDataWithBaseURL(null, mCommunicationService.getSlideShow()
-                        .getNotes(aPosition), "text/html", "UTF-8", null);
+                .getNotes(aPosition), "text/html", "UTF-8", null);
     }
 
     // -------------------------------------------------- RESIZING LISTENER ----
@@ -176,9 +176,9 @@
                 boolean aPortrait = (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT);
 
                 int aFlowSize = aPortrait ? mTopView.getHeight() : mTopView
-                                .getWidth();
+                        .getWidth();
                 int aViewSize = aPortrait ? mLayout.getHeight() : mLayout
-                                .getWidth();
+                        .getWidth();
 
                 // Calculate height change, taking limits into account
                 int aDiff = (int) (aPortrait ? aEvent.getY() : aEvent.getX());
@@ -190,16 +190,16 @@
 
                 // Now deal with the internal height
                 AbstractCoverFlowImageAdapter aAdapter = (AbstractCoverFlowImageAdapter) mTopView
-                                .getAdapter();
+                        .getAdapter();
 
                 double aRatio = mOriginalCoverflowWidth
-                                / mOriginalCoverflowHeight;
+                        / mOriginalCoverflowHeight;
                 float aHeightNew;
                 float aWidthNew;
                 if (aPortrait) {
                     aHeightNew = mTopView.getImageHeight() + aDiff;
                     aWidthNew = (float) (aRatio * aHeightNew);
-                    //               Too wide -- so scale down
+                    // Too wide -- so scale down
                     if (aWidthNew > mLayout.getWidth() - 50) {
                         aWidthNew = mLayout.getWidth() - 50;
                         aHeightNew = (float) (aWidthNew / aRatio);
@@ -208,7 +208,7 @@
                 } else {
                     aWidthNew = mTopView.getImageWidth() + aDiff;
                     aHeightNew = (float) (aWidthNew / aRatio);
-                    //              Too High -- so scale down
+                    // Too High -- so scale down
                     if (aHeightNew > mLayout.getHeight() - 50) {
                         aHeightNew = mLayout.getHeight() - 50;
                         aWidthNew = (float) (aHeightNew * aRatio);
@@ -239,7 +239,7 @@
 
         @Override
         public void onItemSelected(AdapterView<?> arg0, View arg1,
-                        int aPosition, long arg3) {
+                int aPosition, long arg3) {
             if (mCommunicationService != null)
                 mCommunicationService.getTransmitter().gotoSlide(aPosition);
             lastUpdateTime = System.currentTimeMillis();
@@ -260,7 +260,7 @@
             if (mTopView == null || mTopView.getAdapter() == null)
                 return;
             if (aIntent.getAction().equals(
-                            CommunicationService.MSG_SLIDE_CHANGED)) {
+                    CommunicationService.MSG_SLIDE_CHANGED)) {
                 int aSlide = aIntent.getExtras().getInt("slide_number");
 
                 if (aSlide == mTopView.getSelectedItemPosition())
@@ -270,15 +270,17 @@
                 }
                 mTopView.setSelection(aSlide, true);
             } else if (aIntent.getAction().equals(
-                            CommunicationService.MSG_SLIDE_PREVIEW)) {
-                ThumbnailAdapter aThumbAdaptor = (ThumbnailAdapter) mTopView.getAdapter();
+                    CommunicationService.MSG_SLIDE_PREVIEW)) {
+                ThumbnailAdapter aThumbAdaptor = (ThumbnailAdapter) mTopView
+                        .getAdapter();
                 aThumbAdaptor.notifyDataSetChanged();
             } else if (aIntent.getAction().equals(
-                            CommunicationService.MSG_SLIDE_NOTES)) {
+                    CommunicationService.MSG_SLIDE_NOTES)) {
                 int aPosition = aIntent.getExtras().getInt("slide_number");
-                if ( aPosition == mTopView.getSelectedItemPosition() ) {
-                    mNotes.loadDataWithBaseURL(null, mCommunicationService.getSlideShow()
-                                    .getNotes(aPosition), "text/html", "UTF-8", null);
+                if (aPosition == mTopView.getSelectedItemPosition()) {
+                    mNotes.loadDataWithBaseURL(null, mCommunicationService
+                            .getSlideShow().getNotes(aPosition), "text/html",
+                            "UTF-8", null);
                 }
             }
 
@@ -308,3 +310,14 @@
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+.getSize();
+        }
+
+        @Override
+        protected Bitmap createBitmap(int position) {
+            return mSlideShow.getImage(position);
+        }
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
index 3b0f684..26779bb 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
@@ -63,15 +63,18 @@
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_selector);
 
+        if (mCommunicationService != null)
+            mCommunicationService.disconnect();
+
         IntentFilter aFilter = new IntentFilter(
-                        CommunicationService.MSG_SERVERLIST_CHANGED);
+                CommunicationService.MSG_SERVERLIST_CHANGED);
         aFilter.addAction(CommunicationService.STATUS_CONNECTION_FAILED);
 
         mBroadcastProcessor = new ActivityChangeBroadcastProcessor(this);
         mBroadcastProcessor.addToFilter(aFilter);
 
         LocalBroadcastManager.getInstance(this).registerReceiver(mListener,
-                        aFilter);
+                aFilter);
 
         mBluetoothContainer = findViewById(R.id.selector_container_bluetooth);
         mBluetoothList = (LinearLayout) findViewById(R.id.selector_list_bluetooth);
@@ -106,32 +109,27 @@
 
             LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
             final View layout = inflater.inflate(R.layout.dialog_addserver,
-                            null);
+                    null);
 
             builder = new AlertDialog.Builder(this);
             builder.setView(layout);
             builder.setTitle(R.string.addserver);
             builder.setPositiveButton(R.string.addserver_add,
-                            new DialogInterface.OnClickListener() {
-                                @Override
-                                public void onClick(DialogInterface dialog,
-                                                int which) {
-                                    EditText aAddressEntry = (EditText) layout
-                                                    .findViewById(R.id.addserver_addressentry);
-                                    EditText aNameEntry = (EditText) layout
-                                                    .findViewById(R.id.addserver_nameentry);
-                                    CheckBox aRememberServer = (CheckBox) layout
-                                                    .findViewById(R.id.addserver_remember);
-                                    mCommunicationService
-                                                    .addServer(aAddressEntry
-                                                                    .getText()
-                                                                    .toString(),
-                                                                    aNameEntry.getText()
-                                                                                    .toString(),
-                                                                    aRememberServer.isChecked());
-                                    refreshLists();
-                                }
-                            });
+                    new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialog, int which) {
+                            EditText aAddressEntry = (EditText) layout
+                                    .findViewById(R.id.addserver_addressentry);
+                            EditText aNameEntry = (EditText) layout
+                                    .findViewById(R.id.addserver_nameentry);
+                            CheckBox aRememberServer = (CheckBox) layout
+                                    .findViewById(R.id.addserver_remember);
+                            mCommunicationService.addServer(aAddressEntry
+                                    .getText().toString(), aNameEntry.getText()
+                                    .toString(), aRememberServer.isChecked());
+                            refreshLists();
+                        }
+                    });
             builder.setNegativeButton(R.string.addserver_cancel, null);
             alertDialog = builder.create();
             alertDialog.show();
@@ -197,9 +195,9 @@
     private ServiceConnection mConnection = new ServiceConnection() {
         @Override
         public void onServiceConnected(ComponentName aClassName,
-                        IBinder aService) {
+                IBinder aService) {
             mCommunicationService = ((CommunicationService.CBinder) aService)
-                            .getService();
+                    .getService();
             mCommunicationService.startSearching();
             refreshLists();
         }
@@ -215,34 +213,58 @@
         @Override
         public void onReceive(Context aContext, Intent aIntent) {
             if (aIntent.getAction().equals(
-                            CommunicationService.MSG_SERVERLIST_CHANGED)) {
+                    CommunicationService.MSG_SERVERLIST_CHANGED)) {
                 refreshLists();
                 return;
             } else if (aIntent.getAction().equals(
-                            CommunicationService.STATUS_CONNECTION_FAILED)) {
+                    CommunicationService.STATUS_CONNECTION_FAILED)) {
                 if (mProgressDialog != null) {
                     mProgressDialog.dismiss();
 
-                    String aFormat = getResources().getString(
-                                    R.string.selector_dialog_connectionfailed);
-                    String aDialogText = MessageFormat.format(aFormat,
-                                    mCommunicationService
-                                                    .getPairingDeviceName());
+                    if (mCommunicationService != null) {
+                        String aFormat = getResources().getString(
+                                R.string.selector_dialog_connectionfailed);
+                        String aDialogText = MessageFormat.format(aFormat,
+                                mCommunicationService.getPairingDeviceName());
 
-                    AlertDialog.Builder builder = new AlertDialog.Builder(
-                                    SelectorActivity.this);
-                    builder.setMessage(aDialogText)
-                                    .setCancelable(false)
-                                    .setPositiveButton(
-                                                    R.string.selector_dialog_connectionfailed_ok,
-                                                    new DialogInterface.OnClickListener() {
-                                                        public void onClick(
-                                                                        DialogInterface dialog,
-                                                                        int id) {
-                                                            dialog.dismiss();
-                                                        }
-                                                    });
-                    builder.show();
+                        AlertDialog.Builder builder = new AlertDialog.Builder(
+                                SelectorActivity.this);
+                        builder.setMessage(aDialogText)
+                                .setCancelable(false)
+                                .setNeutralButton(R.string.help,
+                                        new DialogInterface.OnClickListener() {
+                                            public void onClick(
+                                                    DialogInterface dialog,
+                                                    int id) {
+                                                dialog.dismiss();
+                                                AlertDialog.Builder builder = new AlertDialog.Builder(
+                                                        SelectorActivity.this);
+                                                builder.setMessage(
+                                                        R.string.ConnectionFailedHelp)
+                                                        .setCancelable(false)
+                                                        .setPositiveButton(
+                                                                R.string.selector_dialog_connectionfailed_ok,
+                                                                new DialogInterface.OnClickListener() {
+                                                                    public void onClick(
+                                                                            DialogInterface dialog,
+                                                                            int id) {
+                                                                        dialog.dismiss();
+                                                                    }
+                                                                });
+                                                builder.show();
+                                            }
+                                        })
+                                .setPositiveButton(
+                                        R.string.selector_dialog_connectionfailed_ok,
+                                        new DialogInterface.OnClickListener() {
+                                            public void onClick(
+                                                    DialogInterface dialog,
+                                                    int id) {
+                                                dialog.dismiss();
+                                            }
+                                        });
+                        builder.show();
+                    }
                 }
             }
             mBroadcastProcessor.onReceive(aContext, aIntent);
@@ -257,10 +279,9 @@
         Log.i(Globals.TAG, "SelectorActivity.deleteServer(" + aView + ")");
         for (Entry<Server, View> aEntry : mNetworkServers.entrySet()) {
             if (aEntry.getValue() == aView
-                            .findViewById(R.id.selector_sub_label)
-                            || aEntry.getValue().findViewById(
-                                            R.id.selector_sub_label) == aView
-                                            .findViewById(R.id.selector_sub_label))
+                    .findViewById(R.id.selector_sub_label)
+                    || aEntry.getValue().findViewById(R.id.selector_sub_label) == aView
+                            .findViewById(R.id.selector_sub_label))
                 mCommunicationService.removeServer(aEntry.getKey());
         }
     }
@@ -270,7 +291,9 @@
 
             List<Server> aServers = mCommunicationService.getServers();
 
-            Log.i(Globals.TAG, "SelectorActivity.refreshLists: got " + aServers.size() + " servers");
+            Log.i(Globals.TAG,
+                    "SelectorActivity.refreshLists: got " + aServers.size()
+                            + " servers");
 
             // Simply replace the lists... first clear the old lists,
             // Then add those currently found.
@@ -283,35 +306,35 @@
             for (Server aServer : aServers) {
                 boolean aIsBluetooth = (aServer.getProtocol() == Protocol.BLUETOOTH);
                 HashMap<Server, View> aMap = aIsBluetooth ? mBluetoothServers
-                                : mNetworkServers;
+                        : mNetworkServers;
                 LinearLayout aLayout = aIsBluetooth ? mBluetoothList
-                                : mNetworkList;
+                        : mNetworkList;
 
-                View aView = getLayoutInflater()
-                                .inflate(R.layout.activity_selector_sublayout_server,
-                                                null);
+                View aView = getLayoutInflater().inflate(
+                        R.layout.activity_selector_sublayout_server, null);
 
                 TextView aText = (TextView) aView
-                                .findViewById(R.id.selector_sub_label);
+                        .findViewById(R.id.selector_sub_label);
                 aText.setOnClickListener(mClickListener);
                 aText.setText(aServer.getName());
                 aLayout.addView(aView);
                 aMap.put(aServer, aText);
 
-                //                    registerForContextMenu(aView);
+                // registerForContextMenu(aView);
                 registerForContextMenu(aText);
             }
         }
 
         // Hide as necessary
         mBluetoothContainer
-                        .setVisibility((mBluetoothServers.size() != 0) ? View.VISIBLE
-                                        : View.GONE);
+                .setVisibility((mBluetoothServers.size() != 0) ? View.VISIBLE
+                        : View.GONE);
         mNetworkContainer
-                        .setVisibility((mNetworkServers.size() != 0) ? View.VISIBLE
-                                        : View.GONE);
+                .setVisibility((mNetworkServers.size() != 0) ? View.VISIBLE
+                        : View.GONE);
 
-        mNoServerLabel.setVisibility(((mBluetoothServers.size() == 0) && (mNetworkServers
+        mNoServerLabel
+                .setVisibility(((mBluetoothServers.size() == 0) && (mNetworkServers
                         .size() == 0)) ? View.VISIBLE : View.GONE);
     }
 
@@ -340,12 +363,12 @@
                 mCommunicationService.connectTo(aDesiredServer);
                 // Connect Service and wait for broadcast
                 String aFormat = getResources().getString(
-                                R.string.selector_dialog_connecting);
+                        R.string.selector_dialog_connecting);
                 String aDialogText = MessageFormat.format(aFormat,
-                                aDesiredServer.getName());
+                        aDesiredServer.getName());
 
                 mProgressDialog = ProgressDialog.show(SelectorActivity.this,
-                                "", aDialogText, true);
+                        "", aDialogText, true);
                 mProgressDialog.setCancelable(true);
                 mProgressDialog.setOnCancelListener(new OnCancelListener() {
 
@@ -362,7 +385,7 @@
     View aLastSelected = null;
 
     public void onCreateContextMenu(android.view.ContextMenu menu, View v,
-                    android.view.ContextMenu.ContextMenuInfo menuInfo) {
+            android.view.ContextMenu.ContextMenuInfo menuInfo) {
         super.onCreateContextMenu(menu, v, menuInfo);
         aLastSelected = v;
         android.view.MenuInflater inflater = getMenuInflater();
diff --git a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
index 471e96b..7b314af 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
@@ -25,7 +25,7 @@
 
     @Override
     public boolean onOptionsItemSelected(
-                    com.actionbarsherlock.view.MenuItem item) {
+            com.actionbarsherlock.view.MenuItem item) {
         switch (item.getItemId()) {
         case android.R.id.home:
             finish();
@@ -37,3 +37,4 @@
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+tab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java
index 44a3368..76bcfea 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/StartPresentationActivity.java
@@ -10,6 +10,7 @@
 
 import org.libreoffice.impressremote.communication.CommunicationService;
 
+import android.app.AlertDialog;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
@@ -18,6 +19,7 @@
 import android.content.ServiceConnection;
 import android.os.Bundle;
 import android.os.IBinder;
+import android.support.v4.app.FragmentTransaction;
 import android.support.v4.content.LocalBroadcastManager;
 import android.view.View;
 import android.view.View.OnClickListener;
@@ -35,19 +37,21 @@
 
         setContentView(R.layout.activity_startpresentation);
         bindService(new Intent(this, CommunicationService.class), mConnection,
-                        Context.BIND_IMPORTANT);
+                Context.BIND_IMPORTANT);
+
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 
         IntentFilter aFilter = new IntentFilter(
-                        CommunicationService.MSG_SLIDESHOW_STARTED);
+                CommunicationService.MSG_SLIDESHOW_STARTED);
 
         mBroadcastProcessor = new ActivityChangeBroadcastProcessor(this);
         mBroadcastProcessor.addToFilter(aFilter);
 
         LocalBroadcastManager.getInstance(this).registerReceiver(mListener,
-                        aFilter);
+                aFilter);
 
         findViewById(R.id.startpresentation_button).setOnClickListener(
-                        mClickListener);
+                mClickListener);
     }
 
     @Override
@@ -68,9 +72,9 @@
     private ServiceConnection mConnection = new ServiceConnection() {
         @Override
         public void onServiceConnected(ComponentName aClassName,
-                        IBinder aService) {
+                IBinder aService) {
             mCommunicationService = ((CommunicationService.CBinder) aService)
-                            .getService();
+                    .getService();
 
         }
 
@@ -97,6 +101,18 @@
             mBroadcastProcessor.onReceive(aContext, aIntent);
         }
     };
+
+    @Override
+    public boolean onOptionsItemSelected(
+            com.actionbarsherlock.view.MenuItem item) {
+        switch (item.getItemId()) {
+        case android.R.id.home:
+            onBackPressed();
+            return true;
+        default:
+            return super.onOptionsItemSelected(item);
+        }
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
index c939973..b384242 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
@@ -44,12 +44,12 @@
 
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                    Bundle savedInstanceState) {
+            Bundle savedInstanceState) {
         // Inflate the layout for this fragment
-        //        container.removeAllViews();
+        // container.removeAllViews();
         setRetainInstance(true);
         View v = inflater
-                        .inflate(R.layout.fragment_thumbnail, container, false);
+                .inflate(R.layout.fragment_thumbnail, container, false);
 
         mGrid = (GridView) v.findViewById(R.id.thumbnail_grid);
 
@@ -61,11 +61,11 @@
         }
 
         IntentFilter aFilter = new IntentFilter(
-                        CommunicationService.MSG_SLIDE_CHANGED);
+                CommunicationService.MSG_SLIDE_CHANGED);
         aFilter.addAction(CommunicationService.MSG_SLIDE_PREVIEW);
         LocalBroadcastManager
-                        .getInstance(getActivity().getApplicationContext())
-                        .registerReceiver(mListener, aFilter);
+                .getInstance(getActivity().getApplicationContext())
+                .registerReceiver(mListener, aFilter);
 
         return v;
     }
@@ -74,8 +74,8 @@
     public void onDestroyView() {
         super.onDestroyView();
         LocalBroadcastManager
-                        .getInstance(getActivity().getApplicationContext())
-                        .unregisterReceiver(mListener);
+                .getInstance(getActivity().getApplicationContext())
+                .unregisterReceiver(mListener);
         mGrid = null;
         mContext = null;
         mCurrentImage = null;
@@ -101,29 +101,29 @@
     private void formatUnselected(ImageView aImage, TextView aText) {
         if (aImage != null) {
             aImage.setBackgroundColor(getResources().getColor(
-                            R.color.thumbnail_border));
+                    R.color.thumbnail_border));
         }
         if (aText != null) {
             aText.setTypeface(Typeface.create(aText.getTypeface(),
-                            Typeface.NORMAL));
+                    Typeface.NORMAL));
         }
     }
 
     private void formatSelected(ImageView aImage, TextView aText) {
         if (aImage != null) {
             aImage.setBackgroundColor(getResources().getColor(
-                            R.color.thumbnail_border_selected));
+                    R.color.thumbnail_border_selected));
         }
         if (aText != null) {
             aText.setTypeface(Typeface.create(aText.getTypeface(),
-                            Typeface.BOLD));
+                    Typeface.BOLD));
         }
     }
 
     // ----------------------------------------------------- CLICK LISTENER ----
     protected class ClickListener implements AdapterView.OnItemClickListener {
         public void onItemClick(AdapterView<?> parent, View v, int position,
-                        long id) {
+                long id) {
             if (mCommunicationService != null)
                 mCommunicationService.getTransmitter().gotoSlide(position);
         }
@@ -132,7 +132,7 @@
     // ---------------------------------------------------- MESSAGE HANDLER ----
 
     public void setCommunicationService(
-                    CommunicationService aCommunicationService) {
+            CommunicationService aCommunicationService) {
         mCommunicationService = aCommunicationService;
         mSlideShow = mCommunicationService.getSlideShow();
         if (mGrid != null) {
@@ -147,11 +147,11 @@
             if (mGrid == null)
                 return;
             if (aIntent.getAction().equals(
-                            CommunicationService.MSG_SLIDE_CHANGED)) {
+                    CommunicationService.MSG_SLIDE_CHANGED)) {
                 int aSlide = aIntent.getExtras().getInt("slide_number");
                 setSelected(aSlide);
             } else if (aIntent.getAction().equals(
-                            CommunicationService.MSG_SLIDE_PREVIEW)) {
+                    CommunicationService.MSG_SLIDE_PREVIEW)) {
                 mGrid.invalidateViews();
             }
 
@@ -188,7 +188,7 @@
         @Override
         public View getView(int position, View convertView, ViewGroup parent) {
             LayoutInflater aInflater = (LayoutInflater) mContext
-                            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             View v = aInflater.inflate(R.layout.slide_thumbnail, null);
 
             ImageView aImage = (ImageView) v.findViewById(R.id.sub_thumbnail);
@@ -196,12 +196,12 @@
 
             // Do the image & number styling
             int aBorderWidth = getResources().getInteger(
-                            R.integer.thumbnail_border_width);
+                    R.integer.thumbnail_border_width);
             aImage.setPadding(aBorderWidth, aBorderWidth, aBorderWidth,
-                            aBorderWidth);
+                    aBorderWidth);
 
             if ((mSlideShow != null)
-                            && (position == mSlideShow.getCurrentSlide())) {
+                    && (position == mSlideShow.getCurrentSlide())) {
                 formatSelected(aImage, aText);
                 mCurrentImage = aImage;
                 mCurrentText = aText;
@@ -227,3 +227,13 @@
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+     }
+
+            aText.setText(String.valueOf(position + 1));
+
+            return v;
+        }
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
index 07a626f..2c1c824 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothClient.java
@@ -32,9 +32,8 @@
     private BluetoothSocket mSocket;
 
     public BluetoothClient(Server aServer,
-                    CommunicationService aCommunicationService,
-                    Receiver aReceiver, boolean aBluetoothWasEnabled)
-                    throws IOException {
+            CommunicationService aCommunicationService, Receiver aReceiver,
+            boolean aBluetoothWasEnabled) throws IOException {
         super(aServer, aCommunicationService, aReceiver);
 
         Log.i(Globals.TAG, "BluetoothClient(" + aServer + ")");
@@ -46,7 +45,7 @@
         }
 
         BluetoothDevice aDevice = mAdapter
-                        .getRemoteDevice(aServer.getAddress());
+                .getRemoteDevice(aServer.getAddress());
         mAdapter.cancelDiscovery();
 
         // This is the "standard UUID for the Serial Port Profile".
@@ -54,30 +53,10 @@
         // Bluetooth BASE_UUID. See
         // https://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm
         mSocket = aDevice.createRfcommSocketToServiceRecord(UUID
-                        .fromString("00001101-0000-1000-8000-00805F9B34FB"));
+                .fromString("00001101-0000-1000-8000-00805F9B34FB"));
 
         mSocket.connect();
         Log.i(Globals.TAG, "BluetoothClient: connected");
-
-        mInputStream = mSocket.getInputStream();
-        mReader = new BufferedReader(new InputStreamReader(mInputStream,
-                        CHARSET));
-
-        mOutputStream = mSocket.getOutputStream();
-
-        String aTemp = mReader.readLine();
-        Log.i(Globals.TAG, "BluetoothClient: got line " + aTemp);
-        if (!aTemp.equals("LO_SERVER_SERVER_PAIRED")) {
-            return;
-        }
-        while (mReader.readLine().length() != 0) {
-            // Get rid of extra lines
-        }
-        Intent aIntent = new Intent(CommunicationService.MSG_PAIRING_SUCCESSFUL);
-        LocalBroadcastManager.getInstance(mCommunicationService).sendBroadcast(
-                        aIntent);
-        startListening();
-
     }
 
     @Override
@@ -96,6 +75,29 @@
         }
     }
 
+    @Override
+    public void validating() throws IOException {
+        // TODO Auto-generated method stub
+        mInputStream = mSocket.getInputStream();
+        mReader = new BufferedReader(new InputStreamReader(mInputStream,
+                CHARSET));
+
+        mOutputStream = mSocket.getOutputStream();
+
+        String aTemp = mReader.readLine();
+        Log.i(Globals.TAG, "BluetoothClient: got line " + aTemp);
+        if (!aTemp.equals("LO_SERVER_SERVER_PAIRED")) {
+            return;
+        }
+        while (mReader.readLine().length() != 0) {
+            // Get rid of extra lines
+        }
+        Intent aIntent = new Intent(CommunicationService.MSG_PAIRING_SUCCESSFUL);
+        LocalBroadcastManager.getInstance(mCommunicationService).sendBroadcast(
+                aIntent);
+        startListening();
+    }
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
index 972a8a4..a28985c 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothFinder.java
@@ -37,7 +37,8 @@
     }
 
     public void startFinding() {
-        Log.i(Globals.TAG, "BluetoothFinder.startFinding(): mAdapter=" + mAdapter);
+        Log.i(Globals.TAG, "BluetoothFinder.startFinding(): mAdapter="
+                + mAdapter);
         if (mAdapter == null) {
             return; // No bluetooth adapter found (emulator, special devices)
         }
@@ -49,7 +50,8 @@
     }
 
     public void stopFinding() {
-        Log.i(Globals.TAG, "BluetoothFinder.stopFinding(): mAdapter=" + mAdapter);
+        Log.i(Globals.TAG, "BluetoothFinder.stopFinding(): mAdapter="
+                + mAdapter);
         if (mAdapter == null) {
             return; // No bluetooth adapter found (emulator, special devices)
         }
@@ -72,25 +74,28 @@
 
         @Override
         public void onReceive(Context context, Intent aIntent) {
-            Log.i(Globals.TAG, "BluetoothFinder: BroadcastReceiver.onReceive: aIntent=" + aIntent);
+            Log.i(Globals.TAG,
+                    "BluetoothFinder: BroadcastReceiver.onReceive: aIntent="
+                            + aIntent);
             if (aIntent.getAction().equals(BluetoothDevice.ACTION_FOUND)) {
                 BluetoothDevice aDevice = (BluetoothDevice) aIntent.getExtras()
-                                .get(BluetoothDevice.EXTRA_DEVICE);
-                Log.i(Globals.TAG, "BluetoothFinder.onReceive: found " + aDevice.getName() + " at " + aDevice.getAddress());
+                        .get(BluetoothDevice.EXTRA_DEVICE);
+                Log.i(Globals.TAG, "BluetoothFinder.onReceive: found "
+                        + aDevice.getName() + " at " + aDevice.getAddress());
                 if (aDevice.getName() == null)
                     return;
                 Server aServer = new Server(Protocol.BLUETOOTH,
-                                aDevice.getAddress(), aDevice.getName(),
-                                System.currentTimeMillis());
+                        aDevice.getAddress(), aDevice.getName(),
+                        System.currentTimeMillis());
                 mServerList.put(aServer.getAddress(), aServer);
                 Intent aNIntent = new Intent(
-                                CommunicationService.MSG_SERVERLIST_CHANGED);
+                        CommunicationService.MSG_SERVERLIST_CHANGED);
                 LocalBroadcastManager.getInstance(mContext).sendBroadcast(
-                                aNIntent);
+                        aNIntent);
             } else if (aIntent.getAction().equals(
-                            BluetoothAdapter.ACTION_DISCOVERY_FINISHED)
-                            || aIntent.getAction()
-                                            .equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+                    BluetoothAdapter.ACTION_DISCOVERY_FINISHED)
+                    || aIntent.getAction().equals(
+                            BluetoothAdapter.ACTION_STATE_CHANGED)) {
                 // Start discovery again after a small delay.
                 // but check whether device is on incase the user manually
                 // disabled bluetooth
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
index 198b873..eb30d68 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
@@ -15,7 +15,11 @@
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 
+import org.libreoffice.impressremote.Globals;
+import org.libreoffice.impressremote.communication.CommunicationService.State;
+
 import android.content.Intent;
+import android.util.Log;
 
 /**
  * Generic Client for the remote control. To implement a Client for a specific
@@ -37,6 +41,8 @@
 
     public abstract void closeConnection();
 
+    public abstract void validating() throws IOException;
+
     private Receiver mReceiver;
 
     protected Server mServer;
@@ -44,8 +50,7 @@
     protected CommunicationService mCommunicationService;
 
     protected Client(Server aServer,
-                    CommunicationService aCommunicationService,
-                    Receiver aReceiver) {
+            CommunicationService aCommunicationService, Receiver aReceiver) {
         mServer = aServer;
         mName = aServer.getName();
         mCommunicationService = aCommunicationService;
@@ -71,18 +76,17 @@
                 String aTemp;
                 // read until empty line
                 while ((aTemp = mReader.readLine()) != null
-                                && aTemp.length() != 0) {
+                        && aTemp.length() != 0) {
                     aList.add(aTemp);
                 }
                 if (aTemp == null) {
-                    mCommunicationService.connectTo(mServer);
                     Intent aIntent = new Intent(
-                                    mCommunicationService
-                                                    .getApplicationContext(),
-                                    ReconnectionActivity.class);
+                            mCommunicationService.getApplicationContext(),
+                            ReconnectionActivity.class);
+                    aIntent.putExtra("server", mServer);
                     aIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                     mCommunicationService.getApplicationContext()
-                                    .startActivity(aIntent);
+                            .startActivity(aIntent);
                     return;
                 }
                 mReceiver.parseCommand(aList);
@@ -122,7 +126,7 @@
             mOutputStream.write(command.getBytes(CHARSET));
         } catch (UnsupportedEncodingException e) {
             throw new Error("Specified network encoding [" + CHARSET
-                            + " not available.");
+                    + " not available.");
         } catch (IOException e) {
             // I.e. connection closed. This will be dealt with by the listening
             // loop.
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index 8028f00..210ccbc 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -38,7 +38,6 @@
     /**
      * Get the publicly visible device name -- generally the bluetooth name,
      * however for bluetoothless devices the device model name is used.
-     *
      * @return The device name.
      */
     public static String getDeviceName() {
@@ -77,6 +76,7 @@
     @Override
     public void run() {
         Log.i(Globals.TAG, "CommunicationService.run()");
+
         synchronized (this) {
             while (true) {
                 // Condition
@@ -90,8 +90,8 @@
                 Log.i(Globals.TAG, "CommunicationService.run: at \"Work\"");
                 synchronized (mConnectionVariableMutex) {
                     if ((mStateDesired == State.CONNECTED && mState == State.CONNECTED)
-                                    || (mStateDesired == State.DISCONNECTED && mState == State.CONNECTED)) {
-                        mClient.closeConnection();
+                            || (mStateDesired == State.DISCONNECTED && mState == State.CONNECTED)) {
+                        getClient().closeConnection();
                         mClient = null;
                         mState = State.DISCONNECTED;
                     }
@@ -101,36 +101,43 @@
                             switch (mServerDesired.getProtocol()) {
                             case NETWORK:
                                 mClient = new NetworkClient(mServerDesired,
-                                                this, mReceiver);
+                                        this, mReceiver);
+                                mClient.validating();
                                 break;
                             case BLUETOOTH:
                                 mClient = new BluetoothClient(mServerDesired,
-                                                this, mReceiver,
-                                                mBluetoothPreviouslyEnabled);
+                                        this, mReceiver,
+                                        mBluetoothPreviouslyEnabled);
+                                mClient.validating();
                                 break;
                             }
-                            mTransmitter = new Transmitter(mClient);
+                            mTransmitter = new Transmitter(getClient());
                             mState = State.CONNECTED;
                         } catch (IOException e) {
                             Log.i(Globals.TAG, "CommunicationService.run: " + e);
-                            mClient = null;
-                            mState = State.DISCONNECTED;
-                            Intent aIntent = new Intent(
-                                            CommunicationService.STATUS_CONNECTION_FAILED);
-                            LocalBroadcastManager.getInstance(this)
-                                            .sendBroadcast(aIntent);
+                            connextionFailed();
                         }
                     }
                 }
+                Log.i(Globals.TAG, "CommunicationService.finished work");
             }
         }
+    }
+
+    private void connextionFailed() {
+        mClient = null;
+        mState = State.DISCONNECTED;
+        Intent aIntent = new Intent(
+                CommunicationService.STATUS_CONNECTION_FAILED);
+        LocalBroadcastManager.getInstance(this).sendBroadcast(aIntent);
     }
 
     private boolean mBluetoothPreviouslyEnabled;
 
     public void startSearching() {
         Log.i(Globals.TAG, "CommunicationService.startSearching()");
-        SharedPreferences aPref = PreferenceManager.getDefaultSharedPreferences(this);
+        SharedPreferences aPref = PreferenceManager
+                .getDefaultSharedPreferences(this);
         boolean bEnableWifi = aPref.getBoolean("option_enablewifi", false);
         if (bEnableWifi)
             mNetworkFinder.startFinding();
@@ -174,6 +181,7 @@
     }
 
     public void disconnect() {
+        Log.d(Globals.TAG, "Service Disconnected");
         synchronized (mConnectionVariableMutex) {
             mStateDesired = State.DISCONNECTED;
             synchronized (this) {
@@ -204,14 +212,12 @@
 
     /**
      * Notify the UI that the service has connected to a server AND a slideshow
-     * is running.
-     * In this case the PresentationActivity should be started.
+     * is running. In this case the PresentationActivity should be started.
      */
     public static final String STATUS_CONNECTED_SLIDESHOW_RUNNING = "STATUS_CONNECTED_SLIDESHOW_RUNNING";
     /**
      * Notify the UI that the service has connected to a server AND no slideshow
-     * is running.
-     * In this case the StartPresentationActivity should be started.
+     * is running. In this case the StartPresentationActivity should be started.
      */
     public static final String STATUS_CONNECTED_NOSLIDESHOW = "STATUS_CONNECTED_NOSLIDESHOW";
 
@@ -283,14 +289,14 @@
 
     void loadServersFromPreferences() {
         SharedPreferences aPref = getSharedPreferences(SERVERSTORAGE_KEY,
-                        MODE_PRIVATE);
+                MODE_PRIVATE);
 
         @SuppressWarnings("unchecked")
-		Map<String, String> aStoredMap = (Map<String, String>) aPref.getAll();
+        Map<String, String> aStoredMap = (Map<String, String>) aPref.getAll();
 
         for (Entry<String, String> aServerEntry : aStoredMap.entrySet()) {
-            mManualServers.put(aServerEntry.getKey(), new Server(
-                            Protocol.NETWORK, aServerEntry.getKey(),
+            mManualServers.put(aServerEntry.getKey(),
+                    new Server(Protocol.NETWORK, aServerEntry.getKey(),
                             aServerEntry.getValue(), 0));
         }
     }
@@ -306,10 +312,10 @@
                 return;
         }
         mManualServers.put(aAddress, new Server(Protocol.NETWORK, aAddress,
-                        aName, 0));
+                aName, 0));
         if (aRemember) {
             SharedPreferences aPref = getSharedPreferences(SERVERSTORAGE_KEY,
-                            MODE_PRIVATE);
+                    MODE_PRIVATE);
             Editor aEditor = aPref.edit();
             aEditor.putString(aAddress, aName);
             aEditor.apply();
@@ -321,13 +327,17 @@
         mManualServers.remove(aServer.getAddress());
 
         SharedPreferences aPref = getSharedPreferences(SERVERSTORAGE_KEY,
-                        MODE_PRIVATE);
+                MODE_PRIVATE);
         Editor aEditor = aPref.edit();
         aEditor.remove(aServer.getAddress());
         aEditor.apply();
 
     }
 
+    public Client getClient() {
+        return mClient;
+    }
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
index 2e88a17..fbd51fa 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
@@ -31,73 +31,38 @@
     private static final int PORT = 1599;
 
     private Socket mSocket;
+    private Intent mIntent;
+    private String mPin;
+    private Server mServer;
 
     public NetworkClient(Server aServer,
-                    CommunicationService aCommunicationService,
-                    Receiver aReceiver) throws UnknownHostException,
-                    IOException {
+            CommunicationService aCommunicationService, Receiver aReceiver)
+            throws UnknownHostException, IOException {
         super(aServer, aCommunicationService, aReceiver);
-        mSocket = new Socket(aServer.getAddress(), PORT);
+        mServer = aServer;
+        mSocket = new Socket(mServer.getAddress(), PORT);
         mInputStream = mSocket.getInputStream();
         mReader = new BufferedReader(new InputStreamReader(mInputStream,
-                        CHARSET));
+                CHARSET));
         mOutputStream = mSocket.getOutputStream();
+
         // Pairing.
-        String aPin = setupPin(aServer);
-        Intent aIntent = new Intent(CommunicationService.MSG_PAIRING_STARTED);
-        aIntent.putExtra("PIN", aPin);
-        mPin = aPin;
+        mPin = setupPin(mServer);
+        mIntent = new Intent(CommunicationService.MSG_PAIRING_STARTED);
+        mIntent.putExtra("PIN", mPin);
         LocalBroadcastManager.getInstance(mCommunicationService).sendBroadcast(
-                        aIntent);
+                mIntent);
         // Send out
-        String aName = CommunicationService.getDeviceName(); // TODO: get the proper name
-        sendCommand("LO_SERVER_CLIENT_PAIR\n" + aName + "\n" + aPin + "\n\n");
-
-        // Wait until we get the appropriate string back...
-        String aTemp = mReader.readLine();
-
-        if (aTemp == null) {
-            throw new IOException(
-                            "End of stream reached before any data received.");
-        }
-
-        while (!aTemp.equals("LO_SERVER_SERVER_PAIRED")) {
-            if (aTemp.equals("LO_SERVER_VALIDATING_PIN")) {
-                // Broadcast that we need a pin screen.
-                aIntent = new Intent(
-                                CommunicationService.STATUS_PAIRING_PINVALIDATION);
-                aIntent.putExtra("PIN", aPin);
-                aIntent.putExtra("SERVERNAME", aServer.getName());
-                mPin = aPin;
-                LocalBroadcastManager.getInstance(mCommunicationService)
-                                .sendBroadcast(aIntent);
-                while (mReader.readLine().length() != 0) {
-                    // Read off empty lines
-                }
-                aTemp = mReader.readLine();
-            } else {
-                return;
-            }
-        }
-
-        aIntent = new Intent(CommunicationService.MSG_PAIRING_SUCCESSFUL);
-        LocalBroadcastManager.getInstance(mCommunicationService).sendBroadcast(
-                        aIntent);
-
-        while (mReader.readLine().length() != 0) {
-            // Get rid of extra lines
-            Log.i(Globals.TAG, "NetworkClient: extra line");
-        }
-        Log.i(Globals.TAG, "NetworkClient: calling startListening");
-        startListening();
-
+        String aName = CommunicationService.getDeviceName(); // TODO: get the
+                                                             // proper name
+        sendCommand("LO_SERVER_CLIENT_PAIR\n" + aName + "\n" + mPin + "\n\n");
     }
 
     private String setupPin(Server aServer) {
         // Get settings
         SharedPreferences aPreferences = mCommunicationService
-                        .getSharedPreferences("sdremote_authorisedremotes",
-                                        android.content.Context.MODE_PRIVATE);
+                .getSharedPreferences("sdremote_authorisedremotes",
+                        android.content.Context.MODE_PRIVATE);
         if (aPreferences.contains(aServer.getName())) {
             return aPreferences.getString(aServer.getName(), "");
         } else {
@@ -132,6 +97,46 @@
         }
     }
 
+    @Override
+    public void validating() throws IOException {
+
+        // Wait until we get the appropriate string back...
+        String aTemp = mReader.readLine();
+
+        if (aTemp == null) {
+            throw new IOException(
+                    "End of stream reached before any data received.");
+        }
+
+        while (!aTemp.equals("LO_SERVER_SERVER_PAIRED")) {
+            if (aTemp.equals("LO_SERVER_VALIDATING_PIN")) {
+                // Broadcast that we need a pin screen.
+                mIntent = new Intent(
+                        CommunicationService.STATUS_PAIRING_PINVALIDATION);
+                mIntent.putExtra("PIN", mPin);
+                mIntent.putExtra("SERVERNAME", mServer.getName());
+                LocalBroadcastManager.getInstance(mCommunicationService)
+                        .sendBroadcast(mIntent);
+                while (mReader.readLine().length() != 0) {
+                    // Read off empty lines
+                }
+                aTemp = mReader.readLine();
+            } else {
+                return;
+            }
+        }
+
+        mIntent = new Intent(CommunicationService.MSG_PAIRING_SUCCESSFUL);
+        LocalBroadcastManager.getInstance(mCommunicationService).sendBroadcast(
+                mIntent);
+
+        while (mReader.readLine().length() != 0) {
+            // Get rid of extra lines
+            Log.i(Globals.TAG, "NetworkClient: extra line");
+        }
+        Log.i(Globals.TAG, "NetworkClient: calling startListening");
+        startListening();
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
index 4ba252f..33a937f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
@@ -43,27 +43,26 @@
             int aCurrentSlide = Integer.parseInt(aCommand.get(2));
             mSlideShow.setLength(aSlideShowlength);
             mSlideShow.setCurrentSlide(aCurrentSlide);
-            //            Intent aIntent = new Intent(mContext.getApplicationContext(),
-            //                            PresentationActivity.class);
-            //            aIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            //            aIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
-            //            mContext.getApplicationContext().startActivity(aIntent);
+            // Intent aIntent = new Intent(mContext.getApplicationContext(),
+            // PresentationActivity.class);
+            // aIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            // aIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
+            // mContext.getApplicationContext().startActivity(aIntent);
             Intent aIntent = new Intent(
-                            CommunicationService.STATUS_CONNECTED_SLIDESHOW_RUNNING);
+                    CommunicationService.STATUS_CONNECTED_SLIDESHOW_RUNNING);
             LocalBroadcastManager.getInstance(mContext).sendBroadcast(aIntent);
-            aIntent = new Intent(
-                     CommunicationService.MSG_SLIDE_CHANGED);
+            aIntent = new Intent(CommunicationService.MSG_SLIDE_CHANGED);
             aIntent.putExtra("slide_number", aCurrentSlide);
             LocalBroadcastManager.getInstance(mContext).sendBroadcast(aIntent);
         } else if (aInstruction.equals("slideshow_finished")) {
             mSlideShow = new SlideShow(mContext);
-            //            Intent aIntent = new Intent(mContext.getApplicationContext(),
-            //                            StartPresentationActivity.class);
-            //            aIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            //            aIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
-            //            mContext.getApplicationContext().startActivity(aIntent);
+            // Intent aIntent = new Intent(mContext.getApplicationContext(),
+            // StartPresentationActivity.class);
+            // aIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            // aIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
+            // mContext.getApplicationContext().startActivity(aIntent);
             Intent aIntent = new Intent(
-                            CommunicationService.STATUS_CONNECTED_NOSLIDESHOW);
+                    CommunicationService.STATUS_CONNECTED_NOSLIDESHOW);
             LocalBroadcastManager.getInstance(mContext).sendBroadcast(aIntent);
         } else {
             if (mSlideShow == null)
@@ -76,10 +75,10 @@
                 mSlideShow.setCurrentSlide(aSlideNumber);
 
                 Intent aIntent = new Intent(
-                                CommunicationService.MSG_SLIDE_CHANGED);
+                        CommunicationService.MSG_SLIDE_CHANGED);
                 aIntent.putExtra("slide_number", aSlideNumber);
                 LocalBroadcastManager.getInstance(mContext).sendBroadcast(
-                                aIntent);
+                        aIntent);
             } else if (aInstruction.equals("slide_preview")) {
                 int aSlideNumber = Integer.parseInt(aCommand.get(1));
                 String aImageString = aCommand.get(2);
@@ -90,10 +89,10 @@
                     mSlideShow.putImage(aSlideNumber, aImage);
 
                     Intent aIntent = new Intent(
-                        CommunicationService.MSG_SLIDE_PREVIEW);
+                            CommunicationService.MSG_SLIDE_PREVIEW);
                     aIntent.putExtra("slide_number", aSlideNumber);
                     LocalBroadcastManager.getInstance(mContext).sendBroadcast(
-                        aIntent);
+                            aIntent);
                 } catch (IllegalArgumentException e) {
                     // Bad data - tough luck
                 }
@@ -108,10 +107,10 @@
                 mSlideShow.putNotes(aSlideNumber, aNotes.toString());
 
                 Intent aIntent = new Intent(
-                                CommunicationService.MSG_SLIDE_NOTES);
+                        CommunicationService.MSG_SLIDE_NOTES);
                 aIntent.putExtra("slide_number", aSlideNumber);
                 LocalBroadcastManager.getInstance(mContext).sendBroadcast(
-                                aIntent);
+                        aIntent);
             }
 
         }
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ReconnectionActivity.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ReconnectionActivity.java
index 8417cde..8622737 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/ReconnectionActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ReconnectionActivity.java
@@ -8,18 +8,99 @@
  */
 package org.libreoffice.impressremote.communication;
 
+import org.libreoffice.impressremote.ActivityChangeBroadcastProcessor;
 import org.libreoffice.impressremote.R;
+import org.libreoffice.impressremote.SelectorActivity;
 
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
 import android.os.Bundle;
+import android.os.IBinder;
+import android.support.v4.content.LocalBroadcastManager;
 
 import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.MenuItem;
 
 public class ReconnectionActivity extends SherlockActivity {
+
+    private ActivityChangeBroadcastProcessor mBroadcastProcessor;
+    private CommunicationService mCommunicationService;
+
+    // private TextView mCountDownTextView;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_reconnect);
+        // mCountDownTextView = (TextView) findViewById(R.id.countDownTV);
+
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+        bindService(new Intent(this, CommunicationService.class), mConnection,
+                Context.BIND_IMPORTANT);
+
+        final Server desiredServer = getIntent().getParcelableExtra("server");
+
+        IntentFilter aFilter = new IntentFilter();
+
+        mBroadcastProcessor = new ActivityChangeBroadcastProcessor(this);
+        mBroadcastProcessor.addToFilter(aFilter);
+
+        LocalBroadcastManager.getInstance(this).registerReceiver(mListener,
+                aFilter);
+
+        getSupportActionBar().setTitle(desiredServer.getName());
+
+        // TODO Connection to desired server
+        // Create a countdown clock for 10 seconds, then double the delay
+        // with every failure. Until it reaches 1min. Like Gmail retry
+
+    }
+
+    private BroadcastReceiver mListener = new BroadcastReceiver() {
+
+        @Override
+        public void onReceive(Context aContext, Intent aIntent) {
+            mBroadcastProcessor.onReceive(aContext, aIntent);
+        }
+    };
+
+    private ServiceConnection mConnection = new ServiceConnection() {
+
+        @Override
+        public void onServiceConnected(ComponentName aClassName,
+                IBinder aService) {
+            mCommunicationService = ((CommunicationService.CBinder) aService)
+                    .getService();
+
+        }
+
+        @Override
+        public void onServiceDisconnected(ComponentName aClassName) {
+            mCommunicationService = null;
+        }
+    };
+
+    @Override
+    public void onBackPressed() {
+        Intent aIntent = new Intent(this, SelectorActivity.class);
+        aIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        startActivity(aIntent);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+
+        switch (item.getItemId()) {
+        case android.R.id.home:
+            onBackPressed();
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
     }
 
 }
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
index 77e6eb3..6fed0ed 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
@@ -8,7 +8,10 @@
  */
 package org.libreoffice.impressremote.communication;
 
-public class Server {
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class Server implements Parcelable {
 
     public enum Protocol {
         NETWORK, BLUETOOTH
@@ -25,7 +28,7 @@
     protected boolean mNoTimeout = false;
 
     protected Server(Protocol aProtocol, String aAddress, String aName,
-                    long aTimeDiscovered) {
+            long aTimeDiscovered) {
         mProtocol = aProtocol;
         mAddress = aAddress;
         mName = aName;
@@ -42,7 +45,6 @@
 
     /**
      * Get a human friendly name for the server.
-     *
      * @return The name.
      */
     public String getName() {
@@ -54,7 +56,38 @@
     }
 
     public String toString() {
-        return getClass().getName() + '@' + Integer.toHexString(hashCode()) + ":{" + mAddress + "," + mName + "}";
+        return getClass().getName() + '@' + Integer.toHexString(hashCode())
+                + ":{" + mAddress + "," + mName + "}";
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeString(mAddress);
+        out.writeString(mName);
+        out.writeString(mProtocol.name());
+        out.writeLong(mTimeDiscovered);
+    }
+
+    public static final Parcelable.Creator<Server> CREATOR = new Parcelable.Creator<Server>() {
+        public Server createFromParcel(Parcel in) {
+            return new Server(in);
+        }
+
+        public Server[] newArray(int size) {
+            return new Server[size];
+        }
+    };
+
+    private Server(Parcel in) {
+        mAddress = in.readString();
+        mName = in.readString();
+        mProtocol = Protocol.valueOf(in.readString());
+        mTimeDiscovered = in.readLong();
     }
 }
 
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
index f1726ad..01be02a 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
@@ -69,7 +69,7 @@
             for (int j = i + 1; j < aBuffer.length; j++) {
                 if (aPacket.getData()[j] == '\n') {
                     aName = new String(aPacket.getData(), i + 1, j - (i + 1),
-                                    CHARSET);
+                            CHARSET);
                     break;
                 }
             }
@@ -77,10 +77,11 @@
                 return;
             }
             Server aServer = new Server(Server.Protocol.NETWORK, aPacket
-                            .getAddress().getHostAddress(), aName,
-                            System.currentTimeMillis());
+                    .getAddress().getHostAddress(), aName,
+                    System.currentTimeMillis());
             mServerList.put(aServer.getAddress(), aServer);
-            Log.i(Globals.TAG, "ServerFinder.listenForServer: contains " + aName);
+            Log.i(Globals.TAG, "ServerFinder.listenForServer: contains "
+                    + aName);
 
             notifyActivity();
         } catch (java.net.SocketTimeoutException e) {
@@ -110,18 +111,20 @@
                             if (System.currentTimeMillis() - aTime > SEARCH_INTERVAL) {
                                 String aString = "LOREMOTE_SEARCH\n";
                                 DatagramPacket aPacket = new DatagramPacket(
-                                                aString.getBytes(CHARSET),
-                                                aString.length(),
-                                                InetAddress.getByName(GROUPADDRESS),
-                                                PORT);
+                                        aString.getBytes(CHARSET),
+                                        aString.length(),
+                                        InetAddress.getByName(GROUPADDRESS),
+                                        PORT);
                                 mSocket.send(aPacket);
                                 aTime = System.currentTimeMillis();
                                 // Remove stale servers
                                 for (Server aServer : mServerList.values()) {
                                     if (!aServer.mNoTimeout
-                                                    && System.currentTimeMillis()
-                                                                    - aServer.getTimeDiscovered() > 60 * 1000) {
-                                        mServerList.remove(aServer.getAddress());
+                                            && System.currentTimeMillis()
+                                                    - aServer
+                                                            .getTimeDiscovered() > 60 * 1000) {
+                                        mServerList
+                                                .remove(aServer.getAddress());
                                         notifyActivity();
 
                                     }
@@ -157,15 +160,16 @@
 
     /**
      * Check whether we are on an emulator and add it's host to the list of
-     * servers if so (although we do not know whether libo is running on
-     * the host).
+     * servers if so (although we do not know whether libo is running on the
+     * host).
      */
     private void checkAndAddEmulator() {
         try {
             if (InetAddress.getByName("10.0.2.2").isReachable(100)) {
-                Log.i(Globals.TAG, "ServerFinder.checkAndAddEmulator: NulledNot, whatever that is supposed to mean");
+                Log.i(Globals.TAG,
+                        "ServerFinder.checkAndAddEmulator: NulledNot, whatever that is supposed to mean");
                 Server aServer = new Server(Protocol.NETWORK, "10.0.2.2",
-                                "Android Emulator Host", 0);
+                        "Android Emulator Host", 0);
                 aServer.mNoTimeout = true;
                 mServerList.put(aServer.getAddress(), aServer);
                 notifyActivity();
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
index 8b7a8e1..0ad0494 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
@@ -19,7 +19,6 @@
 import android.graphics.RectF;
 import android.util.SparseArray;
 
-
 public class SlideShow {
 
     private SparseArray<Bitmap> mPreviews = new SparseArray<Bitmap>();
@@ -50,18 +49,17 @@
     }
 
     protected void putImage(int aSlide, byte[] aImage) {
-        Bitmap aBitmap = BitmapFactory.decodeByteArray(aImage, 0, aImage.length);
+        Bitmap aBitmap = BitmapFactory
+                .decodeByteArray(aImage, 0, aImage.length);
         final int borderWidth = 8;
 
         Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
         p.setShadowLayer(borderWidth, 0, 0, Color.BLACK);
 
         RectF aRect = new RectF(borderWidth, borderWidth, borderWidth
-                        + aBitmap.getWidth(), borderWidth
-                        + aBitmap.getHeight());
-        Bitmap aOut = Bitmap.createBitmap(aBitmap.getWidth() + 2
-                        * borderWidth, aBitmap.getHeight() + 2
-                        * borderWidth, aBitmap.getConfig());
+                + aBitmap.getWidth(), borderWidth + aBitmap.getHeight());
+        Bitmap aOut = Bitmap.createBitmap(aBitmap.getWidth() + 2 * borderWidth,
+                aBitmap.getHeight() + 2 * borderWidth, aBitmap.getConfig());
         Canvas canvas = new Canvas(aOut);
         canvas.drawColor(mContext.getResources().getColor(R.color.light_grey));
         canvas.drawRect(aRect, p);
@@ -97,7 +95,6 @@
     public class Timer {
         /**
          * This stores the starting time of the timer if running.
-         *
          * If paused this stores how long the timer was previously running.
          */
         private long aTime = 0;
@@ -111,7 +108,7 @@
         /**
          * Set whether this timer should be a normal or a countdown timer.
          * @param aIsCountdown
-         *     Whether this should be a countdown timer.
+         *            Whether this should be a countdown timer.
          */
         public void setCountdown(boolean aIsCountdown) {
             mIsCountdown = aIsCountdown;
@@ -122,10 +119,10 @@
         }
 
         /**
-         * Set the countdown time. Can be set, and isn't lost, whatever mode
-         * the timer is running in.
+         * Set the countdown time. Can be set, and isn't lost, whatever mode the
+         * timer is running in.
          * @param aCountdownTime
-         *      The countdown time.
+         *            The countdown time.
          */
         public void setCountdownTime(long aCountdownTime) {
             mCountdownTime = aCountdownTime;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
index eebc2f3..4eb71f9 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
@@ -15,56 +15,55 @@
  */
 public class Transmitter {
 
-	private Client mClient;
+    private Client mClient;
 
-	public Transmitter(Client aClient) {
-		mClient = aClient;
-	}
+    public Transmitter(Client aClient) {
+        mClient = aClient;
+    }
 
-	public void nextTransition() {
-		mClient.sendCommand("transition_next\n\n");
-	}
+    public void nextTransition() {
+        mClient.sendCommand("transition_next\n\n");
+    }
 
-	public void previousTransition() {
+    public void previousTransition() {
 
-		mClient.sendCommand("transition_previous\n\n");
-	}
+        mClient.sendCommand("transition_previous\n\n");
+    }
 
-	public void gotoSlide(int slide) {
-		mClient.sendCommand("goto_slide\n" + slide + "\n\n");
-	}
+    public void gotoSlide(int slide) {
+        mClient.sendCommand("goto_slide\n" + slide + "\n\n");
+    }
 
-	/**
-	 * Blank the screen to the default colour (set server-side), which is
-	 * generally black. This is slightly faster than using
-	 * <code> blankScreen( colour ) </code>.
-	 */
-	public void blankScreen() {
-		mClient.sendCommand("presentation_blank_screen\n\n");
-	}
+    /**
+     * Blank the screen to the default colour (set server-side), which is
+     * generally black. This is slightly faster than using
+     * <code> blankScreen( colour ) </code>.
+     */
+    public void blankScreen() {
+        mClient.sendCommand("presentation_blank_screen\n\n");
+    }
 
-	/**
-	 * Set the screen to a specific colour. Only use if a non default colour is
-	 * needed.
-	 *
-	 * @param aColor
-	 */
-	public void blankScreen(Color aColor) {
-		// FIXME: check how to get colour in integer form.
-		mClient.sendCommand("presentation_blank_screen\n" + aColor + "\n\n");
-	}
+    /**
+     * Set the screen to a specific colour. Only use if a non default colour is
+     * needed.
+     * @param aColor
+     */
+    public void blankScreen(Color aColor) {
+        // FIXME: check how to get colour in integer form.
+        mClient.sendCommand("presentation_blank_screen\n" + aColor + "\n\n");
+    }
 
-	public void resume() {
-		mClient.sendCommand("presentation_resume\n\n");
-	}
+    public void resume() {
+        mClient.sendCommand("presentation_resume\n\n");
+    }
 
-	public void startPresentation() {
-		mClient.sendCommand("presentation_start\n\n");
-	}
+    public void startPresentation() {
+        mClient.sendCommand("presentation_start\n\n");
+    }
 
-	public void stopPresentation() {
-		mClient.sendCommand("presentation_stop\n\n");
-	}
+    public void stopPresentation() {
+        mClient.sendCommand("presentation_stop\n\n");
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

-- 
To view, visit https://gerrit.libreoffice.org/3364
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a97b0ae8e3d3e1a900f6a4ee1d23f3a0ce86681
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Siqi LIU <me at siqi.fr>



More information about the LibreOffice mailing list