[Libreoffice-commits] .: Branch 'feature/remote' - 3 commits - android/sdremote sd/CppunitTest_sd_filters_test.mk sd/CppunitTest_sd_uimpress.mk sd/source
Andrzej J.R. Hunt
ajrhunt at kemper.freedesktop.org
Mon Jul 23 09:23:21 PDT 2012
android/sdremote/.settings/org.eclipse.jdt.core.prefs | 11
android/sdremote/AndroidManifest.xml | 21 -
android/sdremote/res/drawable-hdpi/ic_action_search.png |binary
android/sdremote/res/drawable-mdpi/ic_action_search.png |binary
android/sdremote/res/drawable-xhdpi/ic_action_search.png |binary
android/sdremote/res/drawable/handle_center.png |binary
android/sdremote/res/drawable/handle_line.png |binary
android/sdremote/res/drawable/testimage.png |binary
android/sdremote/res/layout/activity_presentation.xml | 7
android/sdremote/res/layout/activity_thumbnail.xml | 13
android/sdremote/res/layout/fragment_presentation.xml | 60 ++
android/sdremote/res/layout/fragment_thumbnail.xml | 13
android/sdremote/res/menu/activity_presentation.xml | 6
android/sdremote/res/values/strings.xml | 8
android/sdremote/res/values/styles.xml | 20
android/sdremote/src/org/libreoffice/impressremote/ActionBarManager.java | 18
android/sdremote/src/org/libreoffice/impressremote/Launcher.java | 9
android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java | 103 +++++
android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java | 54 ++
android/sdremote/src/org/libreoffice/impressremote/TestClient.java | 47 +-
android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java | 185 ---------
android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java | 202 ++++++++++
android/sdremote/src/org/libreoffice/impressremote/communication/Client.java | 17
android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java | 70 +++
android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java | 11
android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java | 10
android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java | 61 +++
android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java | 10
sd/CppunitTest_sd_filters_test.mk | 4
sd/CppunitTest_sd_uimpress.mk | 4
sd/source/ui/remotecontrol/ImagePreparer.cxx | 2
sd/source/ui/remotecontrol/Receiver.hxx | 1
32 files changed, 722 insertions(+), 245 deletions(-)
New commits:
commit 973e7b4a85a713d96e3d6941ca6ab01126510694
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Mon Jul 23 18:18:02 2012 +0200
Added resizeable view.
Change-Id: Ifddbd1df740494ce5680e4a62a6dae81f395b49a
diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml
index fc00786..689e0ec 100644
--- a/android/sdremote/AndroidManifest.xml
+++ b/android/sdremote/AndroidManifest.xml
@@ -27,7 +27,7 @@
<service android:name=".communication.CommunicationService" >
</service>
- <activity android:name=".ThumbnailActivity" >
+ <activity android:name=".ThumbnailFragment" >
</activity>
<activity
android:name=".PresentationActivity"
diff --git a/android/sdremote/res/drawable/handle_center.png b/android/sdremote/res/drawable/handle_center.png
new file mode 100644
index 0000000..b591d35
Binary files /dev/null and b/android/sdremote/res/drawable/handle_center.png differ
diff --git a/android/sdremote/res/drawable/handle_line.png b/android/sdremote/res/drawable/handle_line.png
new file mode 100644
index 0000000..ede5d81
Binary files /dev/null and b/android/sdremote/res/drawable/handle_line.png differ
diff --git a/android/sdremote/res/drawable/testimage.png b/android/sdremote/res/drawable/testimage.png
new file mode 100644
index 0000000..4529586
Binary files /dev/null and b/android/sdremote/res/drawable/testimage.png differ
diff --git a/android/sdremote/res/layout/fragment_presentation.xml b/android/sdremote/res/layout/fragment_presentation.xml
new file mode 100644
index 0000000..9331dc5
--- /dev/null
+++ b/android/sdremote/res/layout/fragment_presentation.xml
@@ -0,0 +1,60 @@
+<?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" >
+
+ <ImageView
+ android:id="@+id/imageView1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:contentDescription="TODO"
+ android:src="@drawable/testimage" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/presentation_handle" >
+
+ <ImageView
+ android:id="@+id/imageView4"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.5"
+ android:contentDescription="TODO"
+ android:paddingLeft="6dp"
+ android:scaleType="fitXY"
+ android:src="@drawable/handle_line" />
+
+ <ImageView
+ android:id="@+id/imageView3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:contentDescription="TODO"
+ android:src="@drawable/handle_center" />
+
+ <ImageView
+ android:id="@+id/imageView2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.5"
+ android:maxWidth="500dp"
+ android:paddingRight="6dp"
+ android:scaleType="fitXY"
+ android:src="@drawable/handle_line"
+ android:contentDescription="TODO"/>
+ </LinearLayout>
+
+ <ScrollView
+ android:id="@+id/scrollView1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <WebView
+ android:id="@+id/textView1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ </ScrollView>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml
index 2698fea..668d073 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -5,5 +5,4 @@
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_presentation">PresentationActivity</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 45bfd75..e06d2b5 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -21,7 +21,8 @@ public class PresentationActivity extends Activity {
private CommunicationService mCommunicationService;
private boolean mIsBound = false;
private FrameLayout mLayout;
- ThumbnailActivity mThumbnailFragment;
+ ThumbnailFragment mThumbnailFragment;
+ PresentationFragment mPresentationFragment;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -34,9 +35,13 @@ public class PresentationActivity extends Activity {
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager
.beginTransaction();
- mThumbnailFragment = new ThumbnailActivity();
- fragmentTransaction.add(R.id.framelayout, mThumbnailFragment,
- "fragment_thumbnail");
+ mThumbnailFragment = new ThumbnailFragment();
+ mPresentationFragment = new PresentationFragment();
+
+ // fragmentTransaction.add(R.id.framelayout, mThumbnailFragment,
+ // "fragment_thumbnail");
+ fragmentTransaction.add(R.id.framelayout, mPresentationFragment,
+ "fragment_presentation");
fragmentTransaction.commit();
mLayout = (FrameLayout) findViewById(R.id.framelayout);
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
new file mode 100644
index 0000000..5ae47b3
--- /dev/null
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -0,0 +1,54 @@
+package org.libreoffice.impressremote;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnTouchListener;
+import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
+import android.webkit.WebView;
+
+public class PresentationFragment extends Fragment {
+
+ private View mTopView;
+
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View v = inflater.inflate(R.layout.fragment_presentation, container,
+ false);
+
+ WebView mWebView = (WebView) v.findViewById(R.id.textView1);
+
+ String summary = "<html><body>This is just a test<br/><ul><li>And item</li><li>And again</li></ul>More text<br/>Blabla<br/>Blabla<br/>blabla<br/>Blabla</body></html>";
+ mWebView.loadData(summary, "text/html", null);
+
+ mTopView = v.findViewById(R.id.imageView1);
+
+ v.findViewById(R.id.presentation_handle).setOnTouchListener(
+ new SizeListener());
+
+ return v;
+ }
+
+ private class SizeListener implements OnTouchListener {
+
+ @Override
+ public boolean onTouch(View aView, MotionEvent aEvent) {
+
+ LayoutParams aParams = mTopView.getLayoutParams();
+
+ switch (aEvent.getAction()) {
+ case MotionEvent.ACTION_MOVE:
+ int aHeight = mTopView.getHeight();
+ aParams.height = aHeight + (int) (aEvent.getY());
+ mTopView.setLayoutParams(aParams);
+ break;
+ }
+ // TODO Auto-generated method stub
+ return true;
+ }
+ }
+}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/TestClient.java b/android/sdremote/src/org/libreoffice/impressremote/TestClient.java
index f73e772..7ecabbf 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/TestClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/TestClient.java
@@ -63,6 +63,7 @@ public class TestClient extends Activity {
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
+ mCommunicationService.disconnect();
stopService(new Intent(this, CommunicationService.class));
super.onBackPressed();
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java
deleted file mode 100644
index 3890ff3..0000000
--- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-package org.libreoffice.impressremote;
-
-import org.libreoffice.impressremote.communication.CommunicationService;
-import org.libreoffice.impressremote.communication.SlideShow;
-
-import android.app.Fragment;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Typeface;
-import android.os.Bundle;
-import android.os.Message;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.BaseAdapter;
-import android.widget.GridView;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-public class ThumbnailActivity extends Fragment {
-
- private CommunicationService mCommunicationService;
-
- private GridView mGrid;
- private ImageView mCurrentImage;
- private TextView mCurrentText;
-
- private SlideShow mSlideShow;
- private Context mContext;
-
- @Override
- 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) v.findViewById(R.id.thumbnail_grid);
-
- mGrid.setOnItemClickListener(new ClickListener());
- mContext = container.getContext();
-
- return v;
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- }
-
- @Override
- public void onPause() {
- super.onPause();
- }
-
- private void setSelected(int position) {
- formatUnselected(mCurrentImage, mCurrentText);
-
- View aV = mGrid.getChildAt(position);
- if (aV != null) {
- mCurrentImage = (ImageView) aV.findViewById(R.id.sub_thumbnail);
- mCurrentText = (TextView) aV.findViewById(R.id.sub_number);
-
- formatSelected(mCurrentImage, mCurrentText);
- }
- }
-
- private void formatUnselected(ImageView aImage, TextView aText) {
- if (aImage != null) {
- aImage.setBackgroundColor(getResources().getColor(
- R.color.thumbnail_border));
- }
- if (aText != null) {
- aText.setTypeface(Typeface.create(aText.getTypeface(),
- Typeface.NORMAL));
- }
- }
-
- private void formatSelected(ImageView aImage, TextView aText) {
- if (aImage != null) {
- aImage.setBackgroundColor(getResources().getColor(
- R.color.thumbnail_border_selected));
- }
- if (aText != null) {
- aText.setTypeface(Typeface.create(aText.getTypeface(),
- Typeface.BOLD));
- }
- }
-
- // ------------------------------------------------- SERVICE CONNECTION ----
-
- // ----------------------------------------------------- CLICK LISTENER ----
- protected class ClickListener implements AdapterView.OnItemClickListener {
- public void onItemClick(AdapterView<?> parent, View v, int position,
- long id) {
- if (mCommunicationService != null)
- mCommunicationService.getTransmitter().gotoSlide(position);
- }
- }
-
- // ---------------------------------------------------- MESSAGE HANDLER ----
-
- 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;
-
- }
- }
-
- // ------------------------------------------------- THUMBNAIL ADAPTER ----
- protected class ThumbnailAdapter extends BaseAdapter {
-
- private Context mContext;
-
- private SlideShow mSlideShow;
-
- public ThumbnailAdapter(Context aContext, SlideShow aSlideShow) {
- mContext = aContext;
- mSlideShow = aSlideShow;
- }
-
- @Override
- public int getCount() {
- return mSlideShow.getSize();
- }
-
- @Override
- public Object getItem(int arg0) {
- return null;
- }
-
- @Override
- public long getItemId(int position) {
- return 0;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- LayoutInflater aInflater = (LayoutInflater) mContext
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View v = aInflater.inflate(R.layout.slide_thumbnail, null);
-
- ImageView aImage = (ImageView) v.findViewById(R.id.sub_thumbnail);
- TextView aText = (TextView) v.findViewById(R.id.sub_number);
-
- // Do the image & number styling
- int aBorderWidth = getResources().getInteger(
- R.integer.thumbnail_border_width);
- aImage.setPadding(aBorderWidth, aBorderWidth, aBorderWidth,
- aBorderWidth);
-
- if ((mSlideShow != null)
- && (position == mSlideShow.getCurrentSlide())) {
- formatSelected(aImage, aText);
- mCurrentImage = aImage;
- mCurrentText = aText;
- } else {
- formatUnselected(aImage, aText);
- }
-
- Bitmap aBitmap = mSlideShow.getImage(position);
- if (aBitmap != null) {
- aImage.setImageBitmap(aBitmap);
- }
-
- aText.setText(String.valueOf(position + 1));
-
- return v;
- }
- }
-}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
new file mode 100644
index 0000000..b1ed882
--- /dev/null
+++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+package org.libreoffice.impressremote;
+
+import org.libreoffice.impressremote.communication.CommunicationService;
+import org.libreoffice.impressremote.communication.SlideShow;
+
+import android.app.Fragment;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Typeface;
+import android.os.Bundle;
+import android.os.Message;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.GridView;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class ThumbnailFragment extends Fragment {
+
+ private CommunicationService mCommunicationService;
+
+ private GridView mGrid;
+ private ImageView mCurrentImage;
+ private TextView mCurrentText;
+
+ private SlideShow mSlideShow;
+ private Context mContext;
+
+ @Override
+ 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) v.findViewById(R.id.thumbnail_grid);
+
+ mGrid.setOnItemClickListener(new ClickListener());
+ mContext = container.getContext();
+
+ if (mCommunicationService != null && mSlideShow != null) {
+ mGrid.setAdapter(new ThumbnailAdapter(mContext, mSlideShow));
+ }
+
+ return v;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ }
+
+ private void setSelected(int position) {
+ formatUnselected(mCurrentImage, mCurrentText);
+
+ View aV = mGrid.getChildAt(position);
+ if (aV != null) {
+ mCurrentImage = (ImageView) aV.findViewById(R.id.sub_thumbnail);
+ mCurrentText = (TextView) aV.findViewById(R.id.sub_number);
+
+ formatSelected(mCurrentImage, mCurrentText);
+ }
+ }
+
+ private void formatUnselected(ImageView aImage, TextView aText) {
+ if (aImage != null) {
+ aImage.setBackgroundColor(getResources().getColor(
+ R.color.thumbnail_border));
+ }
+ if (aText != null) {
+ aText.setTypeface(Typeface.create(aText.getTypeface(),
+ Typeface.NORMAL));
+ }
+ }
+
+ private void formatSelected(ImageView aImage, TextView aText) {
+ if (aImage != null) {
+ aImage.setBackgroundColor(getResources().getColor(
+ R.color.thumbnail_border_selected));
+ }
+ if (aText != null) {
+ aText.setTypeface(Typeface.create(aText.getTypeface(),
+ Typeface.BOLD));
+ }
+ }
+
+ // ------------------------------------------------- SERVICE CONNECTION ----
+
+ // ----------------------------------------------------- CLICK LISTENER ----
+ protected class ClickListener implements AdapterView.OnItemClickListener {
+ public void onItemClick(AdapterView<?> parent, View v, int position,
+ long id) {
+ if (mCommunicationService != null)
+ mCommunicationService.getTransmitter().gotoSlide(position);
+ }
+ }
+
+ // ---------------------------------------------------- MESSAGE HANDLER ----
+
+ public void setCommunicationService(
+ CommunicationService aCommunicationService) {
+ mCommunicationService = aCommunicationService;
+ mSlideShow = mCommunicationService.getSlideShow();
+ if (mGrid != null) {
+ 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;
+
+ }
+ }
+
+ // ------------------------------------------------- THUMBNAIL ADAPTER ----
+ protected class ThumbnailAdapter extends BaseAdapter {
+
+ private Context mContext;
+
+ private SlideShow mSlideShow;
+
+ public ThumbnailAdapter(Context aContext, SlideShow aSlideShow) {
+ mContext = aContext;
+ mSlideShow = aSlideShow;
+ }
+
+ @Override
+ public int getCount() {
+ return mSlideShow.getSize();
+ }
+
+ @Override
+ public Object getItem(int arg0) {
+ return null;
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return 0;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ LayoutInflater aInflater = (LayoutInflater) mContext
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View v = aInflater.inflate(R.layout.slide_thumbnail, null);
+
+ ImageView aImage = (ImageView) v.findViewById(R.id.sub_thumbnail);
+ TextView aText = (TextView) v.findViewById(R.id.sub_number);
+
+ // Do the image & number styling
+ int aBorderWidth = getResources().getInteger(
+ R.integer.thumbnail_border_width);
+ aImage.setPadding(aBorderWidth, aBorderWidth, aBorderWidth,
+ aBorderWidth);
+
+ if ((mSlideShow != null)
+ && (position == mSlideShow.getCurrentSlide())) {
+ formatSelected(aImage, aText);
+ mCurrentImage = aImage;
+ mCurrentText = aText;
+ } else {
+ formatUnselected(aImage, aText);
+ }
+
+ Bitmap aBitmap = mSlideShow.getImage(position);
+ if (aBitmap != null) {
+ aImage.setImageBitmap(aBitmap);
+ }
+
+ aText.setText(String.valueOf(position + 1));
+
+ return v;
+ }
+ }
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
index 1b2ffff..9d07833 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
@@ -10,14 +10,11 @@ package org.libreoffice.impressremote.communication;
import java.util.ArrayList;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.util.Base64;
-import android.util.SparseArray;
public class Receiver {
@@ -34,7 +31,6 @@ public class Receiver {
}
public void parseCommand(ArrayList<String> aCommand) {
- System.out.println("parsing " + aCommand.get(0));
if (mActivityMessenger == null) {
return;
}
@@ -44,7 +40,7 @@ public class Receiver {
mSlideShow = new SlideShow(aSlideShowlength);
Message aMessage = Message.obtain(null,
- CommunicationService.MSG_SLIDESHOW_STARTED);
+ CommunicationService.MSG_SLIDESHOW_STARTED);
Bundle aData = new Bundle();
aMessage.setData(aData);
try {
@@ -60,7 +56,7 @@ public class Receiver {
int aSlideNumber = Integer.parseInt(aCommand.get(1));
Message aMessage = Message.obtain(null,
- CommunicationService.MSG_SLIDE_CHANGED);
+ CommunicationService.MSG_SLIDE_CHANGED);
Bundle aData = new Bundle();
aData.putInt("slide_number", aSlideNumber);
aMessage.setData(aData);
@@ -79,7 +75,7 @@ public class Receiver {
// Notify the frontend
Message aMessage = Message.obtain(null,
- CommunicationService.MSG_SLIDE_PREVIEW);
+ CommunicationService.MSG_SLIDE_PREVIEW);
Bundle aData = new Bundle();
aData.putInt("slide_number", aSlideNumber);
aMessage.setData(aData);
commit 7f3d7723e1c1d467861c89617c6097219a5e7bc7
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Mon Jul 23 14:53:06 2012 +0200
Fixed thumbnail control. Changed thumbnail activity to fragment.
Change-Id: I4e8a9d37f3b418728404b7fab4f7b6e3c3b5e5b9
diff --git a/android/sdremote/res/layout/activity_presentation.xml b/android/sdremote/res/layout/activity_presentation.xml
index 0cdff5a..f482b3c 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/activity_thumbnail.xml
deleted file mode 100644
index 068ab78..0000000
--- a/android/sdremote/res/layout/activity_thumbnail.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<GridView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/thumbnail_grid"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:columnWidth="90dp"
- android:gravity="center"
- android:horizontalSpacing="10dp"
- android:numColumns="auto_fit"
- android:stretchMode="columnWidth"
- android:verticalSpacing="10dp" >
-
-</GridView>
\ No newline at end of file
diff --git a/android/sdremote/res/layout/fragment_thumbnail.xml b/android/sdremote/res/layout/fragment_thumbnail.xml
new file mode 100644
index 0000000..068ab78
--- /dev/null
+++ b/android/sdremote/res/layout/fragment_thumbnail.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<GridView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/thumbnail_grid"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:columnWidth="90dp"
+ android:gravity="center"
+ android:horizontalSpacing="10dp"
+ android:numColumns="auto_fit"
+ android:stretchMode="columnWidth"
+ android:verticalSpacing="10dp" >
+
+</GridView>
\ 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 b7e3b80..45bfd75 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 0d2f3e0..f73e772 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 f295163..3890ff3 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 a613b5c..82512dc 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 1880c3f..94065b0 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 a42be1f..9497f87 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 5c73913..e4f19f5 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: */
commit 997815fc222a174970776104a90b462ab6db4d8f
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Mon Jul 23 11:18:23 2012 +0200
Added styling and Timer code.
Change-Id: I I044efc4e317fa56f9e3670c7b68d287dcc74ed53
diff --git a/android/sdremote/.settings/org.eclipse.jdt.core.prefs b/android/sdremote/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..8000cd6
--- /dev/null
+++ b/android/sdremote/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml
index e136ca3..fc00786 100644
--- a/android/sdremote/AndroidManifest.xml
+++ b/android/sdremote/AndroidManifest.xml
@@ -5,11 +5,15 @@
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14"/>
+
+ <uses-sdk
+ android:minSdkVersion="14"
+ android:targetSdkVersion="14" />
<application
android:icon="@drawable/ic_launcher"
- android:label="@string/app_name" >
+ android:label="@string/app_name"
+ android:theme="@style/Theme.ImpressRemote" >
<activity
android:name="TestClient"
android:label="@string/app_name" >
@@ -22,7 +26,18 @@
<service android:name=".communication.CommunicationService" >
</service>
- <activity android:name=".ThumbnailActivity"></activity>
+
+ <activity android:name=".ThumbnailActivity" >
+ </activity>
+ <activity
+ android:name=".PresentationActivity"
+ android:label="@string/title_activity_presentation" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
</application>
</manifest>
\ No newline at end of file
diff --git a/android/sdremote/res/drawable-hdpi/ic_action_search.png b/android/sdremote/res/drawable-hdpi/ic_action_search.png
new file mode 100644
index 0000000..67de12d
Binary files /dev/null and b/android/sdremote/res/drawable-hdpi/ic_action_search.png differ
diff --git a/android/sdremote/res/drawable-mdpi/ic_action_search.png b/android/sdremote/res/drawable-mdpi/ic_action_search.png
new file mode 100644
index 0000000..134d549
Binary files /dev/null and b/android/sdremote/res/drawable-mdpi/ic_action_search.png differ
diff --git a/android/sdremote/res/drawable-xhdpi/ic_action_search.png b/android/sdremote/res/drawable-xhdpi/ic_action_search.png
new file mode 100644
index 0000000..d699c6b
Binary files /dev/null and b/android/sdremote/res/drawable-xhdpi/ic_action_search.png differ
diff --git a/android/sdremote/res/layout/activity_presentation.xml b/android/sdremote/res/layout/activity_presentation.xml
new file mode 100644
index 0000000..0cdff5a
--- /dev/null
+++ b/android/sdremote/res/layout/activity_presentation.xml
@@ -0,0 +1,14 @@
+<RelativeLayout 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" >
+
+ <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>
diff --git a/android/sdremote/res/menu/activity_presentation.xml b/android/sdremote/res/menu/activity_presentation.xml
new file mode 100644
index 0000000..cfc10fd
--- /dev/null
+++ b/android/sdremote/res/menu/activity_presentation.xml
@@ -0,0 +1,6 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/menu_settings"
+ android:title="@string/menu_settings"
+ android:orderInCategory="100"
+ android:showAsAction="never" />
+</menu>
diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml
index 78fbe65..2698fea 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="app_name">Launcher</string>
-</resources>
+
+ <string name="app_name">LibreOffice Remote</string>
+ <string name="hello_world">Hello world!</string>
+ <string name="menu_settings">Settings</string>
+ <string name="title_activity_presentation">PresentationActivity</string>
+
+</resources>
\ No newline at end of file
diff --git a/android/sdremote/res/values/styles.xml b/android/sdremote/res/values/styles.xml
new file mode 100644
index 0000000..fdc3926
--- /dev/null
+++ b/android/sdremote/res/values/styles.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <color name="orange">#EE4400</color>
+ <color name="light_grey">#E8E9E8</color>
+
+ <integer name="thumbnail_border_width">3</integer>
+
+ <color name="thumbnail_border">#B4B4B4</color>
+ <color name="thumbnail_border_selected">#EE4400</color>
+
+ <style name="Theme.ImpressRemote.ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
+ <item name="android:background">@color/orange</item>
+ </style>
+
+ <style name="Theme.ImpressRemote" parent="android:style/Theme.Holo.Light">
+ <item name="android:actionBarStyle">@style/Theme.ImpressRemote.ActionBar</item>
+ <item name="android:windowBackground">@color/light_grey</item>
+ </style>
+</resources>
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ActionBarManager.java b/android/sdremote/src/org/libreoffice/impressremote/ActionBarManager.java
new file mode 100644
index 0000000..44ef183
--- /dev/null
+++ b/android/sdremote/src/org/libreoffice/impressremote/ActionBarManager.java
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+package org.libreoffice.impressremote;
+
+/**
+ * Used to manage the action bar whenever a presentation is running.
+ *
+ */
+public class ActionBarManager {
+
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/Launcher.java b/android/sdremote/src/org/libreoffice/impressremote/Launcher.java
index 77f2645..8b27ebf 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/Launcher.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/Launcher.java
@@ -1,3 +1,11 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
package org.libreoffice.impressremote;
import android.app.Activity;
@@ -12,3 +20,4 @@ public class Launcher extends Activity {
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ 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
new file mode 100644
index 0000000..b7e3b80
--- /dev/null
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -0,0 +1,20 @@
+package org.libreoffice.impressremote;
+
+import android.os.Bundle;
+import android.app.Activity;
+import android.view.Menu;
+
+public class PresentationActivity extends Activity {
+
+ @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 99b3fad..0d2f3e0 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/TestClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/TestClient.java
@@ -1,13 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
package org.libreoffice.impressremote;
import org.libreoffice.impressremote.communication.CommunicationService;
+
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -25,8 +33,6 @@ public class TestClient extends Activity {
private boolean mIsBound = false;
- private int mCurrentSlide = 0;
-
private CommunicationService mCommunicationService;
final Messenger mMessenger = new Messenger(new MessageHandler());
@@ -51,25 +57,32 @@ public class TestClient extends Activity {
@Override
protected void onPause() {
super.onPause();
- doUnbindService();
+ // doUnbindService();
+ }
+
+ @Override
+ public void onBackPressed() {
+ // TODO Auto-generated method stub
+ stopService(new Intent(this, CommunicationService.class));
+ super.onBackPressed();
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
-// mCommunicationService.disconnect();
- stopService(new Intent(this, CommunicationService.class));
+ // mCommunicationService.disconnect();
+ // stopService(new Intent(this, CommunicationService.class));
}
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName aClassName,
- IBinder aService) {
+ IBinder aService) {
mCommunicationService = ((CommunicationService.CBinder) aService)
- .getService();
+ .getService();
mCommunicationService.connectTo(
- CommunicationService.Protocol.NETWORK, "10.0.2.2");
+ CommunicationService.Protocol.NETWORK, "10.0.2.2");
mCommunicationService.setActivityMessenger(mMessenger);
enableButtons(true);
}
@@ -84,8 +97,7 @@ public class TestClient extends Activity {
void doBindService() {
Intent aIntent = new Intent(this, CommunicationService.class);
startService(aIntent);
- bindService(aIntent, mConnection,
- Context.BIND_IMPORTANT);
+ bindService(aIntent, mConnection, Context.BIND_IMPORTANT);
mIsBound = true;
}
@@ -138,8 +150,9 @@ public class TestClient extends Activity {
mThumbnailButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- Intent aIntent = new Intent(TestClient.this, ThumbnailActivity.class);
- startActivity( aIntent);
+ Intent aIntent = new Intent(TestClient.this,
+ ThumbnailActivity.class);
+ startActivity(aIntent);
}
});
@@ -162,9 +175,9 @@ public class TestClient extends Activity {
// We continue on to try and update the image.
case CommunicationService.MSG_SLIDE_PREVIEW:
int aSlideNumber = aData.getInt("slide_number");
- if ( mCurrentPreviewImageMissing ) {
- Bitmap aImage = mCommunicationService
- .getSlideShow().getImage(aSlideNumber);
+ if (mCurrentPreviewImageMissing) {
+ Bitmap aImage = mCommunicationService.getSlideShow()
+ .getImage(aSlideNumber);
if (aImage != null) {
mImageView.setImageBitmap(aImage);
mCurrentPreviewImageMissing = false;
@@ -176,3 +189,4 @@ public class TestClient extends Activity {
}
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java
index ce39e0c..f295163 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java
@@ -1,6 +1,13 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
package org.libreoffice.impressremote;
-import org.libreoffice.impressremote.TestClient.MessageHandler;
import org.libreoffice.impressremote.communication.CommunicationService;
import org.libreoffice.impressremote.communication.SlideShow;
@@ -10,7 +17,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.graphics.Bitmap;
-import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
@@ -43,7 +49,7 @@ public class ThumbnailActivity extends Activity {
setContentView(R.layout.activity_thumbnail);
bindService(new Intent(this, CommunicationService.class), mConnection,
- Context.BIND_ADJUST_WITH_ACTIVITY);
+ Context.BIND_ADJUST_WITH_ACTIVITY);
mIsBound = true;
mGrid = (GridView) findViewById(R.id.thumbnail_grid);
@@ -61,24 +67,44 @@ public class ThumbnailActivity extends Activity {
}
}
+ // @Override
+ // public boolean onCreateOptionsMenu(Menu menu) {
+ // MenuInflater inflater = getMenuInflater();
+ // inflater.inflate(R.menu.main_activity, menu);
+ // return true;
+ // }
+
private void setSelected(int position) {
- if (mCurrentImage != null) {
- mCurrentImage.setPadding(0, 0, 0, 0);
- }
- if (mCurrentText != null) {
- mCurrentText.setTypeface(Typeface.create(
- mCurrentText.getTypeface(), Typeface.NORMAL));
- }
+ formatUnselected(mCurrentImage, mCurrentText);
View aV = mGrid.getChildAt(position);
if (aV != null) {
mCurrentImage = (ImageView) aV.findViewById(R.id.sub_thumbnail);
mCurrentText = (TextView) aV.findViewById(R.id.sub_number);
- mCurrentImage.setBackgroundColor(Color.RED);
- mCurrentImage.setPadding(2, 2, 2, 2);
- mCurrentText.setTypeface(Typeface.create(mCurrentText.getTypeface(),
- Typeface.BOLD));
+ formatSelected(mCurrentImage, mCurrentText);
+ }
+ }
+
+ private void formatUnselected(ImageView aImage, TextView aText) {
+ if (aImage != null) {
+ aImage.setBackgroundColor(getResources().getColor(
+ R.color.thumbnail_border));
+ }
+ if (aText != null) {
+ aText.setTypeface(Typeface.create(mCurrentText.getTypeface(),
+ Typeface.NORMAL));
+ }
+ }
+
+ private void formatSelected(ImageView aImage, TextView aText) {
+ if (aImage != null) {
+ aImage.setBackgroundColor(getResources().getColor(
+ R.color.thumbnail_border_selected));
+ }
+ if (aText != null) {
+ aText.setTypeface(Typeface.create(mCurrentText.getTypeface(),
+ Typeface.BOLD));
}
}
@@ -88,13 +114,13 @@ public class ThumbnailActivity extends Activity {
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName aClassName,
- IBinder aService) {
+ IBinder aService) {
mCommunicationService = ((CommunicationService.CBinder) aService)
- .getService();
+ .getService();
mCommunicationService.setActivityMessenger(mMessenger);
mSlideShow = mCommunicationService.getSlideShow();
mGrid.setAdapter(new ThumbnailAdapter(ThumbnailActivity.this,
- mSlideShow));
+ mSlideShow));
}
@Override
@@ -106,7 +132,7 @@ public class ThumbnailActivity extends Activity {
// ----------------------------------------------------- CLICK LISTENER ----
protected class ClickListener implements AdapterView.OnItemClickListener {
public void onItemClick(AdapterView<?> parent, View v, int position,
- long id) {
+ long id) {
mCommunicationService.getTransmitter().gotoSlide(position);
}
}
@@ -160,12 +186,25 @@ public class ThumbnailActivity extends Activity {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater aInflater = (LayoutInflater) mContext
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = aInflater.inflate(R.layout.slide_thumbnail, null);
ImageView aImage = (ImageView) v.findViewById(R.id.sub_thumbnail);
TextView aText = (TextView) v.findViewById(R.id.sub_number);
+ // Do the image & number styling
+ int aBorderWidth = getResources().getInteger(
+ R.integer.thumbnail_border_width);
+ aImage.setPadding(aBorderWidth, aBorderWidth, aBorderWidth,
+ aBorderWidth);
+
+ if ((mSlideShow != null)
+ && (position == mSlideShow.getCurrentSlide())) {
+ formatSelected(aImage, aText);
+ } else {
+ formatUnselected(aImage, aText);
+ }
+
Bitmap aBitmap = mSlideShow.getImage(position);
if (aBitmap != null) {
aImage.setImageBitmap(aBitmap);
@@ -173,13 +212,8 @@ public class ThumbnailActivity extends Activity {
aText.setText(String.valueOf(position + 1));
-// if ((mSlideShow != null)
-// && (position == mSlideShow.getCurrentSlide())) {
-// setSelected(position);
-// }
-
return v;
}
-
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
index 98f713b..b3209b8 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
@@ -1,3 +1,11 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
package org.libreoffice.impressremote.communication;
import java.io.BufferedReader;
@@ -8,10 +16,6 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
-import org.apache.http.util.ByteArrayBuffer;
-import org.json.JSONException;
-import org.json.JSONObject;
-
/**
* Generic Client for the remote control. To implement a Client for a specific
* transport medium you must provide input and output streams (
@@ -50,7 +54,7 @@ public abstract class Client {
BufferedReader aReader;
try {
aReader = new BufferedReader(new InputStreamReader(mInputStream,
- CHARSET));
+ CHARSET));
while (true) {
ArrayList<String> aList = new ArrayList<String>();
String aTemp;
@@ -82,10 +86,11 @@ public abstract class Client {
mOutputStream.write(command.getBytes(CHARSET));
} catch (UnsupportedEncodingException e) {
throw new Error("Specified network encoding [" + CHARSET
- + " not available.");
+ + " not available.");
} catch (IOException e) {
// TODO Notify that stream has closed.
}
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index 48a8e7c..b03c03b 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -1,9 +1,15 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
package org.libreoffice.impressremote.communication;
import android.app.Service;
import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.os.Binder;
import android.os.IBinder;
import android.os.Messenger;
@@ -59,6 +65,24 @@ public class CommunicationService extends Service {
return mTransmitter;
}
+ /**
+ * Connect to a specific server. This method cannot be called on the main
+ * activity thread.
+ *
+ * @param aServer
+ * The Server to connect to.
+ */
+ public void connectTo(Server aServer) {
+ connectTo(aServer.getProtocol(), aServer.getAddress());
+ }
+
+ /**
+ * Connect to a specific server. This method cannot be called on the main
+ * activity thread.
+ *
+ * @param aProtocol
+ * @param address
+ */
public void connectTo(Protocol aProtocol, String address) {
switch (aProtocol) {
case NETWORK:
@@ -66,11 +90,19 @@ public class CommunicationService extends Service {
mTransmitter = new Transmitter(mClient);
mClient.setReceiver(mReceiver);
break;
+ case BLUETOOTH:
+ break;
+ default:
+ break;
}
}
+ public Server[] getServers() {
+ return null;
+ }
+
public void disconnect() {
mClient.closeConnection();
}
@@ -79,5 +111,39 @@ public class CommunicationService extends Service {
return mReceiver.getSlideShow();
}
+ // ---------------------------------------------------- SERVER -------------
+ /**
+ * Class describing a remote server.
+ */
+ public class Server {
+ private Protocol mProtocol;
+ private String mAddress;
+ private String mName;
+
+ protected Server(Protocol aProtocol, String aAddress, String aName) {
+ mProtocol = aProtocol;
+ mAddress = aAddress;
+ mName = aName;
+ }
+
+ public Protocol getProtocol() {
+ return mProtocol;
+ }
+
+ public String getAddress() {
+ return mAddress;
+ }
+
+ /**
+ * Get a human friendly name for the server.
+ *
+ * @return The name.
+ */
+ public String getName() {
+ return mName;
+ }
+
+ }
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
index d8bd86d..9c1f163 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/NetworkClient.java
@@ -1,3 +1,11 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
package org.libreoffice.impressremote.communication;
import java.io.IOException;
@@ -20,7 +28,7 @@ public class NetworkClient extends Client {
public NetworkClient(String ipAddress) {
// FIXME: eventually networking will be fully threaded.
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
- .permitAll().build();
+ .permitAll().build();
StrictMode.setThreadPolicy(policy);
try {
mSocket = new Socket(ipAddress, PORT);
@@ -49,3 +57,4 @@ public class NetworkClient extends Client {
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
index b65bcaf..85e0c27 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
@@ -1,3 +1,11 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
package org.libreoffice.impressremote.communication;
import android.graphics.Bitmap;
@@ -34,4 +42,57 @@ public class SlideShow {
byte[] aImage = mPreviewImages.get(aSlide);
return BitmapFactory.decodeByteArray(aImage, 0, aImage.length);
}
+
+ // ---------------------------------------------------- TIMER --------------
+ private Timer mTimer = new Timer();
+
+ public Timer getTimer() {
+ return mTimer;
+ }
+
+ public class Timer {
+ /**
+ * This stores the starting time of the timer if running.
+ *
+ * If paused this stores how long the timer was previously running.
+ */
+ private long aTime = 0;
+
+ private boolean mIsRunning = false;
+
+ public boolean isRunning() {
+ return mIsRunning;
+ }
+
+ /**
+ * Reset the timer, and stop it it was running.
+ */
+ public void reset() {
+ mIsRunning = false;
+ aTime = 0;
+ }
+
+ public void startTimer() {
+ if (mIsRunning)
+ return;
+
+ aTime = System.currentTimeMillis() - aTime;
+ }
+
+ public void stopTimer() {
+ if (!mIsRunning)
+ return;
+
+ aTime = System.currentTimeMillis() - aTime;
+ }
+
+ public long getTimeMillis() {
+ if (mIsRunning)
+ return (System.currentTimeMillis() - aTime);
+ else
+ return aTime;
+ }
+
+ }
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
index 679b287..8c3c69f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java
@@ -1,3 +1,11 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
package org.libreoffice.impressremote.communication;
import android.graphics.Color;
@@ -40,6 +48,7 @@ public class Transmitter {
/**
* Set the screen to a specific colour. Only use if a non default colour is
* needed.
+ *
* @param aColor
*/
public void blankScreen(Color aColor) {
@@ -55,3 +64,4 @@ public class Transmitter {
mClient.sendCommand("presentation_stop\n\n");
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
More information about the Libreoffice-commits
mailing list