Remove unnecessary code now that minSdk is 21.
This commit is contained in:
parent
8cfd02aff2
commit
3e7dc79fe8
68 changed files with 123 additions and 443 deletions
|
@ -4,8 +4,6 @@ import android.content.Context;
|
|||
import android.net.Uri;
|
||||
import android.provider.DocumentsContract;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
|
||||
/**
|
||||
|
@ -22,7 +20,6 @@ public class DocumentFileHelper {
|
|||
*
|
||||
* @return true if rename successful
|
||||
*/
|
||||
@RequiresApi(21)
|
||||
public static boolean renameTo(Context context, DocumentFile documentFile, String displayName) {
|
||||
if (documentFile instanceof TreeDocumentFile) {
|
||||
Log.d(TAG, "Renaming document directly");
|
||||
|
|
|
@ -168,11 +168,6 @@ public class ApplicationContext extends MultiDexApplication implements AppForegr
|
|||
.addBlocking("lifecycle-observer", () -> ApplicationDependencies.getAppForegroundObserver().addListener(this))
|
||||
.addBlocking("message-retriever", this::initializeMessageRetrieval)
|
||||
.addBlocking("dynamic-theme", () -> DynamicTheme.setDefaultDayNightMode(this))
|
||||
.addBlocking("vector-compat", () -> {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
||||
}
|
||||
})
|
||||
.addBlocking("proxy-init", () -> {
|
||||
if (SignalStore.proxy().isProxyEnabled()) {
|
||||
Log.w(TAG, "Proxy detected. Enabling Conscrypt.setUseEngineSocketByDefault()");
|
||||
|
|
|
@ -72,12 +72,10 @@ public final class AvatarPreviewActivity extends PassphraseRequiredActivity {
|
|||
setTheme(R.style.TextSecure_MediaPreview);
|
||||
setContentView(R.layout.contact_photo_preview_activity);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
postponeEnterTransition();
|
||||
TransitionInflater inflater = TransitionInflater.from(this);
|
||||
getWindow().setSharedElementEnterTransition(inflater.inflateTransition(R.transition.full_screen_avatar_image_enter_transition_set));
|
||||
getWindow().setSharedElementReturnTransition(inflater.inflateTransition(R.transition.full_screen_avatar_image_return_transition_set));
|
||||
}
|
||||
postponeEnterTransition();
|
||||
TransitionInflater inflater = TransitionInflater.from(this);
|
||||
getWindow().setSharedElementEnterTransition(inflater.inflateTransition(R.transition.full_screen_avatar_image_enter_transition_set));
|
||||
getWindow().setSharedElementReturnTransition(inflater.inflateTransition(R.transition.full_screen_avatar_image_return_transition_set));
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
EmojiTextView title = findViewById(R.id.title);
|
||||
|
@ -122,9 +120,7 @@ public final class AvatarPreviewActivity extends PassphraseRequiredActivity {
|
|||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
avatar.setImageDrawable(RoundedBitmapDrawableFactory.create(resources, resource));
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
startPostponedEnterTransition();
|
||||
}
|
||||
startPostponedEnterTransition();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.biometric.BiometricManager
|
||||
import androidx.biometric.BiometricPrompt
|
||||
import androidx.biometric.BiometricPrompt.PromptInfo
|
||||
|
@ -44,7 +43,7 @@ class BiometricDeviceAuthentication(
|
|||
Log.i(TAG, "Skipping show system biometric or device lock dialog unless forced")
|
||||
}
|
||||
true
|
||||
} else if (Build.VERSION.SDK_INT >= 21) {
|
||||
} else {
|
||||
if (force) {
|
||||
Log.i(TAG, "firing intent...")
|
||||
showConfirmDeviceCredentialIntent()
|
||||
|
@ -52,9 +51,6 @@ class BiometricDeviceAuthentication(
|
|||
Log.i(TAG, "Skipping firing intent unless forced")
|
||||
}
|
||||
true
|
||||
} else {
|
||||
Log.w(TAG, "Not compatible...")
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +61,6 @@ class BiometricDeviceAuthentication(
|
|||
|
||||
class BiometricDeviceLockContract : ActivityResultContract<String, Int>() {
|
||||
|
||||
@RequiresApi(api = 21)
|
||||
override fun createIntent(context: Context, input: String): Intent {
|
||||
val keyguardManager = ServiceUtil.getKeyguardManager(context)
|
||||
return keyguardManager.createConfirmDeviceCredentialIntent(input, "")
|
||||
|
|
|
@ -140,27 +140,18 @@ public class DeviceActivity extends PassphraseRequiredActivity
|
|||
Uri uri = Uri.parse(data);
|
||||
deviceLinkFragment.setLinkClickedListener(uri, DeviceActivity.this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
deviceAddFragment.setSharedElementReturnTransition(TransitionInflater.from(DeviceActivity.this).inflateTransition(R.transition.fragment_shared));
|
||||
deviceAddFragment.setExitTransition(TransitionInflater.from(DeviceActivity.this).inflateTransition(android.R.transition.fade));
|
||||
deviceAddFragment.setSharedElementReturnTransition(TransitionInflater.from(DeviceActivity.this).inflateTransition(R.transition.fragment_shared));
|
||||
deviceAddFragment.setExitTransition(TransitionInflater.from(DeviceActivity.this).inflateTransition(android.R.transition.fade));
|
||||
|
||||
deviceLinkFragment.setSharedElementEnterTransition(TransitionInflater.from(DeviceActivity.this).inflateTransition(R.transition.fragment_shared));
|
||||
deviceLinkFragment.setEnterTransition(TransitionInflater.from(DeviceActivity.this).inflateTransition(android.R.transition.fade));
|
||||
deviceLinkFragment.setSharedElementEnterTransition(TransitionInflater.from(DeviceActivity.this).inflateTransition(R.transition.fragment_shared));
|
||||
deviceLinkFragment.setEnterTransition(TransitionInflater.from(DeviceActivity.this).inflateTransition(android.R.transition.fade));
|
||||
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.addToBackStack(null)
|
||||
.addSharedElement(deviceAddFragment.getDevicesImage(), "devices")
|
||||
.replace(R.id.fragment_container, deviceLinkFragment)
|
||||
.commit();
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.addToBackStack(null)
|
||||
.addSharedElement(deviceAddFragment.getDevicesImage(), "devices")
|
||||
.replace(R.id.fragment_container, deviceLinkFragment)
|
||||
.commit();
|
||||
|
||||
} else {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.setCustomAnimations(R.anim.slide_from_bottom, R.anim.slide_to_bottom,
|
||||
R.anim.slide_from_bottom, R.anim.slide_to_bottom)
|
||||
.replace(R.id.fragment_container, deviceLinkFragment)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -41,22 +41,19 @@ public class DeviceAddFragment extends LoggingFragment {
|
|||
this.devicesImage = container.findViewById(R.id.devices);
|
||||
ViewCompat.setTransitionName(devicesImage, "devices");
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
container.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@TargetApi(21)
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom,
|
||||
int oldLeft, int oldTop, int oldRight, int oldBottom)
|
||||
{
|
||||
v.removeOnLayoutChangeListener(this);
|
||||
container.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom,
|
||||
int oldLeft, int oldTop, int oldRight, int oldBottom)
|
||||
{
|
||||
v.removeOnLayoutChangeListener(this);
|
||||
|
||||
Animator reveal = ViewAnimationUtils.createCircularReveal(v, right, bottom, 0, (int) Math.hypot(right, bottom));
|
||||
reveal.setInterpolator(new DecelerateInterpolator(2f));
|
||||
reveal.setDuration(800);
|
||||
reveal.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
Animator reveal = ViewAnimationUtils.createCircularReveal(v, right, bottom, 0, (int) Math.hypot(right, bottom));
|
||||
reveal.setInterpolator(new DecelerateInterpolator(2f));
|
||||
reveal.setDuration(800);
|
||||
reveal.start();
|
||||
}
|
||||
});
|
||||
|
||||
scannerView.start(getViewLifecycleOwner(), CameraXModelBlocklist.isBlocklisted());
|
||||
|
||||
|
|
|
@ -307,10 +307,8 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
|||
|
||||
public Unit showConfirmDeviceCredentialIntent() {
|
||||
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||
Intent intent = null;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
intent = keyguardManager.createConfirmDeviceCredentialIntent(getString(R.string.PassphrasePromptActivity_unlock_signal), "");
|
||||
}
|
||||
Intent intent = keyguardManager.createConfirmDeviceCredentialIntent(getString(R.string.PassphrasePromptActivity_unlock_signal), "");
|
||||
|
||||
startActivityForResult(intent, AUTHENTICATE_REQUEST_CODE);
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.view.ViewGroup
|
|||
import android.view.animation.AccelerateInterpolator
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import android.view.animation.Interpolator
|
||||
import androidx.annotation.RequiresApi
|
||||
|
||||
private const val POSITION_ON_SCREEN = "signal.circleavatartransition.positiononscreen"
|
||||
private const val WIDTH = "signal.circleavatartransition.width"
|
||||
|
@ -22,7 +21,6 @@ private const val HEIGHT = "signal.circleavatartransition.height"
|
|||
/**
|
||||
* Custom transition for Circular avatars, because once you have multiple things animating stuff was getting broken and weird.
|
||||
*/
|
||||
@RequiresApi(21)
|
||||
class CircleAvatarTransition(context: Context, attrs: AttributeSet?) : Transition(context, attrs) {
|
||||
override fun captureStartValues(transitionValues: TransitionValues) {
|
||||
captureValues(transitionValues)
|
||||
|
|
|
@ -7,11 +7,9 @@ import android.transition.Transition
|
|||
import android.transition.TransitionValues
|
||||
import android.util.AttributeSet
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.animation.doOnEnd
|
||||
import androidx.core.animation.doOnStart
|
||||
|
||||
@RequiresApi(21)
|
||||
class CrossfaderTransition(context: Context, attrs: AttributeSet?) : Transition(context, attrs) {
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.transition.TransitionValues
|
|||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.animation.addListener
|
||||
import androidx.fragment.app.FragmentContainerView
|
||||
|
||||
|
@ -19,7 +18,6 @@ private const val BOUNDS = "signal.wipedowntransition.bottom"
|
|||
/**
|
||||
* WipeDownTransition will animate the bottom position of a view such that it "wipes" down the screen to a final position.
|
||||
*/
|
||||
@RequiresApi(21)
|
||||
class WipeDownTransition(context: Context, attrs: AttributeSet?) : Transition(context, attrs) {
|
||||
override fun captureStartValues(transitionValues: TransitionValues) {
|
||||
captureValues(transitionValues)
|
||||
|
|
|
@ -248,10 +248,6 @@ public class ComposeText extends EmojiEditText {
|
|||
editorInfo.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
return inputConnection;
|
||||
}
|
||||
|
||||
if (mediaListener == null) {
|
||||
return inputConnection;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class KeyboardAwareLinearLayout extends LinearLayoutCompat {
|
|||
}
|
||||
|
||||
private void updateKeyboardState(int previousHeight) {
|
||||
if (viewInset == 0 && Build.VERSION.SDK_INT >= 21) viewInset = getViewInset();
|
||||
if (viewInset == 0) viewInset = getViewInset();
|
||||
|
||||
getWindowVisibleDisplayFrame(rect);
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.thoughtcrime.securesms.components
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.PointF
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewAnimationUtils
|
||||
|
@ -55,10 +54,7 @@ class Material3SearchToolbar @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
fun display(x: Float, y: Float) {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
visibility = VISIBLE
|
||||
ViewUtil.focusAndShowKeyboard(input)
|
||||
} else if (!visible) {
|
||||
if (!visible) {
|
||||
circularRevealPoint.set(x, y)
|
||||
|
||||
val animator = ViewAnimationUtils.createCircularReveal(this, x.toInt(), y.toInt(), 0f, width.toFloat())
|
||||
|
@ -75,17 +71,13 @@ class Material3SearchToolbar @JvmOverloads constructor(
|
|||
listener?.onSearchClosed()
|
||||
ViewUtil.hideKeyboard(context, input)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
val animator = ViewAnimationUtils.createCircularReveal(this, circularRevealPoint.x.toInt(), circularRevealPoint.y.toInt(), width.toFloat(), 0f)
|
||||
animator.duration = 400
|
||||
val animator = ViewAnimationUtils.createCircularReveal(this, circularRevealPoint.x.toInt(), circularRevealPoint.y.toInt(), width.toFloat(), 0f)
|
||||
animator.duration = 400
|
||||
|
||||
animator.addListener(onEnd = {
|
||||
visibility = INVISIBLE
|
||||
})
|
||||
animator.start()
|
||||
} else {
|
||||
animator.addListener(onEnd = {
|
||||
visibility = INVISIBLE
|
||||
}
|
||||
})
|
||||
animator.start()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,15 +106,11 @@ public class SearchToolbar extends LinearLayout {
|
|||
|
||||
searchItem.expandActionView();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
Animator animator = ViewAnimationUtils.createCircularReveal(this, (int)x, (int)y, 0, getWidth());
|
||||
animator.setDuration(400);
|
||||
Animator animator = ViewAnimationUtils.createCircularReveal(this, (int)x, (int)y, 0, getWidth());
|
||||
animator.setDuration(400);
|
||||
|
||||
setVisibility(View.VISIBLE);
|
||||
animator.start();
|
||||
} else {
|
||||
setVisibility(View.VISIBLE);
|
||||
}
|
||||
setVisibility(View.VISIBLE);
|
||||
animator.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,19 +125,15 @@ public class SearchToolbar extends LinearLayout {
|
|||
|
||||
if (listener != null) listener.onSearchClosed();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
Animator animator = ViewAnimationUtils.createCircularReveal(this, (int)x, (int)y, getWidth(), 0);
|
||||
animator.setDuration(400);
|
||||
animator.addListener(new AnimationCompleteListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
setVisibility(View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
animator.start();
|
||||
} else {
|
||||
setVisibility(View.INVISIBLE);
|
||||
}
|
||||
Animator animator = ViewAnimationUtils.createCircularReveal(this, (int)x, (int)y, getWidth(), 0);
|
||||
animator.setDuration(400);
|
||||
animator.addListener(new AnimationCompleteListener() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
setVisibility(View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
animator.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,9 +102,7 @@ public class TooltipPopup extends PopupWindow {
|
|||
GlideApp.with(anchor.getContext()).load(iconGlideModel).into(iconView);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
setElevation(10);
|
||||
}
|
||||
setElevation(10);
|
||||
|
||||
getContentView().setOnClickListener(v -> dismiss());
|
||||
|
||||
|
|
|
@ -31,9 +31,7 @@ public class EmojiVariationSelectorPopup extends PopupWindow {
|
|||
setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.emoji_variation_selector_background));
|
||||
setOutsideTouchable(true);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
setElevation(20);
|
||||
}
|
||||
setElevation(20);
|
||||
}
|
||||
|
||||
public void setVariations(List<String> variations) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.thoughtcrime.securesms.components.menu
|
||||
|
||||
import android.os.Build
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
|
@ -83,13 +82,11 @@ class ContextMenuList(recyclerView: RecyclerView, onItemClick: () -> Unit) {
|
|||
icon.setColorFilter(tintColor)
|
||||
title.setTextColor(tintColor)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
when (model.displayType) {
|
||||
DisplayType.TOP -> itemView.setBackgroundResource(R.drawable.signal_context_menu_item_background_top)
|
||||
DisplayType.BOTTOM -> itemView.setBackgroundResource(R.drawable.signal_context_menu_item_background_bottom)
|
||||
DisplayType.MIDDLE -> itemView.setBackgroundResource(R.drawable.signal_context_menu_item_background_middle)
|
||||
DisplayType.ONLY -> itemView.setBackgroundResource(R.drawable.signal_context_menu_item_background_only)
|
||||
}
|
||||
when (model.displayType) {
|
||||
DisplayType.TOP -> itemView.setBackgroundResource(R.drawable.signal_context_menu_item_background_top)
|
||||
DisplayType.BOTTOM -> itemView.setBackgroundResource(R.drawable.signal_context_menu_item_background_bottom)
|
||||
DisplayType.MIDDLE -> itemView.setBackgroundResource(R.drawable.signal_context_menu_item_background_middle)
|
||||
DisplayType.ONLY -> itemView.setBackgroundResource(R.drawable.signal_context_menu_item_background_only)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.thoughtcrime.securesms.components.menu
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -42,10 +41,7 @@ class SignalBottomActionBar(context: Context, attributeSet: AttributeSet) : Line
|
|||
init {
|
||||
orientation = HORIZONTAL
|
||||
setBackgroundResource(R.drawable.signal_bottom_action_bar_background)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
elevation = 20f
|
||||
}
|
||||
elevation = 20f
|
||||
}
|
||||
|
||||
fun setItems(items: List<ActionItem>) {
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.thoughtcrime.securesms.components.menu
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -50,9 +49,7 @@ class SignalContextMenu private constructor(
|
|||
setOnDismissListener { onDismiss.run() }
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
elevation = 20f
|
||||
}
|
||||
elevation = 20f
|
||||
|
||||
contextMenuList.setItems(items)
|
||||
}
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
package org.thoughtcrime.securesms.components.reminder
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* Shown when a user has API 19.
|
||||
*/
|
||||
class Api19Reminder(context: Context) : Reminder(null, context.getString(R.string.API19Reminder_banner_message, getExpireDate())) {
|
||||
|
||||
init {
|
||||
addAction(
|
||||
Action(
|
||||
context.getString(R.string.API19Reminder_learn_more),
|
||||
R.id.reminder_action_api_19_learn_more
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun isDismissable(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getImportance(): Importance {
|
||||
return Importance.TERMINAL
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun isEligible(): Boolean {
|
||||
return Build.VERSION.SDK_INT < 21 && !ExpiredBuildReminder.isEligible()
|
||||
}
|
||||
|
||||
fun getExpireDate(): String {
|
||||
val formatter = SimpleDateFormat("MMMM d", Locale.getDefault())
|
||||
val expireDate = Date(System.currentTimeMillis() + Util.getTimeUntilBuildExpiry())
|
||||
return formatter.format(expireDate)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,15 +19,8 @@ import java.util.List;
|
|||
public class ExpiredBuildReminder extends Reminder {
|
||||
|
||||
public ExpiredBuildReminder(final Context context) {
|
||||
super(null, Build.VERSION.SDK_INT < 21
|
||||
? context.getString(R.string.ExpiredBuildReminder_api_19_message)
|
||||
: context.getString(R.string.ExpiredBuildReminder_this_version_of_signal_has_expired));
|
||||
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
addAction(new Action(context.getString(R.string.API19Reminder_learn_more), R.id.reminder_action_api_19_learn_more));
|
||||
} else {
|
||||
addAction(new Action(context.getString(R.string.ExpiredBuildReminder_update_now), R.id.reminder_action_update_now));
|
||||
}
|
||||
super(null, context.getString(R.string.ExpiredBuildReminder_this_version_of_signal_has_expired));
|
||||
addAction(new Action(context.getString(R.string.ExpiredBuildReminder_update_now), R.id.reminder_action_update_now));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.provider.Settings
|
|||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.Navigation
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.components.settings.DSLConfiguration
|
||||
|
@ -23,7 +22,6 @@ import org.thoughtcrime.securesms.keyvalue.SmsExportPhase
|
|||
import org.thoughtcrime.securesms.util.SmsUtil
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
|
||||
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||
|
||||
private const val SMS_REQUEST_CODE: Short = 1234
|
||||
|
||||
|
@ -146,15 +144,6 @@ class SmsSettingsFragment : DSLSettingsFragment(R.string.preferences__sms_mms) {
|
|||
viewModel.setWifiCallingCompatibilityEnabled(!state.wifiCallingCompatibilityEnabled)
|
||||
}
|
||||
)
|
||||
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
clickPref(
|
||||
title = DSLSettingsText.from(R.string.preferences__advanced_mms_access_point_names),
|
||||
onClick = {
|
||||
Navigation.findNavController(requireView()).safeNavigate(R.id.action_smsSettingsFragment_to_mmsPreferencesFragment)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.hardware.SensorEvent
|
|||
import android.hardware.SensorEventListener
|
||||
import android.hardware.SensorManager
|
||||
import android.media.AudioManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.PowerManager
|
||||
import android.support.v4.media.session.MediaControllerCompat
|
||||
|
@ -29,11 +28,7 @@ class VoiceNoteProximityWakeLockManager(
|
|||
private val mediaController: MediaControllerCompat
|
||||
) : DefaultLifecycleObserver {
|
||||
|
||||
private val wakeLock: PowerManager.WakeLock? = if (Build.VERSION.SDK_INT >= 21) {
|
||||
ServiceUtil.getPowerManager(activity.applicationContext).newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, TAG)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
private val wakeLock: PowerManager.WakeLock? = ServiceUtil.getPowerManager(activity.applicationContext).newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, TAG)
|
||||
|
||||
private val sensorManager: SensorManager = ServiceUtil.getSensorManager(activity)
|
||||
private val proximitySensor: Sensor? = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY)
|
||||
|
|
|
@ -190,11 +190,8 @@ public final class WebRtcAnswerDeclineButton extends LinearLayout implements Acc
|
|||
swipeUpText.setAlpha(1);
|
||||
swipeDownText.setAlpha(1);
|
||||
answer.setRotation(0);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
answer.getDrawable().setTint(getResources().getColor(R.color.green_600));
|
||||
answer.getBackground().setTint(Color.WHITE);
|
||||
}
|
||||
answer.getDrawable().setTint(getResources().getColor(R.color.green_600));
|
||||
answer.getBackground().setTint(Color.WHITE);
|
||||
|
||||
animating = true;
|
||||
animateElements(0);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.thoughtcrime.securesms.conversation
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
|
@ -36,9 +35,7 @@ class ConversationContextMenu(private val anchor: View, items: List<ActionItem>)
|
|||
isFocusable = false
|
||||
isOutsideTouchable = true
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
elevation = 20f
|
||||
}
|
||||
elevation = 20f
|
||||
|
||||
setTouchInterceptor { _, event ->
|
||||
event.action == MotionEvent.ACTION_OUTSIDE
|
||||
|
|
|
@ -1936,8 +1936,6 @@ public class ConversationParentFragment extends Fragment
|
|||
InsightsLauncher.showInsightsDashboard(getChildFragmentManager());
|
||||
} else if (reminderActionId == R.id.reminder_action_update_now) {
|
||||
PlayStoreUtil.openPlayStoreOrOurApkDownloadPage(requireContext());
|
||||
} else if (reminderActionId == R.id.reminder_action_api_19_learn_more) {
|
||||
CommunicationActions.openBrowserLink(requireContext(), "https://support.signal.org/hc/articles/5109141421850");
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown ID: " + reminderActionId);
|
||||
}
|
||||
|
@ -2459,7 +2457,7 @@ public class ConversationParentFragment extends Fragment
|
|||
}
|
||||
|
||||
private void showGroupCallingTooltip() {
|
||||
if (Build.VERSION.SDK_INT == 19 || !SignalStore.tooltips().shouldShowGroupCallingTooltip() || callingTooltipShown) {
|
||||
if (!SignalStore.tooltips().shouldShowGroupCallingTooltip() || callingTooltipShown) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3203,8 +3201,6 @@ public class ConversationParentFragment extends Fragment
|
|||
builder.setNeutralButton(action.getTitle(), (d, i) -> {
|
||||
if (action.getActionId() == R.id.reminder_action_update_now) {
|
||||
PlayStoreUtil.openPlayStoreOrOurApkDownloadPage(requireContext());
|
||||
} else if (action.getActionId() == R.id.reminder_action_api_19_learn_more) {
|
||||
CommunicationActions.openBrowserLink(requireContext(), "https://support.signal.org/hc/articles/5109141421850");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -166,16 +166,11 @@ public final class ConversationReactionOverlay extends FrameLayout {
|
|||
|
||||
setupSelectedEmoji();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
View statusBarBackground = activity.findViewById(android.R.id.statusBarBackground);
|
||||
statusBarHeight = statusBarBackground == null ? 0 : statusBarBackground.getHeight();
|
||||
View statusBarBackground = activity.findViewById(android.R.id.statusBarBackground);
|
||||
statusBarHeight = statusBarBackground == null ? 0 : statusBarBackground.getHeight();
|
||||
|
||||
View navigationBarBackground = activity.findViewById(android.R.id.navigationBarBackground);
|
||||
bottomNavigationBarHeight = navigationBarBackground == null ? 0 : navigationBarBackground.getHeight();
|
||||
} else {
|
||||
statusBarHeight = ViewUtil.getStatusBarHeight(this);
|
||||
bottomNavigationBarHeight = ViewUtil.getNavigationBarHeight(this);
|
||||
}
|
||||
View navigationBarBackground = activity.findViewById(android.R.id.navigationBarBackground);
|
||||
bottomNavigationBarHeight = navigationBarBackground == null ? 0 : navigationBarBackground.getHeight();
|
||||
|
||||
if (zeroNavigationBarHeightForConfiguration()) {
|
||||
bottomNavigationBarHeight = 0;
|
||||
|
@ -199,10 +194,8 @@ public final class ConversationReactionOverlay extends FrameLayout {
|
|||
|
||||
setVisibility(View.INVISIBLE);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
this.activity = activity;
|
||||
updateSystemUiOnShow(activity);
|
||||
}
|
||||
this.activity = activity;
|
||||
updateSystemUiOnShow(activity);
|
||||
|
||||
ViewKt.doOnLayout(this, v -> {
|
||||
showAfterLayout(activity, conversationMessage, lastSeenDownPoint, isMessageOnLeft);
|
||||
|
@ -908,7 +901,7 @@ public final class ConversationReactionOverlay extends FrameLayout {
|
|||
inputShadeAnim.setDuration(duration);
|
||||
animators.add(inputShadeAnim);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21 && activity != null) {
|
||||
if (activity != null) {
|
||||
ValueAnimator statusBarAnim = ValueAnimator.ofArgb(activity.getWindow().getStatusBarColor(), originalStatusBarColor);
|
||||
statusBarAnim.setDuration(duration);
|
||||
statusBarAnim.addUpdateListener(animation -> {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.thoughtcrime.securesms.conversation
|
||||
|
||||
import android.os.Build
|
||||
import android.os.PowerManager
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
|
@ -30,9 +29,7 @@ class VoiceRecorderWakeLock(
|
|||
return
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
wakeLock = WakeLockUtil.acquire(activity, PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, TimeUnit.HOURS.toMillis(1), "voiceRecorder")
|
||||
}
|
||||
wakeLock = WakeLockUtil.acquire(activity, PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, TimeUnit.HOURS.toMillis(1), "voiceRecorder")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,6 @@ import android.graphics.PorterDuff
|
|||
import android.graphics.PorterDuffColorFilter
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.ShapeDrawable
|
||||
import android.graphics.drawable.shapes.OvalShape
|
||||
import android.os.Build
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.ColorInt
|
||||
|
@ -35,7 +32,7 @@ class ChatColors(
|
|||
private val singleColor: Int?
|
||||
) : Parcelable {
|
||||
|
||||
fun isGradient(): Boolean = Build.VERSION.SDK_INT >= 21 && linearGradient != null
|
||||
fun isGradient(): Boolean = linearGradient != null
|
||||
|
||||
/**
|
||||
* Returns the Drawable to render the linear gradient, or null if this ChatColors is a single color.
|
||||
|
@ -43,9 +40,6 @@ class ChatColors(
|
|||
val chatBubbleMask: Drawable
|
||||
get() {
|
||||
return when {
|
||||
Build.VERSION.SDK_INT < 21 -> {
|
||||
ColorDrawable(Color.TRANSPARENT)
|
||||
}
|
||||
linearGradient != null -> {
|
||||
RotatableGradientDrawable(
|
||||
linearGradient.degrees,
|
||||
|
@ -63,11 +57,7 @@ class ChatColors(
|
|||
* Returns the ColorFilter to apply to a conversation bubble or other relevant piece of UI.
|
||||
*/
|
||||
@IgnoredOnParcel
|
||||
val chatBubbleColorFilter: ColorFilter = if (Build.VERSION.SDK_INT >= 21) {
|
||||
PorterDuffColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN)
|
||||
} else {
|
||||
PorterDuffColorFilter(asSingleColor(), PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
val chatBubbleColorFilter: ColorFilter = PorterDuffColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN)
|
||||
|
||||
@ColorInt
|
||||
fun asSingleColor(): Int {
|
||||
|
@ -115,12 +105,6 @@ class ChatColors(
|
|||
}
|
||||
|
||||
fun asCircle(): Drawable {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
return ShapeDrawable(OvalShape()).apply {
|
||||
paint.color = asSingleColor()
|
||||
}
|
||||
}
|
||||
|
||||
val toWrap: Drawable = chatBubbleMask
|
||||
val path = Path()
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.thoughtcrime.securesms.conversation.colors.ui
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -18,9 +17,7 @@ class ChatSelectionContextMenu(val context: Context) : PopupWindow(context) {
|
|||
init {
|
||||
contentView = LayoutInflater.from(context).inflate(R.layout.chat_colors_fragment_context_menu, null, false)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
elevation = ViewUtil.dpToPx(8).toFloat()
|
||||
}
|
||||
elevation = ViewUtil.dpToPx(8).toFloat()
|
||||
|
||||
isOutsideTouchable = false
|
||||
isFocusable = true
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.thoughtcrime.securesms.conversation.colors.ui.custom
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
|
@ -35,11 +34,7 @@ class CustomChatColorCreatorFragment : Fragment(R.layout.custom_chat_color_creat
|
|||
pager.isUserInputEnabled = false
|
||||
pager.adapter = adapter
|
||||
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
tabLayout.visibility = View.GONE
|
||||
} else {
|
||||
tabLayoutMediator.attach()
|
||||
}
|
||||
tabLayoutMediator.attach()
|
||||
|
||||
val startPage = CustomChatColorCreatorFragmentArgs.fromBundle(requireArguments()).startPage
|
||||
pager.setCurrentItem(startPage, false)
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.thoughtcrime.securesms.conversation.ui.inlinequery
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -34,10 +33,8 @@ class InlineQueryResultsPopup(
|
|||
private val adapter: MappingAdapter
|
||||
|
||||
init {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
contentView.outlineProvider = ViewOutlineProvider.BACKGROUND
|
||||
contentView.clipToOutline = true
|
||||
}
|
||||
contentView.outlineProvider = ViewOutlineProvider.BACKGROUND
|
||||
contentView.clipToOutline = true
|
||||
|
||||
inputMethodMode = INPUT_METHOD_NOT_NEEDED
|
||||
|
||||
|
@ -46,9 +43,7 @@ class InlineQueryResultsPopup(
|
|||
callback = null
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
elevation = 20f
|
||||
}
|
||||
elevation = 20f
|
||||
|
||||
adapter = InlineQueryAdapter { m -> callback?.onSelection(m) }
|
||||
list.adapter = adapter
|
||||
|
|
|
@ -97,7 +97,6 @@ import org.thoughtcrime.securesms.components.menu.ActionItem;
|
|||
import org.thoughtcrime.securesms.components.menu.SignalBottomActionBar;
|
||||
import org.thoughtcrime.securesms.components.menu.SignalContextMenu;
|
||||
import org.thoughtcrime.securesms.components.registration.PulsingFloatingActionButton;
|
||||
import org.thoughtcrime.securesms.components.reminder.Api19Reminder;
|
||||
import org.thoughtcrime.securesms.components.reminder.CdsPermanentErrorReminder;
|
||||
import org.thoughtcrime.securesms.components.reminder.CdsTemporyErrorReminder;
|
||||
import org.thoughtcrime.securesms.components.reminder.DozeReminder;
|
||||
|
@ -683,8 +682,6 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
|||
CdsTemporaryErrorBottomSheet.show(getChildFragmentManager());
|
||||
} else if (reminderActionId == R.id.reminder_action_cds_permanent_error_learn_more) {
|
||||
CdsPermanentErrorBottomSheet.show(getChildFragmentManager());
|
||||
} else if (reminderActionId == R.id.reminder_action_api_19_learn_more) {
|
||||
CommunicationActions.openBrowserLink(requireContext(), "https://support.signal.org/hc/articles/5109141421850");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -946,8 +943,6 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
|||
} else if (ServiceOutageReminder.isEligible(context)) {
|
||||
ApplicationDependencies.getJobManager().add(new ServiceOutageDetectionJob());
|
||||
return Optional.of(new ServiceOutageReminder(context));
|
||||
} else if (Api19Reminder.isEligible()) {
|
||||
return Optional.of(new Api19Reminder(context));
|
||||
} else if (OutdatedBuildReminder.isEligible()) {
|
||||
return Optional.of(new OutdatedBuildReminder(context));
|
||||
} else if (PushRegistrationReminder.isEligible(context)) {
|
||||
|
@ -1387,11 +1382,9 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
|||
public void onDestroyActionMode(ActionMode mode) {
|
||||
viewModel.endSelection();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
TypedArray color = getActivity().getTheme().obtainStyledAttributes(new int[] { android.R.attr.statusBarColor });
|
||||
WindowUtil.setStatusBarColor(getActivity().getWindow(), color.getColor(0, Color.BLACK));
|
||||
color.recycle();
|
||||
}
|
||||
TypedArray color = getActivity().getTheme().obtainStyledAttributes(new int[] { android.R.attr.statusBarColor });
|
||||
WindowUtil.setStatusBarColor(getActivity().getWindow(), color.getColor(0, Color.BLACK));
|
||||
color.recycle();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
TypedArray lightStatusBarAttr = getActivity().getTheme().obtainStyledAttributes(new int[] { android.R.attr.windowLightStatusBar });
|
||||
|
|
|
@ -29,11 +29,7 @@ public final class TransferOrRestoreFragment extends LoggingFragment {
|
|||
.setOnClickListener(v -> SafeNavigation.safeNavigate(Navigation.findNavController(v), R.id.action_new_device_transfer_instructions));
|
||||
|
||||
View restoreBackup = view.findViewById(R.id.transfer_or_restore_fragment_restore);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
restoreBackup.setOnClickListener(v -> SafeNavigation.safeNavigate(Navigation.findNavController(v), R.id.action_choose_backup));
|
||||
} else {
|
||||
restoreBackup.setVisibility(View.GONE);
|
||||
}
|
||||
restoreBackup.setOnClickListener(v -> SafeNavigation.safeNavigate(Navigation.findNavController(v), R.id.action_choose_backup));
|
||||
|
||||
String description = getString(R.string.TransferOrRestoreFragment__transfer_your_account_and_messages_from_your_old_android_device);
|
||||
String toBold = getString(R.string.TransferOrRestoreFragment__you_need_access_to_your_old_device);
|
||||
|
|
|
@ -26,10 +26,6 @@ public class OldDeviceExitActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private static void finishAll(@NonNull Activity activity) {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
activity.finishAffinity();
|
||||
} else {
|
||||
activity.finishAndRemoveTask();
|
||||
}
|
||||
activity.finishAndRemoveTask();
|
||||
}
|
||||
}
|
|
@ -14,8 +14,7 @@ object TypefaceHelper {
|
|||
weight.value,
|
||||
false
|
||||
)
|
||||
Build.VERSION.SDK_INT >= 21 -> Typeface.create("${family.familyName}-$weightName", Typeface.NORMAL)
|
||||
else -> Typeface.create(family.familyName, if (weight.value > Weight.MEDIUM.value) Typeface.BOLD else Typeface.NORMAL)
|
||||
else -> Typeface.create("${family.familyName}-$weightName", Typeface.NORMAL)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.thoughtcrime.securesms.keyboard
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -57,10 +56,6 @@ class KeyboardPagerFragment : Fragment() {
|
|||
}
|
||||
|
||||
override fun onHiddenChanged(hidden: Boolean) {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
return
|
||||
}
|
||||
|
||||
if (hidden) {
|
||||
WindowUtil.setNavigationBarColor(requireActivity(), ThemeUtil.getThemedColor(requireContext(), android.R.attr.navigationBarColor))
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.animation.Animator
|
|||
import android.animation.Animator.AnimatorListener
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.view.animation.PathInterpolator
|
||||
|
@ -162,9 +161,7 @@ class AnimatedInOutImageButton @JvmOverloads constructor(
|
|||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
animator.interpolator = PathInterpolator(0.4f, 0.0f, 0.2f, 1f)
|
||||
}
|
||||
animator.interpolator = PathInterpolator(0.4f, 0.0f, 0.2f, 1f)
|
||||
|
||||
animator.start()
|
||||
}
|
||||
|
@ -178,9 +175,7 @@ class AnimatedInOutImageButton @JvmOverloads constructor(
|
|||
.scaleY(0.5f)
|
||||
.withEndAction(endAction)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
animator.interpolator = PathInterpolator(0.4f, 0.0f, 0.2f, 1f)
|
||||
}
|
||||
animator.interpolator = PathInterpolator(0.4f, 0.0f, 0.2f, 1f)
|
||||
animator.start()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.thoughtcrime.securesms.mediapreview
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -26,11 +25,10 @@ class MediaPreviewV2Activity : PassphraseRequiredActivity(), VoiceNoteMediaContr
|
|||
setContentView(R.layout.activity_mediapreview_v2)
|
||||
voiceNoteMediaController = VoiceNoteMediaController(this)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
val systemBarColor = ContextCompat.getColor(this, R.color.signal_dark_colorSurface)
|
||||
window.statusBarColor = systemBarColor
|
||||
window.navigationBarColor = systemBarColor
|
||||
}
|
||||
val systemBarColor = ContextCompat.getColor(this, R.color.signal_dark_colorSurface)
|
||||
window.statusBarColor = systemBarColor
|
||||
window.navigationBarColor = systemBarColor
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
val bundle = Bundle()
|
||||
val args = MediaIntentFactory.requireArguments(intent.extras!!)
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.content.DialogInterface
|
|||
import android.content.Intent
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.view.LayoutInflater
|
||||
|
@ -351,9 +350,7 @@ class MediaPreviewV2Fragment : LoggingFragment(R.layout.fragment_media_preview_v
|
|||
scrollAlbumRailToCurrentAdapterPosition()
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
viewPropertyAnimator.interpolator = PathInterpolator(0.17f, 0.17f, 0f, 1f)
|
||||
}
|
||||
viewPropertyAnimator.interpolator = PathInterpolator(0.17f, 0.17f, 0f, 1f)
|
||||
viewPropertyAnimator.start()
|
||||
true
|
||||
} else {
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.signal.core.util.logging.Log;
|
|||
import org.thoughtcrime.securesms.LoggingFragment;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.animation.AnimationCompleteListener;
|
||||
import org.thoughtcrime.securesms.mediasend.camerax.CameraXModelBlocklist;
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaAnimations;
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaCountIndicatorButton;
|
||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri;
|
||||
|
@ -59,7 +60,7 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
|||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* Camera capture implemented with the legacy camera API's. Should only be used if sdk < 21.
|
||||
* Camera capture implemented with the legacy camera API's. Should only be used if a device is on the {@link CameraXModelBlocklist}.
|
||||
*/
|
||||
public class Camera1Fragment extends LoggingFragment implements CameraFragment,
|
||||
TextureView.SurfaceTextureListener,
|
||||
|
|
|
@ -73,7 +73,6 @@ import io.reactivex.rxjava3.disposables.Disposable;
|
|||
* preferred whenever possible.
|
||||
*/
|
||||
@ExperimentalVideo
|
||||
@RequiresApi(21)
|
||||
public class CameraXFragment extends LoggingFragment implements CameraFragment {
|
||||
|
||||
private static final String TAG = Log.tag(CameraXFragment.class);
|
||||
|
|
|
@ -5,12 +5,10 @@ import android.view.Window;
|
|||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.camera.core.CameraSelector;
|
||||
import androidx.camera.core.ImageCapture;
|
||||
import androidx.camera.view.CameraController;
|
||||
|
||||
@RequiresApi(21)
|
||||
final class CameraXSelfieFlashHelper {
|
||||
|
||||
private static final float MAX_SCREEN_BRIGHTNESS = 1f;
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.thoughtcrime.securesms.R;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@RequiresApi(21)
|
||||
public final class CameraXFlashToggleView extends AppCompatImageView {
|
||||
|
||||
private static final String STATE_FLASH_INDEX = "flash.toggle.state.flash.index";
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.thoughtcrime.securesms.mediasend.camerax
|
|||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.camera.view.CameraController
|
||||
import androidx.camera.view.video.ExperimentalVideo
|
||||
import org.signal.core.util.asListContains
|
||||
|
@ -13,7 +12,6 @@ import org.thoughtcrime.securesms.video.VideoUtil
|
|||
/**
|
||||
* Describes device capabilities
|
||||
*/
|
||||
@RequiresApi(21)
|
||||
@ExperimentalVideo
|
||||
sealed class CameraXModePolicy {
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ public class CameraXUtil {
|
|||
|
||||
private static final String TAG = Log.tag(CameraXUtil.class);
|
||||
|
||||
@RequiresApi(21)
|
||||
private static final int[] CAMERA_HARDWARE_LEVEL_ORDERING = new int[]{CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY,
|
||||
CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
|
||||
CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_FULL};
|
||||
|
@ -60,7 +59,6 @@ public class CameraXUtil {
|
|||
CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_3};
|
||||
|
||||
@SuppressWarnings("SuspiciousNameCombination")
|
||||
@RequiresApi(21)
|
||||
public static ImageResult toJpeg(@NonNull ImageProxy image, boolean flip) throws IOException {
|
||||
ImageProxy.PlaneProxy[] planes = image.getPlanes();
|
||||
ByteBuffer buffer = planes[0].getBuffer();
|
||||
|
@ -106,10 +104,9 @@ public class CameraXUtil {
|
|||
}
|
||||
|
||||
public static boolean isSupported() {
|
||||
return Build.VERSION.SDK_INT >= 21 && !CameraXModelBlocklist.isBlocklisted();
|
||||
return !CameraXModelBlocklist.isBlocklisted();
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
public static int toCameraDirectionInt(CameraSelector cameraSelector) {
|
||||
if (cameraSelector == CameraSelector.DEFAULT_FRONT_CAMERA) {
|
||||
return Camera.CameraInfo.CAMERA_FACING_FRONT;
|
||||
|
@ -118,7 +115,6 @@ public class CameraXUtil {
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
public static CameraSelector toCameraSelector(@CameraSelector.LensFacing int cameraDirectionInt) {
|
||||
if (cameraDirectionInt == Camera.CameraInfo.CAMERA_FACING_FRONT) {
|
||||
return CameraSelector.DEFAULT_FRONT_CAMERA;
|
||||
|
@ -127,7 +123,6 @@ public class CameraXUtil {
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
public static @ImageCapture.CaptureMode int getOptimalCaptureMode() {
|
||||
return FastCameraModels.contains(Build.MODEL) ? ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY
|
||||
: ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY;
|
||||
|
@ -138,7 +133,6 @@ public class CameraXUtil {
|
|||
return Math.max(maxDisplay, 1920);
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
public static @NonNull Size buildResolutionForRatio(int longDimension, @NonNull Rational ratio, boolean isPortrait) {
|
||||
int shortDimension = longDimension * ratio.getDenominator() / ratio.getNumerator();
|
||||
|
||||
|
@ -187,7 +181,6 @@ public class CameraXUtil {
|
|||
return transformedData;
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
private static boolean shouldCropImage(@NonNull ImageProxy image) {
|
||||
Size sourceSize = new Size(image.getWidth(), image.getHeight());
|
||||
Size targetSize = new Size(image.getCropRect().width(), image.getCropRect().height());
|
||||
|
@ -205,12 +198,10 @@ public class CameraXUtil {
|
|||
return out.toByteArray();
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
public static boolean isMixedModeSupported(@NonNull Context context) {
|
||||
return getLowestSupportedHardwareLevel(context) != CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY;
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
public static int getLowestSupportedHardwareLevel(@NonNull Context context) {
|
||||
@SuppressLint("RestrictedApi") CameraManager cameraManager = CameraManagerCompat.from(context).unwrap();
|
||||
|
||||
|
@ -241,13 +232,11 @@ public class CameraXUtil {
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
private static int maxHardwareLevel() {
|
||||
if (Build.VERSION.SDK_INT >= 24) return CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_3;
|
||||
else return CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_FULL;
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
private static int smallerHardwareLevel(int levelA, int levelB) {
|
||||
|
||||
int[] hardwareInfoOrdering = getHardwareInfoOrdering();
|
||||
|
@ -258,7 +247,6 @@ public class CameraXUtil {
|
|||
return CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY;
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
private static int[] getHardwareInfoOrdering() {
|
||||
if (Build.VERSION.SDK_INT >= 28) return CAMERA_HARDWARE_LEVEL_ORDERING_28;
|
||||
else if (Build.VERSION.SDK_INT >= 24) return CAMERA_HARDWARE_LEVEL_ORDERING_24;
|
||||
|
|
|
@ -286,15 +286,10 @@ object NotificationFactory {
|
|||
return
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
ringtone.audioAttributes = AudioAttributes.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN)
|
||||
.setUsage(AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT)
|
||||
.build()
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
ringtone.streamType = AudioManager.STREAM_NOTIFICATION
|
||||
}
|
||||
ringtone.audioAttributes = AudioAttributes.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN)
|
||||
.setUsage(AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT)
|
||||
.build()
|
||||
|
||||
ringtone.play()
|
||||
}
|
||||
|
|
|
@ -309,7 +309,7 @@ public class EditProfileFragment extends LoggingFragment {
|
|||
private void handleUpload() {
|
||||
viewModel.getUploadResult().observe(getViewLifecycleOwner(), uploadResult -> {
|
||||
if (uploadResult == EditProfileRepository.UploadResult.SUCCESS) {
|
||||
if (Build.VERSION.SDK_INT >= 21 && !viewModel.isGroup()) {
|
||||
if (!viewModel.isGroup()) {
|
||||
handleFinishedLollipop();
|
||||
}
|
||||
else {
|
||||
|
@ -330,7 +330,6 @@ public class EditProfileFragment extends LoggingFragment {
|
|||
controller.onProfileNameUploadCompleted();
|
||||
}
|
||||
|
||||
@RequiresApi(api = 21)
|
||||
private void handleFinishedLollipop() {
|
||||
int[] finishButtonLocation = new int[2];
|
||||
int[] revealLocation = new int[2];
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.thoughtcrime.securesms.reactions.edit
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.animation.Animation
|
||||
|
@ -90,14 +89,10 @@ class EditReactionsFragment : LoggingFragment(R.layout.edit_reactions_fragment),
|
|||
}
|
||||
|
||||
private fun configureToolbar() {
|
||||
if (Build.VERSION.SDK_INT == 19) {
|
||||
updateToolbarTopMargin(ViewUtil.getStatusBarHeight(toolbar))
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
ViewCompat.setOnApplyWindowInsetsListener(toolbar) { _, insets ->
|
||||
updateToolbarTopMargin(insets.systemWindowInsetTop)
|
||||
insets
|
||||
}
|
||||
@Suppress("DEPRECATION")
|
||||
ViewCompat.setOnApplyWindowInsetsListener(toolbar) { _, insets ->
|
||||
updateToolbarTopMargin(insets.systemWindowInsetTop)
|
||||
insets
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.transition.TransitionValues
|
|||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.view.ViewCompat
|
||||
|
||||
class ScaleTransition : Transition {
|
||||
|
@ -36,7 +35,6 @@ class ScaleTransition : Transition {
|
|||
|
||||
constructor() : super()
|
||||
|
||||
@RequiresApi(21)
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
||||
|
||||
override fun getTransitionProperties(): Array<String> {
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.media.AudioManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
|
@ -119,9 +118,7 @@ class StoryViewerActivity : PassphraseRequiredActivity(), VoiceNoteMediaControll
|
|||
}
|
||||
|
||||
override fun onEnterAnimationComplete() {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
window.transitionBackgroundFadeDuration = 100
|
||||
}
|
||||
window.transitionBackgroundFadeDuration = 100
|
||||
}
|
||||
|
||||
private fun replaceStoryViewerFragment() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.thoughtcrime.securesms.stories.viewer
|
||||
|
||||
import android.os.Build
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
@ -31,7 +30,7 @@ class StoryViewerViewModel(
|
|||
storyViewerArgs.storyThumbUri != null -> StoryViewerState.CrossfadeSource.ImageUri(storyViewerArgs.storyThumbUri, storyViewerArgs.storyThumbBlur)
|
||||
else -> StoryViewerState.CrossfadeSource.None
|
||||
},
|
||||
skipCrossfade = storyViewerArgs.isFromNotification || storyViewerArgs.isFromQuote || Build.VERSION.SDK_INT < 21
|
||||
skipCrossfade = storyViewerArgs.isFromNotification || storyViewerArgs.isFromQuote
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.stories.viewer.first
|
|||
import android.app.Dialog
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
|
@ -36,14 +35,12 @@ class StoryFirstTimeNavigationFragment : DialogFragment(R.layout.story_viewer_fi
|
|||
val dialog = super.onCreateDialog(savedInstanceState)
|
||||
dialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
dialog.window!!.addFlags(
|
||||
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION or
|
||||
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS or
|
||||
WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS or
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
)
|
||||
}
|
||||
dialog.window!!.addFlags(
|
||||
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION or
|
||||
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS or
|
||||
WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS or
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
)
|
||||
return dialog
|
||||
}
|
||||
|
||||
|
|
|
@ -37,13 +37,6 @@ public final class FullscreenHelper {
|
|||
}
|
||||
|
||||
public void configureToolbarLayout(@NonNull View spacer, @NonNull View toolbar) {
|
||||
if (Build.VERSION.SDK_INT == 19) {
|
||||
setSpacerHeight(spacer, ViewUtil.getStatusBarHeight(spacer));
|
||||
int[] padding = makePaddingValuesForAPI19(activity);
|
||||
toolbar.setPadding(padding[0], 0, padding[1], 0);
|
||||
return;
|
||||
}
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(spacer, (view, insets) -> {
|
||||
setSpacerHeight(view, insets.getSystemWindowInsetTop());
|
||||
return insets;
|
||||
|
@ -57,13 +50,6 @@ public final class FullscreenHelper {
|
|||
}
|
||||
|
||||
public static void configureBottomBarLayout(@NonNull Activity activity, @NonNull View spacer, @NonNull View bottomBar) {
|
||||
if (Build.VERSION.SDK_INT == 19) {
|
||||
setSpacerHeight(spacer, ViewUtil.getNavigationBarHeight(spacer));
|
||||
int[] padding = makePaddingValuesForAPI19(activity);
|
||||
bottomBar.setPadding(padding[0], 0, padding[1], 0);
|
||||
return;
|
||||
}
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(spacer, (view, insets) -> {
|
||||
setSpacerHeight(view, insets.getSystemWindowInsetBottom());
|
||||
return insets;
|
||||
|
|
|
@ -86,11 +86,7 @@ public final class Projection {
|
|||
if (corners == null) {
|
||||
path.addRect(rect, Path.Direction.CW);
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
path.addRoundRect(rect, corners.toRadii(), Path.Direction.CW);
|
||||
} else {
|
||||
path.op(path, Path.Op.UNION);
|
||||
}
|
||||
path.addRoundRect(rect, corners.toRadii(), Path.Direction.CW);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,27 +122,15 @@ public class StorageUtil {
|
|||
}
|
||||
|
||||
public static @NonNull Uri getVideoUri() {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
return getLegacyUri(Environment.DIRECTORY_MOVIES);
|
||||
} else {
|
||||
return MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
|
||||
}
|
||||
return MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
|
||||
}
|
||||
|
||||
public static @NonNull Uri getAudioUri() {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
return getLegacyUri(Environment.DIRECTORY_MUSIC);
|
||||
} else {
|
||||
return MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
|
||||
}
|
||||
return MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
|
||||
}
|
||||
|
||||
public static @NonNull Uri getImageUri() {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
return getLegacyUri(Environment.DIRECTORY_PICTURES);
|
||||
} else {
|
||||
return MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||
}
|
||||
return MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||
}
|
||||
|
||||
public static @NonNull Uri getDownloadUri() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.thoughtcrime.securesms.util
|
||||
|
||||
import android.os.Build
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -24,9 +23,7 @@ class TopToastPopup private constructor(parent: ViewGroup, iconResource: Int, de
|
|||
private val description: TextView = contentView.findViewById(R.id.top_toast_popup_description)
|
||||
|
||||
init {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
elevation = ViewUtil.dpToPx(8).toFloat()
|
||||
}
|
||||
elevation = ViewUtil.dpToPx(8).toFloat()
|
||||
animationStyle = R.style.PopupAnimation
|
||||
icon.setImageResource(iconResource)
|
||||
description.text = descriptionText
|
||||
|
|
|
@ -41,9 +41,7 @@ public final class WindowUtil {
|
|||
}
|
||||
|
||||
public static void setNavigationBarColor(@NonNull Context context, @NonNull Window window, @ColorInt int color) {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
return;
|
||||
} else if (Build.VERSION.SDK_INT < 27) {
|
||||
if (Build.VERSION.SDK_INT < 27) {
|
||||
window.setNavigationBarColor(ThemeUtil.getThemedColor(context, android.R.attr.navigationBarColor));
|
||||
} else {
|
||||
window.setNavigationBarColor(color);
|
||||
|
@ -72,8 +70,6 @@ public final class WindowUtil {
|
|||
}
|
||||
|
||||
public static void setStatusBarColor(@NonNull Window window, @ColorInt int color) {
|
||||
if (Build.VERSION.SDK_INT < 21) return;
|
||||
|
||||
window.setStatusBarColor(color);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.thoughtcrime.securesms.util.views
|
|||
|
||||
import android.animation.Animator
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.util.AttributeSet
|
||||
|
@ -116,7 +115,7 @@ class CircularProgressMaterialButton @JvmOverloads constructor(
|
|||
return
|
||||
}
|
||||
|
||||
if (!animate || Build.VERSION.SDK_INT < 21) {
|
||||
if (!animate) {
|
||||
materialButton.visibility = state.materialButtonVisibility
|
||||
currentState = state
|
||||
return
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.util.DisplayMetrics;
|
|||
import android.util.Size;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import org.thoughtcrime.securesms.mms.MediaConstraints;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
|
@ -28,7 +27,6 @@ public final class VideoUtil {
|
|||
|
||||
private static final int TOTAL_BYTES_PER_SECOND = (VIDEO_BIT_RATE / 8) + (AUDIO_BIT_RATE / 8);
|
||||
|
||||
@RequiresApi(21)
|
||||
public static final String VIDEO_MIME_TYPE = MediaFormat.MIMETYPE_VIDEO_AVC;
|
||||
public static final String AUDIO_MIME_TYPE = "audio/mp4a-latm";
|
||||
|
||||
|
@ -36,7 +34,6 @@ public final class VideoUtil {
|
|||
|
||||
private VideoUtil() { }
|
||||
|
||||
@RequiresApi(21)
|
||||
public static Size getVideoRecordingSize() {
|
||||
return isPortrait(screenSize())
|
||||
? new Size(VIDEO_SHORT_WIDTH, VIDEO_LONG_WIDTH)
|
||||
|
@ -54,13 +51,11 @@ public final class VideoUtil {
|
|||
return VIDEO_MAX_UPLOAD_LENGTH_S;
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
private static Size screenSize() {
|
||||
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
|
||||
return new Size(metrics.widthPixels, metrics.heightPixels);
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
private static boolean isPortrait(Size size) {
|
||||
return size.getWidth() < size.getHeight();
|
||||
}
|
||||
|
|
|
@ -169,10 +169,8 @@ public abstract class AudioManagerCompat {
|
|||
public static AudioManagerCompat create(@NonNull Context context) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
return new Api26AudioManagerCompat(context);
|
||||
} else if (Build.VERSION.SDK_INT >= 21) {
|
||||
return new Api21AudioManagerCompat(context);
|
||||
} else {
|
||||
return new Api19AudioManagerCompat(context);
|
||||
return new Api21AudioManagerCompat(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,7 +240,6 @@ public abstract class AudioManagerCompat {
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
private static class Api21AudioManagerCompat extends Api19AudioManagerCompat {
|
||||
|
||||
private static AudioAttributes AUDIO_ATTRIBUTES = new AudioAttributes.Builder()
|
||||
|
|
|
@ -158,7 +158,7 @@ class FullSignalAudioManager(context: Context, eventListener: EventListener?) :
|
|||
updateAudioDeviceState()
|
||||
|
||||
wiredHeadsetReceiver = WiredHeadsetReceiver()
|
||||
context.registerReceiver(wiredHeadsetReceiver, IntentFilter(if (Build.VERSION.SDK_INT >= 21) AudioManager.ACTION_HEADSET_PLUG else Intent.ACTION_HEADSET_PLUG))
|
||||
context.registerReceiver(wiredHeadsetReceiver, IntentFilter(AudioManager.ACTION_HEADSET_PLUG))
|
||||
|
||||
state = State.PREINITIALIZED
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
<item name="reminder_action_cds_temporary_error_learn_more" type="id" />
|
||||
<item name="reminder_action_cds_permanent_error_learn_more" type="id" />
|
||||
|
||||
<item name="reminder_action_api_19_learn_more" type="id" />
|
||||
|
||||
<item name="status_bar_guideline" type="id" />
|
||||
<item name="navigation_bar_guideline" type="id" />
|
||||
|
||||
|
|
|
@ -653,9 +653,6 @@
|
|||
<string name="ExpiredBuildReminder_this_version_of_signal_has_expired">This version of Signal has expired. Update now to send and receive messages.</string>
|
||||
<string name="ExpiredBuildReminder_update_now">Update now</string>
|
||||
|
||||
<!-- A message in a banner shown at the top of the screen indicating that the user must upgrade their device to use signal. -->
|
||||
<string name="ExpiredBuildReminder_api_19_message">Signal no longer works on this device. To use Signal again, update your device to a newer version of Android or switch to a newer device.</string>
|
||||
|
||||
<!-- PendingGroupJoinRequestsReminder -->
|
||||
<plurals name="PendingGroupJoinRequestsReminder_d_pending_member_requests">
|
||||
<item quantity="one">%d pending member request.</item>
|
||||
|
@ -5485,10 +5482,4 @@
|
|||
<!-- Displayed in the "clear filter" item in the chat feed if the user opened the filter from the overflow menu -->
|
||||
<string name="ChatFilter__tip_pull_down">Tip: Pull down on the chat list to filter</string>
|
||||
|
||||
<!-- Text for a banner that is shown at the top of the screen letting users know that they\'re version of signal will soon expire. The placeholder is a date. -->
|
||||
<string name="API19Reminder_banner_message">Signal will no longer support your device\'s version of Android soon. To keep using Signal, update your device, or switch to a newer device by %1$s.</string>
|
||||
|
||||
<!-- Text for a button in a banner shown at the top of the screen that users can click on to get more information. -->
|
||||
<string name="API19Reminder_learn_more">Learn more</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.signal.qr
|
||||
|
||||
import android.graphics.ImageFormat
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.camera.core.ImageProxy
|
||||
import com.google.zxing.LuminanceSource
|
||||
import java.nio.ByteBuffer
|
||||
|
@ -14,7 +13,6 @@ import java.nio.ByteBuffer
|
|||
* An image width can be reported as 1080 but the row stride may be 1088. Thus when representing a row-major
|
||||
* 2D array as a 1D array, the math can go sideways if width is used instead of row stride.
|
||||
*/
|
||||
@RequiresApi(21)
|
||||
class ImageProxyLuminanceSource(image: ImageProxy) : LuminanceSource(image.width, image.height) {
|
||||
|
||||
val yData: ByteArray
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.signal.qr
|
||||
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.camera.core.ImageProxy
|
||||
import com.google.zxing.BinaryBitmap
|
||||
import com.google.zxing.ChecksumException
|
||||
|
@ -24,7 +23,6 @@ class QrProcessor {
|
|||
private var previousHeight = 0
|
||||
private var previousWidth = 0
|
||||
|
||||
@RequiresApi(21)
|
||||
fun getScannedData(proxy: ImageProxy): String? {
|
||||
return getScannedData(ImageProxyLuminanceSource(proxy))
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.signal.qr
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.widget.FrameLayout
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
|
@ -28,7 +27,7 @@ class QrScannerView @JvmOverloads constructor(
|
|||
val qrData: Observable<String> = qrDataPublish
|
||||
|
||||
private fun initScannerView(forceLegacy: Boolean) {
|
||||
val scannerView: FrameLayout = if (Build.VERSION.SDK_INT >= 21 && !forceLegacy) {
|
||||
val scannerView: FrameLayout = if (!forceLegacy) {
|
||||
ScannerView21(context) { qrDataPublish.onNext(it) }
|
||||
} else {
|
||||
ScannerView19(context) { qrDataPublish.onNext(it) }
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.annotation.SuppressLint
|
|||
import android.content.Context
|
||||
import android.util.Size
|
||||
import android.widget.FrameLayout
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.camera.core.Camera
|
||||
import androidx.camera.core.CameraSelector
|
||||
import androidx.camera.core.ImageAnalysis
|
||||
|
@ -22,7 +21,6 @@ import java.util.concurrent.Executors
|
|||
* API21+ version of QR scanning view. Uses camerax APIs.
|
||||
*/
|
||||
@SuppressLint("ViewConstructor")
|
||||
@RequiresApi(21)
|
||||
internal class ScannerView21 constructor(
|
||||
context: Context,
|
||||
private val listener: ScanListener
|
||||
|
|
Loading…
Add table
Reference in a new issue