mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge remote-tracking branch 'upstream/master' into lite
This commit is contained in:
@@ -2,7 +2,12 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item android:title="@string/menu_delete_chat"
|
||||
<item android:title="@string/menu_view_profile"
|
||||
android:id="@+id/menu_view_profile"
|
||||
android:icon="?menu_info_icon"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
<item android:title="@string/delete_contact"
|
||||
android:id="@+id/menu_delete_selected"
|
||||
android:icon="?menu_trash_icon"
|
||||
app:showAsAction="always" />
|
||||
@@ -11,4 +16,4 @@
|
||||
android:id="@+id/menu_select_all"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
</menu>
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="ask_delete_named_chat">Sind Sie sicher, dass Sie \"%1$s\" löschen möchten?</string>
|
||||
<string name="menu_delete_messages">Nachrichten löschen</string>
|
||||
<string name="menu_delete_image">Bild löschen</string>
|
||||
<string name="delete_contact">Kontakt löschen</string>
|
||||
<string name="menu_delete_locations">Alle Standorte löschen?</string>
|
||||
<string name="menu_delete_location">Diesen Standort löschen?</string>
|
||||
<string name="menu_message_details">Nachrichtendetails</string>
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="ask_delete_named_chat">Sei sicuro di voler eliminare \"%1$s\"?</string>
|
||||
<string name="menu_delete_messages">Elimina messaggi</string>
|
||||
<string name="menu_delete_image">Elimina immagine</string>
|
||||
<string name="delete_contact">Elimina contatto</string>
|
||||
<string name="menu_delete_locations">Eliminare tutte le posizioni?</string>
|
||||
<string name="menu_delete_location">Elimino questa posizione?</string>
|
||||
<string name="menu_message_details">Dettagli messaggio</string>
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="ask_delete_named_chat">Weet je zeker dat je \'%1$s\' wilt verwijderen?</string>
|
||||
<string name="menu_delete_messages">Berichten verwijderen</string>
|
||||
<string name="menu_delete_image">Afbeelding verwijderen</string>
|
||||
<string name="delete_contact">Contactpersoon verwijderen</string>
|
||||
<string name="menu_delete_locations">Wil je alle locaties verwijderen?</string>
|
||||
<string name="menu_delete_location">Wil je deze locatie verwijderen?</string>
|
||||
<string name="menu_message_details">Berichtinformatie</string>
|
||||
|
||||
@@ -158,6 +158,7 @@
|
||||
<string name="ask_delete_named_chat">Jeni i sigurt se doni të fshihet \"%1$s\"?</string>
|
||||
<string name="menu_delete_messages">Fshiji mesazhet</string>
|
||||
<string name="menu_delete_image">Fshije figurën</string>
|
||||
<string name="delete_contact">Fshije kontaktin</string>
|
||||
<string name="menu_delete_locations">Të fshihen krejt vendndodhjet?</string>
|
||||
<string name="menu_delete_location">Të fshihet kjo vendndodhje?</string>
|
||||
<string name="menu_message_details">Hollësi mesazhi</string>
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="ask_delete_named_chat">\"%1$s\" sohbetini silmek istediğinizden emin misiniz?</string>
|
||||
<string name="menu_delete_messages">İletileri sil</string>
|
||||
<string name="menu_delete_image">Görseli sil</string>
|
||||
<string name="delete_contact">Kişiyi sil</string>
|
||||
<string name="menu_delete_locations">Tüm konumlar silinsin mi?</string>
|
||||
<string name="menu_delete_location">Bu konum silinsin mi?</string>
|
||||
<string name="menu_message_details">İleti ayrıntıları</string>
|
||||
|
||||
@@ -154,6 +154,7 @@
|
||||
<string name="ask_delete_named_chat">您确定要删除“%1$s”吗?</string>
|
||||
<string name="menu_delete_messages">删除消息</string>
|
||||
<string name="menu_delete_image">删除图像</string>
|
||||
<string name="delete_contact">删除联系人</string>
|
||||
<string name="menu_delete_locations">删除所有位置?</string>
|
||||
<string name="menu_delete_location">删除此位置?</string>
|
||||
<string name="menu_message_details">消息详情</string>
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="ask_delete_named_chat">Are you sure you want to delete \"%1$s\"?</string>
|
||||
<string name="menu_delete_messages">Delete messages</string>
|
||||
<string name="menu_delete_image">Delete image</string>
|
||||
<string name="delete_contact">Delete contact</string>
|
||||
<string name="menu_delete_locations">Delete all locations?</string>
|
||||
<string name="menu_delete_location">Delete this location?</string>
|
||||
<string name="menu_message_details">Message details</string>
|
||||
@@ -593,6 +594,9 @@
|
||||
<string name="systemmsg_ephemeral_timer_week">Disappearing messages timer set to 1 week.</string>
|
||||
<string name="systemmsg_ephemeral_timer_four_weeks">Disappearing messages timer set to 4 weeks.</string>
|
||||
|
||||
<!-- Translators: Protection disabled/enabled messages may be displayed together with a "big shield" and may be suffixed by systemmsg_action_by_user or systemmsg_action_by_me -->
|
||||
<string name="systemmsg_chat_protection_disabled">Chat protection disabled.</string>
|
||||
<string name="systemmsg_chat_protection_enabled">Chat protection enabled.</string>
|
||||
|
||||
<!-- screen lock -->
|
||||
<string name="screenlock_title">Screen lock</string>
|
||||
|
||||
@@ -152,10 +152,6 @@ public class DcMsg {
|
||||
return getFromId() == DcContact.DC_CONTACT_ID_SELF;
|
||||
}
|
||||
|
||||
public boolean isGroupAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getDisplayBody() {
|
||||
return getText();
|
||||
}
|
||||
@@ -174,21 +170,12 @@ public class DcMsg {
|
||||
public boolean isPreparing() {
|
||||
return getState() == DC_STATE_OUT_PREPARING;
|
||||
}
|
||||
public long getExpiresIn() {
|
||||
return -1; // never.
|
||||
}
|
||||
public long getExpireStarted() {
|
||||
return 0;
|
||||
}
|
||||
public boolean isSecure() {
|
||||
return showPadlock()!=0;
|
||||
}
|
||||
public boolean isPending() {
|
||||
return getState() == DC_STATE_OUT_PENDING;
|
||||
}
|
||||
public boolean isMediaPending() {
|
||||
return isPending();
|
||||
}
|
||||
public boolean isDelivered() {
|
||||
return getState() == DC_STATE_OUT_DELIVERED;
|
||||
}
|
||||
@@ -198,17 +185,7 @@ public class DcMsg {
|
||||
public boolean isSeen() {
|
||||
return getState() == DC_STATE_IN_SEEN;
|
||||
}
|
||||
public boolean isMms() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// the following are probably system messages in delta-land
|
||||
public boolean isJoined() { return false; }
|
||||
public boolean isExpirationTimerUpdate() { return false; }
|
||||
public boolean isEndSession() { return false; }
|
||||
public boolean isIdentityUpdate() { return false; }
|
||||
public boolean isIdentityVerified() { return false; }
|
||||
public boolean isIdentityDefault() { return false; }
|
||||
|
||||
// working with raw c-data
|
||||
private long msgCPtr; // CAVE: the name is referenced in the JNI
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.thoughtcrime.securesms;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
@@ -64,6 +65,7 @@ import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.util.StickyHeaderDecoration;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.views.AdaptiveActionsToolbar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
@@ -148,6 +150,7 @@ public class ContactSelectionListFragment extends Fragment
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.action_mode_status_bar));
|
||||
}
|
||||
setCorrectMenuVisibility(menu);
|
||||
actionMode.setTitle("1");
|
||||
return true;
|
||||
}
|
||||
@@ -163,6 +166,9 @@ public class ContactSelectionListFragment extends Fragment
|
||||
case R.id.menu_select_all:
|
||||
handleSelectAll();
|
||||
return true;
|
||||
case R.id.menu_view_profile:
|
||||
handleViewProfile();
|
||||
return true;
|
||||
case R.id.menu_delete_selected:
|
||||
handleDeleteSelected();
|
||||
return true;
|
||||
@@ -205,6 +211,26 @@ public class ContactSelectionListFragment extends Fragment
|
||||
actionMode.setTitle(String.valueOf(getContactSelectionListAdapter().getActionModeSelection().size()));
|
||||
}
|
||||
|
||||
private void setCorrectMenuVisibility(Menu menu) {
|
||||
ContactSelectionListAdapter adapter = getContactSelectionListAdapter();
|
||||
if (adapter.getActionModeSelection().size() > 1) {
|
||||
menu.findItem(R.id.menu_view_profile).setVisible(false);
|
||||
} else {
|
||||
menu.findItem(R.id.menu_view_profile).setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleViewProfile() {
|
||||
ContactSelectionListAdapter adapter = getContactSelectionListAdapter();
|
||||
if (adapter.getActionModeSelection().size() == 1) {
|
||||
int contactId = adapter.getActionModeSelection().valueAt(0);
|
||||
|
||||
Intent intent = new Intent(getContext(), ProfileActivity.class);
|
||||
intent.putExtra(ProfileActivity.CONTACT_ID_EXTRA, contactId);
|
||||
getContext().startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleDeleteSelected() {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setMessage(R.string.ask_delete_contacts)
|
||||
@@ -365,6 +391,8 @@ public class ContactSelectionListFragment extends Fragment
|
||||
{
|
||||
if (handleActionMode) {
|
||||
if (actionMode != null) {
|
||||
Menu menu = actionMode.getMenu();
|
||||
setCorrectMenuVisibility(menu);
|
||||
updateActionModeTitle();
|
||||
finishActionModeIfSelectionIsEmpty();
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public class ConversationListItem extends RelativeLayout
|
||||
deliveryStatusIndicator.setNone();
|
||||
|
||||
setBatchState(false);
|
||||
contactPhotoImage.setAvatar(glideRequests, recipient, true);
|
||||
contactPhotoImage.setAvatar(glideRequests, recipient, false);
|
||||
}
|
||||
|
||||
public void bind(@NonNull DcMsg messageResult,
|
||||
@@ -244,7 +244,7 @@ public class ConversationListItem extends RelativeLayout
|
||||
deliveryStatusIndicator.setNone();
|
||||
|
||||
setBatchState(false);
|
||||
contactPhotoImage.setAvatar(glideRequests, recipient, true);
|
||||
contactPhotoImage.setAvatar(glideRequests, recipient, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,19 +50,19 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
Log.w(TAG, "onResume()");
|
||||
Log.i(TAG, "onResume()");
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
Log.w(TAG, "onPause()");
|
||||
Log.i(TAG, "onPause()");
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Log.w(TAG, "onDestroy()");
|
||||
Log.i(TAG, "onDestroy()");
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package org.thoughtcrime.securesms.audio;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.DefaultLoadControl;
|
||||
@@ -26,7 +27,7 @@ import com.google.android.exoplayer2.source.MediaSource;
|
||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.mms.AudioSlide;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.guava.Optional;
|
||||
@@ -170,14 +171,16 @@ public class AudioSlidePlayer {
|
||||
public void onPlayerError(ExoPlaybackException error) {
|
||||
Log.w(TAG, "MediaPlayer Error: " + error);
|
||||
|
||||
Toast.makeText(context, R.string.error, Toast.LENGTH_SHORT).show();
|
||||
|
||||
synchronized (AudioSlidePlayer.this) {
|
||||
mediaPlayer = null;
|
||||
}
|
||||
|
||||
notifyOnStop();
|
||||
progressEventHandler.removeMessages(0);
|
||||
|
||||
// Failed to play media file, maybe another app can handle it
|
||||
int msgId = getAudioSlide().getDcMsgId();
|
||||
DcHelper.getContext(context).openForViewOrShare(context, msgId, Intent.ACTION_VIEW);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ public class AvatarImageView extends AppCompatImageView {
|
||||
if (recipient != null) {
|
||||
ContactPhoto contactPhoto = recipient.getContactPhoto(getContext());
|
||||
requestManager.load(contactPhoto)
|
||||
.fallback(recipient.getFallbackAvatarDrawable(getContext()))
|
||||
.error(recipient.getFallbackAvatarDrawable(getContext()))
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.circleCrop()
|
||||
@@ -59,7 +58,7 @@ public class AvatarImageView extends AppCompatImageView {
|
||||
}
|
||||
} else {
|
||||
setImageDrawable(new GeneratedContactPhoto("+").asDrawable(getContext(), ThemeUtil.getDummyContactColor(getContext())));
|
||||
super.setOnClickListener(listener);
|
||||
if (listener != null) super.setOnClickListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +165,8 @@ public class ApplicationDcContext extends DcContext {
|
||||
setStockTranslation(82, context.getString(R.string.videochat_invitation));
|
||||
setStockTranslation(83, context.getString(R.string.videochat_invitation_body));
|
||||
setStockTranslation(84, context.getString(R.string.configuration_failed_with_error));
|
||||
setStockTranslation(88, context.getString(R.string.systemmsg_chat_protection_enabled));
|
||||
setStockTranslation(89, context.getString(R.string.systemmsg_chat_protection_disabled));
|
||||
setStockTranslation(90, context.getString(R.string.reply_noun));
|
||||
}
|
||||
|
||||
|
||||
@@ -47,10 +47,6 @@ public class AudioSlide extends Slide {
|
||||
super(context, new UriAttachment(uri, null, contentType, AttachmentDatabase.TRANSFER_PROGRESS_STARTED, dataSize, 0, 0, null, null, voiceNote));
|
||||
}
|
||||
|
||||
public AudioSlide(Context context, Attachment attachment) {
|
||||
super(context, attachment);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Uri getThumbnailUri() {
|
||||
|
||||
@@ -14,12 +14,8 @@ import org.thoughtcrime.securesms.util.StorageUtil;
|
||||
|
||||
public class DocumentSlide extends Slide {
|
||||
|
||||
public DocumentSlide(@NonNull Context context, @NonNull Attachment attachment) {
|
||||
super(context, attachment);
|
||||
}
|
||||
|
||||
public DocumentSlide(Context context, DcMsg dcMsg) {
|
||||
this(context, new DcAttachment(dcMsg));
|
||||
super(context, new DcAttachment(dcMsg));
|
||||
dcMsgId = dcMsg.getId();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,6 @@ public class GifSlide extends ImageSlide {
|
||||
super(context, dcMsg);
|
||||
}
|
||||
|
||||
public GifSlide(Context context, Attachment attachment) {
|
||||
super(context, attachment);
|
||||
}
|
||||
|
||||
public GifSlide(Context context, Uri uri, long size, int width, int height) {
|
||||
super(context, constructAttachmentFromUri(context, uri, MediaUtil.IMAGE_GIF, size, width, height, uri, null, false));
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package org.thoughtcrime.securesms.mms;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.b44t.messenger.DcMsg;
|
||||
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
|
||||
public class MmsSlide extends ImageSlide {
|
||||
|
||||
public MmsSlide(@NonNull Context context, @NonNull DcMsg dcMsg) {
|
||||
super(context, dcMsg);
|
||||
}
|
||||
|
||||
public MmsSlide(@NonNull Context context, @NonNull Attachment attachment) {
|
||||
super(context, attachment);
|
||||
}
|
||||
}
|
||||
@@ -49,10 +49,6 @@ public class VideoSlide extends Slide {
|
||||
dcMsgId = dcMsg.getId();
|
||||
}
|
||||
|
||||
public VideoSlide(Context context, Attachment attachment) {
|
||||
super(context, attachment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlayOverlay() {
|
||||
return true;
|
||||
|
||||
@@ -16,14 +16,12 @@ import com.b44t.messenger.DcMsg;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.mms.AudioSlide;
|
||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri;
|
||||
import org.thoughtcrime.securesms.mms.DocumentSlide;
|
||||
import org.thoughtcrime.securesms.mms.GifSlide;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
import org.thoughtcrime.securesms.mms.ImageSlide;
|
||||
import org.thoughtcrime.securesms.mms.MmsSlide;
|
||||
import org.thoughtcrime.securesms.mms.PartAuthority;
|
||||
import org.thoughtcrime.securesms.mms.Slide;
|
||||
import org.thoughtcrime.securesms.mms.VideoSlide;
|
||||
@@ -50,46 +48,22 @@ public class MediaUtil {
|
||||
|
||||
public static Slide getSlideForMsg(Context context, DcMsg dcMsg) {
|
||||
Slide slide = null;
|
||||
if (isGif(dcMsg.getFilemime())) {
|
||||
if (dcMsg.getType() == DcMsg.DC_MSG_GIF) {
|
||||
slide = new GifSlide(context, dcMsg);
|
||||
} else if (isImageType(dcMsg.getFilemime())) {
|
||||
} else if (dcMsg.getType() == DcMsg.DC_MSG_IMAGE) {
|
||||
slide = new ImageSlide(context, dcMsg);
|
||||
} else if (isVideoType(dcMsg.getFilemime())) {
|
||||
} else if (dcMsg.getType() == DcMsg.DC_MSG_VIDEO) {
|
||||
slide = new VideoSlide(context, dcMsg);
|
||||
} else if (isAudioType(dcMsg.getFilemime())) {
|
||||
} else if (dcMsg.getType() == DcMsg.DC_MSG_AUDIO
|
||||
|| dcMsg.getType() == DcMsg.DC_MSG_VOICE) {
|
||||
slide = new AudioSlide(context, dcMsg);
|
||||
} else if (isMms(dcMsg.getFilemime())) {
|
||||
slide = new MmsSlide(context, dcMsg);
|
||||
} else if (dcMsg.getFilemime() != null) {
|
||||
} else if (dcMsg.getType() == DcMsg.DC_MSG_FILE) {
|
||||
slide = new DocumentSlide(context, dcMsg);
|
||||
}
|
||||
|
||||
return slide;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getSlideForMsg instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static Slide getSlideForAttachment(Context context, Attachment attachment) {
|
||||
Slide slide = null;
|
||||
if (isGif(attachment.getContentType())) {
|
||||
slide = new GifSlide(context, attachment);
|
||||
} else if (isImageType(attachment.getContentType())) {
|
||||
slide = new ImageSlide(context, attachment);
|
||||
} else if (isVideoType(attachment.getContentType())) {
|
||||
slide = new VideoSlide(context, attachment);
|
||||
} else if (isAudioType(attachment.getContentType())) {
|
||||
slide = new AudioSlide(context, attachment);
|
||||
} else if (isMms(attachment.getContentType())) {
|
||||
slide = new MmsSlide(context, attachment);
|
||||
} else if (attachment.getContentType() != null) {
|
||||
slide = new DocumentSlide(context, attachment);
|
||||
}
|
||||
|
||||
return slide;
|
||||
}
|
||||
|
||||
public static @Nullable String getMimeType(Context context, Uri uri) {
|
||||
if (uri == null) return null;
|
||||
|
||||
@@ -193,10 +167,6 @@ public class MediaUtil {
|
||||
return dimens;
|
||||
}
|
||||
|
||||
public static boolean isMms(String contentType) {
|
||||
return !TextUtils.isEmpty(contentType) && contentType.trim().equals("application/mms");
|
||||
}
|
||||
|
||||
public static boolean isVideo(String contentType) {
|
||||
return !TextUtils.isEmpty(contentType) && contentType.trim().startsWith("video/");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user