From 94e83030221a1f238752d33bf8557a26bec7a130 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Fri, 22 Mar 2019 12:47:16 -0700 Subject: [PATCH] Remove dead code from ScribbleHud/Fragment. --- AndroidManifest.xml | 5 - res/layout/scribble_hud.xml | 103 ---------- .../conversation/ConversationActivity.java | 6 - .../mediasend/MediaSendActivity.java | 12 +- .../mediasend/MediaSendFragment.java | 2 +- .../MediaSendFragmentPagerAdapter.java | 6 +- .../securesms/mms/AttachmentManager.java | 12 -- .../securesms/scribbles/ScribbleActivity.java | 68 ------ .../securesms/scribbles/ScribbleFragment.java | 60 +----- .../securesms/scribbles/ScribbleHud.java | 194 +----------------- 10 files changed, 7 insertions(+), 461 deletions(-) delete mode 100644 src/org/thoughtcrime/securesms/scribbles/ScribbleActivity.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 24465f78f..109c9e57b 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -394,11 +394,6 @@ android:theme="@style/TextSecure.LightTheme" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> - - diff --git a/res/layout/scribble_hud.xml b/res/layout/scribble_hud.xml index 9492a0874..e77a2f5e4 100644 --- a/res/layout/scribble_hud.xml +++ b/res/layout/scribble_hud.xml @@ -15,17 +15,6 @@ android:layout_weight="1" android:animateLayoutChanges="true"> - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index aa55c3077..c4f32b4fa 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -68,7 +68,6 @@ import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.ImageButton; -import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; @@ -181,7 +180,6 @@ import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientFormattingException; import org.thoughtcrime.securesms.recipients.RecipientModifiedListener; import org.thoughtcrime.securesms.recipients.RecipientExporter; -import org.thoughtcrime.securesms.scribbles.ScribbleActivity; import org.thoughtcrime.securesms.search.model.MessageResult; import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.sms.MessageSender; @@ -211,7 +209,6 @@ import org.whispersystems.libsignal.InvalidMessageException; import org.whispersystems.libsignal.util.guava.Optional; import java.io.IOException; -import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.text.SimpleDateFormat; import java.util.Collections; @@ -525,9 +522,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity data.getIntExtra(GiphyActivity.EXTRA_WIDTH, 0), data.getIntExtra(GiphyActivity.EXTRA_HEIGHT, 0)); break; - case ScribbleActivity.SCRIBBLE_REQUEST_CODE: - setMedia(data.getData(), MediaType.IMAGE); - break; case SMS_DEFAULT: initializeSecurity(isSecureText, isDefaultSms); break; diff --git a/src/org/thoughtcrime/securesms/mediasend/MediaSendActivity.java b/src/org/thoughtcrime/securesms/mediasend/MediaSendActivity.java index 667f70e6d..289fd2332 100644 --- a/src/org/thoughtcrime/securesms/mediasend/MediaSendActivity.java +++ b/src/org/thoughtcrime/securesms/mediasend/MediaSendActivity.java @@ -260,16 +260,6 @@ public class MediaSendActivity extends PassphraseRequiredActionBarActivity imple finish(); } - @Override - public void onImageEditComplete(@NonNull Uri uri, int width, int height, long size, @NonNull Optional message, @NonNull Optional transport) { - throw new UnsupportedOperationException("Callback unsupported."); - } - - @Override - public void onImageEditFailure() { - throw new UnsupportedOperationException("Callback unsupported."); - } - @Override public void onTouchEventsNeeded(boolean needed) { MediaSendFragment fragment = (MediaSendFragment) getSupportFragmentManager().findFragmentByTag(TAG_SEND); @@ -308,7 +298,7 @@ public class MediaSendActivity extends PassphraseRequiredActionBarActivity imple } }, media -> { if (media == null) { - onImageEditFailure(); + onNoMediaAvailable(); return; } diff --git a/src/org/thoughtcrime/securesms/mediasend/MediaSendFragment.java b/src/org/thoughtcrime/securesms/mediasend/MediaSendFragment.java index cd64ee2d2..e44cc34b8 100644 --- a/src/org/thoughtcrime/securesms/mediasend/MediaSendFragment.java +++ b/src/org/thoughtcrime/securesms/mediasend/MediaSendFragment.java @@ -177,7 +177,7 @@ public class MediaSendFragment extends Fragment implements ViewTreeObserver.OnGl captionText.clearFocus(); composeText.requestFocus(); - fragmentPagerAdapter = new MediaSendFragmentPagerAdapter(getChildFragmentManager(), locale); + fragmentPagerAdapter = new MediaSendFragmentPagerAdapter(getChildFragmentManager()); fragmentPager.setAdapter(fragmentPagerAdapter); FragmentPageChangeListener pageChangeListener = new FragmentPageChangeListener(); diff --git a/src/org/thoughtcrime/securesms/mediasend/MediaSendFragmentPagerAdapter.java b/src/org/thoughtcrime/securesms/mediasend/MediaSendFragmentPagerAdapter.java index 2283504fb..8830027c7 100644 --- a/src/org/thoughtcrime/securesms/mediasend/MediaSendFragmentPagerAdapter.java +++ b/src/org/thoughtcrime/securesms/mediasend/MediaSendFragmentPagerAdapter.java @@ -22,14 +22,12 @@ import java.util.Map; class MediaSendFragmentPagerAdapter extends FragmentStatePagerAdapter { - private final Locale locale; private final List media; private final Map fragments; private final Map savedState; - MediaSendFragmentPagerAdapter(@NonNull FragmentManager fm, @NonNull Locale locale) { + MediaSendFragmentPagerAdapter(@NonNull FragmentManager fm) { super(fm); - this.locale = locale; this.media = new ArrayList<>(); this.fragments = new HashMap<>(); this.savedState = new HashMap<>(); @@ -42,7 +40,7 @@ class MediaSendFragmentPagerAdapter extends FragmentStatePagerAdapter { if (MediaUtil.isGif(mediaItem.getMimeType())) { return MediaSendGifFragment.newInstance(mediaItem.getUri()); } else if (MediaUtil.isImageType(mediaItem.getMimeType())) { - return ScribbleFragment.newInstance(mediaItem.getUri(), locale, Optional.absent(), true); + return ScribbleFragment.newInstance(mediaItem.getUri()); } else if (MediaUtil.isVideoType(mediaItem.getMimeType())) { return MediaSendVideoFragment.newInstance(mediaItem.getUri()); } else { diff --git a/src/org/thoughtcrime/securesms/mms/AttachmentManager.java b/src/org/thoughtcrime/securesms/mms/AttachmentManager.java index 140b079c1..9ca0f368f 100644 --- a/src/org/thoughtcrime/securesms/mms/AttachmentManager.java +++ b/src/org/thoughtcrime/securesms/mms/AttachmentManager.java @@ -27,7 +27,6 @@ import android.graphics.Bitmap; import android.graphics.PorterDuff; import android.net.Uri; import android.os.AsyncTask; -import android.os.Build; import android.provider.ContactsContract; import android.provider.MediaStore; import android.provider.OpenableColumns; @@ -60,7 +59,6 @@ import org.thoughtcrime.securesms.permissions.Permissions; import org.thoughtcrime.securesms.providers.BlobProvider; import org.thoughtcrime.securesms.providers.DeprecatedPersistentBlobProvider; import org.thoughtcrime.securesms.recipients.Recipient; -import org.thoughtcrime.securesms.scribbles.ScribbleActivity; import org.thoughtcrime.securesms.util.BitmapUtil; import org.thoughtcrime.securesms.util.MediaUtil; import org.thoughtcrime.securesms.util.ThemeUtil; @@ -115,7 +113,6 @@ public class AttachmentManager { this.removableMediaView = ViewUtil.findById(root, R.id.removable_media_view); removableMediaView.setRemoveClickListener(new RemoveButtonListener()); - removableMediaView.setEditClickListener(new EditButtonListener()); thumbnail.setOnClickListener(new ThumbnailClickListener()); documentView.getBackground().setColorFilter(ThemeUtil.getThemedColor(context, R.attr.conversation_item_bubble_background), PorterDuff.Mode.MULTIPLY); } @@ -527,15 +524,6 @@ public class AttachmentManager { } } - private class EditButtonListener implements View.OnClickListener { - @Override - public void onClick(View v) { - Intent intent = new Intent(context, ScribbleActivity.class); - intent.setData(getSlideUri()); - ((Activity)context).startActivityForResult(intent, ScribbleActivity.SCRIBBLE_REQUEST_CODE); - } - } - public interface AttachmentListener { void onAttachmentChanged(); } diff --git a/src/org/thoughtcrime/securesms/scribbles/ScribbleActivity.java b/src/org/thoughtcrime/securesms/scribbles/ScribbleActivity.java deleted file mode 100644 index 593f1e6be..000000000 --- a/src/org/thoughtcrime/securesms/scribbles/ScribbleActivity.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.thoughtcrime.securesms.scribbles; - -import android.annotation.TargetApi; -import android.content.Intent; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.support.annotation.NonNull; -import android.view.View; -import android.widget.Toast; - -import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity; -import org.thoughtcrime.securesms.R; -import org.thoughtcrime.securesms.TransportOption; -import org.thoughtcrime.securesms.util.DynamicLanguage; -import org.whispersystems.libsignal.util.guava.Optional; - -@TargetApi(Build.VERSION_CODES.JELLY_BEAN) -public class ScribbleActivity extends PassphraseRequiredActionBarActivity implements ScribbleFragment.Controller { - - private static final String TAG = ScribbleActivity.class.getSimpleName(); - - public static final int SCRIBBLE_REQUEST_CODE = 31424; - - private final DynamicLanguage dynamicLanguage = new DynamicLanguage(); - - @Override - protected void onPreCreate() { - dynamicLanguage.onCreate(this); - } - - @Override - protected void onCreate(Bundle savedInstanceState, boolean ready) { - setContentView(R.layout.scribble_activity); - - if (savedInstanceState == null) { - ScribbleFragment fragment = ScribbleFragment.newInstance(getIntent().getData(), dynamicLanguage.getCurrentLocale(), Optional.absent(), false); - getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, fragment).commit(); - } - - getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN | - View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); - } - - @Override - protected void onResume() { - super.onResume(); - dynamicLanguage.onResume(this); - } - - @Override - public void onImageEditComplete(@NonNull Uri uri, int width, int height, long size, @NonNull Optional message, @NonNull Optional transport) { - Intent intent = new Intent(); - intent.setData(uri); - setResult(RESULT_OK, intent); - - finish(); - } - - @Override - public void onImageEditFailure() { - Toast.makeText(ScribbleActivity.this, R.string.ScribbleActivity_save_failure, Toast.LENGTH_SHORT).show(); - finish(); - } - - @Override - public void onTouchEventsNeeded(boolean needed) { } -} diff --git a/src/org/thoughtcrime/securesms/scribbles/ScribbleFragment.java b/src/org/thoughtcrime/securesms/scribbles/ScribbleFragment.java index 16ebb1677..f7dfa9e63 100644 --- a/src/org/thoughtcrime/securesms/scribbles/ScribbleFragment.java +++ b/src/org/thoughtcrime/securesms/scribbles/ScribbleFragment.java @@ -57,9 +57,6 @@ public class ScribbleFragment extends Fragment implements ScribbleHud.EventListe private static final String TAG = ScribbleFragment.class.getSimpleName(); private static final String KEY_IMAGE_URI = "image_uri"; - private static final String KEY_LOCALE = "locale"; - private static final String KEY_TRANSPORT = "compose_mode"; - private static final String KEY_HIDE_SAVE = "hide_save"; public static final int SELECT_STICKER_REQUEST_CODE = 123; @@ -71,12 +68,9 @@ public class ScribbleFragment extends Fragment implements ScribbleHud.EventListe private ScribbleView.SavedState savedState; - public static ScribbleFragment newInstance(@NonNull Uri imageUri, @NonNull Locale locale, Optional transport, boolean hideSave) { + public static ScribbleFragment newInstance(@NonNull Uri imageUri) { Bundle args = new Bundle(); args.putParcelable(KEY_IMAGE_URI, imageUri); - args.putSerializable(KEY_LOCALE, locale); - args.putParcelable(KEY_TRANSPORT, transport.orNull()); - args.putBoolean(KEY_HIDE_SAVE, hideSave); ScribbleFragment fragment = new ScribbleFragment(); fragment.setArguments(args); @@ -109,9 +103,6 @@ public class ScribbleFragment extends Fragment implements ScribbleHud.EventListe this.scribbleView = view.findViewById(R.id.scribble_view); scribbleHud.setEventListener(this); - scribbleHud.setTransport(Optional.fromNullable(getArguments().getParcelable(KEY_TRANSPORT))); - scribbleHud.hideSaveButton(getArguments().getBoolean(KEY_HIDE_SAVE)); - scribbleHud.setFullscreen((getActivity().getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) > 0); scribbleView.setMotionViewCallback(motionViewCallback); scribbleView.setDrawingChangedListener(() -> scribbleHud.setColorPalette(scribbleView.getUniqueColors())); @@ -156,14 +147,6 @@ public class ScribbleFragment extends Fragment implements ScribbleHud.EventListe } } - public boolean isEmojiKeyboardVisible() { - return scribbleHud.isInputOpen(); - } - - public void dismissEmojiKeyboard() { - scribbleHud.dismissEmojiKeyboard(); - } - private void addSticker(final Bitmap pica) { Util.runOnMain(() -> { Layer layer = new Layer(); @@ -305,45 +288,6 @@ public class ScribbleFragment extends Fragment implements ScribbleHud.EventListe scribbleHud.setColorPalette(scribbleView.getUniqueColors()); } - @Override - public void onEditComplete(@NonNull Optional message, @NonNull Optional transport) { - ListenableFuture future = scribbleView.getRenderedImage(glideRequests); - - future.addListener(new ListenableFuture.Listener() { - @Override - public void onSuccess(Bitmap result) { - AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> { - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - result.compress(Bitmap.CompressFormat.JPEG, 80, baos); - - byte[] data = baos.toByteArray(); - Uri uri = BlobProvider.getInstance() - .forData(data) - .withMimeType(MediaUtil.IMAGE_JPEG) - .createForSingleSessionOnDisk(requireContext(), e -> Log.w(TAG, "Failed to persist image.", e)); - - controller.onImageEditComplete(uri, - result.getWidth(), - result.getHeight(), - data.length, - message, - transport); - } catch (IOException e) { - Log.w(TAG, "Failed to persist image.", e); - Util.runOnMain(() -> controller.onImageEditFailure()); - } - }); - } - - @Override - public void onFailure(ExecutionException e) { - Log.w(TAG, e); - Util.runOnMain(() -> controller.onImageEditFailure()); - } - }); - } - private final MotionView.MotionViewCallback motionViewCallback = new MotionView.MotionViewCallback() { @Override public void onEntitySelected(@Nullable MotionEntity entity) { @@ -369,8 +313,6 @@ public class ScribbleFragment extends Fragment implements ScribbleHud.EventListe }; public interface Controller { - void onImageEditComplete(@NonNull Uri uri, int width, int height, long size, @NonNull Optional message, @NonNull Optional transport); - void onImageEditFailure(); void onTouchEventsNeeded(boolean needed); } } diff --git a/src/org/thoughtcrime/securesms/scribbles/ScribbleHud.java b/src/org/thoughtcrime/securesms/scribbles/ScribbleHud.java index 10ffdae57..64e4f17d2 100644 --- a/src/org/thoughtcrime/securesms/scribbles/ScribbleHud.java +++ b/src/org/thoughtcrime/securesms/scribbles/ScribbleHud.java @@ -15,6 +15,7 @@ import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; +import android.widget.LinearLayout; import android.widget.TextView; import org.thoughtcrime.securesms.R; @@ -38,7 +39,7 @@ import java.util.Set; * The HUD (heads-up display) that contains all of the tools for interacting with * {@link org.thoughtcrime.securesms.scribbles.widget.ScribbleView} */ -public class ScribbleHud extends InputAwareLayout implements ViewTreeObserver.OnGlobalLayoutListener { +public class ScribbleHud extends LinearLayout { private View drawButton; private View highlightButton; @@ -47,23 +48,11 @@ public class ScribbleHud extends InputAwareLayout implements ViewTreeObserver.On private View undoButton; private View deleteButton; private View confirmButton; - private View saveButton; private VerticalSlideColorPicker colorPicker; private RecyclerView colorPalette; - private ViewGroup inputContainer; - private ComposeText composeText; - private SendButton sendButton; - private ViewGroup sendButtonBkg; - private EmojiToggle emojiToggle; - private Stub emojiDrawer; - private TextView charactersLeft; private EventListener eventListener; private ColorPaletteAdapter colorPaletteAdapter; - private int visibleHeight; - private Locale locale; - - private final Rect visibleBounds = new Rect(); public ScribbleHud(@NonNull Context context) { super(context); @@ -80,33 +69,6 @@ public class ScribbleHud extends InputAwareLayout implements ViewTreeObserver.On initialize(); } - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - getRootView().getViewTreeObserver().addOnGlobalLayoutListener(this); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - getRootView().getViewTreeObserver().removeGlobalOnLayoutListener(this); - } - - @Override - public void onGlobalLayout() { - getRootView().getWindowVisibleDisplayFrame(visibleBounds); - - int currentVisibleHeight = visibleBounds.height(); - - if (currentVisibleHeight != visibleHeight) { - getLayoutParams().height = currentVisibleHeight; - layout(visibleBounds.left, visibleBounds.top, visibleBounds.right, visibleBounds.bottom); - requestLayout(); - - visibleHeight = currentVisibleHeight; - } - } - private void initialize() { inflate(getContext(), R.layout.scribble_hud, this); setOrientation(VERTICAL); @@ -118,20 +80,11 @@ public class ScribbleHud extends InputAwareLayout implements ViewTreeObserver.On undoButton = findViewById(R.id.scribble_undo_button); deleteButton = findViewById(R.id.scribble_delete_button); confirmButton = findViewById(R.id.scribble_confirm_button); - saveButton = findViewById(R.id.scribble_save_button); colorPicker = findViewById(R.id.scribble_color_picker); colorPalette = findViewById(R.id.scribble_color_palette); - inputContainer = findViewById(R.id.scribble_compose_container); - composeText = findViewById(R.id.scribble_compose_text); - sendButton = findViewById(R.id.scribble_send_button); - sendButtonBkg = findViewById(R.id.scribble_send_button_bkg); - emojiToggle = findViewById(R.id.scribble_emoji_toggle); - emojiDrawer = new Stub<>(findViewById(R.id.scribble_emoji_drawer_stub)); - charactersLeft = findViewById(R.id.scribble_characters_left); initializeViews(); setMode(Mode.NONE); - setTransport(Optional.absent()); } private void initializeViews() { @@ -148,75 +101,13 @@ public class ScribbleHud extends InputAwareLayout implements ViewTreeObserver.On setMode(Mode.NONE); }); - saveButton.setOnClickListener(v -> { - if (eventListener != null) { - eventListener.onEditComplete(Optional.absent(), Optional.absent()); - } - setMode(Mode.NONE); - }); - - sendButton.setOnClickListener(v -> { - if (eventListener != null) { - if (isKeyboardOpen()) { - hideSoftkey(composeText, null); - } - eventListener.onEditComplete(Optional.of(composeText.getTextTrimmed()), Optional.of(sendButton.getSelectedTransport())); - } - setMode(Mode.NONE); - }); - confirmButton.setOnClickListener(v -> setMode(Mode.NONE)); - sendButton.addOnTransportChangedListener((newTransport, manuallySelected) -> { - presentCharactersRemaining(); - composeText.setTransport(newTransport); - sendButtonBkg.getBackground().setColorFilter(newTransport.getBackgroundColor(), PorterDuff.Mode.MULTIPLY); - sendButtonBkg.getBackground().invalidateSelf(); - }); - - ComposeKeyPressedListener composeKeyPressedListener = new ComposeKeyPressedListener(); - - composeText.setOnKeyListener(composeKeyPressedListener); - composeText.addTextChangedListener(composeKeyPressedListener); - composeText.setOnClickListener(composeKeyPressedListener); - composeText.setOnFocusChangeListener(composeKeyPressedListener); - colorPaletteAdapter = new ColorPaletteAdapter(); colorPaletteAdapter.setEventListener(colorPicker::setActiveColor); colorPalette.setLayoutManager(new LinearLayoutManager(getContext())); colorPalette.setAdapter(colorPaletteAdapter); - - if (TextSecurePreferences.isSystemEmojiPreferred(getContext())) { - emojiToggle.setVisibility(GONE); - } else { - emojiToggle.setOnClickListener(this::onEmojiToggleClicked); - } - } - - public void setLocale(@NonNull Locale locale) { - this.locale = locale; - } - - public void setTransport(@NonNull Optional transport) { - if (transport.isPresent()) { - saveButton.setVisibility(GONE); - inputContainer.setVisibility(VISIBLE); - sendButton.setTransport(transport.get()); - } else { - saveButton.setVisibility(VISIBLE); - inputContainer.setVisibility(GONE); - } - } - - public void hideSaveButton(boolean hide) { - if (hide) { - saveButton.setVisibility(GONE); - } - } - - public void dismissEmojiKeyboard() { - hideCurrentInput(composeText); } public void setColorPalette(@NonNull Set colors) { @@ -337,46 +228,6 @@ public class ScribbleHud extends InputAwareLayout implements ViewTreeObserver.On colorPalette.setVisibility(GONE); } - private void presentCharactersRemaining() { - String messageBody = composeText.getTextTrimmed(); - TransportOption transportOption = sendButton.getSelectedTransport(); - CharacterState characterState = transportOption.calculateCharacters(messageBody); - - if (characterState.charactersRemaining <= 15 || characterState.messagesSpent > 1) { - charactersLeft.setText(String.format(locale, - "%d/%d (%d)", - characterState.charactersRemaining, - characterState.maxTotalMessageSize, - characterState.messagesSpent)); - charactersLeft.setVisibility(View.VISIBLE); - } else { - charactersLeft.setVisibility(View.GONE); - } - } - - private void onEmojiToggleClicked(View v) { - if (!emojiDrawer.resolved()) { - emojiToggle.attach(emojiDrawer.get()); - emojiDrawer.get().setEmojiEventListener(new EmojiDrawer.EmojiEventListener() { - @Override - public void onKeyEvent(KeyEvent keyEvent) { - composeText.dispatchKeyEvent(keyEvent); - } - - @Override - public void onEmojiSelected(String emoji) { - composeText.insertEmoji(emoji); - } - }); - } - - if (getCurrentInput() == emojiDrawer.get()) { - showSoftkey(composeText); - } else { - hideSoftkey(composeText, () -> post(() -> show(composeText, emojiDrawer.get()))); - } - } - private final VerticalSlideColorPicker.OnColorChangeListener standardOnColorChangeListener = new VerticalSlideColorPicker.OnColorChangeListener() { @Override public void onColorChange(int selectedColor) { @@ -400,46 +251,6 @@ public class ScribbleHud extends InputAwareLayout implements ViewTreeObserver.On } }; - private class ComposeKeyPressedListener implements OnKeyListener, OnClickListener, TextWatcher, OnFocusChangeListener { - - int beforeLength; - - @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { - if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (keyCode == KeyEvent.KEYCODE_ENTER) { - if (TextSecurePreferences.isEnterSendsEnabled(getContext())) { - sendButton.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER)); - sendButton.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER)); - return true; - } - } - } - return false; - } - - @Override - public void onClick(View v) { - showSoftkey(composeText); - } - - @Override - public void beforeTextChanged(CharSequence s, int start, int count,int after) { - beforeLength = composeText.getTextTrimmed().length(); - } - - @Override - public void afterTextChanged(Editable s) { - presentCharactersRemaining(); - } - - @Override - public void onTextChanged(CharSequence s, int start, int before,int count) {} - - @Override - public void onFocusChange(View v, boolean hasFocus) {} - } - public enum Mode { NONE, DRAW, HIGHLIGHT, TEXT, STICKER } @@ -449,6 +260,5 @@ public class ScribbleHud extends InputAwareLayout implements ViewTreeObserver.On void onColorChange(int color); void onUndo(); void onDelete(); - void onEditComplete(@NonNull Optional message, @NonNull Optional transport); } }