summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/sdremote/res/layout/activity_presentation.xml15
-rw-r--r--android/sdremote/res/layout/fragment_thumbnail.xml (renamed from android/sdremote/res/layout/activity_thumbnail.xml)0
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java102
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/TestClient.java2
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java109
-rw-r--r--sd/CppunitTest_sd_filters_test.mk4
-rw-r--r--sd/CppunitTest_sd_uimpress.mk4
-rw-r--r--sd/source/ui/remotecontrol/ImagePreparer.cxx2
-rw-r--r--sd/source/ui/remotecontrol/Receiver.hxx1
9 files changed, 139 insertions, 100 deletions
diff --git a/android/sdremote/res/layout/activity_presentation.xml b/android/sdremote/res/layout/activity_presentation.xml
index 0cdff5adb4cd..f482b3c246ef 100644
--- a/android/sdremote/res/layout/activity_presentation.xml
+++ b/android/sdremote/res/layout/activity_presentation.xml
@@ -1,14 +1,7 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
- android:layout_height="match_parent" >
+ android:layout_height="match_parent"
+ android:id="@+id/framelayout" >
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerVertical="true"
- android:text="@string/hello_world"
- tools:context=".PresentationActivity" />
-
-</RelativeLayout>
+</FrameLayout>
diff --git a/android/sdremote/res/layout/activity_thumbnail.xml b/android/sdremote/res/layout/fragment_thumbnail.xml
index 068ab7893317..068ab7893317 100644
--- a/android/sdremote/res/layout/activity_thumbnail.xml
+++ b/android/sdremote/res/layout/fragment_thumbnail.xml
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index b7e3b80c969c..45bfd75ede1a 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -1,20 +1,98 @@
package org.libreoffice.impressremote;
-import android.os.Bundle;
+import org.libreoffice.impressremote.communication.CommunicationService;
+
import android.app.Activity;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
import android.view.Menu;
+import android.widget.FrameLayout;
public class PresentationActivity extends Activity {
+ private CommunicationService mCommunicationService;
+ private boolean mIsBound = false;
+ private FrameLayout mLayout;
+ ThumbnailActivity mThumbnailFragment;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_presentation);
+
+ bindService(new Intent(this, CommunicationService.class), mConnection,
+ Context.BIND_IMPORTANT);
+
+ FragmentManager fragmentManager = getFragmentManager();
+ FragmentTransaction fragmentTransaction = fragmentManager
+ .beginTransaction();
+ mThumbnailFragment = new ThumbnailActivity();
+ fragmentTransaction.add(R.id.framelayout, mThumbnailFragment,
+ "fragment_thumbnail");
+ fragmentTransaction.commit();
+
+ mLayout = (FrameLayout) findViewById(R.id.framelayout);
+
+ mIsBound = true;
+ }
+
+ // @Override
+ // public boolean onCreateOptionsMenu(Menu menu) {
+ // MenuInflater inflater = getMenuInflater();
+ // inflater.inflate(R.menu.main_activity, menu);
+ // return true;
+ // }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.activity_presentation, menu);
+ return true;
+ }
+
+ private ServiceConnection mConnection = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName aClassName,
+ IBinder aService) {
+ mCommunicationService = ((CommunicationService.CBinder) aService)
+ .getService();
+ mCommunicationService.setActivityMessenger(mMessenger);
+ mThumbnailFragment.setCommunicationService(mCommunicationService);
+ // TODO: add mCommunicationSercie to all fragments.
+
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName aClassName) {
+ mCommunicationService = null;
+ }
+ };
+
+ final Messenger mMessenger = new Messenger(new MessageHandler());
+
+ protected class MessageHandler extends Handler {
+ @Override
+ public void handleMessage(Message 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;
+ //
+ // }
+ }
+ }
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_presentation);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.activity_presentation, menu);
- return true;
- }
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/TestClient.java b/android/sdremote/src/org/libreoffice/impressremote/TestClient.java
index 0d2f3e0e95c2..f73e772d707b 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/TestClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/TestClient.java
@@ -151,7 +151,7 @@ public class TestClient extends Activity {
@Override
public void onClick(View v) {
Intent aIntent = new Intent(TestClient.this,
- ThumbnailActivity.class);
+ PresentationActivity.class);
startActivity(aIntent);
}
});
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java
index f295163a1b9c..3890ff3de37b 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java
@@ -11,18 +11,12 @@ package org.libreoffice.impressremote;
import org.libreoffice.impressremote.communication.CommunicationService;
import org.libreoffice.impressremote.communication.SlideShow;
-import android.app.Activity;
-import android.content.ComponentName;
+import android.app.Fragment;
import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.os.Bundle;
-import android.os.Handler;
-import android.os.IBinder;
import android.os.Message;
-import android.os.Messenger;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -32,47 +26,42 @@ import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
-public class ThumbnailActivity extends Activity {
+public class ThumbnailActivity extends Fragment {
private CommunicationService mCommunicationService;
- private boolean mIsBound = false;
private GridView mGrid;
private ImageView mCurrentImage;
private TextView mCurrentText;
private SlideShow mSlideShow;
+ private Context mContext;
@Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_thumbnail);
-
- bindService(new Intent(this, CommunicationService.class), mConnection,
- Context.BIND_ADJUST_WITH_ACTIVITY);
- mIsBound = true;
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View v = inflater
+ .inflate(R.layout.fragment_thumbnail, container, false);
- mGrid = (GridView) findViewById(R.id.thumbnail_grid);
+ mGrid = (GridView) v.findViewById(R.id.thumbnail_grid);
mGrid.setOnItemClickListener(new ClickListener());
+ mContext = container.getContext();
+
+ return v;
}
@Override
- protected void onPause() {
- super.onPause();
- mCommunicationService.setActivityMessenger(null);
- if (mIsBound) {
- unbindService(mConnection);
- mIsBound = false;
- }
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
}
- // @Override
- // public boolean onCreateOptionsMenu(Menu menu) {
- // MenuInflater inflater = getMenuInflater();
- // inflater.inflate(R.menu.main_activity, menu);
- // return true;
- // }
+ @Override
+ public void onPause() {
+ super.onPause();
+ }
private void setSelected(int position) {
formatUnselected(mCurrentImage, mCurrentText);
@@ -92,7 +81,7 @@ public class ThumbnailActivity extends Activity {
R.color.thumbnail_border));
}
if (aText != null) {
- aText.setTypeface(Typeface.create(mCurrentText.getTypeface(),
+ aText.setTypeface(Typeface.create(aText.getTypeface(),
Typeface.NORMAL));
}
}
@@ -103,56 +92,42 @@ public class ThumbnailActivity extends Activity {
R.color.thumbnail_border_selected));
}
if (aText != null) {
- aText.setTypeface(Typeface.create(mCurrentText.getTypeface(),
+ aText.setTypeface(Typeface.create(aText.getTypeface(),
Typeface.BOLD));
}
}
// ------------------------------------------------- SERVICE CONNECTION ----
- final Messenger mMessenger = new Messenger(new MessageHandler());
-
- private ServiceConnection mConnection = new ServiceConnection() {
- @Override
- public void onServiceConnected(ComponentName aClassName,
- IBinder aService) {
- mCommunicationService = ((CommunicationService.CBinder) aService)
- .getService();
- mCommunicationService.setActivityMessenger(mMessenger);
- mSlideShow = mCommunicationService.getSlideShow();
- mGrid.setAdapter(new ThumbnailAdapter(ThumbnailActivity.this,
- mSlideShow));
- }
-
- @Override
- public void onServiceDisconnected(ComponentName aClassName) {
- mCommunicationService = null;
- }
- };
// ----------------------------------------------------- CLICK LISTENER ----
protected class ClickListener implements AdapterView.OnItemClickListener {
public void onItemClick(AdapterView<?> parent, View v, int position,
long id) {
- mCommunicationService.getTransmitter().gotoSlide(position);
+ if (mCommunicationService != null)
+ mCommunicationService.getTransmitter().gotoSlide(position);
}
}
// ---------------------------------------------------- MESSAGE HANDLER ----
- protected class MessageHandler extends Handler {
- @Override
- public void handleMessage(Message aMessage) {
- Bundle aData = aMessage.getData();
- switch (aMessage.what) {
- case CommunicationService.MSG_SLIDE_CHANGED:
- int aSlide = aData.getInt("slide_number");
- setSelected(aSlide);
- break;
- case CommunicationService.MSG_SLIDE_PREVIEW:
- // int aNSlide = aData.getInt("slide_number");
- mGrid.invalidateViews();
- break;
- }
+ public void setCommunicationService(
+ CommunicationService aCommunicationService) {
+ mCommunicationService = aCommunicationService;
+ mSlideShow = mCommunicationService.getSlideShow();
+ mGrid.setAdapter(new ThumbnailAdapter(mContext, mSlideShow));
+ }
+
+ public void handleMessage(Message aMessage) {
+ Bundle aData = aMessage.getData();
+ switch (aMessage.what) {
+ case CommunicationService.MSG_SLIDE_CHANGED:
+ int aSlide = aData.getInt("slide_number");
+ setSelected(aSlide);
+ break;
+ case CommunicationService.MSG_SLIDE_PREVIEW:
+ mGrid.invalidateViews();
+ break;
+
}
}
@@ -201,6 +176,8 @@ public class ThumbnailActivity extends Activity {
if ((mSlideShow != null)
&& (position == mSlideShow.getCurrentSlide())) {
formatSelected(aImage, aText);
+ mCurrentImage = aImage;
+ mCurrentText = aText;
} else {
formatUnselected(aImage, aText);
}
diff --git a/sd/CppunitTest_sd_filters_test.mk b/sd/CppunitTest_sd_filters_test.mk
index ad13e96dbaaf..6afe52d4d79d 100644
--- a/sd/CppunitTest_sd_filters_test.mk
+++ b/sd/CppunitTest_sd_filters_test.mk
@@ -67,10 +67,6 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_filters_test, \
$(gb_STDLIBS) \
))
-$(eval $(call gb_CppunitTest_add_libs,sd_filters_test,\
- $(shell pkg-config --libs glib-2.0 json-glib-1.0) \
-))
-
$(eval $(call gb_CppunitTest_set_include,sd_filters_test,\
-I$(SRCDIR)/sd/source/ui/inc \
-I$(SRCDIR)/sd/inc \
diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk
index 1880c3f87f8d..94065b0f648b 100644
--- a/sd/CppunitTest_sd_uimpress.mk
+++ b/sd/CppunitTest_sd_uimpress.mk
@@ -41,10 +41,6 @@ $(eval $(call gb_CppunitTest_use_api,sd_uimpress,\
udkapi \
))
-$(eval $(call gb_CppunitTest_add_libs,sd_uimpress,\
- $(shell pkg-config --libs glib-2.0 json-glib-1.0) \
-))
-
$(eval $(call gb_CppunitTest_use_library_objects,sd_uimpress,sd))
$(eval $(call gb_CppunitTest_use_libraries,sd_uimpress,\
diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx
index a42be1f5c135..9497f879e51c 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, 160, 120,
+ uno::Sequence<sal_Int8> aImageData = preparePreview( aSlideNumber, 140, 100,
aSize );
if ( !xController->isRunning() )
return;
diff --git a/sd/source/ui/remotecontrol/Receiver.hxx b/sd/source/ui/remotecontrol/Receiver.hxx
index 5c739136000a..e4f19f59203f 100644
--- a/sd/source/ui/remotecontrol/Receiver.hxx
+++ b/sd/source/ui/remotecontrol/Receiver.hxx
@@ -39,4 +39,3 @@ private:
}
#endif // _SD_IMPRESSREMOTE_RECEIVER_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */