mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Remove unnecessary code now that minSdk is 21.
This commit is contained in:
committed by
Cody Henthorne
parent
8cfd02aff2
commit
3e7dc79fe8
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user