Commit 3a48ce9d by Thomas Krex

empty view in feedactivity hinzugefügt

parent 2043cb46
......@@ -35,7 +35,9 @@
android:name="tttclient.activities.FeedActivity"
android:label="Feeds" >
</activity>
<activity android:name="tttclient.activities.FeedDetailActivity" >
<activity
android:name="tttclient.activities.FeedDetailActivity"
android:configChanges="orientation|screenSize" >
</activity>
<activity
android:name="tttclient.activities.PlayerActivity"
......
......@@ -35,7 +35,9 @@
android:name="tttclient.activities.FeedActivity"
android:label="Feeds" >
</activity>
<activity android:name="tttclient.activities.FeedDetailActivity" >
<activity
android:name="tttclient.activities.FeedDetailActivity"
android:configChanges="orientation|screenSize" >
</activity>
<activity
android:name="tttclient.activities.PlayerActivity"
......
......@@ -322,34 +322,36 @@ int id abs__submit_area 0x7f04002f
int id abs__textButton 0x7f040013
int id abs__title 0x7f04001b
int id abs__up 0x7f04000b
int id action_settings 0x7f040045
int id add 0x7f040044
int id action_settings 0x7f040047
int id add 0x7f040046
int id button_save 0x7f04003e
int id checkBox1 0x7f04003b
int id connect_btn 0x7f04003a
int id disableHome 0x7f040009
int id edit_query 0x7f040026
int id extend 0x7f040048
int id feedDetailsLv 0x7f040040
int id feed_list 0x7f04003f
int id empty 0x7f040041
int id extend 0x7f04004a
int id feedDetailsLv 0x7f040042
int id feed_list 0x7f040040
int id homeAsUp 0x7f040006
int id indexScrollView 0x7f040033
int id itemTitle 0x7f040042
int id itemTitle 0x7f040044
int id listMode 0x7f040002
int id next 0x7f040047
int id next 0x7f040049
int id normal 0x7f040001
int id playerView_extended 0x7f040034
int id playerView_fullscreen 0x7f040036
int id port_tx 0x7f040039
int id progressBar 0x7f040041
int id progressBar 0x7f040043
int id scrollView1 0x7f040035
int id search 0x7f040046
int id search 0x7f040048
int id server_tx 0x7f040038
int id showCustom 0x7f040008
int id showHome 0x7f040005
int id showTitle 0x7f040007
int id statusIcon 0x7f040043
int id statusIcon 0x7f040045
int id tabMode 0x7f040003
int id textView1 0x7f04003f
int id tx_name 0x7f04003d
int id tx_url 0x7f04003c
int id useLogo 0x7f040004
......@@ -384,11 +386,12 @@ int layout activity_player_fullscreen_overlay 0x7f030017
int layout activity_player_main 0x7f030018
int layout dialog_connect 0x7f030019
int layout dialog_feeds 0x7f03001a
int layout feed_activity 0x7f03001b
int layout feed_details_activity 0x7f03001c
int layout list_feeditems 0x7f03001d
int layout sherlock_spinner_dropdown_item 0x7f03001e
int layout sherlock_spinner_item 0x7f03001f
int layout empty_feeds 0x7f03001b
int layout feed_activity 0x7f03001c
int layout feed_details_activity 0x7f03001d
int layout list_feeditems 0x7f03001e
int layout sherlock_spinner_dropdown_item 0x7f03001f
int layout sherlock_spinner_item 0x7f030020
int menu feed_menu 0x7f0b0000
int menu main 0x7f0b0001
int menu player_menu 0x7f0b0002
......
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
1390577451000 627582 db0f122c99ef9f90dbab3fada6d191f2880cbb8e /Volumes/Macintosh HD/Users/thomaskrex/git/TTTAndroidClient/TTTCLient/libs/android-support-v4.jar
1375081746000 271754 53307dc2bd2b69fd5533458ee11885f55807de4b /Volumes/Macintosh HD/Users/thomaskrex/BA_workspace/actionbarsherlock/libs/android-support-v4.jar
......@@ -12,8 +12,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
android:layout_height="match_parent" >
<ImageView
android:id="@+id/playerView_fullscreen"
......@@ -26,6 +25,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="horizontal"
android:weightSum="3" >
......
<?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" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="No Feeds found!!! \n\n Add a feed by clicking on \n + \nin the Actionbar"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@android:color/darker_gray" />
</LinearLayout>
\ No newline at end of file
......@@ -10,4 +10,12 @@
android:layout_height="wrap_content" >
</ListView>
<ViewStub
android:id="@+id/empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout="@layout/empty_feeds" >
</ViewStub>
</LinearLayout>
\ No newline at end of file
......@@ -6,15 +6,15 @@
<TextView
android:id="@+id/itemTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="4"
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceLarge" />
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="@+id/statusIcon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/ic_action_download" >
</ImageView>
......
......@@ -20,7 +20,7 @@
<resources>
<style name="Theme.Customactionbar" parent="@style/Theme.Sherlock.Light">
<style name="Theme.Customactionbar" parent="@style/Theme.Sherlock.Light.DarkActionBar">
<item name="actionBarItemBackground">@drawable/selectable_background_customactionbar</item>
<item name="popupMenuStyle">@style/PopupMenu.Customactionbar</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Customactionbar</item>
......@@ -32,7 +32,7 @@
<item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Customactionbar</item>
</style>
<style name="ActionBar.Solid.Customactionbar" parent="@style/Widget.Sherlock.Light.ActionBar.Solid">
<style name="ActionBar.Solid.Customactionbar" parent="@style/Widget.Sherlock.Light.ActionBar">
<item name="background">@drawable/ab_solid_customactionbar</item>
<item name="backgroundStacked">@drawable/ab_stacked_solid_customactionbar</item>
<item name="backgroundSplit">@drawable/ab_bottom_solid_customactionbar</item>
......
......@@ -54,6 +54,8 @@ public class FeedActivity extends SherlockActivity implements
android.R.id.text1, android.R.id.text2 });
feedList.setAdapter(adapter);
View empty = findViewById(R.id.empty);
feedList.setEmptyView(empty);
feedList.setOnItemClickListener(this);
feedList.setOnItemLongClickListener(this);
......
......@@ -108,7 +108,7 @@ public class FeedDetailActivity extends SherlockActivity implements
// init progress dialog for showing downloading/unzipping progress
progressDialog = new ProgressDialog(FeedDetailActivity.this);
progressDialog.setIndeterminate(true);
progressDialog.setTitle("Downloading File");
progressDialog.setTitle("Downloading File...");
progressDialog.setMessage("0% downloaded");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setCanceledOnTouchOutside(false);
......
......@@ -72,6 +72,8 @@ public class PlayerActivity extends SherlockActivity implements
dialog.setTitle("Please Wait");
dialog.setMessage("Prepare File ...");
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
AsyncTask<Void, Void, Void> initTask = new AsyncTask<Void, Void, Void>() {
......@@ -88,6 +90,10 @@ public class PlayerActivity extends SherlockActivity implements
recording = new Recording(getApplicationContext(), tttFile,
audioPlayer, imgV, scrollView);
Log.d("Prefs",
" bits/pixel "
+ recording.getProtocolPreferences().bitsPerPixel);
OnClickListener prevListener = new OnClickListener() {
@Override
......@@ -145,13 +151,11 @@ public class PlayerActivity extends SherlockActivity implements
@Override
public boolean canSeekBackward() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean canSeekForward() {
// TODO Auto-generated method stub
return false;
}
......@@ -292,20 +296,17 @@ public class PlayerActivity extends SherlockActivity implements
void switchLayout(int index) {
// fullscreen
// switch to fullscreen
if (index == 0) {
imgV = (ImageView) findViewById(R.id.playerView_fullscreen);
recording.graphicsContext().setImageView(imgV);
// recording.focusCurrentIndexEntry(recording.getLastIndexFired() -
// 1);
switcher.setDisplayedChild(0);
}
// extended View
// switch to extended View
if (index == 1) {
imgV = (ImageView) findViewById(R.id.playerView_extended);
recording.graphicsContext().setImageView(imgV);
recording.graphicsContext().updateView();
switcher.setDisplayedChild(1);
......
......@@ -20,7 +20,6 @@ import android.graphics.Rect;
import android.media.Image;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -37,7 +36,6 @@ public class GraphicsContext implements MessageConsumer {
private final Handler scrollHandler;
private final BitmapContainer bitmapContainer;
private final Canvas canvas;
private ImageView imgView;
private boolean refreshEnabled = false;
......@@ -76,7 +74,6 @@ public class GraphicsContext implements MessageConsumer {
Config.ARGB_4444));
// canvas to Bitmap
this.canvas = new Canvas(bitmapContainer.getBimap());
this.pixels = bitmapContainer.getPixels();
hextile_bg_encoded = new byte[prefs.bytesPerPixel];
......@@ -89,13 +86,7 @@ public class GraphicsContext implements MessageConsumer {
@Override
public void handleMessage(android.os.Message inputMessage) {
// Gets the image task from the incoming Message object.
Bitmap bitmap = bitmapContainer.getBimap();
Canvas canvas = new Canvas(bitmap);
if (isWhiteboardEnabled())
paintWhiteboard(canvas);
paintAnnotations(canvas);
recording.highlightSearchResults(canvas);
Bitmap bitmap = (Bitmap) inputMessage.obj;
imgView.setImageBitmap(bitmap);
......@@ -118,14 +109,6 @@ public class GraphicsContext implements MessageConsumer {
};
}
// public void setSurfaceView(SurfaceView surfaceView) {
// this.overlay = surfaceView;
// overlay.setZOrderOnTop(true);
// sHolder = overlay.getHolder();
// sHolder.setFixedSize(prefs.framebufferWidth, prefs.framebufferHeight);
//
// }
// public static void borderRect(int[] array, Rect r, int color,
// int screenWidth) {
// int x = r.left;
......@@ -150,18 +133,6 @@ public class GraphicsContext implements MessageConsumer {
// }
// }
// public void updateOverlay() {
//
// Canvas canvas = sHolder.lockCanvas();
// if (canvas != null) {
// canvas.drawBitmap(bitmapContainer.getBimap(), 0, 0, null);
// paintAnnotations(canvas);
// recording.highlightSearchResults(canvas);
// sHolder.unlockCanvasAndPost(canvas);
// }
//
// }
public void enableRefresh(boolean refresh) {
this.refreshEnabled = refresh;
}
......@@ -204,18 +175,34 @@ public class GraphicsContext implements MessageConsumer {
// draw Canvas on current Bitmap
public void updateView() {
if (refreshEnabled) {
android.os.Message message = viewHandler.obtainMessage();
// Thread paintThread = new Thread(new Runnable() {
//
// @Override
// public void run() {
Bitmap bitmap = bitmapContainer.getBitmap();
Canvas canvas = new Canvas(bitmap);
if (isWhiteboardEnabled())
paintWhiteboard(canvas);
paintAnnotations(canvas);
recording.highlightSearchResults(canvas);
android.os.Message message = viewHandler.obtainMessage(0, bitmap);
message.sendToTarget();
// }
// });
// paintThread.start();
}
}
// // set new Bitmap
// public void updateView(final Bitmap bitmap) {
// if (refreshEnabled) {
// android.os.Message message = viewHandler.obtainMessage(0, bitmap);
// message.sendToTarget();
// }
// }
// set new Bitmap
public void updateView(final Bitmap bitmap) {
if (refreshEnabled) {
android.os.Message message = viewHandler.obtainMessage(0, bitmap);
message.sendToTarget();
}
}
public int decodeColor(byte[] colorField) {
int color = (colorField[1] & 0xFF) << 8 | (colorField[0] & 0xFF);
......@@ -235,6 +222,34 @@ public class GraphicsContext implements MessageConsumer {
}
//
// public int decodeColor(byte[] colorField) {
// int color = 0;
// for (int i = 0, shift = 0; i < prefs.bytesPerPixel; i++, shift += 8) {
// color += (colorField[i] & 0xFF) << shift;
// }
//
// switch (prefs.bitsPerPixel) {
// case 16:
// if (prefs.bigEndian)
// // 16 bit big endian: swap bytes
// color = (color & 0xFF) << 8 | ((color & 0xFF00) >> 8);
// // case 8:
// // // use color table
// // return colors[color];
// // default:
// // // use default color
// // if (prefs.bigEndian) {
// // // 24 bit big endian: swap bytes
// // color = (color & 0xFF) << 24 | (color >> 8 & 0xFF) << 16
// // | (color >> 16 & 0xFF) << 8 | color >> 24 & 0xFF;
// // }
// // return new Color(color);
//
// }
// return color;
// }
public void setForeground(byte[] color, int offset) {
System.arraycopy(color, offset, hextile_fg_encoded, 0,
prefs.bytesPerPixel);
......@@ -255,20 +270,14 @@ public class GraphicsContext implements MessageConsumer {
}
public void handleUpdatedPixels(int[] pixel) {
Log.d("GC", "setting new pixel array");
bitmapContainer.getBimap().setPixels(pixel, 0, prefs.framebufferWidth,
0, 0, prefs.framebufferWidth, prefs.framebufferHeight);
}
public void handleUpdatedPixels(int x, int y, int w, int h) {
// if recording is adjusting, messages are not painted one by one but
// only the final image
if (!recording.adjusting) {
bitmapContainer.getBimap().setPixels(pixels,
x + y * prefs.framebufferWidth, prefs.framebufferWidth, x,
y, w, h);
// bitmapContainer.getCurBitmap().setPixels(pixels,
// x + y * prefs.framebufferWidth, prefs.framebufferWidth, x,
// y, w, h);
updateView();
}
......@@ -352,27 +361,10 @@ public class GraphicsContext implements MessageConsumer {
// show blank page if whiteboard activated
if (isWhiteboardEnabled()) {
// int[] whitePixels = new int[(int) (prefs.framebufferWidth *
// IndexEntry.THUMBNAIL_SCALE_FACTOR)
// * (int) (prefs.framebufferHeight *
// IndexEntry.THUMBNAIL_SCALE_FACTOR)];
// for (int i = 0; i < whitePixels.length; i++) {
// whitePixels[i] = Color.WHITE;
// screenshot.setPixels(whitePixels, 0, stride, x, y, width,
// height);
Canvas canvas = new Canvas(screenshot);
canvas.drawColor(Color.WHITE);
// Bitmap whiteboard = Bitmap
// .createBitmap(
// whitePixels,
// (int) (prefs.framebufferWidth *
// IndexEntry.THUMBNAIL_SCALE_FACTOR),
// (int) (prefs.framebufferHeight *
// IndexEntry.THUMBNAIL_SCALE_FACTOR),
// Config.ARGB_4444);
// return whiteboard;
} else
screenshot.setPixels(pixels, 0, prefs.framebufferWidth, 0, 0,
prefs.framebufferWidth, prefs.framebufferHeight);
......
......@@ -415,7 +415,6 @@ public class Index {
}
// set collected annotations
Log.d("Index", "Annotations: " + annotations.size());
recording.getIndex().get(i).setAnnotations(annotations);
// clear buffer if index ended with a delete event, which was not
......
......@@ -13,6 +13,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
......@@ -26,7 +27,7 @@ public class IndexEntry extends ImageButton {
private String searchbase_of_page;
private ArrayList<SearchBaseEntry> words;
private ArrayList<Annotation> annotations;
public static double THUMBNAIL_SCALE_FACTOR = 0.3;
public static double THUMBNAIL_SCALE_FACTOR = 1;
public static boolean SCALE_FACTOR_CALCULATED = false;
private boolean hasThumbnail = false;
......@@ -86,7 +87,7 @@ public class IndexEntry extends ImageButton {
}
public void updateThumbail() {
Bitmap bitmap = bitmapContainer.getBimap();
Bitmap bitmap = bitmapContainer.getBitmap();
Canvas canvas = new Canvas(bitmap);
paintAnnotations(canvas);
highlightSearchResultsOnThumbail(canvas);
......@@ -213,20 +214,20 @@ public class IndexEntry extends ImageButton {
}
}
// show annoattions (if enabled)
// show annotations (if enabled)
void paintAnnotations(Canvas canvas) {
boolean paintHighlightAnnotations = index.getAnnotationsPaintMode() == Index.PAINT_ALL_ANNOTATIONS;
if (annotations != null)
if (annotations != null) {
Log.d("IndexEntry", "annotaion to thumbnail");
if (index.getAnnotationsPaintMode() != Index.PAINT_NO_ANNOTATIONS)
for (int i = 0; i < annotations.size(); i++) {
Annotation annotation = annotations.get(i);
if (paintHighlightAnnotations
|| !(annotation instanceof HighlightAnnotation)) {
annotation.paint(canvas);
}
|| !(annotation instanceof HighlightAnnotation))
annotation.paintToThumbnail(canvas);
;
}
}
}
}
......@@ -545,9 +545,9 @@ public class Recording extends MessageProducerAdapter implements Runnable {
// messages.setTime_full_frame_check_regarding_stripes(time);
if (refresh) {
// TODO timeout justieren
if (Math.abs(time - previousTime) < 10 && time > 5) {
return;
}
// if (Math.abs(time - previousTime) < 1000 && time > 5) {
// return;
// }
previousTime = time;
// focusCurrentIndexEntry(time);
......
......@@ -40,20 +40,6 @@ import android.graphics.RectF;
*/
public class SearchBaseEntry {
// character widths for dynamic underlining
// static int[] widths = new int[256];
// static {
// // choose standard font (proportions will be similar for other fonts)
// Font f = new Font("Serif", Font.PLAIN, 16);
// FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(f);
//
// // determine size of printable characters (all others will be zero)
// for (char c = 32; c < 127; c++)
// widths[c] = metrics.charWidth(c);
// for (char c = 161; c < 256; c++)
// widths[c] = metrics.charWidth(c);
// }
private final int x, y, width, height;
// TODO: maybe ratio should be handled in index
......
......@@ -26,7 +26,6 @@ package tttclient.messages;
import tttclient.core.Constants;
import tttclient.core.GraphicsContext;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
......@@ -53,7 +52,9 @@ public abstract class Annotation extends Message {
public boolean temporary;
// special thumbnail drawing if needed (to avoid ugly scaling)
public abstract void paintToThumbnail(Bitmap bitmap);
public void paintToThumbnail(Canvas canvas) {
paint(canvas);
}
abstract public boolean contains(int x, int y);
......
......@@ -26,7 +26,6 @@ package tttclient.messages;
import tttclient.core.Constants;
import tttclient.core.GraphicsContext;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
......@@ -79,10 +78,4 @@ public class DeleteAllAnnotation extends Annotation {
return 1;
}
@Override
public void paintToThumbnail(Bitmap bitmap) {
// TODO Auto-generated method stub
}
}
......@@ -30,7 +30,6 @@ import java.io.OutputStream;
import tttclient.core.Constants;
import tttclient.core.GraphicsContext;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
......@@ -100,10 +99,4 @@ public class DeleteAnnotation extends Annotation {
return 5;
}
@Override
public void paintToThumbnail(Bitmap bitmap) {
// TODO Auto-generated method stub
}
}
......@@ -29,7 +29,6 @@ import java.io.IOException;
import tttclient.core.Constants;
import tttclient.shapes.StrokedPath;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint.Cap;
import android.graphics.Paint.Join;
......@@ -119,19 +118,6 @@ public class FreehandAnnotation extends Annotation {
}
@Override
public void paintToThumbnail(Bitmap thumbnail) {
// graphics.setColor(annotationColors[color]);
// Stroke stroke = graphics.getStroke();
// // painting to thumbnails
// graphics.setStroke(new BasicStroke(6f, BasicStroke.CAP_ROUND,
// BasicStroke.JOIN_ROUND));
// graphics.draw(path);
// graphics.setStroke(stroke);
}
// TODO
@Override
public boolean contains(int x, int y) {
......
......@@ -35,6 +35,7 @@ import java.util.Random;
import tttclient.core.Constants;
import tttclient.core.GraphicsContext;
import android.graphics.Rect;
import android.util.Log;
public class HextileMessage extends FramebufferUpdateMessage {
// reading from stream is easier then reading from byte array
......@@ -71,9 +72,7 @@ public class HextileMessage extends FramebufferUpdateMessage {
this(timestamp, x, y, width, height, handleAndBufferHextileRect(
graphicsContext, is, x, y, width, height, false));
// Log.d("HextileMessageConstructor", "new update message at " + x +
// " , "
// + y);
}
@Override
......@@ -136,13 +135,7 @@ public class HextileMessage extends FramebufferUpdateMessage {
updateFlag);
}
}
// // mark rectangle
// graphicsContext.memGraphics.setColor(Color.CYAN);
// graphicsContext.memGraphics.drawRect(x, y, w, h);
// Finished, now let's show it.
// graphicsContext.refresh(x, y, w, h);
}
// Handle one tile in the Hextile-encoded data.
......@@ -242,66 +235,33 @@ public class HextileMessage extends FramebufferUpdateMessage {
DataInputStream is, DataOutputStream os, int x, int y, int w, int h)
throws IOException {
switch (graphicsContext.getPrefs().bytesPerPixel) {
// case 1:
// for (int dy = y; dy < y + h; dy++) {
// is.readFully(graphicsContext.pixels8, dy
// * graphicsContext.prefs.framebufferWidth + x, w);
//
// // buffering
// if (os != null)
// os.write(graphicsContext.pixels8, dy
// * graphicsContext.prefs.framebufferWidth + x, w);
// }
// break;
// TODO Android: support more bytes per pixel
switch (graphicsContext.getPrefs().bytesPerPixel) {
case 2:
byte[] buf = new byte[w * 2];
byte[] buf = new byte[2];
// Paint p = new Paint();
int color;
for (int dy = y; dy < y + h; dy++) {
is.readFully(buf);
// buffering
if (os != null)
os.write(buf);
int offset = dy * graphicsContext.getPrefs().framebufferWidth
+ x;
if (graphicsContext.getPrefs().bigEndian)
for (int i = 0; i < w; i++)
graphicsContext.getPixels()[offset + i] = (buf[i * 2] & 0xFF) << 8
| (buf[i * 2 + 1] & 0xFF);
else
for (int i = 0; i < w; i++)
graphicsContext.getPixels()[offset + i] = (buf[i * 2 + 1] & 0xFF) << 8
| (buf[i * 2] & 0xFF);
for (int i = x; i < x + w; i++) {
// TODO make buffer containing the whole rect, not only 2
// bytes... Android