diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 024d2704f..72d3509fa 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -399,13 +399,6 @@
-
-
.
- */
-package org.thoughtcrime.securesms.components;
-
-import android.content.Context;
-
-import androidx.annotation.NonNull;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.RelativeLayout;
-
-import network.loki.messenger.R;
-import org.thoughtcrime.securesms.contacts.RecipientsAdapter;
-import org.thoughtcrime.securesms.contacts.RecipientsEditor;
-import org.thoughtcrime.securesms.database.Address;
-import org.thoughtcrime.securesms.recipients.Recipient;
-import org.thoughtcrime.securesms.recipients.RecipientModifiedListener;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-/**
- * Panel component combining both an editable field with a button for
- * a list-based contact selector.
- *
- * @author Moxie Marlinspike
- */
-public class PushRecipientsPanel extends RelativeLayout implements RecipientModifiedListener {
- private final String TAG = PushRecipientsPanel.class.getSimpleName();
- private RecipientsPanelChangedListener panelChangeListener;
-
- private RecipientsEditor recipientsText;
- private View panel;
-
- private static final int RECIPIENTS_MAX_LENGTH = 312;
-
- public PushRecipientsPanel(Context context) {
- super(context);
- initialize();
- }
-
- public PushRecipientsPanel(Context context, AttributeSet attrs) {
- super(context, attrs);
- initialize();
- }
-
- public PushRecipientsPanel(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- initialize();
- }
-
- public List getRecipients() {
- String rawText = recipientsText.getText().toString();
- return getRecipientsFromString(getContext(), rawText, true);
- }
-
- public void disable() {
- recipientsText.setText("");
- panel.setVisibility(View.GONE);
- }
-
- public void setPanelChangeListener(RecipientsPanelChangedListener panelChangeListener) {
- this.panelChangeListener = panelChangeListener;
- }
-
- private void initialize() {
- LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- inflater.inflate(R.layout.push_recipients_panel, this, true);
-
- View imageButton = findViewById(R.id.contacts_button);
- ((MarginLayoutParams) imageButton.getLayoutParams()).topMargin = 0;
-
- panel = findViewById(R.id.recipients_panel);
- initRecipientsEditor();
- }
-
- private void initRecipientsEditor() {
-
- this.recipientsText = (RecipientsEditor)findViewById(R.id.recipients_text);
-
- List recipients = getRecipients();
-
- for (Recipient recipient : recipients) {
- recipient.addListener(this);
- }
-
- recipientsText.setAdapter(new RecipientsAdapter(this.getContext()));
- recipientsText.populate(recipients);
-
- recipientsText.setOnFocusChangeListener(new FocusChangedListener());
- recipientsText.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
- if (panelChangeListener != null) {
- panelChangeListener.onRecipientsPanelUpdate(getRecipients());
- }
- recipientsText.setText("");
- }
- });
- }
-
- private @NonNull List getRecipientsFromString(Context context, @NonNull String rawText, boolean asynchronous) {
- StringTokenizer tokenizer = new StringTokenizer(rawText, ",");
- List recipients = new LinkedList<>();
-
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken().trim();
-
- if (!TextUtils.isEmpty(token)) {
- if (hasBracketedNumber(token)) recipients.add(Recipient.from(context, Address.fromExternal(context, parseBracketedNumber(token)), asynchronous));
- else recipients.add(Recipient.from(context, Address.fromExternal(context, token), asynchronous));
- }
- }
-
- return recipients;
- }
-
- private boolean hasBracketedNumber(String recipient) {
- int openBracketIndex = recipient.indexOf('<');
-
- return (openBracketIndex != -1) &&
- (recipient.indexOf('>', openBracketIndex) != -1);
- }
-
- private String parseBracketedNumber(String recipient) {
- int begin = recipient.indexOf('<');
- int end = recipient.indexOf('>', begin);
- String value = recipient.substring(begin + 1, end);
-
- return value;
- }
-
- @Override
- public void onModified(Recipient recipient) {
- recipientsText.populate(getRecipients());
- }
-
- private class FocusChangedListener implements View.OnFocusChangeListener {
- public void onFocusChange(View v, boolean hasFocus) {
- if (!hasFocus && (panelChangeListener != null)) {
- panelChangeListener.onRecipientsPanelUpdate(getRecipients());
- }
- }
- }
-
- public interface RecipientsPanelChangedListener {
- public void onRecipientsPanelUpdate(List recipients);
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/RatingManager.java b/app/src/main/java/org/thoughtcrime/securesms/components/RatingManager.java
deleted file mode 100644
index 7114f240d..000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/components/RatingManager.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.thoughtcrime.securesms.components;
-
-import android.content.ActivityNotFoundException;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.net.Uri;
-import androidx.appcompat.app.AlertDialog;
-import org.thoughtcrime.securesms.logging.Log;
-import android.widget.Toast;
-
-import network.loki.messenger.R;
-import org.thoughtcrime.securesms.util.TextSecurePreferences;
-
-import java.util.concurrent.TimeUnit;
-
-public class RatingManager {
-
- private static final int DAYS_SINCE_INSTALL_THRESHOLD = 7;
- private static final int DAYS_UNTIL_REPROMPT_THRESHOLD = 4;
-
- private static final String TAG = RatingManager.class.getSimpleName();
-
- public static void showRatingDialogIfNecessary(Context context) {
- if (!TextSecurePreferences.isRatingEnabled(context)) return;
-
- long daysSinceInstall = getDaysSinceInstalled(context);
- long laterTimestamp = TextSecurePreferences.getRatingLaterTimestamp(context);
-
- if (daysSinceInstall >= DAYS_SINCE_INSTALL_THRESHOLD &&
- System.currentTimeMillis() >= laterTimestamp)
- {
- showRatingDialog(context);
- }
- }
-
- private static void showRatingDialog(final Context context) {
- new AlertDialog.Builder(context)
- .setTitle(R.string.RatingManager_rate_this_app)
- .setMessage(R.string.RatingManager_if_you_enjoy_using_this_app_please_take_a_moment)
- .setPositiveButton(R.string.RatingManager_rate_now, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- TextSecurePreferences.setRatingEnabled(context, false);
- startPlayStore(context);
- }
- })
- .setNegativeButton(R.string.RatingManager_no_thanks, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- TextSecurePreferences.setRatingEnabled(context, false);
- }
- })
- .setNeutralButton(R.string.RatingManager_later, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- long waitUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(DAYS_UNTIL_REPROMPT_THRESHOLD);
- TextSecurePreferences.setRatingLaterTimestamp(context, waitUntil);
- }
- })
- .show();
- }
-
- private static void startPlayStore(Context context) {
- Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
- try {
- context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, e);
- Toast.makeText(context, R.string.RatingManager_whoops_the_play_store_app_does_not_appear_to_be_installed, Toast.LENGTH_LONG).show();
- }
- }
-
- private static long getDaysSinceInstalled(Context context) {
- try {
- long installTimestamp = context.getPackageManager()
- .getPackageInfo(context.getPackageName(), 0)
- .firstInstallTime;
-
- return TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - installTimestamp);
- } catch (PackageManager.NameNotFoundException e) {
- Log.w(TAG, e);
- return 0;
- }
- }
-
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/RecyclerViewFastScroller.java b/app/src/main/java/org/thoughtcrime/securesms/components/RecyclerViewFastScroller.java
deleted file mode 100644
index 50d9d4d3d..000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/components/RecyclerViewFastScroller.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/**
- * Modified version of
- * https://github.com/AndroidDeveloperLB/LollipopContactsRecyclerViewFastScroller
- *
- * Their license:
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.thoughtcrime.securesms.components;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.os.Build.VERSION;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewTreeObserver;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import network.loki.messenger.R;
-import org.thoughtcrime.securesms.util.Util;
-import org.thoughtcrime.securesms.util.ViewUtil;
-
-public class RecyclerViewFastScroller extends LinearLayout {
- private static final int BUBBLE_ANIMATION_DURATION = 100;
- private static final int TRACK_SNAP_RANGE = 5;
-
- private @NonNull TextView bubble;
- private @NonNull View handle;
- private @Nullable RecyclerView recyclerView;
-
- private int height;
- private ObjectAnimator currentAnimator;
-
- private final RecyclerView.OnScrollListener onScrollListener = new RecyclerView.OnScrollListener() {
- @Override
- public void onScrolled(@NonNull final RecyclerView recyclerView, final int dx, final int dy) {
- if (handle.isSelected()) return;
- final int offset = recyclerView.computeVerticalScrollOffset();
- final int range = recyclerView.computeVerticalScrollRange();
- final int extent = recyclerView.computeVerticalScrollExtent();
- final int offsetRange = Math.max(range - extent, 1);
- setBubbleAndHandlePosition((float) Util.clamp(offset, 0, offsetRange) / offsetRange);
- }
- };
-
- public interface FastScrollAdapter {
- CharSequence getBubbleText(int pos);
- }
-
- public RecyclerViewFastScroller(final Context context) {
- this(context, null);
- }
-
- public RecyclerViewFastScroller(final Context context, final AttributeSet attrs) {
- super(context, attrs);
- setOrientation(HORIZONTAL);
- setClipChildren(false);
- setScrollContainer(true);
- inflate(context, R.layout.recycler_view_fast_scroller, this);
- bubble = ViewUtil.findById(this, R.id.fastscroller_bubble);
- handle = ViewUtil.findById(this, R.id.fastscroller_handle);
- }
-
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
- height = h;
- }
-
- @Override
- @TargetApi(11)
- public boolean onTouchEvent(@NonNull MotionEvent event) {
- final int action = event.getAction();
- switch (action) {
- case MotionEvent.ACTION_DOWN:
- if (event.getX() < ViewUtil.getX(handle) - handle.getPaddingLeft() ||
- event.getY() < ViewUtil.getY(handle) - handle.getPaddingTop() ||
- event.getY() > ViewUtil.getY(handle) + handle.getHeight() + handle.getPaddingBottom())
- {
- return false;
- }
- if (currentAnimator != null) {
- currentAnimator.cancel();
- }
- if (bubble.getVisibility() != VISIBLE) {
- showBubble();
- }
- handle.setSelected(true);
- case MotionEvent.ACTION_MOVE:
- final float y = event.getY();
- setBubbleAndHandlePosition(y / height);
- setRecyclerViewPosition(y);
- return true;
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_CANCEL:
- handle.setSelected(false);
- hideBubble();
- return true;
- }
- return super.onTouchEvent(event);
- }
-
- public void setRecyclerView(final @NonNull RecyclerView recyclerView) {
- if (this.recyclerView != null) {
- this.recyclerView.removeOnScrollListener(onScrollListener);
- }
- this.recyclerView = recyclerView;
- recyclerView.addOnScrollListener(onScrollListener);
- recyclerView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
- @Override
- public boolean onPreDraw() {
- recyclerView.getViewTreeObserver().removeOnPreDrawListener(this);
- if (handle.isSelected()) return true;
- final int verticalScrollOffset = recyclerView.computeVerticalScrollOffset();
- final int verticalScrollRange = recyclerView.computeVerticalScrollRange();
- float proportion = (float)verticalScrollOffset / ((float)verticalScrollRange - height);
- setBubbleAndHandlePosition(height * proportion);
- return true;
- }
- });
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- if (recyclerView != null)
- recyclerView.removeOnScrollListener(onScrollListener);
- }
-
- private void setRecyclerViewPosition(float y) {
- if (recyclerView != null) {
- final int itemCount = recyclerView.getAdapter().getItemCount();
- float proportion;
- if (ViewUtil.getY(handle) == 0) {
- proportion = 0f;
- } else if (ViewUtil.getY(handle) + handle.getHeight() >= height - TRACK_SNAP_RANGE) {
- proportion = 1f;
- } else {
- proportion = y / (float)height;
- }
-
- final int targetPos = Util.clamp((int)(proportion * (float)itemCount), 0, itemCount - 1);
- ((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(targetPos, 0);
- final CharSequence bubbleText = ((FastScrollAdapter) recyclerView.getAdapter()).getBubbleText(targetPos);
- bubble.setText(bubbleText);
- }
- }
-
- private void setBubbleAndHandlePosition(float y) {
- final int handleHeight = handle.getHeight();
- final int bubbleHeight = bubble.getHeight();
- final int handleY = Util.clamp((int)((height - handleHeight) * y), 0, height - handleHeight);
- ViewUtil.setY(handle, handleY);
- ViewUtil.setY(bubble, Util.clamp(handleY - bubbleHeight - bubble.getPaddingBottom() + handleHeight,
- 0,
- height - bubbleHeight));
- }
-
- @TargetApi(11)
- private void showBubble() {
- bubble.setVisibility(VISIBLE);
- if (VERSION.SDK_INT >= 11) {
- if (currentAnimator != null) currentAnimator.cancel();
- currentAnimator = ObjectAnimator.ofFloat(bubble, "alpha", 0f, 1f).setDuration(BUBBLE_ANIMATION_DURATION);
- currentAnimator.start();
- }
- }
-
- @TargetApi(11)
- private void hideBubble() {
- if (VERSION.SDK_INT >= 11) {
- if (currentAnimator != null) currentAnimator.cancel();
- currentAnimator = ObjectAnimator.ofFloat(bubble, "alpha", 1f, 0f).setDuration(BUBBLE_ANIMATION_DURATION);
- currentAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- bubble.setVisibility(INVISIBLE);
- currentAnimator = null;
- }
-
- @Override
- public void onAnimationCancel(Animator animation) {
- super.onAnimationCancel(animation);
- bubble.setVisibility(INVISIBLE);
- currentAnimator = null;
- }
- });
- currentAnimator.start();
- } else {
- bubble.setVisibility(INVISIBLE);
- }
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/SharedContactView.java b/app/src/main/java/org/thoughtcrime/securesms/components/SharedContactView.java
deleted file mode 100644
index 5fea44e4f..000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/components/SharedContactView.java
+++ /dev/null
@@ -1,230 +0,0 @@
-package org.thoughtcrime.securesms.components;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.net.Uri;
-import android.os.Build;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.RequiresApi;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.annimon.stream.Stream;
-import com.bumptech.glide.load.engine.DiskCacheStrategy;
-
-import network.loki.messenger.R;
-import org.thoughtcrime.securesms.contactshare.ContactUtil;
-import org.thoughtcrime.securesms.contactshare.Contact;
-import org.thoughtcrime.securesms.database.RecipientDatabase;
-import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri;
-import org.thoughtcrime.securesms.mms.GlideRequests;
-import org.thoughtcrime.securesms.recipients.Recipient;
-import org.thoughtcrime.securesms.recipients.RecipientModifiedListener;
-import org.thoughtcrime.securesms.util.Util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-public class SharedContactView extends LinearLayout implements RecipientModifiedListener {
-
- private ImageView avatarView;
- private TextView nameView;
- private TextView numberView;
- private TextView actionButtonView;
- private ConversationItemFooter footer;
-
- private Contact contact;
- private Locale locale;
- private GlideRequests glideRequests;
- private EventListener eventListener;
- private CornerMask cornerMask;
- private int bigCornerRadius;
- private int smallCornerRadius;
-
- private final Map activeRecipients = new HashMap<>();
-
- public SharedContactView(Context context) {
- super(context);
- initialize(null);
- }
-
- public SharedContactView(Context context, @Nullable AttributeSet attrs) {
- super(context, attrs);
- initialize(attrs);
- }
-
- public SharedContactView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- initialize(attrs);
- }
-
- @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
- public SharedContactView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- initialize(attrs);
- }
-
- private void initialize(@Nullable AttributeSet attrs) {
- inflate(getContext(), R.layout.shared_contact_view, this);
-
- avatarView = findViewById(R.id.contact_avatar);
- nameView = findViewById(R.id.contact_name);
- numberView = findViewById(R.id.contact_number);
- actionButtonView = findViewById(R.id.contact_action_button);
- footer = findViewById(R.id.contact_footer);
-
- cornerMask = new CornerMask(this);
- bigCornerRadius = getResources().getDimensionPixelOffset(R.dimen.message_corner_radius);
- smallCornerRadius = getResources().getDimensionPixelOffset(R.dimen.message_corner_collapse_radius);
-
- if (attrs != null) {
- TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.SharedContactView, 0, 0);
- int titleColor = typedArray.getInt(R.styleable.SharedContactView_contact_titleColor, Color.BLACK);
- int captionColor = typedArray.getInt(R.styleable.SharedContactView_contact_captionColor, Color.BLACK);
- int iconColor = typedArray.getInt(R.styleable.SharedContactView_contact_footerIconColor, Color.BLACK);
- float footerAlpha = typedArray.getFloat(R.styleable.SharedContactView_contact_footerAlpha, 1);
- typedArray.recycle();
-
- nameView.setTextColor(titleColor);
- numberView.setTextColor(captionColor);
- footer.setTextColor(captionColor);
- footer.setIconColor(iconColor);
- footer.setAlpha(footerAlpha);
- }
- }
-
- @Override
- protected void dispatchDraw(Canvas canvas) {
- super.dispatchDraw(canvas);
- cornerMask.mask(canvas);
- }
-
- public void setContact(@NonNull Contact contact, @NonNull GlideRequests glideRequests, @NonNull Locale locale) {
- this.glideRequests = glideRequests;
- this.locale = locale;
- this.contact = contact;
-
- Stream.of(activeRecipients.values()).forEach(recipient -> recipient.removeListener(this));
- this.activeRecipients.clear();
-
- presentContact(contact);
- presentAvatar(contact.getAvatarAttachment() != null ? contact.getAvatarAttachment().getDataUri() : null);
- presentActionButtons(ContactUtil.getRecipients(getContext(), contact));
- }
-
- public void setSingularStyle() {
- cornerMask.setBottomLeftRadius(bigCornerRadius);
- cornerMask.setBottomRightRadius(bigCornerRadius);
- }
-
- public void setClusteredIncomingStyle() {
- cornerMask.setBottomLeftRadius(smallCornerRadius);
- cornerMask.setBottomRightRadius(bigCornerRadius);
- }
-
- public void setClusteredOutgoingStyle() {
- cornerMask.setBottomLeftRadius(bigCornerRadius);
- cornerMask.setBottomRightRadius(smallCornerRadius);
- }
-
- public void setEventListener(@NonNull EventListener eventListener) {
- this.eventListener = eventListener;
- }
-
- public @NonNull View getAvatarView() {
- return avatarView;
- }
-
- public ConversationItemFooter getFooter() {
- return footer;
- }
-
- @Override
- public void onModified(Recipient recipient) {
- Util.runOnMain(() -> presentActionButtons(Collections.singletonList(recipient)));
- }
-
- private void presentContact(@Nullable Contact contact) {
- if (contact != null) {
- nameView.setText(ContactUtil.getDisplayName(contact));
- numberView.setText(ContactUtil.getDisplayNumber(contact, locale));
- } else {
- nameView.setText("");
- numberView.setText("");
- }
- }
-
- private void presentAvatar(@Nullable Uri uri) {
- if (uri != null) {
- glideRequests.load(new DecryptableUri(uri))
- .fallback(R.drawable.ic_contact_picture)
- .circleCrop()
- .diskCacheStrategy(DiskCacheStrategy.ALL)
- .dontAnimate()
- .into(avatarView);
- } else {
- glideRequests.load(R.drawable.ic_contact_picture)
- .circleCrop()
- .diskCacheStrategy(DiskCacheStrategy.ALL)
- .into(avatarView);
- }
- }
-
- private void presentActionButtons(@NonNull List recipients) {
- for (Recipient recipient : recipients) {
- activeRecipients.put(recipient.getAddress().serialize(), recipient);
- }
-
- List pushUsers = new ArrayList<>(recipients.size());
- List systemUsers = new ArrayList<>(recipients.size());
-
- for (Recipient recipient : activeRecipients.values()) {
- recipient.addListener(this);
-
- if (recipient.getRegistered() == RecipientDatabase.RegisteredState.REGISTERED) {
- pushUsers.add(recipient);
- } else if (recipient.isSystemContact()) {
- systemUsers.add(recipient);
- }
- }
-
- if (!pushUsers.isEmpty()) {
- actionButtonView.setText(R.string.SharedContactView_message);
- actionButtonView.setOnClickListener(v -> {
- if (eventListener != null) {
- eventListener.onMessageClicked(pushUsers);
- }
- });
- } else if (!systemUsers.isEmpty()) {
- actionButtonView.setText(R.string.SharedContactView_invite_to_signal);
- actionButtonView.setOnClickListener(v -> {
- if (eventListener != null) {
- eventListener.onInviteClicked(systemUsers);
- }
- });
- } else {
- actionButtonView.setText(R.string.SharedContactView_add_to_contacts);
- actionButtonView.setOnClickListener(v -> {
- if (eventListener != null && contact != null) {
- eventListener.onAddToContactsClicked(contact);
- }
- });
- }
- }
-
- public interface EventListener {
- void onAddToContactsClicked(@NonNull Contact contact);
- void onInviteClicked(@NonNull List choices);
- void onMessageClicked(@NonNull List choices);
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/SquareLinearLayout.java b/app/src/main/java/org/thoughtcrime/securesms/components/SquareLinearLayout.java
deleted file mode 100644
index ea24fb7c2..000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/components/SquareLinearLayout.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.thoughtcrime.securesms.components;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.os.Build.VERSION_CODES;
-import android.util.AttributeSet;
-import android.widget.LinearLayout;
-
-public class SquareLinearLayout extends LinearLayout {
- @SuppressWarnings("unused")
- public SquareLinearLayout(Context context) {
- super(context);
- }
-
- @SuppressWarnings("unused")
- public SquareLinearLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @TargetApi(VERSION_CODES.HONEYCOMB) @SuppressWarnings("unused")
- public SquareLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- }
-
- @TargetApi(VERSION_CODES.LOLLIPOP) @SuppressWarnings("unused")
- public SquareLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- //noinspection SuspiciousNameCombination
- super.onMeasure(widthMeasureSpec, widthMeasureSpec);
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/reminder/Reminder.java b/app/src/main/java/org/thoughtcrime/securesms/components/reminder/Reminder.java
deleted file mode 100644
index be0c86717..000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/components/reminder/Reminder.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.thoughtcrime.securesms.components.reminder;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import android.view.View.OnClickListener;
-
-public abstract class Reminder {
- private CharSequence title;
- private CharSequence text;
-
- private OnClickListener okListener;
- private OnClickListener dismissListener;
-
- public Reminder(@Nullable CharSequence title,
- @NonNull CharSequence text)
- {
- this.title = title;
- this.text = text;
- }
-
- public @Nullable CharSequence getTitle() {
- return title;
- }
-
- public CharSequence getText() {
- return text;
- }
-
- public OnClickListener getOkListener() {
- return okListener;
- }
-
- public OnClickListener getDismissListener() {
- return dismissListener;
- }
-
- public void setOkListener(OnClickListener okListener) {
- this.okListener = okListener;
- }
-
- public void setDismissListener(OnClickListener dismissListener) {
- this.dismissListener = dismissListener;
- }
-
- public boolean isDismissable() {
- return true;
- }
-
- public @NonNull Importance getImportance() {
- return Importance.NORMAL;
- }
-
-
- public enum Importance {
- NORMAL, ERROR
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/reminder/ReminderView.java b/app/src/main/java/org/thoughtcrime/securesms/components/reminder/ReminderView.java
deleted file mode 100644
index af59bf4ff..000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/components/reminder/ReminderView.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.thoughtcrime.securesms.components.reminder;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.os.Build.VERSION_CODES;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageButton;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import network.loki.messenger.R;
-import org.thoughtcrime.securesms.util.ViewUtil;
-
-/**
- * View to display actionable reminders to the user
- */
-public class ReminderView extends LinearLayout {
- private ViewGroup container;
- private ImageButton closeButton;
- private TextView title;
- private TextView text;
- private OnDismissListener dismissListener;
-
- public ReminderView(Context context) {
- super(context);
- initialize();
- }
-
- public ReminderView(Context context, AttributeSet attrs) {
- super(context, attrs);
- initialize();
- }
-
- @TargetApi(VERSION_CODES.HONEYCOMB)
- public ReminderView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- initialize();
- }
-
- private void initialize() {
- LayoutInflater.from(getContext()).inflate(R.layout.reminder_header, this, true);
- container = ViewUtil.findById(this, R.id.container);
- closeButton = ViewUtil.findById(this, R.id.cancel);
- title = ViewUtil.findById(this, R.id.reminder_title);
- text = ViewUtil.findById(this, R.id.reminder_text);
- }
-
- public void showReminder(final Reminder reminder) {
- if (!TextUtils.isEmpty(reminder.getTitle())) {
- title.setText(reminder.getTitle());
- title.setVisibility(VISIBLE);
- } else {
- title.setText("");
- title.setVisibility(GONE);
- }
- text.setText(reminder.getText());
- container.setBackgroundResource(reminder.getImportance() == Reminder.Importance.ERROR ? R.drawable.reminder_background_error
- : R.drawable.reminder_background_normal);
-
- setOnClickListener(reminder.getOkListener());
-
- closeButton.setVisibility(reminder.isDismissable() ? View.VISIBLE : View.GONE);
- closeButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- hide();
- if (reminder.getDismissListener() != null) reminder.getDismissListener().onClick(v);
- if (dismissListener != null) dismissListener.onDismiss();
- }
- });
-
- container.setVisibility(View.VISIBLE);
- }
-
- public void setOnDismissListener(OnDismissListener dismissListener) {
- this.dismissListener = dismissListener;
- }
-
- public void requestDismiss() {
- closeButton.performClick();
- }
-
- public void hide() {
- container.setVisibility(View.GONE);
- }
-
- public interface OnDismissListener {
- void onDismiss();
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/contacts/ArrayListCursor.java b/app/src/main/java/org/thoughtcrime/securesms/contacts/ArrayListCursor.java
deleted file mode 100644
index 23b06cedd..000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/contacts/ArrayListCursor.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.thoughtcrime.securesms.contacts;
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import android.database.AbstractCursor;
-import android.database.CursorWindow;
-
-import java.lang.System;
-import java.util.ArrayList;
-
-/**
- * A convenience class that presents a two-dimensional ArrayList
- * as a Cursor.
- */
-public class ArrayListCursor extends AbstractCursor {
- private String[] mColumnNames;
- private ArrayList