mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 09:49:21 +02:00
Merge branch 'main' into r10s/allow-cloning-email-chats
This commit is contained in:
commit
4fbb8d2b78
8 changed files with 17 additions and 38 deletions
|
@ -3,7 +3,7 @@
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
* Allow to clone email chats
|
* Allow to clone email chats
|
||||||
|
* improve image quality when setting group avatars
|
||||||
|
|
||||||
## v2.10.0
|
## v2.10.0
|
||||||
2025-08
|
2025-08
|
||||||
|
|
|
@ -31,5 +31,6 @@ LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT
|
||||||
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -ffast-math -D__STDC_CONSTANT_MACROS
|
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -ffast-math -D__STDC_CONSTANT_MACROS
|
||||||
|
|
||||||
LOCAL_SRC_FILES := dc_wrapper.c
|
LOCAL_SRC_FILES := dc_wrapper.c
|
||||||
|
LOCAL_LDFLAGS += -Wl,--build-id=none
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
|
@ -50,6 +50,14 @@ if test -z "$ANDROID_NDK_ROOT"; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# for reproducible build:
|
||||||
|
export RUSTFLAGS="-C link-args=-Wl,--build-id=none --remap-path-prefix=$HOME/.cargo= --remap-path-prefix=$(realpath $(dirname $(dirname "$0")))="
|
||||||
|
export SOURCE_DATE_EPOCH=1
|
||||||
|
# always use the same path to NDK:
|
||||||
|
rm -f /tmp/android-ndk-root
|
||||||
|
ln -s "$ANDROID_NDK_ROOT" /tmp/android-ndk-root
|
||||||
|
ANDROID_NDK_ROOT=/tmp/android-ndk-root
|
||||||
|
|
||||||
echo Setting CARGO_TARGET environment variables.
|
echo Setting CARGO_TARGET environment variables.
|
||||||
|
|
||||||
if test -z "$NDK_HOST_TAG"; then
|
if test -z "$NDK_HOST_TAG"; then
|
||||||
|
@ -66,11 +74,9 @@ if test -z "$NDK_HOST_TAG"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$CARGO_TARGET_DIR"; then
|
if test -z "$CARGO_TARGET_DIR"; then
|
||||||
CARGO_TARGET_DIR=target
|
export CARGO_TARGET_DIR=/tmp/deltachat-build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset RUSTFLAGS
|
|
||||||
|
|
||||||
TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$NDK_HOST_TAG"
|
TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$NDK_HOST_TAG"
|
||||||
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="$TOOLCHAIN/bin/armv7a-linux-androideabi21-clang"
|
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="$TOOLCHAIN/bin/armv7a-linux-androideabi21-clang"
|
||||||
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$TOOLCHAIN/bin/aarch64-linux-android21-clang"
|
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$TOOLCHAIN/bin/aarch64-linux-android21-clang"
|
||||||
|
@ -154,8 +160,6 @@ if test -z $1 || test $1 = x86_64; then
|
||||||
cp "$CARGO_TARGET_DIR/x86_64-linux-android/$RELEASE/libdeltachat.a" "$jnidir/x86_64"
|
cp "$CARGO_TARGET_DIR/x86_64-linux-android/$RELEASE/libdeltachat.a" "$jnidir/x86_64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -fr "$TMPLIB"
|
|
||||||
|
|
||||||
echo -- ndk-build --
|
echo -- ndk-build --
|
||||||
|
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.thoughtcrime.securesms.mms.AttachmentManager;
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||||
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
||||||
import org.thoughtcrime.securesms.profiles.ProfileMediaConstraints;
|
|
||||||
import org.thoughtcrime.securesms.scribbles.ScribbleActivity;
|
import org.thoughtcrime.securesms.scribbles.ScribbleActivity;
|
||||||
import org.thoughtcrime.securesms.util.Prefs;
|
import org.thoughtcrime.securesms.util.Prefs;
|
||||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||||
|
@ -144,14 +143,13 @@ public class CreateProfileActivity extends BaseActionBarActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAvatarView(Uri output) {
|
private void setAvatarView(Uri output) {
|
||||||
final ProfileMediaConstraints constraints = new ProfileMediaConstraints();
|
|
||||||
GlideApp.with(this)
|
GlideApp.with(this)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(output)
|
.load(output)
|
||||||
.skipMemoryCache(true)
|
.skipMemoryCache(true)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
.centerCrop()
|
.centerCrop()
|
||||||
.override(constraints.getImageMaxWidth(this), constraints.getImageMaxHeight(this))
|
.override(AvatarHelper.AVATAR_SIZE, AvatarHelper.AVATAR_SIZE)
|
||||||
.into(new SimpleTarget<Bitmap>() {
|
.into(new SimpleTarget<Bitmap>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
||||||
|
|
|
@ -54,7 +54,6 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
||||||
public static final String CLONE_CHAT_EXTRA = "clone_chat";
|
public static final String CLONE_CHAT_EXTRA = "clone_chat";
|
||||||
|
|
||||||
private static final int PICK_CONTACT = 1;
|
private static final int PICK_CONTACT = 1;
|
||||||
public static final int AVATAR_SIZE = 210;
|
|
||||||
private static final int REQUEST_CODE_AVATAR = 2759;
|
private static final int REQUEST_CODE_AVATAR = 2759;
|
||||||
|
|
||||||
private DcContext dcContext;
|
private DcContext dcContext;
|
||||||
|
@ -376,7 +375,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
||||||
.skipMemoryCache(true)
|
.skipMemoryCache(true)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
.centerCrop()
|
.centerCrop()
|
||||||
.override(AVATAR_SIZE, AVATAR_SIZE)
|
.override(AvatarHelper.AVATAR_SIZE, AvatarHelper.AVATAR_SIZE)
|
||||||
.into(new CustomTarget<Bitmap>() {
|
.into(new CustomTarget<Bitmap>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
||||||
|
|
|
@ -49,7 +49,6 @@ import org.thoughtcrime.securesms.mms.AttachmentManager;
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||||
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
||||||
import org.thoughtcrime.securesms.profiles.ProfileMediaConstraints;
|
|
||||||
import org.thoughtcrime.securesms.proxy.ProxySettingsActivity;
|
import org.thoughtcrime.securesms.proxy.ProxySettingsActivity;
|
||||||
import org.thoughtcrime.securesms.qr.RegistrationQrActivity;
|
import org.thoughtcrime.securesms.qr.RegistrationQrActivity;
|
||||||
import org.thoughtcrime.securesms.scribbles.ScribbleActivity;
|
import org.thoughtcrime.securesms.scribbles.ScribbleActivity;
|
||||||
|
@ -284,14 +283,13 @@ public class InstantOnboardingActivity extends BaseActionBarActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAvatarView(Uri output) {
|
private void setAvatarView(Uri output) {
|
||||||
final ProfileMediaConstraints constraints = new ProfileMediaConstraints();
|
|
||||||
GlideApp.with(this)
|
GlideApp.with(this)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(output)
|
.load(output)
|
||||||
.skipMemoryCache(true)
|
.skipMemoryCache(true)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
.centerCrop()
|
.centerCrop()
|
||||||
.override(constraints.getImageMaxWidth(this), constraints.getImageMaxHeight(this))
|
.override(AvatarHelper.AVATAR_SIZE, AvatarHelper.AVATAR_SIZE)
|
||||||
.into(new CustomTarget<Bitmap>() {
|
.into(new CustomTarget<Bitmap>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
||||||
|
|
|
@ -20,6 +20,8 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class AvatarHelper {
|
public class AvatarHelper {
|
||||||
|
/* the maximum width/height an avatar should have */
|
||||||
|
public static final int AVATAR_SIZE = 640;
|
||||||
|
|
||||||
public static void setGroupAvatar(Context context, int chatId, Bitmap bitmap) {
|
public static void setGroupAvatar(Context context, int chatId, Bitmap bitmap) {
|
||||||
DcContext dcContext = DcHelper.getContext(context);
|
DcContext dcContext = DcHelper.getContext(context);
|
||||||
|
@ -30,7 +32,7 @@ public class AvatarHelper {
|
||||||
try {
|
try {
|
||||||
File avatar = File.createTempFile("groupavatar", ".jpg", context.getCacheDir());
|
File avatar = File.createTempFile("groupavatar", ".jpg", context.getCacheDir());
|
||||||
FileOutputStream out = new FileOutputStream(avatar);
|
FileOutputStream out = new FileOutputStream(avatar);
|
||||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 85, out);
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
|
||||||
out.close();
|
out.close();
|
||||||
dcContext.setChatProfileImage(chatId, avatar.getPath()); // The avatar is copied to the blobs directory here...
|
dcContext.setChatProfileImage(chatId, avatar.getPath()); // The avatar is copied to the blobs directory here...
|
||||||
//noinspection ResultOfMethodCallIgnored
|
//noinspection ResultOfMethodCallIgnored
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package org.thoughtcrime.securesms.profiles;
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.mms.MediaConstraints;
|
|
||||||
|
|
||||||
public class ProfileMediaConstraints extends MediaConstraints {
|
|
||||||
@Override
|
|
||||||
public int getImageMaxWidth(Context context) {
|
|
||||||
return 640;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getImageMaxHeight(Context context) {
|
|
||||||
return 640;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getImageMaxSize(Context context) {
|
|
||||||
return 5 * 1024 * 1024;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue