clean up unused code
parent
ff36fbb6a1
commit
fec13ba72e
@ -1,69 +0,0 @@
|
||||
package org.thoughtcrime.securesms.profiles;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import androidx.annotation.AttrRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.session.libsession.messaging.threads.recipients.Recipient;
|
||||
import org.session.libsession.utilities.ViewUtil;
|
||||
|
||||
public class GroupShareProfileView extends FrameLayout {
|
||||
|
||||
private View container;
|
||||
private @Nullable Recipient recipient;
|
||||
|
||||
public GroupShareProfileView(@NonNull Context context) {
|
||||
super(context);
|
||||
initialize();
|
||||
}
|
||||
|
||||
public GroupShareProfileView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initialize();
|
||||
}
|
||||
|
||||
public GroupShareProfileView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initialize();
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
public GroupShareProfileView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
initialize();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
inflate(getContext(), R.layout.profile_group_share_view, this);
|
||||
|
||||
this.container = ViewUtil.findById(this, R.id.container);
|
||||
this.container.setOnClickListener(view -> {
|
||||
if (this.recipient != null) {
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setIconAttribute(R.attr.dialog_info_icon)
|
||||
.setTitle(R.string.GroupShareProfileView_share_your_profile_name_and_photo_with_this_group)
|
||||
.setMessage(R.string.GroupShareProfileView_do_you_want_to_make_your_profile_name_and_photo_visible_to_all_current_and_future_members_of_this_group)
|
||||
.setPositiveButton(R.string.GroupShareProfileView_make_visible, (dialog, which) -> {
|
||||
DatabaseFactory.getRecipientDatabase(getContext()).setProfileSharing(recipient, true);
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setRecipient(@NonNull Recipient recipient) {
|
||||
this.recipient = recipient;
|
||||
}
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
package org.thoughtcrime.securesms.profiles;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.session.libsession.messaging.threads.recipients.Recipient;
|
||||
import org.session.libsession.messaging.threads.recipients.RecipientExporter;
|
||||
import org.session.libsession.utilities.ViewUtil;
|
||||
|
||||
public class UnknownSenderView extends FrameLayout {
|
||||
|
||||
private final @NonNull Recipient recipient;
|
||||
private final long threadId;
|
||||
|
||||
public UnknownSenderView(@NonNull Context context, @NonNull Recipient recipient, long threadId) {
|
||||
super(context);
|
||||
this.recipient = recipient;
|
||||
this.threadId = threadId;
|
||||
|
||||
inflate(context, R.layout.unknown_sender_view, this);
|
||||
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
|
||||
|
||||
View block = ViewUtil.findById(this, R.id.block);
|
||||
View add = ViewUtil.findById(this, R.id.add_to_contacts);
|
||||
View profileAccess = ViewUtil.findById(this, R.id.share_profile);
|
||||
|
||||
block.setOnClickListener(v -> handleBlock());
|
||||
add.setOnClickListener(v -> handleAdd());
|
||||
profileAccess.setOnClickListener(v -> handleProfileAccess());
|
||||
}
|
||||
|
||||
private void handleBlock() {
|
||||
final Context context = getContext();
|
||||
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setIconAttribute(R.attr.dialog_alert_icon)
|
||||
.setTitle(getContext().getString(R.string.UnknownSenderView_block_s, recipient.toShortString()))
|
||||
.setMessage(R.string.UnknownSenderView_blocked_contacts_will_no_longer_be_able_to_send_you_messages_or_call_you)
|
||||
.setPositiveButton(R.string.UnknownSenderView_block, (dialog, which) -> {
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
DatabaseFactory.getRecipientDatabase(context).setBlocked(recipient, true);
|
||||
if (threadId != -1) DatabaseFactory.getThreadDatabase(context).setHasSent(threadId, true);
|
||||
return null;
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void handleAdd() {
|
||||
getContext().startActivity(RecipientExporter.export(recipient).asAddContactIntent());
|
||||
if (threadId != -1) DatabaseFactory.getThreadDatabase(getContext()).setHasSent(threadId, true);
|
||||
}
|
||||
|
||||
private void handleProfileAccess() {
|
||||
final Context context = getContext();
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setIconAttribute(R.attr.dialog_info_icon)
|
||||
.setTitle(context.getString(R.string.UnknownSenderView_share_profile_with_s, recipient.toShortString()))
|
||||
.setMessage(R.string.UnknownSenderView_the_easiest_way_to_share_your_profile_information_is_to_add_the_sender_to_your_contacts)
|
||||
.setPositiveButton(R.string.UnknownSenderView_share_profile, (dialog, which) -> {
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true);
|
||||
if (threadId != -1) DatabaseFactory.getThreadDatabase(context).setHasSent(threadId, true);
|
||||
return null;
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
}
|
@ -1,193 +0,0 @@
|
||||
package org.thoughtcrime.securesms.providers;
|
||||
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.content.UriMatcher;
|
||||
import android.net.Uri;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.AttachmentSecret;
|
||||
import org.thoughtcrime.securesms.crypto.AttachmentSecretProvider;
|
||||
import org.thoughtcrime.securesms.crypto.ClassicDecryptingPartInputStream;
|
||||
import org.thoughtcrime.securesms.crypto.ModernDecryptingPartInputStream;
|
||||
import org.session.libsignal.utilities.logging.Log;
|
||||
import org.thoughtcrime.securesms.util.FileProviderUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link BlobProvider} instead. Keeping in read-only mode due to the number of
|
||||
* legacy URIs it handles. Given that this was largely used for drafts, and that files were stored
|
||||
* in the cache directory, it's possible that we could remove this class after a reasonable amount
|
||||
* of time has passed.
|
||||
*/
|
||||
@Deprecated
|
||||
public class DeprecatedPersistentBlobProvider {
|
||||
|
||||
private static final String TAG = DeprecatedPersistentBlobProvider.class.getSimpleName();
|
||||
|
||||
private static final String URI_STRING = "content://network.loki.provider.securesms/capture-new";
|
||||
public static final Uri CONTENT_URI = Uri.parse(URI_STRING);
|
||||
public static final String AUTHORITY = "org.thoughtcrime.securesms";
|
||||
public static final String EXPECTED_PATH_OLD = "capture/*/*/#";
|
||||
public static final String EXPECTED_PATH_NEW = "capture-new/*/*/*/*/#";
|
||||
|
||||
private static final int MIMETYPE_PATH_SEGMENT = 1;
|
||||
private static final int FILENAME_PATH_SEGMENT = 2;
|
||||
private static final int FILESIZE_PATH_SEGMENT = 3;
|
||||
|
||||
private static final String BLOB_EXTENSION = "blob";
|
||||
private static final int MATCH_OLD = 1;
|
||||
private static final int MATCH_NEW = 2;
|
||||
|
||||
private static final UriMatcher MATCHER = new UriMatcher(UriMatcher.NO_MATCH) {{
|
||||
addURI(AUTHORITY, EXPECTED_PATH_OLD, MATCH_OLD);
|
||||
addURI(AUTHORITY, EXPECTED_PATH_NEW, MATCH_NEW);
|
||||
}};
|
||||
|
||||
private static volatile DeprecatedPersistentBlobProvider instance;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link BlobProvider} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static DeprecatedPersistentBlobProvider getInstance(Context context) {
|
||||
if (instance == null) {
|
||||
synchronized (DeprecatedPersistentBlobProvider.class) {
|
||||
if (instance == null) {
|
||||
instance = new DeprecatedPersistentBlobProvider(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final AttachmentSecret attachmentSecret;
|
||||
|
||||
private DeprecatedPersistentBlobProvider(@NonNull Context context) {
|
||||
this.attachmentSecret = AttachmentSecretProvider.getInstance(context).getOrCreateAttachmentSecret();
|
||||
}
|
||||
|
||||
public Uri createForExternal(@NonNull Context context, @NonNull String mimeType) throws IOException {
|
||||
File target = new File(getExternalDir(context), String.valueOf(System.currentTimeMillis()) + "." + getExtensionFromMimeType(mimeType));
|
||||
return FileProviderUtil.getUriFor(context, target);
|
||||
}
|
||||
|
||||
public boolean delete(@NonNull Context context, @NonNull Uri uri) {
|
||||
switch (MATCHER.match(uri)) {
|
||||
case MATCH_OLD:
|
||||
case MATCH_NEW:
|
||||
long id = ContentUris.parseId(uri);
|
||||
return getFile(context, ContentUris.parseId(uri)).file.delete();
|
||||
}
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (isExternalBlobUri(context, uri)) {
|
||||
return FileProviderUtil.delete(context, uri);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public @NonNull InputStream getStream(@NonNull Context context, long id) throws IOException {
|
||||
FileData fileData = getFile(context, id);
|
||||
|
||||
if (fileData.modern) return ModernDecryptingPartInputStream.createFor(attachmentSecret, fileData.file, 0);
|
||||
else return ClassicDecryptingPartInputStream.createFor(attachmentSecret, fileData.file);
|
||||
}
|
||||
|
||||
private FileData getFile(@NonNull Context context, long id) {
|
||||
File legacy = getLegacyFile(context, id);
|
||||
File cache = getCacheFile(context, id);
|
||||
File modernCache = getModernCacheFile(context, id);
|
||||
|
||||
if (legacy.exists()) return new FileData(legacy, false);
|
||||
else if (cache.exists()) return new FileData(cache, false);
|
||||
else return new FileData(modernCache, true);
|
||||
}
|
||||
|
||||
private File getLegacyFile(@NonNull Context context, long id) {
|
||||
return new File(context.getDir("captures", Context.MODE_PRIVATE), id + "." + BLOB_EXTENSION);
|
||||
}
|
||||
|
||||
private File getCacheFile(@NonNull Context context, long id) {
|
||||
return new File(context.getCacheDir(), "capture-" + id + "." + BLOB_EXTENSION);
|
||||
}
|
||||
|
||||
private File getModernCacheFile(@NonNull Context context, long id) {
|
||||
return new File(context.getCacheDir(), "capture-m-" + id + "." + BLOB_EXTENSION);
|
||||
}
|
||||
|
||||
public static @Nullable String getMimeType(@NonNull Context context, @NonNull Uri persistentBlobUri) {
|
||||
if (!isAuthority(context, persistentBlobUri)) return null;
|
||||
return isExternalBlobUri(context, persistentBlobUri)
|
||||
? getMimeTypeFromExtension(persistentBlobUri)
|
||||
: persistentBlobUri.getPathSegments().get(MIMETYPE_PATH_SEGMENT);
|
||||
}
|
||||
|
||||
public static @Nullable String getFileName(@NonNull Context context, @NonNull Uri persistentBlobUri) {
|
||||
if (!isAuthority(context, persistentBlobUri)) return null;
|
||||
if (isExternalBlobUri(context, persistentBlobUri)) return null;
|
||||
if (MATCHER.match(persistentBlobUri) == MATCH_OLD) return null;
|
||||
|
||||
return persistentBlobUri.getPathSegments().get(FILENAME_PATH_SEGMENT);
|
||||
}
|
||||
|
||||
public static @Nullable Long getFileSize(@NonNull Context context, Uri persistentBlobUri) {
|
||||
if (!isAuthority(context, persistentBlobUri)) return null;
|
||||
if (isExternalBlobUri(context, persistentBlobUri)) return null;
|
||||
if (MATCHER.match(persistentBlobUri) == MATCH_OLD) return null;
|
||||
|
||||
try {
|
||||
return Long.valueOf(persistentBlobUri.getPathSegments().get(FILESIZE_PATH_SEGMENT));
|
||||
} catch (NumberFormatException e) {
|
||||
Log.w(TAG, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static @NonNull String getExtensionFromMimeType(String mimeType) {
|
||||
final String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
|
||||
return extension != null ? extension : BLOB_EXTENSION;
|
||||
}
|
||||
|
||||
private static @NonNull String getMimeTypeFromExtension(@NonNull Uri uri) {
|
||||
final String mimeType = MimeTypeMap.getSingleton()
|
||||
.getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(uri.toString()));
|
||||
return mimeType != null ? mimeType : "application/octet-stream";
|
||||
}
|
||||
|
||||
private static @NonNull File getExternalDir(Context context) throws IOException {
|
||||
final File externalDir = context.getExternalCacheDir();
|
||||
if (externalDir == null) throw new IOException("no external files directory");
|
||||
return externalDir;
|
||||
}
|
||||
|
||||
public static boolean isAuthority(@NonNull Context context, @NonNull Uri uri) {
|
||||
int matchResult = MATCHER.match(uri);
|
||||
return matchResult == MATCH_NEW || matchResult == MATCH_OLD || isExternalBlobUri(context, uri);
|
||||
}
|
||||
|
||||
private static boolean isExternalBlobUri(@NonNull Context context, @NonNull Uri uri) {
|
||||
try {
|
||||
return uri.getPath().startsWith(getExternalDir(context).getAbsolutePath()) || FileProviderUtil.isAuthority(uri);
|
||||
} catch (IOException ioe) {
|
||||
Log.w(TAG, "Failed to determine if it's an external blob URI.", ioe);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class FileData {
|
||||
private final File file;
|
||||
private final boolean modern;
|
||||
|
||||
private FileData(File file, boolean modern) {
|
||||
this.file = file;
|
||||
this.modern = modern;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2015 Open Whisper Systems
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.thoughtcrime.securesms.providers;
|
||||
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentUris;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.UriMatcher;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.session.libsignal.utilities.logging.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class MmsBodyProvider extends ContentProvider {
|
||||
private static final String TAG = MmsBodyProvider.class.getSimpleName();
|
||||
private static final String CONTENT_URI_STRING = "content://network.loki.provider.securesms.mms/mms";
|
||||
public static final Uri CONTENT_URI = Uri.parse(CONTENT_URI_STRING);
|
||||
private static final int SINGLE_ROW = 1;
|
||||
|
||||
private static final UriMatcher uriMatcher;
|
||||
|
||||
static {
|
||||
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
|
||||
uriMatcher.addURI("network.loki.provider.securesms.mms", "mms/#", SINGLE_ROW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private File getFile(Uri uri) {
|
||||
long id = Long.parseLong(uri.getPathSegments().get(1));
|
||||
return new File(getContext().getCacheDir(), id + ".mmsbody");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException {
|
||||
Log.i(TAG, "openFile(" + uri + ", " + mode + ")");
|
||||
|
||||
switch (uriMatcher.match(uri)) {
|
||||
case SINGLE_ROW:
|
||||
Log.i(TAG, "Fetching message body for a single row...");
|
||||
File tmpFile = getFile(uri);
|
||||
|
||||
final int fileMode;
|
||||
switch (mode) {
|
||||
case "w": fileMode = ParcelFileDescriptor.MODE_TRUNCATE |
|
||||
ParcelFileDescriptor.MODE_CREATE |
|
||||
ParcelFileDescriptor.MODE_WRITE_ONLY; break;
|
||||
case "r": fileMode = ParcelFileDescriptor.MODE_READ_ONLY; break;
|
||||
default: throw new IllegalArgumentException("requested file mode unsupported");
|
||||
}
|
||||
|
||||
Log.i(TAG, "returning file " + tmpFile.getAbsolutePath());
|
||||
return ParcelFileDescriptor.open(tmpFile, fileMode);
|
||||
}
|
||||
|
||||
throw new FileNotFoundException("Request for bad message.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(@NonNull Uri uri, String arg1, String[] arg2) {
|
||||
switch (uriMatcher.match(uri)) {
|
||||
case SINGLE_ROW:
|
||||
return getFile(uri).delete() ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType(@NonNull Uri arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri insert(@NonNull Uri arg0, ContentValues arg1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor query(@NonNull Uri arg0, String[] arg1, String arg2, String[] arg3, String arg4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(@NonNull Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
|
||||
return 0;
|
||||
}
|
||||
public static Pointer makeTemporaryPointer(Context context) {
|
||||
return new Pointer(context, ContentUris.withAppendedId(MmsBodyProvider.CONTENT_URI, System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
public static class Pointer {
|
||||
private final Context context;
|
||||
private final Uri uri;
|
||||
|
||||
public Pointer(Context context, Uri uri) {
|
||||
this.context = context;
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public Uri getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() throws FileNotFoundException {
|
||||
return context.getContentResolver().openOutputStream(uri, "w");
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws FileNotFoundException {
|
||||
return context.getContentResolver().openInputStream(uri);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
context.getContentResolver().delete(uri, null, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package org.thoughtcrime.securesms.qr;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
|
||||
import org.session.libsignal.utilities.logging.Log;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class QrCode {
|
||||
|
||||
public static final String TAG = QrCode.class.getSimpleName();
|
||||
|
||||
public static @NonNull Bitmap create(String data) {
|
||||
return create(data, 1024);
|
||||
}
|
||||
public static @NonNull Bitmap create(String data, int size) { return create(data, size, 2); }
|
||||
public static @NonNull Bitmap create(String data, int size, int margin) {
|
||||
try {
|
||||
HashMap<EncodeHintType, Integer> hintMap = new HashMap<>();
|
||||
hintMap.put(EncodeHintType.MARGIN, margin);
|
||||
BitMatrix result = new QRCodeWriter().encode(data, BarcodeFormat.QR_CODE, size, size, hintMap);
|
||||
Bitmap bitmap = Bitmap.createBitmap(result.getWidth(), result.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
|
||||
for (int y = 0; y < result.getHeight(); y++) {
|
||||
for (int x = 0; x < result.getWidth(); x++) {
|
||||
if (result.get(x, y)) {
|
||||
bitmap.setPixel(x, y, Color.BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
} catch (WriterException e) {
|
||||
Log.w(TAG, e);
|
||||
return Bitmap.createBitmap(512, 512, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.thoughtcrime.securesms.profiles.GroupShareProfileView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/group_share_profile_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
Loading…
Reference in New Issue