summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2012-07-23 18:18:02 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-08-06 10:23:00 +0100
commit22608b731635fdc28ab6b1a490ad65a2d4c2df7d (patch)
tree689545bf198c4506e45e271976ce8dd6bb39df09 /android
parentc67a772da68c75333b3aae73ee3d6f3f835552c5 (diff)
Added resizeable view.
Change-Id: Ifddbd1df740494ce5680e4a62a6dae81f395b49a
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/AndroidManifest.xml2
-rw-r--r--android/sdremote/res/drawable/handle_center.pngbin0 -> 268 bytes
-rw-r--r--android/sdremote/res/drawable/handle_line.pngbin0 -> 112 bytes
-rw-r--r--android/sdremote/res/drawable/testimage.pngbin0 -> 9075 bytes
-rw-r--r--android/sdremote/res/layout/fragment_presentation.xml60
-rw-r--r--android/sdremote/res/values/strings.xml1
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java13
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java54
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/TestClient.java1
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java (renamed from android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java)10
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java10
11 files changed, 136 insertions, 15 deletions
diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml
index fc007865ac29..689e0ecfe9ee 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 000000000000..b591d3594ad4
--- /dev/null
+++ b/android/sdremote/res/drawable/handle_center.png
Binary files differ
diff --git a/android/sdremote/res/drawable/handle_line.png b/android/sdremote/res/drawable/handle_line.png
new file mode 100644
index 000000000000..ede5d818ace2
--- /dev/null
+++ b/android/sdremote/res/drawable/handle_line.png
Binary files differ
diff --git a/android/sdremote/res/drawable/testimage.png b/android/sdremote/res/drawable/testimage.png
new file mode 100644
index 000000000000..4529586c5901
--- /dev/null
+++ b/android/sdremote/res/drawable/testimage.png
Binary files differ
diff --git a/android/sdremote/res/layout/fragment_presentation.xml b/android/sdremote/res/layout/fragment_presentation.xml
new file mode 100644
index 000000000000..9331dc53bae1
--- /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 2698feac6237..668d0739b948 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 45bfd75ede1a..e06d2b5a3e1b 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 000000000000..5ae47b306446
--- /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 f73e772d707b..7ecabbfc1d45 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/ThumbnailFragment.java
index 3890ff3de37b..b1ed882a4493 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
@@ -26,7 +26,7 @@ import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
-public class ThumbnailActivity extends Fragment {
+public class ThumbnailFragment extends Fragment {
private CommunicationService mCommunicationService;
@@ -49,6 +49,10 @@ public class ThumbnailActivity extends Fragment {
mGrid.setOnItemClickListener(new ClickListener());
mContext = container.getContext();
+ if (mCommunicationService != null && mSlideShow != null) {
+ mGrid.setAdapter(new ThumbnailAdapter(mContext, mSlideShow));
+ }
+
return v;
}
@@ -114,7 +118,9 @@ public class ThumbnailActivity extends Fragment {
CommunicationService aCommunicationService) {
mCommunicationService = aCommunicationService;
mSlideShow = mCommunicationService.getSlideShow();
- mGrid.setAdapter(new ThumbnailAdapter(mContext, mSlideShow));
+ if (mGrid != null) {
+ mGrid.setAdapter(new ThumbnailAdapter(mContext, mSlideShow));
+ }
}
public void handleMessage(Message aMessage) {
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
index 1b2ffff2064f..9d07833c4be3 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);