mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Clean up indentation
This commit is contained in:
parent
6b84bb63f9
commit
7319e310eb
@ -1,11 +1,11 @@
|
||||
package org.thoughtcrime.securesms.attachments
|
||||
|
||||
data class DatabaseAttachmentAudioExtras(
|
||||
val attachmentId: AttachmentId,
|
||||
/** Small amount of normalized audio byte samples to visualise the content (e.g. draw waveform). */
|
||||
val visualSamples: ByteArray,
|
||||
/** Duration of the audio track in milliseconds. May be [DURATION_UNDEFINED] when is not known. */
|
||||
val durationMs: Long = DURATION_UNDEFINED) {
|
||||
val attachmentId: AttachmentId,
|
||||
/** Small amount of normalized audio byte samples to visualise the content (e.g. draw waveform). */
|
||||
val visualSamples: ByteArray,
|
||||
/** Duration of the audio track in milliseconds. May be [DURATION_UNDEFINED] when it is not known. */
|
||||
val durationMs: Long = DURATION_UNDEFINED) {
|
||||
|
||||
companion object {
|
||||
const val DURATION_UNDEFINED = -1L
|
||||
@ -13,8 +13,8 @@ data class DatabaseAttachmentAudioExtras(
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return other != null &&
|
||||
other is DatabaseAttachmentAudioExtras &&
|
||||
other.attachmentId == attachmentId
|
||||
other is DatabaseAttachmentAudioExtras &&
|
||||
other.attachmentId == attachmentId
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
|
@ -24,11 +24,12 @@ import android.graphics.Bitmap;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
@ -52,10 +53,10 @@ import org.thoughtcrime.securesms.mms.PartAuthority;
|
||||
import org.thoughtcrime.securesms.stickers.StickerLocator;
|
||||
import org.thoughtcrime.securesms.util.BitmapDecodingException;
|
||||
import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||
import org.thoughtcrime.securesms.util.ExternalStorageUtil;
|
||||
import org.thoughtcrime.securesms.util.JsonUtils;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil.ThumbnailData;
|
||||
import org.thoughtcrime.securesms.util.ExternalStorageUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.video.EncryptedMediaDataSource;
|
||||
|
||||
@ -839,15 +840,15 @@ public class AttachmentDatabase extends Database {
|
||||
@Synchronized
|
||||
public @Nullable DatabaseAttachmentAudioExtras getAttachmentAudioExtras(@NonNull AttachmentId attachmentId) {
|
||||
try (Cursor cursor = databaseHelper.getReadableDatabase()
|
||||
// We expect all the audio extra values to be present (not null) or reject the whole record.
|
||||
.query(TABLE_NAME,
|
||||
PROJECTION_AUDIO_EXTRAS,
|
||||
PART_ID_WHERE +
|
||||
" AND " + AUDIO_VISUAL_SAMPLES + " IS NOT NULL" +
|
||||
" AND " + AUDIO_DURATION + " IS NOT NULL" +
|
||||
" AND " + PART_AUDIO_ONLY_WHERE,
|
||||
attachmentId.toStrings(),
|
||||
null, null, null, "1")) {
|
||||
// We expect all the audio extra values to be present (not null) or reject the whole record.
|
||||
.query(TABLE_NAME,
|
||||
PROJECTION_AUDIO_EXTRAS,
|
||||
PART_ID_WHERE +
|
||||
" AND " + AUDIO_VISUAL_SAMPLES + " IS NOT NULL" +
|
||||
" AND " + AUDIO_DURATION + " IS NOT NULL" +
|
||||
" AND " + PART_AUDIO_ONLY_WHERE,
|
||||
attachmentId.toStrings(),
|
||||
null, null, null, "1")) {
|
||||
|
||||
if (cursor == null || !cursor.moveToFirst()) return null;
|
||||
|
||||
@ -869,9 +870,9 @@ public class AttachmentDatabase extends Database {
|
||||
values.put(AUDIO_DURATION, extras.getDurationMs());
|
||||
|
||||
int alteredRows = databaseHelper.getWritableDatabase().update(TABLE_NAME,
|
||||
values,
|
||||
PART_ID_WHERE + " AND " + PART_AUDIO_ONLY_WHERE,
|
||||
extras.getAttachmentId().toStrings());
|
||||
values,
|
||||
PART_ID_WHERE + " AND " + PART_AUDIO_ONLY_WHERE,
|
||||
extras.getAttachmentId().toStrings());
|
||||
|
||||
return alteredRows > 0;
|
||||
}
|
||||
|
@ -93,8 +93,9 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||
private static final int lokiV14_BACKUP_FILES = 35;
|
||||
private static final int lokiV15 = 36;
|
||||
private static final int lokiV16 = 37;
|
||||
private static final int lokiV17 = 38;
|
||||
|
||||
private static final int DATABASE_VERSION = lokiV16;
|
||||
private static final int DATABASE_VERSION = lokiV17;
|
||||
private static final String DATABASE_NAME = "signal.db";
|
||||
|
||||
private final Context context;
|
||||
@ -635,9 +636,12 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
if (oldVersion < lokiV16) {
|
||||
db.execSQL(LokiAPIDatabase.getCreateOpenGroupProfilePictureTableCommand());
|
||||
}
|
||||
|
||||
if (oldVersion < lokiV17) {
|
||||
db.execSQL("ALTER TABLE part ADD COLUMN audio_visual_samples BLOB");
|
||||
db.execSQL("ALTER TABLE part ADD COLUMN audio_duration INTEGER");
|
||||
db.execSQL(LokiAPIDatabase.getCreateOpenGroupProfilePictureTableCommand());
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
|
@ -7,13 +7,12 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.thoughtcrime.securesms.attachments.AttachmentId;
|
||||
import org.thoughtcrime.securesms.util.ParcelableUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
//TODO AC: For now parcelable objects utilize byteArrays field to store their data into.
|
||||
// TODO AC: For now parcelable objects utilize byteArrays field to store their data into.
|
||||
// Introduce a dedicated Map<String, byte[]> field specifically for parcelable needs.
|
||||
public class Data {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user