Commit ca859d19 authored by Thomas Krex's avatar Thomas Krex

eintrag in datenbank ob file gedownloadad wurde /status

icon ändert sich dementsrpechend via viewbinder
parent bb8e546c
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="lib" path="libs/commons-io-2.4.jar"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>
eclipse.preferences.version=1 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.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 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 org.eclipse.jdt.core.compiler.source=1.6
...@@ -21,28 +21,32 @@ public final class R { ...@@ -21,28 +21,32 @@ public final class R {
public static final int activity_vertical_margin=0x7f040001; public static final int activity_vertical_margin=0x7f040001;
} }
public static final class drawable { public static final class drawable {
public static final int ic_launcher=0x7f020000; public static final int checked_icon=0x7f020000;
public static final int my_border=0x7f020001; public static final int ic_launcher=0x7f020001;
public static final int selected_index_border=0x7f020002; public static final int my_border=0x7f020002;
public static final int selected_index_border=0x7f020003;
public static final int unchecked_icon=0x7f020004;
} }
public static final class id { public static final class id {
public static final int action_settings=0x7f080013; public static final int action_settings=0x7f080015;
public static final int add=0x7f080012; public static final int add=0x7f080014;
public static final int button_save=0x7f08000e; public static final int button_save=0x7f08000e;
public static final int checkBox1=0x7f08000b; public static final int checkBox1=0x7f08000b;
public static final int connect_btn=0x7f08000a; public static final int connect_btn=0x7f08000a;
public static final int extend=0x7f080015; public static final int extend=0x7f080017;
public static final int feedDetailsLv=0x7f080010; public static final int feedDetailsLv=0x7f080010;
public static final int feed_list=0x7f08000f; public static final int feed_list=0x7f08000f;
public static final int indexScrollView=0x7f080003; public static final int indexScrollView=0x7f080003;
public static final int itemTitle=0x7f080012;
public static final int liveChannel_button=0x7f080002; public static final int liveChannel_button=0x7f080002;
public static final int playerView_extended=0x7f080004; public static final int playerView_extended=0x7f080004;
public static final int playerView_fullscreen=0x7f080006; public static final int playerView_fullscreen=0x7f080006;
public static final int port_tx=0x7f080009; public static final int port_tx=0x7f080009;
public static final int progressBar=0x7f080011; public static final int progressBar=0x7f080011;
public static final int scrollView1=0x7f080005; public static final int scrollView1=0x7f080005;
public static final int search=0x7f080014; public static final int search=0x7f080016;
public static final int server_tx=0x7f080008; public static final int server_tx=0x7f080008;
public static final int statusIcon=0x7f080013;
public static final int test_button=0x7f080000; public static final int test_button=0x7f080000;
public static final int tx_name=0x7f08000d; public static final int tx_name=0x7f08000d;
public static final int tx_url=0x7f08000c; public static final int tx_url=0x7f08000c;
...@@ -58,6 +62,7 @@ public final class R { ...@@ -58,6 +62,7 @@ public final class R {
public static final int dialog_feeds=0x7f030005; public static final int dialog_feeds=0x7f030005;
public static final int feed_activity=0x7f030006; public static final int feed_activity=0x7f030006;
public static final int feed_details_activity=0x7f030007; public static final int feed_details_activity=0x7f030007;
public static final int list_feeditems=0x7f030008;
} }
public static final class menu { public static final class menu {
public static final int feed_menu=0x7f070000; public static final int feed_menu=0x7f070000;
......
This diff is collapsed.
Apache Commons IO
Copyright 2002-2012 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<lint>
</lint>
\ No newline at end of file
...@@ -12,3 +12,4 @@ ...@@ -12,3 +12,4 @@
# Project target. # Project target.
target=android-19 target=android-19
android.library=false
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<stroke <stroke
android:width="10dip" android:width="10dip"
android:color="@android:color/darker_gray" > android:color="@android:color/background_dark" >
</stroke> </stroke>
</shape> </shape>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="5" >
<TextView
android:id="@+id/itemTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="@+id/statusIcon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="?android:attr/textCheckMark" />
</LinearLayout>
\ No newline at end of file
package tttclient.activities; package tttclient.activities;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import org.apache.commons.io.FileUtils;
import tttclient.models.FeedItem; import tttclient.models.FeedItem;
import tttclient.models.FeedItemDbManager; import tttclient.models.FeedItemDbManager;
import tttclient.services.DownloadService; import tttclient.services.DownloadService;
...@@ -25,8 +28,11 @@ import android.view.View; ...@@ -25,8 +28,11 @@ import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener; import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.CheckedTextView;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.SimpleCursorAdapter; import android.widget.SimpleCursorAdapter;
import android.widget.Toast;
import com.example.test.R; import com.example.test.R;
...@@ -46,6 +52,7 @@ public class FeedDetailActivity extends Activity implements ...@@ -46,6 +52,7 @@ public class FeedDetailActivity extends Activity implements
FeedItemDbManager manager; FeedItemDbManager manager;
SimpleCursorAdapter adapter; SimpleCursorAdapter adapter;
ProgressDialog progressDialog; ProgressDialog progressDialog;
ListView lv;
private final BroadcastReceiver receiver = new BroadcastReceiver() { private final BroadcastReceiver receiver = new BroadcastReceiver() {
...@@ -63,12 +70,13 @@ public class FeedDetailActivity extends Activity implements ...@@ -63,12 +70,13 @@ public class FeedDetailActivity extends Activity implements
if (result == RESULT_OK) { if (result == RESULT_OK) {
Log.d("Download", "complete " + path); Log.d("Download", "complete " + path);
manager.updatePath(title, path); manager.updatePath(title, path, true);
adapter.changeCursor(manager.getAllFromDB()); adapter.changeCursor(manager.getAllFromDB());
startPlayer(); startPlayer();
} }
lv.setClickable(true);
} else if (action.equals(ParseService.BROADCAST_NAME)) { } else if (action.equals(ParseService.BROADCAST_NAME)) {
itemList = bundle.getParcelableArrayList("result"); itemList = bundle.getParcelableArrayList("result");
...@@ -95,25 +103,58 @@ public class FeedDetailActivity extends Activity implements ...@@ -95,25 +103,58 @@ public class FeedDetailActivity extends Activity implements
setContentView(R.layout.feed_details_activity); setContentView(R.layout.feed_details_activity);
progressDialog = new ProgressDialog(FeedDetailActivity.this); progressDialog = new ProgressDialog(FeedDetailActivity.this);
progressDialog.setIndeterminate(false); progressDialog.setIndeterminate(true);
progressDialog.setTitle("Downloading File"); progressDialog.setTitle("Downloading File");
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setMessage("0% downloaded");
// progressDialog.setCancelable(true); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setCancelable(false);
feedId = getIntent().getStringExtra("id"); feedId = getIntent().getStringExtra("id");
feedName = getIntent().getStringExtra("name"); feedName = getIntent().getStringExtra("name");
feedUrl = getIntent().getStringExtra("feedUrl"); feedUrl = getIntent().getStringExtra("feedUrl");
this.setTitle(feedName); this.setTitle(feedName);
ListView lv = (ListView) findViewById(R.id.feedDetailsLv); lv = (ListView) findViewById(R.id.feedDetailsLv);
lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
manager = new FeedItemDbManager(this); manager = new FeedItemDbManager(this);
Cursor cursor = manager.getAllFromDB(); Cursor cursor = manager.getAllFromDB();
adapter = new SimpleCursorAdapter(this, adapter = new SimpleCursorAdapter(this, R.layout.list_feeditems,
android.R.layout.simple_list_item_1, cursor, cursor, new String[] { FeedItemDbManager.COLUMN_TITLE,
new String[] { FeedItemDbManager.COLUMN_TITLE }, FeedItemDbManager.COLUMN_STATUS }, new int[] {
new int[] { android.R.id.text1 }); R.id.itemTitle, R.id.statusIcon });
adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
@Override
public boolean setViewValue(View view, Cursor cursor,
int columnIndex) {
if (view.getId() == R.id.statusIcon) {
ImageView icon = (ImageView) view;
int status = cursor.getInt(cursor
.getColumnIndex(FeedItemDbManager.COLUMN_STATUS));
if (status == 1) {
icon.setImageDrawable(getResources().getDrawable(
(R.drawable.checked_icon)));
} else if (status == 0) {
icon.setImageDrawable(getResources().getDrawable(
(R.drawable.unchecked_icon)));
}
return true;
}
return false;
}
});
lv.setAdapter(adapter); lv.setAdapter(adapter);
lv.setOnItemClickListener(this); lv.setOnItemClickListener(this);
lv.setOnItemLongClickListener(this);
Intent intent = new Intent(this, ParseService.class); Intent intent = new Intent(this, ParseService.class);
intent.putExtra(Consts.SERVICE_ID, Consts.PARSE_SERVICE_ID); intent.putExtra(Consts.SERVICE_ID, Consts.PARSE_SERVICE_ID);
...@@ -151,12 +192,18 @@ public class FeedDetailActivity extends Activity implements ...@@ -151,12 +192,18 @@ public class FeedDetailActivity extends Activity implements
link = c.getString(c.getColumnIndex(FeedItemDbManager.COLUMN_LINK)); link = c.getString(c.getColumnIndex(FeedItemDbManager.COLUMN_LINK));
title = c.getString(c title = c.getString(c
.getColumnIndex(FeedItemDbManager.COLUMN_TITLE)); .getColumnIndex(FeedItemDbManager.COLUMN_TITLE));
int status = c.getInt(c
.getColumnIndex(FeedItemDbManager.COLUMN_STATUS));
Log.d("FeedItem", "status: " + status);
if (path != null) { if (path != null) {
if (checkPath(path)) { if (checkPath(path)) {
startPlayer(); startPlayer();
} else { } else {
manager.updatePath(title, ""); manager.updatePath(title, "", false);
Toast.makeText(FeedDetailActivity.this,
"invalide path, start downloading",
Toast.LENGTH_LONG).show();
startDownloadService(); startDownloadService();
} }
} }
...@@ -193,6 +240,19 @@ public class FeedDetailActivity extends Activity implements ...@@ -193,6 +240,19 @@ public class FeedDetailActivity extends Activity implements
} }
public void isDownloaded() {
int count = lv.getChildCount();
for (int i = 0; i < count; i++) {
CheckedTextView child = (CheckedTextView) lv.getChildAt(i);
String title = child.getText().toString();
Log.d("isDownloaded", "title: " + title);
String path = manager.getPath(title);
child.setChecked(checkPath(path));
}
}
public boolean checkPath(String path) { public boolean checkPath(String path) {
Log.d("FILE", "checking path " + path); Log.d("FILE", "checking path " + path);
...@@ -217,15 +277,33 @@ public class FeedDetailActivity extends Activity implements ...@@ -217,15 +277,33 @@ public class FeedDetailActivity extends Activity implements
// delete feed from list, refresh feed list // delete feed from list, refresh feed list
Cursor c = (Cursor) av.getAdapter().getItem(position); Cursor c = (Cursor) av.getAdapter().getItem(position);
int _id = c.getInt(c // int _id = c.getInt(c
.getColumnIndex(FeedItemDbManager.COLUMN_ID)); // .getColumnIndex(FeedItemDbManager.COLUMN_ID));
String path = c.getString(c
.getColumnIndex(FeedItemDbManager.COLUMN_PATH));
String title = c.getString(c
.getColumnIndex(FeedItemDbManager.COLUMN_TITLE));
File dir = new File(path);
try {
FileUtils.deleteDirectory(dir);
Toast.makeText(FeedDetailActivity.this, "File was deleted",
Toast.LENGTH_LONG).show();
} catch (IOException e) {
Toast.makeText(FeedDetailActivity.this, "File not found",
Toast.LENGTH_LONG).show();
}
FeedItemDbManager fm = new FeedItemDbManager(av.getContext()); FeedItemDbManager fm = new FeedItemDbManager(av.getContext());
fm.deleteFromDb(_id);
// fm.deleteFromDb(_id);
fm.updatePath(title, path, false);
adapter.changeCursor(fm.getAllFromDB()); adapter.changeCursor(fm.getAllFromDB());
} }
}; };
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(
FeedDetailActivity.this);
builder.setMessage("delete?"); builder.setMessage("delete?");
builder.setPositiveButton("delete", listener); builder.setPositiveButton("delete", listener);
builder.setNegativeButton("cancel", null); builder.setNegativeButton("cancel", null);
...@@ -245,11 +323,8 @@ public class FeedDetailActivity extends Activity implements ...@@ -245,11 +323,8 @@ public class FeedDetailActivity extends Activity implements
if (resultCode == DownloadService.PROGRESS_UPDATE) { if (resultCode == DownloadService.PROGRESS_UPDATE) {
int progress = resultData.getInt("progress"); int progress = resultData.getInt("progress");
Log.d("ResultReceiver", "progress: " + progress);
progressDialog.setProgress(progress); progressDialog.setMessage(progress + "% donwloaded");
progressDialog.setMessage(String.valueOf(progress)
+ "% downloaded sucessfully.");
if (progress == 100) { if (progress == 100) {
progressDialog.dismiss(); progressDialog.dismiss();
......
...@@ -17,13 +17,15 @@ public class FeedItemDbManager { ...@@ -17,13 +17,15 @@ public class FeedItemDbManager {
public static final String COLUMN_DESCRIPTION = "description"; public static final String COLUMN_DESCRIPTION = "description";
public static final String COLUMN_PUBDATE = "pubDate"; public static final String COLUMN_PUBDATE = "pubDate";
public static final String COLUMN_PATH = "path"; public static final String COLUMN_PATH = "path";
public static final String COLUMN_STATUS = "status";
private static final String TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " private static final String TABLE_CREATE = "CREATE TABLE IF NOT EXISTS "
+ TABLE_FEEDITEMS + " ( " + COLUMN_ID + TABLE_FEEDITEMS + " ( " + COLUMN_ID
+ " integer primary key autoincrement, " + COLUMN_FEEDID + " integer primary key autoincrement, " + COLUMN_FEEDID
+ " INTEGER, " + COLUMN_TITLE + " VARCHAR, " + COLUMN_LINK + " INTEGER, " + COLUMN_TITLE + " VARCHAR, " + COLUMN_LINK
+ " VARCHAR, " + COLUMN_DESCRIPTION + " VARCHAR, " + COLUMN_PUBDATE + " VARCHAR, " + COLUMN_DESCRIPTION + " VARCHAR, " + COLUMN_PUBDATE
+ " VARCHAR, " + COLUMN_PATH + " VARCHAR );"; + " VARCHAR, " + COLUMN_PATH + " VARCHAR, " + COLUMN_STATUS
+ " INTEGER );";
private final SQLiteDatabase db; private final SQLiteDatabase db;
public FeedItemDbManager(Context context) { public FeedItemDbManager(Context context) {
...@@ -41,17 +43,22 @@ public class FeedItemDbManager { ...@@ -41,17 +43,22 @@ public class FeedItemDbManager {
// + " FROM " + TABLE_FEEDITEMS + " ORDER BY " + COLUMN_PUBDATE); // + " FROM " + TABLE_FEEDITEMS + " ORDER BY " + COLUMN_PUBDATE);
return db return db
.rawQuery( .rawQuery(
"SELECT title, id as _id , feedId, link, description, pubDate, path FROM feedItems ORDER BY pubDate", "SELECT title, id as _id , feedId, link, description, pubDate, path, status FROM feedItems ORDER BY pubDate",
null); null);
} }
public void updatePath(String title, String path) { public void updatePath(String title, String path, boolean isDownloaded) {
Cursor cursor = db.rawQuery("SELECT id FROM feedItems WHERE title = ?", Cursor cursor = db.rawQuery("SELECT id FROM feedItems WHERE title = ?",
new String[] { title }); new String[] { title });
if (cursor.moveToNext()) { if (cursor.moveToNext()) {
db.execSQL("UPDATE feedItems SET path = ? WHERE id=?", String status;
new String[] { path, cursor.getString(0) }); if (isDownloaded) {
status = "1";
} else
status = "0";
db.execSQL("UPDATE feedItems SET path = ?, status=? WHERE id=?",
new String[] { path, status, cursor.getString(0) });
} else { } else {
Log.e("SQL", "FeedItem with title " + title + " not found "); Log.e("SQL", "FeedItem with title " + title + " not found ");
...@@ -59,6 +66,21 @@ public class FeedItemDbManager { ...@@ -59,6 +66,21 @@ public class FeedItemDbManager {
} }
public String getPath(String title) {
Cursor cursor = db.rawQuery(
"SELECT id, path FROM feedItems WHERE title = ? ",
new String[] { title });
if (cursor.moveToNext()) {
return cursor.getString(1);
} else {
Log.d("Database", "No entry found");
return null;
}
}
public void insertintoDB(ArrayList<FeedItem> itemList, String feedId) public void insertintoDB(ArrayList<FeedItem> itemList, String feedId)
throws Exception { throws Exception {
...@@ -75,7 +97,8 @@ public class FeedItemDbManager { ...@@ -75,7 +97,8 @@ public class FeedItemDbManager {
db.execSQL("INSERT INTO " + TABLE_FEEDITEMS + " (" db.execSQL("INSERT INTO " + TABLE_FEEDITEMS + " ("
+ COLUMN_TITLE + ", " + COLUMN_FEEDID + ", " + COLUMN_TITLE + ", " + COLUMN_FEEDID + ", "
+ COLUMN_LINK + ", " + COLUMN_DESCRIPTION + ", " + COLUMN_LINK + ", " + COLUMN_DESCRIPTION + ", "
+ COLUMN_PUBDATE + ") VALUES ( ? , ? , ? , ? , ? )", + COLUMN_PUBDATE + ", " + COLUMN_STATUS
+ ") VALUES ( ? , ? , ? , ? , ?," + 0 + " )",
new String[] { item.getTitle(), feedId, item.getLink(), new String[] { item.getTitle(), feedId, item.getLink(),
item.getDescription(), item.getPupDate() }); item.getDescription(), item.getPupDate() });
......
...@@ -18,6 +18,7 @@ import android.os.Build; ...@@ -18,6 +18,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.ResultReceiver; import android.os.ResultReceiver;
import android.util.Log; import android.util.Log;
import android.widget.Toast;
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class DownloadService extends IntentService { public class DownloadService extends IntentService {
...@@ -88,6 +89,8 @@ public class DownloadService extends IntentService { ...@@ -88,6 +89,8 @@ public class DownloadService extends IntentService {
+ fileName + ".zip"); + fileName + ".zip");
byte data[] = new byte[512000]; byte data[] = new byte[512000];
long total = 0; long total = 0;
int lastProgress = 0;
int progress = 0;
int count; int count;
while ((count = input.read(data)) != -1) { while ((count = input.read(data)) != -1) {
// allow canceling with back button // allow canceling with back button
...@@ -95,9 +98,13 @@ public class DownloadService extends IntentService { ...@@ -95,9 +98,13 @@ public class DownloadService extends IntentService {
// publishing the progress.... // publishing the progress....
Bundle resultData = new Bundle(); Bundle resultData = new Bundle();
if (fileLength > 0) if (fileLength > 0)
resultData.putInt("progress", progress = (int) (total * 100 / fileLength);
(int) (total * 100 / fileLength));
receiver.send(PROGRESS_UPDATE, resultData); resultData.putInt("progress", progress);
if (progress > lastProgress) {
receiver.send(PROGRESS_UPDATE, resultData);
lastProgress = progress;
}
output.write(data, 0, count); output.write(data, 0, count);
// Log.d("DownloadService", total + " bytes downloaded"); // Log.d("DownloadService", total + " bytes downloaded");
...@@ -109,9 +116,12 @@ public class DownloadService extends IntentService { ...@@ -109,9 +116,12 @@ public class DownloadService extends IntentService {
if (zipFile.exists()) { if (zipFile.exists()) {
result = Activity.RESULT_OK; result = Activity.RESULT_OK;
Log.d("DownloadService", " sucessful"); Log.d("DownloadService", " sucessful");
Toast.makeText(getApplicationContext(), "unzipping file ...",
Toast.LENGTH_LONG);
UnzipManager unzip = new UnzipManager( UnzipManager unzip = new UnzipManager(
zipFile.getAbsolutePath(), lectureDir.getAbsolutePath()); zipFile.getAbsolutePath(), lectureDir.getAbsolutePath());
unzip.unzip(); unzip.unzip();
zipFile.delete();
} }
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
......
...@@ -370,20 +370,23 @@ public class GraphicsContext implements MessageConsumer { ...@@ -370,20 +370,23 @@ public class GraphicsContext implements MessageConsumer {
public Bitmap getScreenshotWithoutAnnotations() { public Bitmap getScreenshotWithoutAnnotations() {
Bitmap screenshot; Bitmap screenshot;
// Create a buffered image using the default color model
screenshot = Bitmap.createBitmap(pixels, prefs.framebufferWidth, screenshot = Bitmap.createBitmap(pixels, prefs.framebufferWidth,
prefs.framebufferHeight, Config.ARGB_8888); 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 // show blank page if whiteboard activated
if (isWhiteboardEnabled()) { if (isWhiteboardEnabled()) {
int[] whitePixels = new int[prefs.framebufferWidth int[] whitePixels = new int[prefs.framebufferWidth / 3
* prefs.framebufferWidth]; * prefs.framebufferWidth / 3];
for (int i = 0; i < whitePixels.length; i++) { for (int i = 0; i < whitePixels.length; i++) {
whitePixels[i] = Color.WHITE; whitePixels[i] = Color.WHITE;
} }
Bitmap whiteboard = Bitmap.createBitmap(whitePixels, Bitmap whiteboard = Bitmap.createBitmap(whitePixels,
prefs.framebufferWidth, prefs.framebufferHeight, prefs.framebufferWidth / 3, prefs.framebufferHeight / 3,
Config.ARGB_8888); Config.ARGB_8888);
return whiteboard; return whiteboard;
...@@ -391,7 +394,7 @@ public class GraphicsContext implements MessageConsumer { ...@@ -391,7 +394,7 @@ public class GraphicsContext implements MessageConsumer {
// show desktop // show desktop
return screenshot; return scaledScreenshot;
} }
// //////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////
......
...@@ -44,7 +44,6 @@ public class Index { ...@@ -44,7 +44,6 @@ public class Index {