Messaging: Remove unused code

Change-Id: I8093bb3e305ae323f7069bf42f9e83f8c8647cc7
This commit is contained in:
Michael W
2024-12-26 15:54:37 +01:00
parent 0069df879a
commit e29b158fba
69 changed files with 42 additions and 3228 deletions
@@ -1,38 +0,0 @@
/*
* Copyright (C) 2015 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.
*/
package com.android.messaging.ui;
/**
* Defines a list of animation tags used as android:transitionName properties used for L's
* hero transitions.
*/
public class BugleAnimationTags {
/**
* The tag for the FAB in the conversation list activity.
*/
public static final String TAG_FABICON = "bugle:fabicon";
/**
* The tag for the content view of a conversation list item view.
*/
public static final String TAG_CLIVCONTENT = "bugle:clivcontent";
/**
* The tag for the action bar.
*/
public static final String TAG_ACTIONBAR = "bugle:actionbar";
}
@@ -33,7 +33,6 @@ import android.view.ViewOverlay;
import android.widget.FrameLayout;
import com.android.messaging.R;
import com.android.messaging.util.ImageUtils;
import com.android.messaging.util.UiUtils;
/**
@@ -192,9 +191,9 @@ public class ViewGroupItemVerticalExplodeAnimation {
// Strip the view of its background when taking a snapshot so that things like touch
// feedback don't get accidentally snapshotted.
final Drawable viewBackground = view.getBackground();
ImageUtils.setBackgroundDrawableOnView(view, null);
view.setBackground(null);
view.draw(new Canvas(viewBitmap));
ImageUtils.setBackgroundDrawableOnView(view, viewBackground);
view.setBackground(viewBackground);
return viewBitmap;
}
}
@@ -30,7 +30,6 @@ import androidx.fragment.app.FragmentTransaction;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreferenceCompat;
import com.android.messaging.R;
import com.android.messaging.ui.BugleActionBarActivity;
@@ -82,14 +81,10 @@ public class ApplicationSettingsActivity extends BugleActionBarActivity {
public static class ApplicationSettingsFragment extends PreferenceFragmentCompat {
private String mNotificationsPreferenceKey;
private Preference mNotificationsPreference;
private String mSmsDisabledPrefKey;
private Preference mSmsDisabledPreference;
private String mSmsEnabledPrefKey;
private Preference mSmsEnabledPreference;
private boolean mIsSmsPreferenceClicked;
private String mSwipeRightToDeleteConversationkey;
private SwitchPreferenceCompat mSwipeRightToDeleteConversationPreference;
public ApplicationSettingsFragment() {
// Required empty constructor
@@ -103,16 +98,10 @@ public class ApplicationSettingsActivity extends BugleActionBarActivity {
mNotificationsPreferenceKey =
getString(R.string.notifications_pref_key);
mNotificationsPreference = findPreference(mNotificationsPreferenceKey);
mSmsDisabledPrefKey = getString(R.string.sms_disabled_pref_key);
mSmsDisabledPreference = findPreference(mSmsDisabledPrefKey);
mSmsEnabledPrefKey = getString(R.string.sms_enabled_pref_key);
mSmsEnabledPreference = findPreference(mSmsEnabledPrefKey);
mSwipeRightToDeleteConversationkey = getString(
R.string.swipe_right_deletes_conversation_key);
mSwipeRightToDeleteConversationPreference =
(SwitchPreferenceCompat) findPreference(mSwipeRightToDeleteConversationkey);
mIsSmsPreferenceClicked = false;
final PreferenceScreen advancedScreen = (PreferenceScreen) findPreference(
getString(R.string.advanced_pref_key));
@@ -135,10 +124,6 @@ public class ApplicationSettingsActivity extends BugleActionBarActivity {
intent.putExtra(Settings.EXTRA_APP_PACKAGE, getContext().getPackageName());
startActivity(intent);
}
if (preference.getKey() == mSmsDisabledPrefKey ||
preference.getKey() == mSmsEnabledPrefKey) {
mIsSmsPreferenceClicked = true;
}
return super.onPreferenceTreeClick(preference);
}
@@ -152,7 +137,6 @@ public class ApplicationSettingsActivity extends BugleActionBarActivity {
getPreferenceScreen().removePreference(mSmsEnabledPreference);
mSmsDisabledPreference.setSummary(defaultSmsAppLabel);
}
mIsSmsPreferenceClicked = false;
}
@Override
@@ -152,7 +152,7 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
mRecipientTextView.setContactChipsListener(this);
mRecipientTextView.setDropdownChipLayouter(new ContactDropdownLayouter(inflater,
getActivity(), this));
mRecipientTextView.setAdapter(new ContactRecipientAdapter(getActivity(), this));
mRecipientTextView.setAdapter(new ContactRecipientAdapter(getActivity()));
mRecipientTextView.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(final CharSequence s, final int start, final int before,
@@ -68,15 +68,14 @@ public final class ContactRecipientAdapter extends BaseRecipientAdapter {
*/
private static final int ENTRY_TYPE_DIRECTORY = RecipientEntry.ENTRY_TYPE_SIZE;
public ContactRecipientAdapter(final Context context,
final ContactListItemView.HostInterface clivHost) {
this(context, Integer.MAX_VALUE, QUERY_TYPE_PHONE, clivHost);
public ContactRecipientAdapter(final Context context) {
this(context, Integer.MAX_VALUE, QUERY_TYPE_PHONE);
}
public ContactRecipientAdapter(final Context context, final int preferredMaxResultCount,
final int queryMode, final ContactListItemView.HostInterface clivHost) {
final int queryMode) {
super(context, preferredMaxResultCount, queryMode);
setPhotoManager(new ContactRecipientPhotoManager(context, clivHost));
setPhotoManager(new ContactRecipientPhotoManager(context));
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@@ -59,7 +59,6 @@ public class ContactRecipientAutoCompleteView extends RecipientEditTextView {
void onEntryComplete();
}
private final int mTextHeight;
private ContactChipsChangeListener mChipsChangeListener;
/**
@@ -110,7 +109,6 @@ public class ContactRecipientAutoCompleteView extends RecipientEditTextView {
final Rect textBounds = new Rect(0, 0, 0, 0);
final TextPaint paint = getPaint();
paint.getTextBounds(TEXT_HEIGHT_SAMPLE, 0, TEXT_HEIGHT_SAMPLE.length(), textBounds);
mTextHeight = textBounds.height();
setTokenizer(new Rfc822Tokenizer());
addTextChangedListener(new ContactChipsWatcher());
@@ -42,15 +42,12 @@ public class ContactRecipientPhotoManager implements PhotoManager {
private static final String IMAGE_BYTES_REQUEST_STATIC_BINDING_ID = "imagebytes";
private final Context mContext;
private final int mIconSize;
private final ContactListItemView.HostInterface mClivHostInterface;
public ContactRecipientPhotoManager(final Context context,
final ContactListItemView.HostInterface clivHostInterface) {
public ContactRecipientPhotoManager(final Context context) {
mContext = context;
mIconSize = context.getResources().getDimensionPixelSize(
R.dimen.compose_message_chip_height) - context.getResources().getDimensionPixelSize(
R.dimen.compose_message_chip_padding) * 2;
mClivHostInterface = clivHostInterface;
}
/**
@@ -90,7 +90,6 @@ public class ComposeMessageView extends LinearLayout
void sendMessage(MessageData message);
void onComposeEditTextFocused();
void onAttachmentsCleared();
void onAttachmentsChanged(final boolean haveAttachments);
void displayPhoto(Uri photoUri, Rect imageBounds, boolean isDraft);
void promptForSelfPhoneNumber();
boolean isReadyForAction();
@@ -301,10 +300,8 @@ public class ComposeMessageView extends LinearLayout
}
final boolean haveAttachments = mBinding.getData().hasAttachments();
if (simPickerVisible && haveAttachments) {
mHost.onAttachmentsChanged(false);
mAttachmentPreview.hideAttachmentPreview();
} else {
mHost.onAttachmentsChanged(haveAttachments);
mAttachmentPreview.onAttachmentsChanged(mBinding.getData());
}
}
@@ -474,8 +471,7 @@ public class ComposeMessageView extends LinearLayout
if ((changeFlags & DraftMessageData.ATTACHMENTS_CHANGED) ==
DraftMessageData.ATTACHMENTS_CHANGED) {
final boolean haveAttachments = mAttachmentPreview.onAttachmentsChanged(data);
mHost.onAttachmentsChanged(haveAttachments);
mAttachmentPreview.onAttachmentsChanged(data);
hasAttachmentsChanged = true;
}
@@ -165,13 +165,6 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
private ConversationFragmentHost mHost;
protected List<Integer> mFilterResults;
// The minimum scrolling distance between RecyclerView's scroll change event beyong which
// a fling motion is considered fast, in which case we'll delay load image attachments for
// perf optimization.
private int mFastFlingThreshold;
// ConversationMessageView that is currently selected
private ConversationMessageView mSelectedMessage;
@@ -412,8 +405,6 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFastFlingThreshold = getResources().getDimensionPixelOffset(
R.dimen.conversation_fast_fling_threshold);
mAdapter = new ConversationMessageAdapter(getActivity(), null, this,
null,
// Sets the item click listener on the Recycler item views.
@@ -1579,11 +1570,6 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
return -1; // don't override the color
}
@Override
public void onAttachmentsChanged(final boolean haveAttachments) {
// no-op for now
}
@Override
public void onDraftChanged(final DraftMessageData data, final int changeFlags) {
mDraftMessageDataModel.ensureBound(data);
@@ -40,7 +40,6 @@ import com.android.messaging.ui.mediapicker.MediaPicker.MediaPickerListener;
import com.android.messaging.util.Assert;
import com.android.messaging.util.ImeUtil;
import com.android.messaging.util.ImeUtil.ImeStateHost;
import com.google.common.annotations.VisibleForTesting;
import java.util.Collection;
@@ -236,26 +235,6 @@ public class ConversationInputManager implements ConversationInput.ConversationI
return false;
}
@VisibleForTesting
boolean isMediaPickerVisible() {
return mMediaInput.mShowing;
}
@VisibleForTesting
boolean isSimSelectorVisible() {
return mSimInput.mShowing;
}
@VisibleForTesting
boolean isImeKeyboardVisible() {
return mImeInput.mShowing;
}
@VisibleForTesting
void testNotifyImeStateChanged(final boolean imeOpen) {
mImeStateObserver.onImeStateChanged(imeOpen);
}
/**
* returns true if the state of the visibility was actually changed
*/
@@ -737,7 +737,7 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
R.dimen.message_metadata_top_padding);
// Update the message text/info views
ImageUtils.setBackgroundDrawableOnView(mMessageTextAndInfoView, textBackground);
mMessageTextAndInfoView.setBackground(textBackground);
mMessageTextAndInfoView.setMinimumHeight(textMinHeight);
final LinearLayout.LayoutParams textAndInfoLayoutParams =
(LinearLayout.LayoutParams) mMessageTextAndInfoView.getLayoutParams();
@@ -36,7 +36,6 @@ import android.widget.AbsListView;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.core.view.ViewCompat;
import androidx.core.view.ViewGroupCompat;
import androidx.fragment.app.Fragment;
import androidx.loader.app.LoaderManager;
@@ -51,7 +50,6 @@ import com.android.messaging.datamodel.binding.BindingBase;
import com.android.messaging.datamodel.data.ConversationListData;
import com.android.messaging.datamodel.data.ConversationListData.ConversationListDataListener;
import com.android.messaging.datamodel.data.ConversationListItemData;
import com.android.messaging.ui.BugleAnimationTags;
import com.android.messaging.ui.ListEmptyView;
import com.android.messaging.ui.SnackBarInteraction;
import com.android.messaging.ui.UIIntents;
@@ -232,7 +230,6 @@ public class ConversationListFragment extends Fragment implements ConversationLi
mStartNewConversationButton.setOnClickListener(clickView ->
mHost.onCreateConversationClick());
}
ViewCompat.setTransitionName(mStartNewConversationButton, BugleAnimationTags.TAG_FABICON);
// The root view has a non-null background, which by default is deemed by the framework
// to be a "transition group," where all child views are animated together during an
@@ -417,15 +414,6 @@ public class ConversationListFragment extends Fragment implements ConversationLi
});
}
public View getHeroElementForTransition() {
return mArchiveMode ? null : mStartNewConversationButton;
}
@VisibleForAnimation
public RecyclerView getRecyclerView() {
return mRecyclerView;
}
@Override
public void startFullScreenPhotoViewer(
final Uri initialPhoto, final Rect initialPhotoBounds, final Uri photosUri) {
@@ -79,8 +79,6 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
private static String sPlusOneString;
private static String sPlusNString;
private static final int SWIPE_DIRECTION_RIGHT = 2;
public interface HostInterface {
boolean isConversationSelected(final String conversationId);
void onConversationClicked(final ConversationListItemData conversationListItemData,
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,47 +28,16 @@ import javax.annotation.concurrent.ThreadSafe;
@ThreadSafe
public class AudioLevelSource {
private volatile int mSpeechLevel;
private volatile Listener mListener;
public static final int LEVEL_UNKNOWN = -1;
public interface Listener {
void onSpeechLevel(int speechLevel);
}
public void setSpeechLevel(int speechLevel) {
Preconditions.checkArgument(speechLevel >= 0 && speechLevel <= 100 ||
speechLevel == LEVEL_UNKNOWN);
mSpeechLevel = speechLevel;
maybeNotify();
}
public int getSpeechLevel() {
return mSpeechLevel;
}
public void reset() {
setSpeechLevel(LEVEL_UNKNOWN);
}
public boolean isValid() {
return mSpeechLevel > 0;
}
private void maybeNotify() {
final Listener l = mListener;
if (l != null) {
l.onSpeechLevel(mSpeechLevel);
}
}
public synchronized void setListener(Listener listener) {
mListener = listener;
}
public synchronized void clearListener(Listener listener) {
if (mListener == listener) {
mListener = null;
}
}
}
@@ -111,11 +111,6 @@ public class AudioRecordView extends FrameLayout implements
mHostInterface = hostInterface;
}
@VisibleForTesting
public void testSetMediaRecorder(final LevelTrackingMediaRecorder recorder) {
mMediaRecorder = recorder;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
@@ -17,7 +17,6 @@
package com.android.messaging.ui.mediapicker.camerafocus;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.drawable.Drawable;
@@ -47,7 +46,6 @@ public class PieItem {
private List<PieItem> mItems;
private Path mPath;
private OnClickListener mOnClickListener;
private float mAlpha;
// Gray out the view when disabled
private static final float ENABLED_ALPHA = 1;
@@ -87,12 +85,7 @@ public class PieItem {
return mPath;
}
public void setChangeAlphaWhenDisabled (boolean enable) {
mChangeAlphaWhenDisabled = enable;
}
public void setAlpha(float alpha) {
mAlpha = alpha;
mDrawable.setAlpha((int) (255 * alpha));
}
@@ -138,11 +131,6 @@ public class PieItem {
outer = outside;
}
public void setFixedSlice(float center, float sweep) {
mCenter = center;
this.sweep = sweep;
}
public float getCenter() {
return mCenter;
}
@@ -192,12 +180,4 @@ public class PieItem {
public void draw(Canvas canvas) {
mDrawable.draw(canvas);
}
public void setImageResource(Context context, int resId) {
Drawable d = context.getResources().getDrawable(resId).mutate();
d.setBounds(mDrawable.getBounds());
mDrawable = d;
setAlpha(mAlpha);
}
}