diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-07-28 16:13:31 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-08-06 10:23:06 +0100 |
commit | f4bd34856656c18232737d3a9ecee559df11df1e (patch) | |
tree | 7f4309e28f4cdcb63ec5fa364301de0840e63a67 /android | |
parent | 0ce7b3e9f12c06973705a19cc8003941f8ce267a (diff) |
Blank screen view showing.
Change-Id: Ica6b740029bb1eb7d55dedec189c944af0027566
Diffstat (limited to 'android')
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java | 45 | ||||
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java | 23 |
2 files changed, 63 insertions, 5 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java index 934baeacfa64..d87565c93532 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java @@ -1,7 +1,52 @@ package org.libreoffice.impressremote; import android.app.Fragment; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.RectF; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; public class BlankScreenFragment extends Fragment { + Bitmap mBitmap; + + public BlankScreenFragment(Bitmap aBitmap) { + mBitmap = aBitmap; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + + View v = inflater.inflate(R.layout.fragment_blankscreen, container, + false); + + // Process the image + 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 + + mBitmap.getWidth(), borderWidth + mBitmap.getHeight()); + Bitmap aOut = Bitmap.createBitmap(mBitmap.getWidth() + 2 * borderWidth, + mBitmap.getHeight() + 2 * borderWidth, + mBitmap.getConfig()); + Canvas canvas = new Canvas(aOut); + canvas.drawColor(Color.TRANSPARENT); + canvas.drawRect(aRect, p); + canvas.drawBitmap(mBitmap, null, aRect, null); + + ImageView aImage = (ImageView) v + .findViewById(R.id.blankscreen_slidepreview); + aImage.setImageBitmap(aOut); + // TODO Auto-generated method stub + return v; + } } diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java index efb3ae8c343a..a6f6d3838aca 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java @@ -17,6 +17,7 @@ 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; @@ -143,15 +144,27 @@ public class PresentationActivity extends Activity { Intent aIntent; switch (item.getItemId()) { case R.id.actionbar_presentation_submenu_options: - // FragmentTransaction ft = getFragmentManager().beginTransaction(); - // ft.replace(R.id.presentation_innerFrame, new SettingsFragment()); - // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); - // ft.addToBackStack(null); - // ft.commit(); + aIntent = new Intent(this, SettingsActivity.class); startActivity(aIntent); return true; case R.id.actionbar_presentation_submenu_blank: + boolean aRelevantFragmentVisible = mPresentationFragment + .isVisible() || mThumbnailFragment.isVisible(); + if (aRelevantFragmentVisible) { + Bitmap aBitmap = mCommunicationService.getSlideShow().getImage( + mCommunicationService.getSlideShow() + .getCurrentSlide()); + + BlankScreenFragment aFragment = new BlankScreenFragment(aBitmap); + + FragmentTransaction ft = getFragmentManager() + .beginTransaction(); + ft.replace(R.id.presentation_innerFrame, aFragment); + ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); + ft.addToBackStack(null); + ft.commit(); + } return true; default: return super.onOptionsItemSelected(item); |