diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-07-24 14:34:59 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-08-06 10:23:01 +0100 |
commit | 17081d1aff72fa7c0c5b5a71cace87826ed8b17b (patch) | |
tree | 2a81c5ceaf167ca16b1d455774093797814e5bae | |
parent | fa189184fd1f139986aab32531ab19f03223d312 (diff) |
Enabled slide switching from cover flow, + fixes.
Change-Id: I4cb520a3c014ff54a36dbab6cdb35b70a8996e8e
6 files changed, 44 insertions, 14 deletions
diff --git a/android/sdremote/res/layout/fragment_presentation.xml b/android/sdremote/res/layout/fragment_presentation.xml index fb501489cb47..d40f517aac41 100644 --- a/android/sdremote/res/layout/fragment_presentation.xml +++ b/android/sdremote/res/layout/fragment_presentation.xml @@ -11,11 +11,13 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="5dip" - coverflow:imageHeight="150dip" - coverflow:imageReflectionRatio="0.2" - coverflow:imageWidth="100dip" - coverflow:reflectionGap="2dip" - coverflow:withReflection="true" /> + coverflow:imageHeight="160dip" + + coverflow:imageWidth="200dip" + + coverflow:withReflection="false" /> + <!-- coverflow:imageReflectionRatio="0.2" + coverflow:reflectionGap="2dip" --> <ImageView android:id="@+id/presentation_handle" diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java index 28ba8d0fb031..3c769fcc521a 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java @@ -18,6 +18,7 @@ import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.webkit.WebView; import android.widget.AdapterView; +import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ImageView; public class PresentationFragment extends Fragment { @@ -49,9 +50,8 @@ public class PresentationFragment extends Fragment { mHandle = (ImageView) v.findViewById(R.id.presentation_handle); mHandle.setOnTouchListener(new SizeListener()); - if (mCommunicationService != null && mSlideShow != null) { - mTopView.setAdapter(new ThumbnailAdapter(mContext, mSlideShow)); - } + // Call again to set things up if necessary. + setCommunicationService(mCommunicationService); return v; } @@ -85,6 +85,7 @@ public class PresentationFragment extends Fragment { } mTopView.setLayoutParams(aParams); + mTopView.setImageHeight(aParams.height); break; } // TODO Auto-generated method stub @@ -93,11 +94,18 @@ public class PresentationFragment extends Fragment { } // ----------------------------------------------------- CLICK LISTENER ---- - protected class ClickListener implements AdapterView.OnItemClickListener { - public void onItemClick(AdapterView<?> parent, View v, int position, - long id) { + + protected class ClickListener implements OnItemSelectedListener { + + @Override + public void onItemSelected(AdapterView<?> arg0, View arg1, + int aPosition, long arg3) { if (mCommunicationService != null) - mCommunicationService.getTransmitter().gotoSlide(position); + mCommunicationService.getTransmitter().gotoSlide(aPosition); + } + + @Override + public void onNothingSelected(AdapterView<?> arg0) { } } @@ -105,10 +113,16 @@ public class PresentationFragment extends Fragment { public void setCommunicationService( CommunicationService aCommunicationService) { mCommunicationService = aCommunicationService; + if (mCommunicationService == null) + return; + mSlideShow = mCommunicationService.getSlideShow(); - if (mTopView != null) { + if (mTopView != null && mSlideShow != null) { mTopView.setAdapter(new ThumbnailAdapter(mContext, mSlideShow)); + mTopView.setSelection(mSlideShow.getCurrentSlide(), true); + mTopView.setOnItemSelectedListener(new ClickListener()); } + } public void handleMessage(Message aMessage) { diff --git a/android/sdremote/src/org/libreoffice/impressremote/TestClient.java b/android/sdremote/src/org/libreoffice/impressremote/TestClient.java index 7ecabbfc1d45..5620c5b400b9 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/TestClient.java +++ b/android/sdremote/src/org/libreoffice/impressremote/TestClient.java @@ -65,6 +65,7 @@ public class TestClient extends Activity { // TODO Auto-generated method stub mCommunicationService.disconnect(); stopService(new Intent(this, CommunicationService.class)); + finish(); super.onBackPressed(); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java index de07603a2fec..265327733dcc 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java @@ -24,6 +24,7 @@ import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageView; +import android.widget.ImageView.ScaleType; import android.widget.TextView; public class ThumbnailFragment extends Fragment { @@ -70,6 +71,10 @@ public class ThumbnailFragment extends Fragment { private void setSelected(int position) { formatUnselected(mCurrentImage, mCurrentText); + if (mGrid == null) { + return; + } + View aV = mGrid.getChildAt(position); if (aV != null) { mCurrentImage = (ImageView) aV.findViewById(R.id.sub_thumbnail); @@ -191,6 +196,11 @@ public class ThumbnailFragment extends Fragment { aImage.setImageBitmap(aBitmap); } + // Width + int aWidth = (mGrid.getWidth()) / 3 - 20; + aImage.setMaxWidth(aWidth); + aImage.setScaleType(ScaleType.MATRIX); + aText.setText(String.valueOf(position + 1)); return v; diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java index 9d07833c4be3..6fd3623717ff 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java @@ -55,6 +55,9 @@ public class Receiver { if (aInstruction.equals("slide_updated")) { int aSlideNumber = Integer.parseInt(aCommand.get(1)); + + mSlideShow.setCurrentSlide(aSlideNumber); + Message aMessage = Message.obtain(null, CommunicationService.MSG_SLIDE_CHANGED); Bundle aData = new Bundle(); diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx index 9497f879e51c..b81ff7717340 100644 --- a/sd/source/ui/remotecontrol/ImagePreparer.cxx +++ b/sd/source/ui/remotecontrol/ImagePreparer.cxx @@ -58,7 +58,7 @@ void ImagePreparer::execute() void ImagePreparer::sendPreview( sal_uInt32 aSlideNumber ) { sal_uInt64 aSize; - uno::Sequence<sal_Int8> aImageData = preparePreview( aSlideNumber, 140, 100, + uno::Sequence<sal_Int8> aImageData = preparePreview( aSlideNumber, 320, 240, aSize ); if ( !xController->isRunning() ) return; |