[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - 2 commits - android/sdremote
Artur Dryomov
artur.dryomov at gmail.com
Mon Mar 25 04:12:52 PDT 2013
android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java | 1
android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java | 6 -
android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java | 23 ----
android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java | 1
android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java | 1
android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java | 11 --
android/sdremote/src/org/libreoffice/impressremote/communication/Client.java | 2
android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java | 2
android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java | 6 -
android/sdremote/src/org/libreoffice/impressremote/communication/Server.java | 2
android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java | 2
android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java | 47 +++++-----
12 files changed, 33 insertions(+), 71 deletions(-)
New commits:
commit 410240d23d1d8f25b9ed1b5a59721994071b7cbc
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date: Fri Mar 22 22:13:30 2013 +0300
Clean up Impress remove client source code a bit.
* Remove unnecessary semicolons.
* Remove empty methods that only call super methods.
* Replace String concatenation with StringBuilder.
* Fix possible NullPointerException on String comparison.
* Remove TODO comments generated via IDE.
Change-Id: Id2d2ebd29386080715fd743f81fbfae3a4a0a5ce
Reviewed-on: https://gerrit.libreoffice.org/2915
Reviewed-by: Chris Sherlock <chris.sherlock79 at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at suse.com>
Tested-by: Michael Meeks <michael.meeks at suse.com>
Signed-off-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
index be82eeb..8f172e5 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
@@ -75,7 +75,6 @@ public class BlankScreenFragment extends SherlockFragment {
aListener);
v.findViewById(R.id.blankscreen_return).setOnClickListener(aListener);
mCommunicationService.getTransmitter().blankScreen();
- // TODO Auto-generated method stub
return v;
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index d3a0352..51e590f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -529,12 +529,6 @@ public class PresentationActivity extends SherlockFragmentActivity {
mActionBarManager.hidePopups();
return super.onInterceptTouchEvent(aEvent);
}
-
- @Override
- public boolean onTouchEvent(MotionEvent aEvent) {
- return super.onTouchEvent(aEvent);
- }
-
}
private BroadcastReceiver mListener = new BroadcastReceiver() {
diff --git a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
index 1b8c044..3b0f684 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
@@ -171,7 +171,6 @@ public class SelectorActivity extends SherlockActivity {
@Override
protected void onPause() {
- // TODO Auto-generated method stub
super.onPause();
if (mCommunicationService != null) {
mCommunicationService.stopSearching();
diff --git a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
index 56d5bad..471e96b 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java
@@ -18,7 +18,6 @@ public class SettingsActivity extends SherlockPreferenceActivity {
// but build with sdk 15
@Override
protected void onCreate(Bundle savedInstanceState) {
- // TODO Auto-generated method stub
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
addPreferencesFromResource(R.xml.preferences);
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
index d1f2487..c939973 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
@@ -82,17 +82,6 @@ public class ThumbnailFragment extends SherlockFragment {
mCurrentText = null;
}
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- }
-
- @Override
- public void onPause() {
- super.onPause();
- }
-
private void setSelected(int position) {
formatUnselected(mCurrentImage, mCurrentText);
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
index ce5e3ad..198b873 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java
@@ -58,7 +58,7 @@ public abstract class Client {
Thread t = new Thread() {
public void run() {
listen();
- };
+ }
};
t.start();
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index 5b32661..8028f00 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -33,7 +33,7 @@ public class CommunicationService extends Service implements Runnable {
public enum State {
DISCONNECTED, SEARCHING, CONNECTING, CONNECTED
- };
+ }
/**
* Get the publicly visible device name -- generally the bluetooth name,
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
index 5a6316e..4ba252f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
@@ -99,13 +99,13 @@ public class Receiver {
}
} else if (aInstruction.equals("slide_notes")) {
int aSlideNumber = Integer.parseInt(aCommand.get(1));
- String aNotes = new String();
+ StringBuilder aNotes = new StringBuilder();
for (int i = 2; i < aCommand.size(); i++) {
- aNotes += aCommand.get(i);
+ aNotes.append(aCommand.get(i));
}
// Store image internally
- mSlideShow.putNotes(aSlideNumber, aNotes);
+ mSlideShow.putNotes(aSlideNumber, aNotes.toString());
Intent aIntent = new Intent(
CommunicationService.MSG_SLIDE_NOTES);
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
index 82172be..77e6eb3 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
@@ -12,7 +12,7 @@ public class Server {
public enum Protocol {
NETWORK, BLUETOOTH
- };
+ }
private Protocol mProtocol;
private String mAddress;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
index 703069c..f1726ad 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java
@@ -63,7 +63,7 @@ public class ServerFinder {
break;
}
}
- if (i == aBuffer.length || !aCommand.equals("LOREMOTE_ADVERTISE")) {
+ if (i == aBuffer.length || !"LOREMOTE_ADVERTISE".equals(aCommand)) {
return;
}
for (int j = i + 1; j < aBuffer.length; j++) {
commit 4ef4046419a3bc351a2ae06362ff5049cd120f96
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date: Fri Mar 22 23:03:32 2013 +0300
fdo#62591 - change Impress remote slide previews building
* Store bitmaps directly instead of byte arrays.
* Store bitmaps with shadows instead of one set with shadows and another
without them.
This change should optimize memory usage a bit.
Change-Id: Ied7ce57a660438a06167e8984d16a6f26ebd8c23
Reviewed-on: https://gerrit.libreoffice.org/2917
Reviewed-by: Michael Meeks <michael.meeks at suse.com>
Tested-by: Michael Meeks <michael.meeks at suse.com>
Signed-off-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 0aab5a6..8f1ba7d 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -21,10 +21,7 @@ import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.res.Configuration;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.RectF;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
@@ -38,7 +35,6 @@ import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ImageView;
import android.widget.TextView;
-
import com.actionbarsherlock.app.SherlockFragment;
public class PresentationFragment extends SherlockFragment {
@@ -306,24 +302,7 @@ public class PresentationFragment extends SherlockFragment {
@Override
protected Bitmap createBitmap(int position) {
- Bitmap aBitmap = mSlideShow.getImage(position);
- final int borderWidth = 8;
-
- Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
- p.setShadowLayer(borderWidth, 0, 0, Color.BLACK);
-
- RectF aRect = new RectF(borderWidth, borderWidth, borderWidth
- + aBitmap.getWidth(), borderWidth
- + aBitmap.getHeight());
- Bitmap aOut = Bitmap.createBitmap(aBitmap.getWidth() + 2
- * borderWidth, aBitmap.getHeight() + 2
- * borderWidth, aBitmap.getConfig());
- Canvas canvas = new Canvas(aOut);
- canvas.drawColor(getResources().getColor(R.color.light_grey));
- canvas.drawRect(aRect, p);
- canvas.drawBitmap(aBitmap, null, aRect, null);
-
- return aOut;
+ return mSlideShow.getImage(position);
}
}
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
index 3925fe2..8b7a8e1 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
@@ -9,17 +9,20 @@
package org.libreoffice.impressremote.communication;
import org.libreoffice.impressremote.R;
-import org.libreoffice.impressremote.Globals;
-import android.util.Log;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.RectF;
import android.util.SparseArray;
+
public class SlideShow {
- private SparseArray<byte[]> mPreviewImages = new SparseArray<byte[]>();
+ private SparseArray<Bitmap> mPreviews = new SparseArray<Bitmap>();
private SparseArray<String> mNotes = new SparseArray<String>();
private int mSize = 0;
@@ -47,28 +50,28 @@ public class SlideShow {
}
protected void putImage(int aSlide, byte[] aImage) {
- mPreviewImages.put(aSlide, aImage);
+ Bitmap aBitmap = BitmapFactory.decodeByteArray(aImage, 0, aImage.length);
+ final int borderWidth = 8;
+
+ Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
+ p.setShadowLayer(borderWidth, 0, 0, Color.BLACK);
+
+ RectF aRect = new RectF(borderWidth, borderWidth, borderWidth
+ + aBitmap.getWidth(), borderWidth
+ + aBitmap.getHeight());
+ Bitmap aOut = Bitmap.createBitmap(aBitmap.getWidth() + 2
+ * borderWidth, aBitmap.getHeight() + 2
+ * borderWidth, aBitmap.getConfig());
+ Canvas canvas = new Canvas(aOut);
+ canvas.drawColor(mContext.getResources().getColor(R.color.light_grey));
+ canvas.drawRect(aRect, p);
+ canvas.drawBitmap(aBitmap, null, aRect, null);
+
+ mPreviews.put(aSlide, aOut);
}
public Bitmap getImage(int aSlide) {
- byte[] aImage = mPreviewImages.get(aSlide);
- if (aImage == null) {
- return BitmapFactory.decodeResource(mContext.getResources(),
- R.drawable.image_loading);
- }
- Bitmap aBitmap = null;
- try {
- aBitmap = BitmapFactory.decodeByteArray(aImage, 0, aImage.length);
- } catch (OutOfMemoryError e) {
- Log.e(Globals.TAG, "Bitmap decoding error byte length: " + aImage.length +
- "first 4 bytes: " + aImage[0] + " " + aImage[1] + " " + aImage[2] + " " + aImage[3] +
- "Exception " + e);
- }
- if (aBitmap == null) {
- return BitmapFactory.decodeResource(mContext.getResources(),
- R.drawable.image_loading);
- }
- return aBitmap;
+ return mPreviews.get(aSlide);
}
protected void putNotes(int aSlide, String aNotes) {
More information about the Libreoffice-commits
mailing list