[Libreoffice-commits] .: Branch 'feature/remote' - 9 commits - android/sdremote sd/source

Andrzej J.R. Hunt ajrhunt at kemper.freedesktop.org
Thu Jul 26 09:55:20 PDT 2012


 android/sdremote/res/drawable/actionbar_icon_overflow.png                      |binary
 android/sdremote/res/drawable/actionbar_icon_thumbs.png                        |binary
 android/sdremote/res/drawable/actionbar_thumbs.xml                             |    2 
 android/sdremote/res/drawable/clockbar_clock.xml                               |   11 
 android/sdremote/res/drawable/clockbar_countdown.xml                           |   11 
 android/sdremote/res/drawable/clockbar_icon_clock.png                          |binary
 android/sdremote/res/drawable/clockbar_icon_countdown.png                      |binary
 android/sdremote/res/drawable/clockbar_icon_stopwatch.png                      |binary
 android/sdremote/res/drawable/clockbar_stopwatch.xml                           |   11 
 android/sdremote/res/layout/idlayout.xml                                       |    9 
 android/sdremote/res/layout/presentation_clockbar.xml                          |   18 
 android/sdremote/res/layout/presentation_clockbar_countdownbar.xml             |   29 +
 android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml             |   28 
 android/sdremote/res/menu/actionbar_presentation.xml                           |    2 
 android/sdremote/res/values/strings.xml                                        |    9 
 android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java   |  286 ++++++++--
 android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java   |   37 -
 android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java |    2 
 dev/null                                                                       |binary
 sd/source/ui/remotecontrol/Listener.cxx                                        |   14 
 sd/source/ui/remotecontrol/Receiver.cxx                                        |    5 
 sd/source/ui/remotecontrol/Server.cxx                                          |    4 
 22 files changed, 403 insertions(+), 75 deletions(-)

New commits:
commit b2c6170e0f02f61f177b891d7b8cfe09a4cf99d0
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Jul 26 18:52:11 2012 +0200

    Added automatic hiding of clockbar as necessary.
    
    Change-Id: Id758f8e3f73e9d7d180e09b606ee44cbe5c48d6c

diff --git a/android/sdremote/res/layout/idlayout.xml b/android/sdremote/res/layout/idlayout.xml
new file mode 100644
index 0000000..6288cbb
--- /dev/null
+++ b/android/sdremote/res/layout/idlayout.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:id="@+id/presentation_innerFrame">
+
+
+</LinearLayout>
\ No newline at end of file
diff --git a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
index fb3a648..cc75341 100644
--- a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
@@ -23,6 +23,7 @@
         android:layout_height="wrap_content"
         android:layout_weight="1"
         android:text="@string/clock_timer_start"
-        android:textColor="#FFFFFF" />
+        android:textColor="#FFFFFF"
+        android:background="#00000000" />
 
 </LinearLayout>
\ No newline at end of file
diff --git a/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml b/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
index d3f5021..5459bec 100644
--- a/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
@@ -12,13 +12,17 @@
         android:layout_width="0dip"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:text="@string/clock_timer_start" />
+        android:background="#00000000"
+        android:text="@string/clock_timer_start"
+        android:textColor="#FFFFFF" />
 
     <Button
         android:id="@+id/clockbar_stopwatch_reset"
         android:layout_width="0dip"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:text="@string/clock_timer_reset" />
