2011-12-20 18:20:44 +00:00
|
|
|
/**
|
|
|
|
* Copyright (C) 2011 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.mms;
|
|
|
|
|
2015-03-31 22:44:41 +00:00
|
|
|
import android.content.Context;
|
|
|
|
import android.content.res.Resources.Theme;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.support.annotation.DrawableRes;
|
2015-09-10 04:05:21 +00:00
|
|
|
import android.support.annotation.NonNull;
|
2015-10-13 01:25:05 +00:00
|
|
|
import android.support.annotation.Nullable;
|
2011-12-20 18:20:44 +00:00
|
|
|
|
2019-07-24 02:30:23 +00:00
|
|
|
import network.loki.messenger.R;
|
2015-10-13 01:25:05 +00:00
|
|
|
import org.thoughtcrime.securesms.attachments.Attachment;
|
2015-11-22 18:44:44 +00:00
|
|
|
import org.thoughtcrime.securesms.attachments.UriAttachment;
|
|
|
|
import org.thoughtcrime.securesms.database.AttachmentDatabase;
|
2017-05-08 22:32:59 +00:00
|
|
|
import org.thoughtcrime.securesms.util.MediaUtil;
|
2015-01-30 06:37:01 +00:00
|
|
|
import org.thoughtcrime.securesms.util.ResUtil;
|
2011-12-20 18:20:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
public class AudioSlide extends Slide {
|
|
|
|
|
2017-05-12 05:46:35 +00:00
|
|
|
public AudioSlide(Context context, Uri uri, long dataSize, boolean voiceNote) {
|
2019-04-17 14:21:30 +00:00
|
|
|
super(context, constructAttachmentFromUri(context, uri, MediaUtil.AUDIO_UNSPECIFIED, dataSize, 0, 0, false, null, null, null, voiceNote, false));
|
2011-12-20 18:20:44 +00:00
|
|
|
}
|
2014-12-01 17:45:37 +00:00
|
|
|
|
2017-05-12 05:46:35 +00:00
|
|
|
public AudioSlide(Context context, Uri uri, long dataSize, String contentType, boolean voiceNote) {
|
2019-04-17 14:21:30 +00:00
|
|
|
super(context, new UriAttachment(uri, null, contentType, AttachmentDatabase.TRANSFER_PROGRESS_STARTED, dataSize, 0, 0, null, null, voiceNote, false, null, null));
|
2015-11-22 18:44:44 +00:00
|
|
|
}
|
|
|
|
|
2015-10-13 01:25:05 +00:00
|
|
|
public AudioSlide(Context context, Attachment attachment) {
|
|
|
|
super(context, attachment);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Nullable
|
|
|
|
public Uri getThumbnailUri() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasPlaceholder() {
|
|
|
|
return true;
|
2015-01-19 02:11:30 +00:00
|
|
|
}
|
|
|
|
|
2011-12-20 18:20:44 +00:00
|
|
|
@Override
|
2015-05-18 15:38:48 +00:00
|
|
|
public boolean hasImage() {
|
2011-12-20 18:20:44 +00:00
|
|
|
return true;
|
|
|
|
}
|
2014-12-01 17:45:37 +00:00
|
|
|
|
2011-12-20 18:20:44 +00:00
|
|
|
@Override
|
2015-05-18 15:38:48 +00:00
|
|
|
public boolean hasAudio() {
|
2011-12-20 18:20:44 +00:00
|
|
|
return true;
|
|
|
|
}
|
2014-06-28 21:06:15 +00:00
|
|
|
|
2015-10-13 01:25:05 +00:00
|
|
|
@NonNull
|
|
|
|
@Override
|
|
|
|
public String getContentDescription() {
|
2015-09-10 04:05:21 +00:00
|
|
|
return context.getString(R.string.Slide_audio);
|
|
|
|
}
|
|
|
|
|
2011-12-20 18:20:44 +00:00
|
|
|
@Override
|
2015-03-31 22:44:41 +00:00
|
|
|
public @DrawableRes int getPlaceholderRes(Theme theme) {
|
|
|
|
return ResUtil.getDrawableRes(theme, R.attr.conversation_icon_attach_audio);
|
2011-12-20 18:20:44 +00:00
|
|
|
}
|
|
|
|
}
|