aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java16
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/AvatarWorkerTask.java2
2 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index 17e139c59..a074eca4f 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -49,6 +49,7 @@ import java.net.URL;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.security.acl.LastOwnerException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -683,12 +684,23 @@ public class FileBackend {
}
public void drawOverlay(final Bitmap bitmap, final int resource, final float factor) {
+ drawOverlay(bitmap, resource, factor, false);
+ }
+
+ public void drawOverlay(final Bitmap bitmap, final int resource, final float factor, final boolean corner) {
Bitmap overlay = BitmapFactory.decodeResource(mXmppConnectionService.getResources(), resource);
Canvas canvas = new Canvas(bitmap);
float targetSize = Math.min(canvas.getWidth(), canvas.getHeight()) * factor;
Log.d(Config.LOGTAG, "target size overlay: " + targetSize + " overlay bitmap size was " + overlay.getHeight());
- float left = (canvas.getWidth() - targetSize) / 2.0f;
- float top = (canvas.getHeight() - targetSize) / 2.0f;
+ float left;
+ float top;
+ if (corner) {
+ left = canvas.getWidth() - targetSize;
+ top = canvas.getHeight() - targetSize;
+ } else {
+ left = (canvas.getWidth() - targetSize) / 2.0f;
+ top = (canvas.getHeight() - targetSize) / 2.0f;
+ }
RectF dst = new RectF(left, top, left + targetSize - 1, top + targetSize - 1);
canvas.drawBitmap(overlay, null, dst, createAntiAliasingPaint());
}
diff --git a/src/main/java/de/pixart/messenger/ui/util/AvatarWorkerTask.java b/src/main/java/de/pixart/messenger/ui/util/AvatarWorkerTask.java
index 738f387de..4898cf327 100644
--- a/src/main/java/de/pixart/messenger/ui/util/AvatarWorkerTask.java
+++ b/src/main/java/de/pixart/messenger/ui/util/AvatarWorkerTask.java
@@ -87,7 +87,7 @@ public class AvatarWorkerTask extends AsyncTask<AvatarService.Avatarable, Void,
if (bm != null) {
cancelPotentialWork(avatarable, imageView);
if (overlay) {
- activity.xmppConnectionService.fileBackend.drawOverlay(bm, R.drawable.pencil_overlay, 1.0f);
+ activity.xmppConnectionService.fileBackend.drawOverlay(bm, R.drawable.pencil_overlay, 0.35f, true);
imageView.setImageBitmap(bm);
} else {
imageView.setImageBitmap(bm);