Commit ca859d19 authored by Thomas Krex's avatar Thomas Krex
Browse files

eintrag in datenbank ob file gedownloadad wurde /status

icon ändert sich dementsrpechend via viewbinder
parent bb8e546c
......@@ -18,6 +18,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.util.Log;
import android.widget.Toast;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class DownloadService extends IntentService {
......@@ -88,6 +89,8 @@ public class DownloadService extends IntentService {
+ fileName + ".zip");
byte data[] = new byte[512000];
long total = 0;
int lastProgress = 0;
int progress = 0;
int count;
while ((count = input.read(data)) != -1) {
// allow canceling with back button
......@@ -95,9 +98,13 @@ public class DownloadService extends IntentService {
// publishing the progress....
Bundle resultData = new Bundle();
if (fileLength > 0)
resultData.putInt("progress",
(int) (total * 100 / fileLength));
receiver.send(PROGRESS_UPDATE, resultData);
progress = (int) (total * 100 / fileLength);
resultData.putInt("progress", progress);
if (progress > lastProgress) {
receiver.send(PROGRESS_UPDATE, resultData);
lastProgress = progress;
}
output.write(data, 0, count);
// Log.d("DownloadService", total + " bytes downloaded");
......@@ -109,9 +116,12 @@ public class DownloadService extends IntentService {
if (zipFile.exists()) {
result = Activity.RESULT_OK;
Log.d("DownloadService", " sucessful");
Toast.makeText(getApplicationContext(), "unzipping file ...",
Toast.LENGTH_LONG);
UnzipManager unzip = new UnzipManager(
zipFile.getAbsolutePath(), lectureDir.getAbsolutePath());
unzip.unzip();
zipFile.delete();
}
} catch (Exception e) {
// TODO Auto-generated catch block
......
......@@ -370,20 +370,23 @@ public class GraphicsContext implements MessageConsumer {
public Bitmap getScreenshotWithoutAnnotations() {
Bitmap screenshot;
// Create a buffered image using the default color model
screenshot = Bitmap.createBitmap(pixels, prefs.framebufferWidth,
prefs.framebufferHeight, Config.ARGB_8888);
Bitmap scaledScreenshot = Bitmap.createScaledBitmap(screenshot,
prefs.framebufferWidth / 3, prefs.framebufferHeight / 3, true);
screenshot.recycle();
// show blank page if whiteboard activated
if (isWhiteboardEnabled()) {
int[] whitePixels = new int[prefs.framebufferWidth
* prefs.framebufferWidth];
int[] whitePixels = new int[prefs.framebufferWidth / 3
* prefs.framebufferWidth / 3];
for (int i = 0; i < whitePixels.length; i++) {
whitePixels[i] = Color.WHITE;
}
Bitmap whiteboard = Bitmap.createBitmap(whitePixels,
prefs.framebufferWidth, prefs.framebufferHeight,
prefs.framebufferWidth / 3, prefs.framebufferHeight / 3,
Config.ARGB_8888);
return whiteboard;
......@@ -391,7 +394,7 @@ public class GraphicsContext implements MessageConsumer {
// show desktop
return screenshot;
return scaledScreenshot;
}
// ////////////////////////////////////////////////////////////////
......
......@@ -44,7 +44,6 @@ public class Index {
final public static int NO_SEARCHBASE = 0;
final public static int ASCII_SEARCHBASE = 1;
final public static int XML_SEARCHBASE = 2;
final public static double THUMBNAIL_SCALE_FACTOR = 0.25;
public ArrayList<IndexEntry> index = new ArrayList<IndexEntry>();
ArrayList<IndexEntry> search_index = new ArrayList<IndexEntry>();
......@@ -441,6 +440,8 @@ public class Index {
* @return
* @throws IOException
*/
final public static double THUMBNAIL_SCALE_FACTOR = 0.3;
public boolean createScreenshots() throws IOException {
// measure time
......@@ -458,10 +459,13 @@ public class Index {
// create screenshot
Bitmap screenshot = recording.graphicsContext()
.getScreenshotWithoutAnnotations();
int scaledWidth = (int) (screenshot.getWidth() * THUMBNAIL_SCALE_FACTOR);
int scaledHeight = (int) (screenshot.getHeight() * THUMBNAIL_SCALE_FACTOR);
Bitmap scaled = Bitmap.createScaledBitmap(screenshot, scaledWidth,
scaledHeight, true);
// int scaledWidth = (int) (screenshot.getWidth() *
// THUMBNAIL_SCALE_FACTOR);
// int scaledHeight = (int) (screenshot.getHeight() *
// THUMBNAIL_SCALE_FACTOR);
// Bitmap scaled = Bitmap.createScaledBitmap(screenshot,
// scaledWidth,
// scaledHeight, true);
indexEntry.setThumbnail(screenshot);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment