Search in sources :

Example 1 with PushMediaConstraints

use of org.thoughtcrime.securesms.mms.PushMediaConstraints in project Signal-Android by WhisperSystems.

the class ImageEditorFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fragment parent = getParentFragment();
    if (parent instanceof Controller) {
        controller = (Controller) parent;
    } else if (getActivity() instanceof Controller) {
        controller = (Controller) getActivity();
    } else {
        throw new IllegalStateException("Parent must implement Controller interface.");
    }
    Bundle arguments = getArguments();
    if (arguments != null) {
        imageUri = arguments.getParcelable(KEY_IMAGE_URI);
    }
    if (imageUri == null) {
        throw new AssertionError("No KEY_IMAGE_URI supplied");
    }
    MediaConstraints mediaConstraints = new PushMediaConstraints(SentMediaQuality.HIGH);
    imageMaxWidth = mediaConstraints.getImageMaxWidth(requireContext());
    imageMaxHeight = mediaConstraints.getImageMaxHeight(requireContext());
}
Also used : PushMediaConstraints(org.thoughtcrime.securesms.mms.PushMediaConstraints) MediaConstraints(org.thoughtcrime.securesms.mms.MediaConstraints) Bundle(android.os.Bundle) Fragment(androidx.fragment.app.Fragment) MediaSendPageFragment(org.thoughtcrime.securesms.mediasend.MediaSendPageFragment) PushMediaConstraints(org.thoughtcrime.securesms.mms.PushMediaConstraints)

Example 2 with PushMediaConstraints

use of org.thoughtcrime.securesms.mms.PushMediaConstraints in project Signal-Android by signalapp.

the class ImageEditorFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fragment parent = getParentFragment();
    if (parent instanceof Controller) {
        controller = (Controller) parent;
    } else if (getActivity() instanceof Controller) {
        controller = (Controller) getActivity();
    } else {
        throw new IllegalStateException("Parent must implement Controller interface.");
    }
    Bundle arguments = getArguments();
    if (arguments != null) {
        imageUri = arguments.getParcelable(KEY_IMAGE_URI);
    }
    if (imageUri == null) {
        throw new AssertionError("No KEY_IMAGE_URI supplied");
    }
    MediaConstraints mediaConstraints = new PushMediaConstraints(SentMediaQuality.HIGH);
    imageMaxWidth = mediaConstraints.getImageMaxWidth(requireContext());
    imageMaxHeight = mediaConstraints.getImageMaxHeight(requireContext());
}
Also used : PushMediaConstraints(org.thoughtcrime.securesms.mms.PushMediaConstraints) MediaConstraints(org.thoughtcrime.securesms.mms.MediaConstraints) Bundle(android.os.Bundle) Fragment(androidx.fragment.app.Fragment) MediaSendPageFragment(org.thoughtcrime.securesms.mediasend.MediaSendPageFragment) PushMediaConstraints(org.thoughtcrime.securesms.mms.PushMediaConstraints)

Aggregations

Bundle (android.os.Bundle)2 Fragment (androidx.fragment.app.Fragment)2 MediaSendPageFragment (org.thoughtcrime.securesms.mediasend.MediaSendPageFragment)2 MediaConstraints (org.thoughtcrime.securesms.mms.MediaConstraints)2 PushMediaConstraints (org.thoughtcrime.securesms.mms.PushMediaConstraints)2