summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2012-07-28 16:26:49 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-08-06 10:23:06 +0100
commit36c96dadc995831654935e0f9bd15737d3b2a510 (patch)
treefc9a4cb69ab798147403e42732360872b5783480
parentf4bd34856656c18232737d3a9ecee559df11df1e (diff)
Blank screen essentially working.
Change-Id: I I I645fab156d9803a2f076b7e5b45a5035a6854fab
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java29
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java7
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java6
3 files changed, 28 insertions, 14 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
index d87565c93532..4418431fd9b2 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
@@ -1,5 +1,7 @@
package org.libreoffice.impressremote;
+import org.libreoffice.impressremote.communication.CommunicationService;
+
import android.app.Fragment;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -14,10 +16,10 @@ import android.widget.ImageView;
public class BlankScreenFragment extends Fragment {
- Bitmap mBitmap;
+ CommunicationService mCommunicationService;
- public BlankScreenFragment(Bitmap aBitmap) {
- mBitmap = aBitmap;
+ public BlankScreenFragment(CommunicationService aCommunicationService) {
+ mCommunicationService = aCommunicationService;
}
@Override
@@ -27,6 +29,9 @@ public class BlankScreenFragment extends Fragment {
View v = inflater.inflate(R.layout.fragment_blankscreen, container,
false);
+ Bitmap aBitmap = mCommunicationService.getSlideShow().getImage(
+ mCommunicationService.getSlideShow().getCurrentSlide());
+
// Process the image
final int borderWidth = 8;
@@ -34,19 +39,27 @@ public class BlankScreenFragment extends Fragment {
p.setShadowLayer(borderWidth, 0, 0, Color.BLACK);
RectF aRect = new RectF(borderWidth, borderWidth, borderWidth
- + mBitmap.getWidth(), borderWidth + mBitmap.getHeight());
- Bitmap aOut = Bitmap.createBitmap(mBitmap.getWidth() + 2 * borderWidth,
- mBitmap.getHeight() + 2 * borderWidth,
- mBitmap.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(Color.TRANSPARENT);
canvas.drawRect(aRect, p);
- canvas.drawBitmap(mBitmap, null, aRect, null);
+ canvas.drawBitmap(aBitmap, null, aRect, null);
ImageView aImage = (ImageView) v
.findViewById(R.id.blankscreen_slidepreview);
aImage.setImageBitmap(aOut);
+
+ mCommunicationService.getTransmitter().blankScreen();
// TODO Auto-generated method stub
return v;
}
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ mCommunicationService.getTransmitter().resume();
+ }
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index a6f6d3838aca..c6b80fecdea3 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -17,7 +17,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
-import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -152,11 +151,9 @@ public class PresentationActivity extends Activity {
boolean aRelevantFragmentVisible = mPresentationFragment
.isVisible() || mThumbnailFragment.isVisible();
if (aRelevantFragmentVisible) {
- Bitmap aBitmap = mCommunicationService.getSlideShow().getImage(
- mCommunicationService.getSlideShow()
- .getCurrentSlide());
- BlankScreenFragment aFragment = new BlankScreenFragment(aBitmap);
+ BlankScreenFragment aFragment = new BlankScreenFragment(
+ mCommunicationService);
FragmentTransaction ft = getFragmentManager()
.beginTransaction();
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
index 8c3c69f685d2..1a9560456f92 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
@@ -52,10 +52,14 @@ public class Transmitter {
* @param aColor
*/
public void blankScreen(Color aColor) {
- // Fixme: check how to get colour in integer form.
+ // 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 startPresentation() {
mClient.sendCommand("presentation_start\n\n");
}