+        android:background="#00000000"
+        android:text="@string/clock_timer_reset"
+        android:textColor="#FFFFFF" />
 
 </LinearLayout>
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index b9c2091..fb24076 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -25,6 +25,7 @@ import android.text.format.DateFormat;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.Menu;
+import android.view.MotionEvent;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
@@ -37,6 +38,7 @@ public class PresentationActivity extends Activity {
 	private CommunicationService mCommunicationService;
 	private boolean mIsBound = false;
 	private FrameLayout mLayout;
+	private FrameLayout mOuterLayout;
 	private ThumbnailFragment mThumbnailFragment;
 	private PresentationFragment mPresentationFragment;
 	private ActionBarManager mActionBarManager;
@@ -50,15 +52,19 @@ public class PresentationActivity extends Activity {
 		mIsBound = true;
 
 		setContentView(R.layout.activity_presentation);
-		mLayout = (FrameLayout) findViewById(R.id.framelayout);
+		mOuterLayout = (FrameLayout) findViewById(R.id.framelayout);
+		mLayout = new InterceptorLayout(this);
+		mOuterLayout.addView(mLayout);
+		mLayout.setId(R.id.presentation_innerFrame);
+		//		((FrameLayout) findViewById(R.id.framelayout)).addView(mLayout);
 		mThumbnailFragment = new ThumbnailFragment();
 		mPresentationFragment = new PresentationFragment();
 
 		FragmentManager fragmentManager = getFragmentManager();
 		FragmentTransaction fragmentTransaction = fragmentManager
 		                .beginTransaction();
-		fragmentTransaction.add(R.id.framelayout, mPresentationFragment,
-		                "fragment_presentation");
+		fragmentTransaction.add(R.id.presentation_innerFrame,
+		                mPresentationFragment, "fragment_presentation");
 		fragmentTransaction.commit();
 	}
 
@@ -155,12 +161,20 @@ public class PresentationActivity extends Activity {
 
 		}
 
+		public void hidePopups() {
+			if (mClockBar.getVisibility() == View.VISIBLE) {
+				mClockBar.setVisibility(View.INVISIBLE);
+				mStopwatchBar.setVisibility(View.INVISIBLE);
+				mCountdownBar.setVisibility(View.INVISIBLE);
+				mTimeLabel.setChecked(false);
+			}
+		}
+
 		private void setupClockBar() {
 			// ClockBar
 			LayoutInflater aInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-			aInflater.inflate(R.layout.presentation_clockbar, mLayout);
-			mClockBar = mLayout.findViewById(R.id.clockbar);
-			mClockBar.setVisibility(View.INVISIBLE);
+			aInflater.inflate(R.layout.presentation_clockbar, mOuterLayout);
+			mClockBar = mOuterLayout.findViewById(R.id.clockbar);
 
 			mClockBar_clockButton = (ToggleButton) mClockBar
 			                .findViewById(R.id.clockbar_toggle_clockmode);
@@ -174,9 +188,9 @@ public class PresentationActivity extends Activity {
 
 			// Stopwatch bar
 			aInflater.inflate(R.layout.presentation_clockbar_stopwatchbar,
-			                mLayout);
-			mStopwatchBar = mLayout.findViewById(R.id.clockbar_stopwatchbar);
-			mStopwatchBar.setVisibility(View.INVISIBLE);
+			                mOuterLayout);
+			mStopwatchBar = mOuterLayout
+			                .findViewById(R.id.clockbar_stopwatchbar);
 
 			mStopwatchButtonRun = (Button) mStopwatchBar
 			                .findViewById(R.id.clockbar_stopwatch_run);
@@ -187,9 +201,9 @@ public class PresentationActivity extends Activity {
 
 			// Countdown bar
 			aInflater.inflate(R.layout.presentation_clockbar_countdownbar,
-			                mLayout);
-			mCountdownBar = mLayout.findViewById(R.id.clockbar_countdownbar);
-			mCountdownBar.setVisibility(View.INVISIBLE);
+			                mOuterLayout);
+			mCountdownBar = mOuterLayout
+			                .findViewById(R.id.clockbar_countdownbar);
 
 			mCountdownEntry = (EditText) mCountdownBar
 			                .findViewById(R.id.clockbar_countdown_time);
@@ -199,6 +213,7 @@ public class PresentationActivity extends Activity {
 			mCountdownEntry.setOnEditorActionListener(this);
 
 			updateClockBar();
+			hidePopups();
 
 		}
 
@@ -215,6 +230,7 @@ public class PresentationActivity extends Activity {
 			mClockBar_stopwatchButton.setChecked(aStopwatchMode);
 			mStopwatchBar.setVisibility(aStopwatchMode ? View.VISIBLE
 			                : View.INVISIBLE);
+			mStopwatchBar.bringToFront();
 			if (aStopwatchMode) {
 				Timer aTimer = mCommunicationService.getSlideShow().getTimer();
 				if (aTimer.isRunning()) {
@@ -231,6 +247,7 @@ public class PresentationActivity extends Activity {
 			mClockBar_countdownButton.setChecked(mTimerOn && aIsCountdown);
 			mCountdownBar.setVisibility(mTimerOn && aIsCountdown ? View.VISIBLE
 			                : View.INVISIBLE);
+			mCountdownBar.bringToFront();
 			if (aCountdownMode) {
 				Timer aTimer = mCommunicationService.getSlideShow().getTimer();
 				if (aTimer.isRunning()) {
@@ -274,7 +291,7 @@ public class PresentationActivity extends Activity {
 				if (!mThumbnailFragment.isVisible()) {
 					FragmentTransaction ft = getFragmentManager()
 					                .beginTransaction();
-					ft.replace(R.id.framelayout, mThumbnailFragment);
+					ft.replace(R.id.presentation_innerFrame, mThumbnailFragment);
 					ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
 					ft.addToBackStack(null);
 					ft.commit();
@@ -282,11 +299,11 @@ public class PresentationActivity extends Activity {
 					getFragmentManager().popBackStack();
 				}
 			} else if (aSource == mTimeLabel) {
-
 				if (mClockBar.getVisibility() == View.VISIBLE) {
-					mClockBar.setVisibility(View.INVISIBLE);
+					hidePopups();
 				} else {
 					mClockBar.setVisibility(View.VISIBLE);
+					updateClockBar();
 					mClockBar.bringToFront();
 				}
 			}
@@ -373,4 +390,28 @@ public class PresentationActivity extends Activity {
 		}
 	}
 
+	/**
+	 * Intermediate layout that catches all touches, used in order to hide
+	 * the clock menu as appropriate.
+	 * @author andy
+	 *
+	 */
+	private class InterceptorLayout extends FrameLayout {
+
+		public InterceptorLayout(Context context) {
+			super(context);
+		}
+
+		@Override
+		public boolean onInterceptTouchEvent(MotionEvent aEvent) {
+			mActionBarManager.hidePopups();
+			return super.onInterceptTouchEvent(aEvent);
+		}
+
+		@Override
+		public boolean onTouchEvent(MotionEvent aEvent) {
+			return super.onTouchEvent(aEvent);
+		}
+
+	}
 }
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 7d9f36a..cf45e09 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -90,6 +90,11 @@ public class PresentationFragment extends Fragment {
 		return v;
 	}
 
+	private void updateSlideNumberDisplay() {
+		mNumberText.setText((mSlideShow.getCurrentSlide() + 1) + "/"
+		                + mSlideShow.getSize());
+	}
+
 	// -------------------------------------------------- RESIZING LISTENER ----
 	private class SizeListener implements OnTouchListener {
 
@@ -182,6 +187,7 @@ public class PresentationFragment extends Fragment {
 			mTopView.setOnItemSelectedListener(new ClickListener());
 		}
 
+		updateSlideNumberDisplay();
 	}
 
 	public void handleMessage(Message aMessage) {
@@ -190,10 +196,7 @@ public class PresentationFragment extends Fragment {
 		case CommunicationService.MSG_SLIDE_CHANGED:
 			int aSlide = aData.getInt("slide_number");
 			mTopView.setSelection(aSlide, true);
-
-			mNumberText.setText((mSlideShow.getCurrentSlide() + 1) + "/"
-			                + mSlideShow.getSize());
-
+			updateSlideNumberDisplay();
 			break;
 		case CommunicationService.MSG_SLIDE_PREVIEW:
 			int aNSlide = aData.getInt("slide_number");
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
index 6fd3623..6a0496f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
@@ -37,7 +37,9 @@ public class Receiver {
 		String aInstruction = aCommand.get(0);
 		if (aInstruction.equals("slideshow_started")) {
 			int aSlideShowlength = Integer.parseInt(aCommand.get(1));
+			int aCurrentSlide = Integer.parseInt(aCommand.get(2));
 			mSlideShow = new SlideShow(aSlideShowlength);
+			mSlideShow.setCurrentSlide(aCurrentSlide);
 
 			Message aMessage = Message.obtain(null,
 			                CommunicationService.MSG_SLIDESHOW_STARTED);
diff --git a/sd/source/ui/remotecontrol/Listener.cxx b/sd/source/ui/remotecontrol/Listener.cxx
index 3619905..2aac478 100644
--- a/sd/source/ui/remotecontrol/Listener.cxx
+++ b/sd/source/ui/remotecontrol/Listener.cxx
@@ -29,29 +29,25 @@ Listener::Listener( const ::rtl::Reference<Server>& rServer, sd::Transmitter *aT
       mPreparer()
 {
     pTransmitter = aTransmitter;
-    fprintf( stderr, "Listener created %p\n", this );
 }
 
 Listener::~Listener()
 {
-    fprintf( stderr, "Listener destroyed %p\n", this );
 }
 
 void Listener::init( const css::uno::Reference< css::presentation::XSlideShowController >& aController)
 {
-    fprintf( stderr, "Initing\n" );
     if ( aController.is() )
     {
-        fprintf( stderr, "Is -- now copying refrerence.\n" );
         mController = css::uno::Reference< css::presentation::XSlideShowController >( aController );
-        fprintf( stderr, "Registering listener\n" );
         aController->addSlideShowListener( this );
-        fprintf( stderr, "Registered listener.\n" );
 
         sal_Int32 aSlides = aController->getSlideCount();
+	sal_Int32 aCurrentSlide = aController->getCurrentSlideIndex();
         OStringBuffer aBuffer;
         aBuffer.append( "slideshow_started\n" )
-               .append( OString::valueOf( aSlides ) ).append( "\n\n" );
+               .append( OString::valueOf( aSlides ) ).append("\n")
+	       .append( OString::valueOf( aCurrentSlide ) ).append( "\n\n" );
 
         pTransmitter->addMessage( aBuffer.makeStringAndClear(),
                                   Transmitter::Priority::HIGH );
@@ -61,7 +57,6 @@ void Listener::init( const css::uno::Reference< css::presentation::XSlideShowCon
     }
     else
     {
-        fprintf( stderr, "Couldn't register listener -- aController isn't\n" );
     }
 }
 
@@ -114,7 +109,6 @@ void SAL_CALL Listener::hyperLinkClicked (const rtl::OUString &)
 void SAL_CALL Listener::slideTransitionStarted (void)
     throw (css::uno::RuntimeException)
 {
-    fprintf( stderr, "slideTransitionStarted\n" );
     sal_Int32 aSlide = mController->getCurrentSlideIndex();
 
     OStringBuffer aBuilder( "slide_updated\n" );
@@ -140,7 +134,6 @@ void SAL_CALL Listener::slideAnimationsEnded (void)
 
 void SAL_CALL Listener::disposing (void)
 {
-    fprintf( stderr, "disposing void\n" );
     if ( mPreparer.is() )
     {
         delete mPreparer.get();
@@ -160,7 +153,6 @@ void SAL_CALL Listener::disposing (
     const css::lang::EventObject& rEvent)
     throw (::com::sun::star::uno::RuntimeException)
 {
-    fprintf( stderr, "disposing with Events\n" );
     (void) rEvent;
     dispose();
 }
diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx
index 654664a..d7c97bb 100644
--- a/sd/source/ui/remotecontrol/Receiver.cxx
+++ b/sd/source/ui/remotecontrol/Receiver.cxx
@@ -75,8 +75,11 @@ void Receiver::parseCommand( std::vector<OString> aCommand )
     {
         // FIXME: if 0 returned, then not a valid number
         sal_Int32 aSlide = aCommand[1].toInt32();
-        if ( xSlideShowController.is() )
+        if ( xSlideShowController.is() &&
+            xSlideShowController->getCurrentSlideIndex() != aSlide )
+        {
             xSlideShowController->gotoSlideIndex( aSlide );
+        }
     }
     else if ( aCommand[0].equals( "presentation_start" ) )
     {
diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx
index 700e561..2f67d17 100644
--- a/sd/source/ui/remotecontrol/Server.cxx
+++ b/sd/source/ui/remotecontrol/Server.cxx
@@ -40,7 +40,6 @@ void Server::listenThread()
     pTransmitter->launch();
     Receiver aReceiver( pTransmitter );
     try {
-        fprintf( stderr, "Trying to add a Listener in listenThread\n" );
         uno::Reference< lang::XMultiServiceFactory > xServiceManager(
             ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
         uno::Reference< frame::XFramesSupplier > xFramesSupplier( xServiceManager->createInstance(
@@ -52,9 +51,7 @@ void Server::listenThread()
         if ( xPresentation->isRunning() )
         {
             presentationStarted( xPresentation->getController() );
-            fprintf( stderr, "Added the listener\n");
         }
-        fprintf( stderr, "We aren't running\n" );
     }
     catch ( com::sun::star::uno::RuntimeException &e )
     {
@@ -93,7 +90,6 @@ void Server::listenThread()
         }
     }
     // TODO: deal with transmision errors gracefully.
-    fprintf( stderr, "done with transmitting\n" );
     presentationStopped();
 
     delete pTransmitter;
commit f682e70d56b5186efa282fea2efd34c39874e00c
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Jul 26 16:24:40 2012 +0200

    Some cleanup on Presentation Fragment.
    
    Change-Id: I I705b84c339303a77d4920cd601d4192ca9c23ea5

diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 6bf3a0e..b9c2091 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -7,6 +7,7 @@ import java.util.TimeZone;
 import org.libreoffice.impressremote.communication.CommunicationService;
 import org.libreoffice.impressremote.communication.SlideShow.Timer;
 
+import android.annotation.SuppressLint;
 import android.app.ActionBar;
 import android.app.Activity;
 import android.app.FragmentManager;
@@ -43,26 +44,22 @@ public class PresentationActivity extends Activity {
 	@Override
 	public void onCreate(Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_presentation);
 
 		bindService(new Intent(this, CommunicationService.class), mConnection,
 		                Context.BIND_IMPORTANT);
+		mIsBound = true;
 
-		FragmentManager fragmentManager = getFragmentManager();
-		FragmentTransaction fragmentTransaction = fragmentManager
-		                .beginTransaction();
+		setContentView(R.layout.activity_presentation);
+		mLayout = (FrameLayout) findViewById(R.id.framelayout);
 		mThumbnailFragment = new ThumbnailFragment();
 		mPresentationFragment = new PresentationFragment();
 
-		// fragmentTransaction.add(R.id.framelayout, mThumbnailFragment,
-		// "fragment_thumbnail");
+		FragmentManager fragmentManager = getFragmentManager();
+		FragmentTransaction fragmentTransaction = fragmentManager
+		                .beginTransaction();
 		fragmentTransaction.add(R.id.framelayout, mPresentationFragment,
 		                "fragment_presentation");
 		fragmentTransaction.commit();
-
-		mLayout = (FrameLayout) findViewById(R.id.framelayout);
-
-		mIsBound = true;
 	}
 
 	@Override
@@ -94,22 +91,12 @@ public class PresentationActivity extends Activity {
 
 	final Messenger mMessenger = new Messenger(new MessageHandler());
 
+	@SuppressLint("HandlerLeak")
 	protected class MessageHandler extends Handler {
 		@Override
 		public void handleMessage(Message aMessage) {
 			mPresentationFragment.handleMessage(aMessage);
 			mThumbnailFragment.handleMessage(aMessage);
-			// Bundle aData = aMessage.getData();
-			// TODO: pass to fragments
-			// switch (aMessage.what) {
-			// case CommunicationService.MSG_SLIDE_CHANGED:
-			// int aSlide = aData.getInt("slide_number");
-			// break;
-			// case CommunicationService.MSG_SLIDE_PREVIEW:
-			// // int aNSlide = aData.getInt("slide_number");
-			// break;
-			//
-			// }
 		}
 	}
 
@@ -149,13 +136,8 @@ public class PresentationActivity extends Activity {
 		public ActionBarManager() {
 
 			ActionBar aBar = getActionBar();
-			// Set custom view and unset the title.
-			aBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
-			                ActionBar.DISPLAY_SHOW_CUSTOM
-			                                | ActionBar.DISPLAY_SHOW_TITLE);
 			aBar.setCustomView(R.layout.presentation_actionbar);
 
-			// Set up the various components
 			mThumbnailButton = (ToggleButton) aBar.getCustomView()
 			                .findViewById(R.id.actionbar_thumbnailtoggle);
 			mThumbnailButton.setOnClickListener(this);
@@ -166,10 +148,8 @@ public class PresentationActivity extends Activity {
 
 			setupClockBar();
 
-			// Listen for fragment changes
 			getFragmentManager().addOnBackStackChangedListener(this);
 
-			// Setup the auto updater
 			timerHandler.removeCallbacks(timerUpdateThread);
 			timerHandler.postDelayed(timerUpdateThread, 50);
 
@@ -385,7 +365,6 @@ public class PresentationActivity extends Activity {
 					} catch (ParseException e) {
 					}
 				}
-				System.out.println("atime=" + aTime);
 				mCommunicationService.getSlideShow().getTimer()
 				                .setCountdownTime(aTime);
 				return true;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 1793696..7d9f36a 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -112,7 +112,6 @@ public class PresentationFragment extends Fragment {
 
 				// Calculate height change, taking limits into account
 				int aDiff = (int) (aEvent.getY());
-				System.out.println("Diff1 is :" + aDiff);
 				if (aDiff + aHeight < DRAG_MARGIN) {
 					aDiff = DRAG_MARGIN - aHeight;
 				} else if ((aHeight + aDiff) > (aViewSize - DRAG_MARGIN)) {
@@ -125,7 +124,6 @@ public class PresentationFragment extends Fragment {
 
 				double aRatio = mOriginalCoverflowWidth
 				                / mOriginalCoverflowHeight;
-				System.out.println("Diff2 is :" + aDiff);
 				float aHeightNew = mTopView.getImageHeight() + aDiff;
 				float aWidthNew = (float) (aRatio * aHeightNew);
 
@@ -136,12 +134,6 @@ public class PresentationFragment extends Fragment {
 					aDiff = (int) (aHeightNew - mTopView.getImageHeight());
 				}
 
-				// Set the new settings -- it turns out that changing the
-				// internal height now works, and changing the views height
-				// is unnecessary / even causes problems.
-				//				aParams.height += aDiff;
-				//				mTopView.setLayoutParams(aParams);
-
 				mNewCoverflowHeight = aHeightNew;
 				mNewCoverflowWidth = aWidthNew;
 
@@ -150,7 +142,7 @@ public class PresentationFragment extends Fragment {
 				aAdapter.setWidth(aWidthNew);
 				mTopView.setImageWidth(aWidthNew);
 
-				// We need to update the view now
+				// Force an update of the view
 				aAdapter.notifyDataSetChanged();
 
 				break;
commit 8858a75fed44d2b4e6d3a1034c49ecd64669db4b
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Jul 26 16:11:51 2012 +0200

    Coverflow resize saved when fragment hidden.
    
    Change-Id: I892d309b824ad607b073d44e9c864bc3f910c119

diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index ed6e86f..1793696 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -41,6 +41,9 @@ public class PresentationFragment extends Fragment {
 	private float mOriginalCoverflowWidth;
 	private float mOriginalCoverflowHeight;
 
+	private float mNewCoverflowWidth = 0;
+	private float mNewCoverflowHeight = 0;
+
 	public View onCreateView(LayoutInflater inflater, ViewGroup container,
 	                Bundle savedInstanceState) {
 		mContext = container.getContext();
@@ -72,6 +75,18 @@ public class PresentationFragment extends Fragment {
 		// Save the height/width for future reference
 		mOriginalCoverflowHeight = mTopView.getImageHeight();
 		mOriginalCoverflowWidth = mTopView.getImageWidth();
+
+		if (mNewCoverflowHeight != 0) {
+			ThumbnailAdapter aAdapter = (ThumbnailAdapter) mTopView
+			                .getAdapter();
+			aAdapter.setHeight(mNewCoverflowHeight);
+			mTopView.setImageHeight(mNewCoverflowHeight);
+			aAdapter.setWidth(mNewCoverflowWidth);
+			mTopView.setImageWidth(mNewCoverflowWidth);
+
+			// We need to update the view now
+			aAdapter.notifyDataSetChanged();
+		}
 		return v;
 	}
 
@@ -127,6 +142,9 @@ public class PresentationFragment extends Fragment {
 				//				aParams.height += aDiff;
 				//				mTopView.setLayoutParams(aParams);
 
+				mNewCoverflowHeight = aHeightNew;
+				mNewCoverflowWidth = aWidthNew;
+
 				aAdapter.setHeight(aHeightNew);
 				mTopView.setImageHeight(aHeightNew);
 				aAdapter.setWidth(aWidthNew);
commit c830e37981546060d15b361840e82f49e234b6c9
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Jul 26 15:12:09 2012 +0200

    Countdown timer enabled.
    
    Change-Id: Ibab6574385502022b045902abfc969fe6c7e6b87

diff --git a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
index dafe925..fb3a648 100644
--- a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
@@ -13,6 +13,7 @@
         android:layout_height="wrap_content"
         android:layout_weight="1"
         android:ems="10"
+        android:text="03:00"
         android:inputType="time" >
     </EditText>
 
@@ -21,6 +22,7 @@
         android:layout_width="0dip"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:text="@string/clock_timer_start" />
+        android:text="@string/clock_timer_start"
+        android:textColor="#FFFFFF" />
 
 </LinearLayout>
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index cbce4ed..6bf3a0e 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -1,5 +1,9 @@
 package org.libreoffice.impressremote;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.TimeZone;
+
 import org.libreoffice.impressremote.communication.CommunicationService;
 import org.libreoffice.impressremote.communication.SlideShow.Timer;
 
@@ -17,6 +21,7 @@ import android.os.IBinder;
 import android.os.Message;
 import android.os.Messenger;
 import android.text.format.DateFormat;
+import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.View;
@@ -24,6 +29,7 @@ import android.view.View.OnClickListener;
 import android.widget.Button;
 import android.widget.EditText;
 import android.widget.FrameLayout;
+import android.widget.TextView;
 import android.widget.ToggleButton;
 
 public class PresentationActivity extends Activity {
@@ -108,7 +114,8 @@ public class PresentationActivity extends Activity {
 	}
 
 	private class ActionBarManager implements OnClickListener,
-	                FragmentManager.OnBackStackChangedListener {
+	                FragmentManager.OnBackStackChangedListener,
+	                TextView.OnEditorActionListener {
 
 		private ToggleButton mTimeLabel;
 		private ToggleButton mThumbnailButton;
@@ -209,6 +216,7 @@ public class PresentationActivity extends Activity {
 			mCountdownButton = (Button) mCountdownBar
 			                .findViewById(R.id.clockbar_countdown_button);
 			mCountdownButton.setOnClickListener(this);
+			mCountdownEntry.setOnEditorActionListener(this);
 
 			updateClockBar();
 
@@ -223,13 +231,34 @@ public class PresentationActivity extends Activity {
 			boolean aIsCountdown = mCommunicationService.getSlideShow()
 			                .getTimer().isCountdown();
 			// Stopwatch
-			mClockBar_stopwatchButton.setChecked(mTimerOn && !aIsCountdown);
-			mStopwatchBar.setVisibility(mTimerOn && !aIsCountdown ? View.VISIBLE
+			boolean aStopwatchMode = mTimerOn && !aIsCountdown;
+			mClockBar_stopwatchButton.setChecked(aStopwatchMode);
+			mStopwatchBar.setVisibility(aStopwatchMode ? View.VISIBLE
 			                : View.INVISIBLE);
+			if (aStopwatchMode) {
+				Timer aTimer = mCommunicationService.getSlideShow().getTimer();
+				if (aTimer.isRunning()) {
+					mStopwatchButtonRun.setText(R.string.clock_timer_pause);
+					mStopwatchButtonReset.setText(R.string.clock_timer_restart);
+				} else {
+					mStopwatchButtonRun.setText(R.string.clock_timer_start);
+					mStopwatchButtonReset.setText(R.string.clock_timer_reset);
+				}
+			}
+
 			// Countdown
+			boolean aCountdownMode = mTimerOn && aIsCountdown;
 			mClockBar_countdownButton.setChecked(mTimerOn && aIsCountdown);
 			mCountdownBar.setVisibility(mTimerOn && aIsCountdown ? View.VISIBLE
 			                : View.INVISIBLE);
+			if (aCountdownMode) {
+				Timer aTimer = mCommunicationService.getSlideShow().getTimer();
+				if (aTimer.isRunning()) {
+					mCountdownButton.setText(R.string.clock_timer_pause);
+				} else {
+					mCountdownButton.setText(R.string.clock_timer_resume);
+				}
+			}
 
 		}
 
@@ -287,10 +316,16 @@ public class PresentationActivity extends Activity {
 				updateClockBar();
 			} else if (aSource == mClockBar_stopwatchButton) {
 				mTimerOn = true;
+				if (aTimer.isCountdown()) { // Changing mode.
+					aTimer.reset();
+				}
 				aTimer.setCountdown(false);
 				updateClockBar();
 			} else if (aSource == mClockBar_countdownButton) {
 				mTimerOn = true;
+				if (!aTimer.isCountdown()) { // Changing mode
+					aTimer.reset();
+				}
 				aTimer.setCountdown(true);
 				updateClockBar();
 			}
@@ -309,9 +344,14 @@ public class PresentationActivity extends Activity {
 				} else {
 					aTimer.reset();
 				}
-
+				updateClockBar();
 			} else if (aSource == mCountdownButton) {
-
+				if (aTimer.isRunning()) {
+					aTimer.stopTimer();
+				} else {
+					aTimer.startTimer();
+				}
+				updateClockBar();
 			}
 
 		}
@@ -322,6 +362,36 @@ public class PresentationActivity extends Activity {
 				mThumbnailButton.setChecked(false);
 			}
 		}
+
+		@Override
+		public boolean onEditorAction(TextView tv, int aID, KeyEvent aEvent) {
+			if (aEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
+
+				long aTime = 0;
+				try {
+					SimpleDateFormat aFormat = new SimpleDateFormat("HH:mm:ss");
+					aFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+					aTime = aFormat.parse(mCountdownEntry.getText().toString())
+					                .getTime();
+				} catch (ParseException e) {
+				}
+				if (aTime == 0) {
+					try {
+						SimpleDateFormat aFormat = new SimpleDateFormat("mm:ss");
+						aFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+						aTime = aFormat.parse(
+						                mCountdownEntry.getText().toString())
+						                .getTime();
+					} catch (ParseException e) {
+					}
+				}
+				System.out.println("atime=" + aTime);
+				mCommunicationService.getSlideShow().getTimer()
+				                .setCountdownTime(aTime);
+				return true;
+			}
+			return false;
+		}
 	}
 
 }
commit 80ffe1bc6f52fd1a841dc1c11d831b86964a818d
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Jul 26 12:12:00 2012 +0200

    Basic timer code done.
    
    Change-Id: Ida0233b30f29e667c0c147346debc8306503719f

diff --git a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
index dc510ce..dafe925 100644
--- a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
@@ -21,6 +21,6 @@
         android:layout_width="0dip"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:text="Test" />
+        android:text="@string/clock_timer_start" />
 
 </LinearLayout>
\ No newline at end of file
diff --git a/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml b/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
index 49d1edd..d3f5021 100644
--- a/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
@@ -12,13 +12,13 @@
         android:layout_width="0dip"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:text="Test" />
+        android:text="@string/clock_timer_start" />
 
     <Button
         android:id="@+id/clockbar_stopwatch_reset"
         android:layout_width="0dip"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:text="Test" />
+        android:text="@string/clock_timer_reset" />
 
 </LinearLayout>
\ No newline at end of file
diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml
index 7c9dae3..991d692 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -7,6 +7,11 @@
     <string name="presentation_ui_resizehandle">Handle to resize view.</string>
     <string name="presentation_blank_screen">Blank Screen</string>
     <string name="options">Options</string>
-    <string name="actionbar_timeformat">hh:mm</string>
-    <string name="actionbar_timerformat">h:m:ss</string>
+    <string name="actionbar_timeformat">h:mmaa</string>
+    <string name="actionbar_timerformat">mm:ss</string>
+    <string name="clock_timer_start">Start</string>
+    <string name="clock_timer_pause">Pause</string>
+    <string name="clock_timer_restart">Restart</string>
+    <string name="clock_timer_reset">Reset</string>
+    <string name="clock_timer_resume">Resume</string>
 </resources>
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 11e0743..cbce4ed 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -1,6 +1,7 @@
 package org.libreoffice.impressremote;
 
 import org.libreoffice.impressremote.communication.CommunicationService;
+import org.libreoffice.impressremote.communication.SlideShow.Timer;
 
 import android.app.ActionBar;
 import android.app.Activity;
@@ -190,12 +191,25 @@ public class PresentationActivity extends Activity {
 			mStopwatchBar = mLayout.findViewById(R.id.clockbar_stopwatchbar);
 			mStopwatchBar.setVisibility(View.INVISIBLE);
 
+			mStopwatchButtonRun = (Button) mStopwatchBar
+			                .findViewById(R.id.clockbar_stopwatch_run);
+			mStopwatchButtonReset = (Button) mStopwatchBar
+			                .findViewById(R.id.clockbar_stopwatch_reset);
+			mStopwatchButtonRun.setOnClickListener(this);
+			mStopwatchButtonReset.setOnClickListener(this);
+
 			// Countdown bar
 			aInflater.inflate(R.layout.presentation_clockbar_countdownbar,
 			                mLayout);
 			mCountdownBar = mLayout.findViewById(R.id.clockbar_countdownbar);
 			mCountdownBar.setVisibility(View.INVISIBLE);
 
+			mCountdownEntry = (EditText) mCountdownBar
+			                .findViewById(R.id.clockbar_countdown_time);
+			mCountdownButton = (Button) mCountdownBar
+			                .findViewById(R.id.clockbar_countdown_button);
+			mCountdownButton.setOnClickListener(this);
+
 			updateClockBar();
 
 		}
@@ -245,6 +259,7 @@ public class PresentationActivity extends Activity {
 
 		@Override
 		public void onClick(View aSource) {
+			Timer aTimer = mCommunicationService.getSlideShow().getTimer();
 			// --------------------------------- ACTIONBAR BUTTONS -------------
 			if (aSource == mThumbnailButton) {
 				if (!mThumbnailFragment.isVisible()) {
@@ -267,19 +282,36 @@ public class PresentationActivity extends Activity {
 				}
 			}
 			// ------------------------------------ CLOCKBAR BUTTONS -----------
-			if (aSource == mClockBar_clockButton) {
+			else if (aSource == mClockBar_clockButton) {
 				mTimerOn = false;
 				updateClockBar();
 			} else if (aSource == mClockBar_stopwatchButton) {
 				mTimerOn = true;
-				mCommunicationService.getSlideShow().getTimer()
-				                .setCountdown(false);
+				aTimer.setCountdown(false);
 				updateClockBar();
 			} else if (aSource == mClockBar_countdownButton) {
 				mTimerOn = true;
-				mCommunicationService.getSlideShow().getTimer()
-				                .setCountdown(true);
+				aTimer.setCountdown(true);
+				updateClockBar();
+			}
+			// ------------------------------------- TIMER BUTTONS
+			else if (aSource == mStopwatchButtonRun) {
+				if (aTimer.isRunning()) {
+					aTimer.stopTimer();
+				} else {
+					aTimer.startTimer();
+				}
 				updateClockBar();
+			} else if (aSource == mStopwatchButtonReset) {
+				if (aTimer.isRunning()) {
+					aTimer.reset();
+					aTimer.startTimer();
+				} else {
+					aTimer.reset();
+				}
+
+			} else if (aSource == mCountdownButton) {
+
 			}
 
 		}
commit 4c2b8d96b8b06dbca24b9155d0f7a0f3437dcad3
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Jul 26 11:26:32 2012 +0200

    Added stopwatch and countdown bars.
    
    Change-Id: I Id0bd62aa9e2f6e19a3723e70a9cc8d153457c859

diff --git a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
new file mode 100644
index 0000000..dc510ce
--- /dev/null
+++ b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/clockbar_countdownbar"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="#DD4D4D4D"
+    android:gravity="left|top"
+    android:orientation="horizontal" >
+
+    <EditText
+        android:id="@+id/clockbar_countdown_time"
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:ems="10"
+        android:inputType="time" >
+    </EditText>
+
+    <Button
+        android:id="@+id/clockbar_countdown_button"
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:text="Test" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml b/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
new file mode 100644
index 0000000..49d1edd
--- /dev/null
+++ b/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/clockbar_stopwatchbar"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="#DD4D4D4D"
+    android:gravity="left|top"
+    android:orientation="horizontal" >
+
+    <Button
+        android:id="@+id/clockbar_stopwatch_run"
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:text="Test" />
+
+    <Button
+        android:id="@+id/clockbar_stopwatch_reset"
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:text="Test" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 10eb028..11e0743 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -20,6 +20,8 @@ import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.View;
 import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.EditText;
 import android.widget.FrameLayout;
 import android.widget.ToggleButton;
 
@@ -116,6 +118,16 @@ public class PresentationActivity extends Activity {
 		private ToggleButton mClockBar_stopwatchButton;
 		private ToggleButton mClockBar_countdownButton;
 
+		// ------- STOPWATCH BAR
+		private View mStopwatchBar;
+		private Button mStopwatchButtonRun;
+		private Button mStopwatchButtonReset;
+
+		// ------- COUNTDOWN BAR
+		private View mCountdownBar;
+		private EditText mCountdownEntry;
+		private Button mCountdownButton;
+
 		private String aTimeFormat = getResources().getString(
 		                R.string.actionbar_timeformat);
 		private String aTimerFormat = getResources().getString(
@@ -156,6 +168,7 @@ public class PresentationActivity extends Activity {
 		}
 
 		private void setupClockBar() {
+			// ClockBar
 			LayoutInflater aInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 			aInflater.inflate(R.layout.presentation_clockbar, mLayout);
 			mClockBar = mLayout.findViewById(R.id.clockbar);
@@ -171,18 +184,39 @@ public class PresentationActivity extends Activity {
 			mClockBar_stopwatchButton.setOnClickListener(this);
 			mClockBar_countdownButton.setOnClickListener(this);
 
+			// Stopwatch bar
+			aInflater.inflate(R.layout.presentation_clockbar_stopwatchbar,
+			                mLayout);
+			mStopwatchBar = mLayout.findViewById(R.id.clockbar_stopwatchbar);
+			mStopwatchBar.setVisibility(View.INVISIBLE);
+
+			// Countdown bar
+			aInflater.inflate(R.layout.presentation_clockbar_countdownbar,
+			                mLayout);
+			mCountdownBar = mLayout.findViewById(R.id.clockbar_countdownbar);
+			mCountdownBar.setVisibility(View.INVISIBLE);
+
 			updateClockBar();
 
 		}
 
 		private void updateClockBar() {
-			// TODO: show/hide the sub bar
 			mClockBar_clockButton.setChecked(!mTimerOn);
 
+			mCountdownBar.setY(mClockBar.getHeight());
+			mStopwatchBar.setY(mClockBar.getHeight());
+
 			boolean aIsCountdown = mCommunicationService.getSlideShow()
 			                .getTimer().isCountdown();
+			// Stopwatch
 			mClockBar_stopwatchButton.setChecked(mTimerOn && !aIsCountdown);
+			mStopwatchBar.setVisibility(mTimerOn && !aIsCountdown ? View.VISIBLE
+			                : View.INVISIBLE);
+			// Countdown
 			mClockBar_countdownButton.setChecked(mTimerOn && aIsCountdown);
+			mCountdownBar.setVisibility(mTimerOn && aIsCountdown ? View.VISIBLE
+			                : View.INVISIBLE);
+
 		}
 
 		private Handler timerHandler = new Handler();
commit d9a08a702ec0429695cd910821970b333cb0afda
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Jul 26 10:37:19 2012 +0200

    Fixed clockbar toggling.
    
    Change-Id: Ifd7a5f5a18a507db70b198943418e1e468ebcce0

diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 0c9e56f..10eb028 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -110,7 +110,11 @@ public class PresentationActivity extends Activity {
 		private ToggleButton mTimeLabel;
 		private ToggleButton mThumbnailButton;
 
+		// ------- CLOCKBAR
 		private View mClockBar;
+		private ToggleButton mClockBar_clockButton;
+		private ToggleButton mClockBar_stopwatchButton;
+		private ToggleButton mClockBar_countdownButton;
 
 		private String aTimeFormat = getResources().getString(
 		                R.string.actionbar_timeformat);
@@ -140,6 +144,8 @@ public class PresentationActivity extends Activity {
 			                R.id.actionbar_time);
 			mTimeLabel.setOnClickListener(this);
 
+			setupClockBar();
+
 			// Listen for fragment changes
 			getFragmentManager().addOnBackStackChangedListener(this);
 
@@ -149,6 +155,36 @@ public class PresentationActivity extends Activity {
 
 		}
 
+		private void setupClockBar() {
+			LayoutInflater aInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+			aInflater.inflate(R.layout.presentation_clockbar, mLayout);
+			mClockBar = mLayout.findViewById(R.id.clockbar);
+			mClockBar.setVisibility(View.INVISIBLE);
+
+			mClockBar_clockButton = (ToggleButton) mClockBar
+			                .findViewById(R.id.clockbar_toggle_clockmode);
+			mClockBar_stopwatchButton = (ToggleButton) mClockBar
+			                .findViewById(R.id.clockbar_toggle_stopwatchmode);
+			mClockBar_countdownButton = (ToggleButton) mClockBar
+			                .findViewById(R.id.clockbar_toggle_countdownmode);
+			mClockBar_clockButton.setOnClickListener(this);
+			mClockBar_stopwatchButton.setOnClickListener(this);
+			mClockBar_countdownButton.setOnClickListener(this);
+
+			updateClockBar();
+
+		}
+
+		private void updateClockBar() {
+			// TODO: show/hide the sub bar
+			mClockBar_clockButton.setChecked(!mTimerOn);
+
+			boolean aIsCountdown = mCommunicationService.getSlideShow()
+			                .getTimer().isCountdown();
+			mClockBar_stopwatchButton.setChecked(mTimerOn && !aIsCountdown);
+			mClockBar_countdownButton.setChecked(mTimerOn && aIsCountdown);
+		}
+
 		private Handler timerHandler = new Handler();
 
 		private Thread timerUpdateThread = new Thread() {
@@ -175,6 +211,7 @@ public class PresentationActivity extends Activity {
 
 		@Override
 		public void onClick(View aSource) {
+			// --------------------------------- ACTIONBAR BUTTONS -------------
 			if (aSource == mThumbnailButton) {
 				if (!mThumbnailFragment.isVisible()) {
 					FragmentTransaction ft = getFragmentManager()
@@ -187,41 +224,29 @@ public class PresentationActivity extends Activity {
 					getFragmentManager().popBackStack();
 				}
 			} else if (aSource == mTimeLabel) {
-				if (mClockBar == null) {
-					LayoutInflater aInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-					mClockBar = aInflater.inflate(
-					                R.layout.presentation_clockbar, mLayout);
-					mClockBar = mLayout.findViewById(R.id.clockbar);
-					if (!mTimerOn) {
-						((ToggleButton) mClockBar
-						                .findViewById(R.id.clockbar_toggle_clockmode))
-						                .setChecked(true);
-					} else {
-						boolean aIsCountdown = mCommunicationService
-						                .getSlideShow().getTimer()
-						                .isCountdown();
-						((ToggleButton) mClockBar
-						                .findViewById(R.id.clockbar_toggle_stopwatchmode))
-						                .setChecked(!aIsCountdown);
-						((ToggleButton) mClockBar
-						                .findViewById(R.id.clockbar_toggle_countdownmode))
-						                .setChecked(aIsCountdown);
-					}
 
+				if (mClockBar.getVisibility() == View.VISIBLE) {
+					mClockBar.setVisibility(View.INVISIBLE);
 				} else {
-					//					mClockBar.setVisibility(View.INVISIBLE);
-
-					//					((ViewGroup) mClockBar.getParent()).removeView(mClockBar);
-					if (mClockBar.getVisibility() == View.VISIBLE) {
-						mClockBar.setVisibility(View.INVISIBLE);
-					} else {
-						mClockBar.setVisibility(View.VISIBLE);
-						mClockBar.bringToFront();
-					}
-					//					mLayout.removeView(mClockBar);
-					//					mClockBar = null;
+					mClockBar.setVisibility(View.VISIBLE);
+					mClockBar.bringToFront();
 				}
 			}
+			// ------------------------------------ CLOCKBAR BUTTONS -----------
+			if (aSource == mClockBar_clockButton) {
+				mTimerOn = false;
+				updateClockBar();
+			} else if (aSource == mClockBar_stopwatchButton) {
+				mTimerOn = true;
+				mCommunicationService.getSlideShow().getTimer()
+				                .setCountdown(false);
+				updateClockBar();
+			} else if (aSource == mClockBar_countdownButton) {
+				mTimerOn = true;
+				mCommunicationService.getSlideShow().getTimer()
+				                .setCountdown(true);
+				updateClockBar();
+			}
 
 		}
 
commit 733f6018da0ad2401854e599c1e13211f7df4b58
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Jul 26 10:11:22 2012 +0200

    Enabled hiding of clockbar.
    
    Change-Id: I6b40629ec87c88c367b1958f3a7ab9b7938581e2

diff --git a/android/sdremote/res/layout/presentation_clockbar.xml b/android/sdremote/res/layout/presentation_clockbar.xml
index cde3c95..1e2e097 100644
--- a/android/sdremote/res/layout/presentation_clockbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/clockbar"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:background="#EE313131"
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 48e6678..0c9e56f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -110,6 +110,8 @@ public class PresentationActivity extends Activity {
 		private ToggleButton mTimeLabel;
 		private ToggleButton mThumbnailButton;
 
+		private View mClockBar;
+
 		private String aTimeFormat = getResources().getString(
 		                R.string.actionbar_timeformat);
 		private String aTimerFormat = getResources().getString(
@@ -185,11 +187,40 @@ public class PresentationActivity extends Activity {
 					getFragmentManager().popBackStack();
 				}
 			} else if (aSource == mTimeLabel) {
-				System.out.println("added");
-				LayoutInflater aInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-				View v = aInflater.inflate(R.layout.presentation_clockbar,
-				                mLayout);
-				//				mLayout.addView(v);
+				if (mClockBar == null) {
+					LayoutInflater aInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+					mClockBar = aInflater.inflate(
+					                R.layout.presentation_clockbar, mLayout);
+					mClockBar = mLayout.findViewById(R.id.clockbar);
+					if (!mTimerOn) {
+						((ToggleButton) mClockBar
+						                .findViewById(R.id.clockbar_toggle_clockmode))
+						                .setChecked(true);
+					} else {
+						boolean aIsCountdown = mCommunicationService
+						                .getSlideShow().getTimer()
+						                .isCountdown();
+						((ToggleButton) mClockBar
+						                .findViewById(R.id.clockbar_toggle_stopwatchmode))
+						                .setChecked(!aIsCountdown);
+						((ToggleButton) mClockBar
+						                .findViewById(R.id.clockbar_toggle_countdownmode))
+						                .setChecked(aIsCountdown);
+					}
+
+				} else {
+					//					mClockBar.setVisibility(View.INVISIBLE);
+
+					//					((ViewGroup) mClockBar.getParent()).removeView(mClockBar);
+					if (mClockBar.getVisibility() == View.VISIBLE) {
+						mClockBar.setVisibility(View.INVISIBLE);
+					} else {
+						mClockBar.setVisibility(View.VISIBLE);
+						mClockBar.bringToFront();
+					}
+					//					mLayout.removeView(mClockBar);
+					//					mClockBar = null;
+				}
 			}
 
 		}
commit b0f67f92f77afba13a022a0f5234cf5b168a2f99
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Jul 26 09:26:00 2012 +0200

    Added main clockbar icons.
    
    Change-Id: I18bee8c5f0fd588e34ad50650754cea9d3cee89a

diff --git a/android/sdremote/res/drawable/actionbar_icon_overflow.png b/android/sdremote/res/drawable/actionbar_icon_overflow.png
new file mode 100644
index 0000000..5265c45
Binary files /dev/null and b/android/sdremote/res/drawable/actionbar_icon_overflow.png differ
diff --git a/android/sdremote/res/drawable/actionbar_icon_thumbs.png b/android/sdremote/res/drawable/actionbar_icon_thumbs.png
new file mode 100644
index 0000000..ae10acc
Binary files /dev/null and b/android/sdremote/res/drawable/actionbar_icon_thumbs.png differ
diff --git a/android/sdremote/res/drawable/actionbar_thumbs.xml b/android/sdremote/res/drawable/actionbar_thumbs.xml
index 2dbf5ea..2d03853 100644
--- a/android/sdremote/res/drawable/actionbar_thumbs.xml
+++ b/android/sdremote/res/drawable/actionbar_thumbs.xml
@@ -3,7 +3,7 @@
 
     <item android:drawable="@drawable/actionbar_toggle"/>
     <item><bitmap
-        android:src="@drawable/icon_thumbs"
+        android:src="@drawable/actionbar_icon_thumbs"
         android:gravity="center"  /></item>
 
 </layer-list>
\ No newline at end of file
diff --git a/android/sdremote/res/drawable/clockbar_clock.xml b/android/sdremote/res/drawable/clockbar_clock.xml
new file mode 100644
index 0000000..14ceb47
--- /dev/null
+++ b/android/sdremote/res/drawable/clockbar_clock.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item android:drawable="@drawable/actionbar_toggle"/>
+    <item>
+        <bitmap
+            android:gravity="center"
+            android:src="@drawable/clockbar_icon_clock" />
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/android/sdremote/res/drawable/clockbar_countdown.xml b/android/sdremote/res/drawable/clockbar_countdown.xml
new file mode 100644
index 0000000..129d9aa
--- /dev/null
+++ b/android/sdremote/res/drawable/clockbar_countdown.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item android:drawable="@drawable/actionbar_toggle"/>
+    <item>
+        <bitmap
+            android:gravity="center"
+            android:src="@drawable/clockbar_icon_countdown" />
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/android/sdremote/res/drawable/clockbar_icon_clock.png b/android/sdremote/res/drawable/clockbar_icon_clock.png
new file mode 100644
index 0000000..792af07
Binary files /dev/null and b/android/sdremote/res/drawable/clockbar_icon_clock.png differ
diff --git a/android/sdremote/res/drawable/clockbar_icon_countdown.png b/android/sdremote/res/drawable/clockbar_icon_countdown.png
new file mode 100644
index 0000000..19af041
Binary files /dev/null and b/android/sdremote/res/drawable/clockbar_icon_countdown.png differ
diff --git a/android/sdremote/res/drawable/clockbar_icon_stopwatch.png b/android/sdremote/res/drawable/clockbar_icon_stopwatch.png
new file mode 100644
index 0000000..ac04142
Binary files /dev/null and b/android/sdremote/res/drawable/clockbar_icon_stopwatch.png differ
diff --git a/android/sdremote/res/drawable/clockbar_stopwatch.xml b/android/sdremote/res/drawable/clockbar_stopwatch.xml
new file mode 100644
index 0000000..bfdab6c
--- /dev/null
+++ b/android/sdremote/res/drawable/clockbar_stopwatch.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item android:drawable="@drawable/actionbar_toggle"/>
+    <item>
+        <bitmap
+            android:gravity="center"
+            android:src="@drawable/clockbar_icon_stopwatch" />
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/android/sdremote/res/drawable/icon_overflow.png b/android/sdremote/res/drawable/icon_overflow.png
deleted file mode 100644
index 5265c45..0000000
Binary files a/android/sdremote/res/drawable/icon_overflow.png and /dev/null differ
diff --git a/android/sdremote/res/drawable/icon_thumbs.png b/android/sdremote/res/drawable/icon_thumbs.png
deleted file mode 100644
index ae10acc..0000000
Binary files a/android/sdremote/res/drawable/icon_thumbs.png and /dev/null differ
diff --git a/android/sdremote/res/layout/presentation_clockbar.xml b/android/sdremote/res/layout/presentation_clockbar.xml
index 5ab7081..cde3c95 100644
--- a/android/sdremote/res/layout/presentation_clockbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar.xml
@@ -2,29 +2,34 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="horizontal"
-    android:background="#BB000000">
+    android:background="#EE313131"
+    android:orientation="horizontal" >
 
     <ToggleButton
         android:id="@+id/clockbar_toggle_clockmode"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-
-        android:text="ToggleButton" />
+        android:background="@drawable/clockbar_clock"
+        android:textOff=""
+        android:textOn="" />
 
     <ToggleButton
         android:id="@+id/clockbar_toggle_stopwatchmode"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:text="@drawable/actionbar_toggle" />
+        android:background="@drawable/clockbar_stopwatch"
+        android:textOff=""
+        android:textOn="" />
 
     <ToggleButton
         android:id="@+id/clockbar_toggle_countdownmode"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:text="@drawable/actionbar_toggle" />
+        android:background="@drawable/clockbar_countdown"
+        android:textOff=""
+        android:textOn="" />
 
 </LinearLayout>
\ No newline at end of file
diff --git a/android/sdremote/res/menu/actionbar_presentation.xml b/android/sdremote/res/menu/actionbar_presentation.xml
index a48aad5..cd88ddc 100644
--- a/android/sdremote/res/menu/actionbar_presentation.xml
+++ b/android/sdremote/res/menu/actionbar_presentation.xml
@@ -4,7 +4,7 @@
     <item
         android:id="@+id/actionbar_presentation_submenu"
         android:showAsAction="always"
-        android:icon="@drawable/icon_overflow">
+        android:icon="@drawable/actionbar_icon_overflow">
         <menu>
             <item
                 android:id="@+id/actionbar_presentation_submenu_blank"


More information about the Libreoffice-commits mailing list