Messaging: Remove compatibility for old android versions
Change-Id: Id9065d60525a509271a0e64c0e349e857cb998e2
This commit is contained in:
@@ -41,7 +41,6 @@ import com.android.messaging.ui.mediapicker.PausableChronometer;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.MediaUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
/**
|
||||
@@ -79,9 +78,6 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
private int mThemeColor;
|
||||
|
||||
private boolean mStartPlayAfterPrepare;
|
||||
// should the MediaPlayer be prepared lazily when the user chooses to play the audio (as
|
||||
// opposed to preparing it early, on bind)
|
||||
private boolean mPrepareOnPlayback;
|
||||
private boolean mPrepared;
|
||||
private boolean mPlaybackFinished; // Was the audio played all the way to the end
|
||||
private final int mMode;
|
||||
@@ -148,12 +144,7 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPrepareOnPlayback) {
|
||||
// For lazy preparation, the chronometer will only be shown during playback
|
||||
mChronometer.setVisibility(playing ? View.VISIBLE : View.INVISIBLE);
|
||||
} else {
|
||||
mChronometer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mChronometer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,7 +171,6 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
|
||||
mUseIncomingStyle = useIncomingStyle;
|
||||
mThemeColor = themeColor;
|
||||
mPrepareOnPlayback = incoming && !MediaUtil.canAutoAccessIncomingMedia();
|
||||
|
||||
if (!TextUtils.equals(currentUriString, newUriString)) {
|
||||
mDataSourceUri = dataSourceUri;
|
||||
@@ -216,7 +206,7 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the MediaPlayer, and if mPrepareOnPlayback, start playing the audio
|
||||
* Prepare the MediaPlayer and start playing the audio
|
||||
*/
|
||||
private void setupMediaPlayer() {
|
||||
Assert.notNull(mDataSourceUri);
|
||||
@@ -332,7 +322,7 @@ public class AudioAttachmentView extends LinearLayout {
|
||||
updateVisualStyle();
|
||||
updateChronometerVisibility(false /* playing */);
|
||||
|
||||
if (mDataSourceUri != null && !mPrepareOnPlayback) {
|
||||
if (mDataSourceUri != null) {
|
||||
// Prepare the media player, so we can read the duration of the audio.
|
||||
setupMediaPlayer();
|
||||
}
|
||||
|
||||
@@ -22,9 +22,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -43,8 +40,8 @@ public class LineWrapLayout extends ViewGroup {
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
final int startPadding = UiUtils.getPaddingStart(this);
|
||||
final int endPadding = UiUtils.getPaddingEnd(this);
|
||||
final int startPadding = getPaddingStart();
|
||||
final int endPadding = getPaddingEnd();
|
||||
final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
final int widthSize = MeasureSpec.getSize(widthMeasureSpec) - startPadding - endPadding;
|
||||
final boolean isFixedSize = (widthMode == MeasureSpec.EXACTLY);
|
||||
@@ -96,8 +93,8 @@ public class LineWrapLayout extends ViewGroup {
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
final int startPadding = UiUtils.getPaddingStart(this);
|
||||
final int endPadding = UiUtils.getPaddingEnd(this);
|
||||
final int startPadding = getPaddingStart();
|
||||
final int endPadding = getPaddingEnd();
|
||||
int width = getWidth() - startPadding - endPadding;
|
||||
int y = getPaddingTop();
|
||||
int x = startPadding;
|
||||
@@ -171,7 +168,7 @@ public class LineWrapLayout extends ViewGroup {
|
||||
}
|
||||
}
|
||||
|
||||
if (OsUtil.isAtLeastJB_MR2() && getResources().getConfiguration()
|
||||
if (getResources().getConfiguration()
|
||||
.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
|
||||
currChild.layout(width - startPositionX - childWidth, startPositionY,
|
||||
width - startPositionX, startPositionY + childHeight);
|
||||
@@ -214,19 +211,11 @@ public class LineWrapLayout extends ViewGroup {
|
||||
}
|
||||
|
||||
public int getStartMargin() {
|
||||
if (OsUtil.isAtLeastJB_MR2()) {
|
||||
return getMarginStart();
|
||||
} else {
|
||||
return leftMargin;
|
||||
}
|
||||
return getMarginStart();
|
||||
}
|
||||
|
||||
public int getEndMargin() {
|
||||
if (OsUtil.isAtLeastJB_MR2()) {
|
||||
return getMarginEnd();
|
||||
} else {
|
||||
return rightMargin;
|
||||
}
|
||||
return getMarginEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ import com.android.messaging.ui.SnackBar.SnackBarListener;
|
||||
import com.android.messaging.util.AccessibilityUtil;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.TextUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
import com.google.common.base.Joiner;
|
||||
@@ -354,22 +353,15 @@ public class SnackBarManager {
|
||||
private int getScreenBottomOffset(final SnackBar snackBar) {
|
||||
final WindowManager windowManager = getWindowManager(snackBar.getContext());
|
||||
final DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
windowManager.getDefaultDisplay().getRealMetrics(displayMetrics);
|
||||
} else {
|
||||
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
|
||||
}
|
||||
windowManager.getDefaultDisplay().getRealMetrics(displayMetrics);
|
||||
|
||||
final int screenHeight = displayMetrics.heightPixels;
|
||||
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
// In L, the navigation bar is included in the space for the popup window, so we have to
|
||||
// offset by the size of the navigation bar
|
||||
final Rect displayRect = new Rect();
|
||||
snackBar.getParentView().getRootView().getWindowVisibleDisplayFrame(displayRect);
|
||||
return screenHeight - displayRect.bottom;
|
||||
}
|
||||
|
||||
return 0;
|
||||
// In L, the navigation bar is included in the space for the popup window, so we have to
|
||||
// offset by the size of the navigation bar
|
||||
final Rect displayRect = new Rect();
|
||||
snackBar.getParentView().getRootView().getWindowVisibleDisplayFrame(displayRect);
|
||||
return screenHeight - displayRect.bottom;
|
||||
}
|
||||
|
||||
private int getRelativeOffset(final SnackBar snackBar) {
|
||||
|
||||
@@ -211,30 +211,19 @@ public class VideoThumbnailView extends FrameLayout {
|
||||
mVideoView.start();
|
||||
}
|
||||
|
||||
// TODO: The check could be added to MessagePartData itself so that all users of MessagePartData
|
||||
// get the right behavior, instead of requiring all the users to do similar checks.
|
||||
private static boolean shouldUseGenericVideoIcon(final boolean incomingMessage) {
|
||||
return incomingMessage && !VideoThumbnailRequest.shouldShowIncomingVideoThumbnails();
|
||||
}
|
||||
|
||||
public void setSource(final MessagePartData part, final boolean incomingMessage) {
|
||||
if (part == null) {
|
||||
clearSource();
|
||||
} else {
|
||||
mVideoSource = part.getContentUri();
|
||||
if (shouldUseGenericVideoIcon(incomingMessage)) {
|
||||
mThumbnailImage.setImageResource(R.drawable.generic_video_icon);
|
||||
mVideoWidth = ImageRequest.UNSPECIFIED_SIZE;
|
||||
mVideoHeight = ImageRequest.UNSPECIFIED_SIZE;
|
||||
} else {
|
||||
mThumbnailImage.setImageResourceId(
|
||||
new MessagePartVideoThumbnailRequestDescriptor(part));
|
||||
if (mVideoView != null) {
|
||||
mVideoView.setVideoURI(mVideoSource);
|
||||
}
|
||||
mVideoWidth = part.getWidth();
|
||||
mVideoHeight = part.getHeight();
|
||||
|
||||
mThumbnailImage.setImageResourceId(
|
||||
new MessagePartVideoThumbnailRequestDescriptor(part));
|
||||
if (mVideoView != null) {
|
||||
mVideoView.setVideoURI(mVideoSource);
|
||||
}
|
||||
mVideoWidth = part.getWidth();
|
||||
mVideoHeight = part.getHeight();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,16 +232,10 @@ public class VideoThumbnailView extends FrameLayout {
|
||||
clearSource();
|
||||
} else {
|
||||
mVideoSource = videoSource;
|
||||
if (shouldUseGenericVideoIcon(incomingMessage)) {
|
||||
mThumbnailImage.setImageResource(R.drawable.generic_video_icon);
|
||||
mVideoWidth = ImageRequest.UNSPECIFIED_SIZE;
|
||||
mVideoHeight = ImageRequest.UNSPECIFIED_SIZE;
|
||||
} else {
|
||||
mThumbnailImage.setImageResourceId(
|
||||
new MessagePartVideoThumbnailRequestDescriptor(videoSource));
|
||||
if (mVideoView != null) {
|
||||
mVideoView.setVideoURI(videoSource);
|
||||
}
|
||||
mThumbnailImage.setImageResourceId(
|
||||
new MessagePartVideoThumbnailRequestDescriptor(videoSource));
|
||||
if (mVideoView != null) {
|
||||
mVideoView.setVideoURI(videoSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
public class ViewPagerTabStrip extends LinearLayout {
|
||||
private int mSelectedUnderlineThickness;
|
||||
@@ -97,6 +96,6 @@ public class ViewPagerTabStrip extends LinearLayout {
|
||||
}
|
||||
|
||||
private boolean isRtl() {
|
||||
return OsUtil.isAtLeastJB_MR2() ? getLayoutDirection() == View.LAYOUT_DIRECTION_RTL : false;
|
||||
return getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import android.widget.Toast;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
/**
|
||||
* Lightweight implementation of ViewPager tabs. This looks similar to traditional actionBar tabs,
|
||||
@@ -130,14 +129,12 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
|
||||
a.recycle();
|
||||
|
||||
// enable shadow casting from view bounds
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRect(0, 0, view.getWidth(), view.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRect(0, 0, view.getWidth(), view.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setViewPager(ViewPager viewPager) {
|
||||
@@ -223,7 +220,7 @@ public class ViewPagerTabs extends HorizontalScrollView implements ViewPager.OnP
|
||||
}
|
||||
|
||||
private int getRtlPosition(int position) {
|
||||
if (OsUtil.isAtLeastJB_MR2() && Factory.get().getApplicationContext().getResources()
|
||||
if (Factory.get().getApplicationContext().getResources()
|
||||
.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
|
||||
return mTabStrip.getChildCount() - 1 - position;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,19 +20,12 @@ import android.animation.RectEvaluator;
|
||||
import android.animation.TypeEvaluator;
|
||||
import android.graphics.Rect;
|
||||
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
/**
|
||||
* This evaluator can be used to perform type interpolation between <code>Rect</code> values.
|
||||
* It's backward compatible to Api Level 11.
|
||||
*/
|
||||
public class RectEvaluatorCompat implements TypeEvaluator<Rect> {
|
||||
public static TypeEvaluator<Rect> create() {
|
||||
if (OsUtil.isAtLeastJB_MR2()) {
|
||||
return new RectEvaluator();
|
||||
} else {
|
||||
return new RectEvaluatorCompat();
|
||||
}
|
||||
return new RectEvaluator();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.android.messaging.ui.animation;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
@@ -34,7 +33,6 @@ import android.widget.FrameLayout;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.util.ImageUtils;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
/**
|
||||
@@ -69,20 +67,15 @@ public class ViewGroupItemVerticalExplodeAnimation {
|
||||
*/
|
||||
public static void startAnimationForView(final ViewGroup container, final View viewToAnimate,
|
||||
final View animationStagingView, final boolean snapshotView, final int duration) {
|
||||
if (OsUtil.isAtLeastJB_MR2() && (viewToAnimate.getContext() instanceof Activity)) {
|
||||
if ((viewToAnimate.getContext() instanceof Activity)) {
|
||||
new ViewExplodeAnimationJellyBeanMR2(viewToAnimate, container, snapshotView, duration)
|
||||
.startAnimation();
|
||||
} else {
|
||||
// Pre JB_MR2, this animation can cause rendering failures which causes the framework
|
||||
// to fall back to software rendering where camera preview isn't supported (b/18264647)
|
||||
// just skip the animation to avoid this case.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation class for API level >= 18.
|
||||
*/
|
||||
@TargetApi(18)
|
||||
private static class ViewExplodeAnimationJellyBeanMR2 {
|
||||
private final View mViewToAnimate;
|
||||
private final ViewGroup mContainer;
|
||||
|
||||
@@ -49,7 +49,6 @@ import com.android.messaging.sms.ApnDatabase;
|
||||
import com.android.messaging.sms.BugleApnSettingsLoader;
|
||||
import com.android.messaging.ui.BugleActionBarActivity;
|
||||
import com.android.messaging.ui.UIIntents;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
public class ApnSettingsActivity extends BugleActionBarActivity {
|
||||
@@ -150,13 +149,8 @@ public class ApnSettingsActivity extends BugleActionBarActivity {
|
||||
super.onCreate(icicle);
|
||||
|
||||
mDatabase = ApnDatabase.getApnDatabase().getWritableDatabase();
|
||||
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
mUm = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
|
||||
if (!mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
} else {
|
||||
mUm = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
|
||||
if (!mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
}
|
||||
@@ -172,8 +166,7 @@ public class ApnSettingsActivity extends BugleActionBarActivity {
|
||||
lv.setEmptyView(empty);
|
||||
}
|
||||
|
||||
if (OsUtil.isAtLeastL() &&
|
||||
mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||
if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||
mUnavailable = true;
|
||||
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getActivity()));
|
||||
return;
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.android.messaging.ui.LicenseActivity;
|
||||
import com.android.messaging.ui.UIIntents;
|
||||
import com.android.messaging.util.BuglePrefs;
|
||||
import com.android.messaging.util.DebugUtils;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
public class ApplicationSettingsActivity extends BugleActionBarActivity {
|
||||
@@ -151,35 +150,14 @@ public class ApplicationSettingsActivity extends BugleActionBarActivity {
|
||||
}
|
||||
|
||||
private void updateSmsEnabledPreferences() {
|
||||
if (!OsUtil.isAtLeastKLP()) {
|
||||
final String defaultSmsAppLabel = getString(R.string.default_sms_app,
|
||||
PhoneUtils.getDefault().getDefaultSmsAppLabel());
|
||||
if (PhoneUtils.getDefault().isDefaultSmsApp()) {
|
||||
getPreferenceScreen().removePreference(mSmsDisabledPreference);
|
||||
getPreferenceScreen().removePreference(mSmsEnabledPreference);
|
||||
mSmsEnabledPreference.setSummary(defaultSmsAppLabel);
|
||||
} else {
|
||||
final String defaultSmsAppLabel = getString(R.string.default_sms_app,
|
||||
PhoneUtils.getDefault().getDefaultSmsAppLabel());
|
||||
boolean isSmsEnabledBeforeState;
|
||||
boolean isSmsEnabledCurrentState;
|
||||
if (PhoneUtils.getDefault().isDefaultSmsApp()) {
|
||||
if (getPreferenceScreen().findPreference(mSmsEnabledPrefKey) == null) {
|
||||
getPreferenceScreen().addPreference(mSmsEnabledPreference);
|
||||
isSmsEnabledBeforeState = false;
|
||||
} else {
|
||||
isSmsEnabledBeforeState = true;
|
||||
}
|
||||
isSmsEnabledCurrentState = true;
|
||||
getPreferenceScreen().removePreference(mSmsDisabledPreference);
|
||||
mSmsEnabledPreference.setSummary(defaultSmsAppLabel);
|
||||
} else {
|
||||
if (getPreferenceScreen().findPreference(mSmsDisabledPrefKey) == null) {
|
||||
getPreferenceScreen().addPreference(mSmsDisabledPreference);
|
||||
isSmsEnabledBeforeState = true;
|
||||
} else {
|
||||
isSmsEnabledBeforeState = false;
|
||||
}
|
||||
isSmsEnabledCurrentState = false;
|
||||
getPreferenceScreen().removePreference(mSmsEnabledPreference);
|
||||
mSmsDisabledPreference.setSummary(defaultSmsAppLabel);
|
||||
}
|
||||
getPreferenceScreen().removePreference(mSmsEnabledPreference);
|
||||
mSmsDisabledPreference.setSummary(defaultSmsAppLabel);
|
||||
}
|
||||
mIsSmsPreferenceClicked = false;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ import com.android.messaging.util.Assert.RunsOnMainThread;
|
||||
import com.android.messaging.util.ContactUtil;
|
||||
import com.android.messaging.util.ImeUtil;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -503,10 +502,6 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
|
||||
* @param show whether the contact lists are to be shown or hidden.
|
||||
*/
|
||||
private void startExplodeTransitionForContactLists(final boolean show) {
|
||||
if (!OsUtil.isAtLeastL()) {
|
||||
// Explode animation is not supported pre-L.
|
||||
return;
|
||||
}
|
||||
final Explode transition = new Explode();
|
||||
final Rect epicenter = mPendingExplodeView == null ? null :
|
||||
UiUtils.getMeasuredBoundsOnScreen(mPendingExplodeView);
|
||||
@@ -533,10 +528,6 @@ public class ContactPickerFragment extends Fragment implements ContactPickerData
|
||||
* the transition manager for pending explode transition.
|
||||
*/
|
||||
private void toggleContactListItemsVisibilityForPendingTransition(final boolean show) {
|
||||
if (!OsUtil.isAtLeastL()) {
|
||||
// Explode animation is not supported pre-L.
|
||||
return;
|
||||
}
|
||||
mAllContactsListViewHolder.toggleVisibilityForPendingTransition(show, mPendingExplodeView);
|
||||
mFrequentContactsListViewHolder.toggleVisibilityForPendingTransition(show,
|
||||
mPendingExplodeView);
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.android.messaging.util.BugleGservices;
|
||||
import com.android.messaging.util.BugleGservicesKeys;
|
||||
import com.android.messaging.util.ContactRecipientEntryUtils;
|
||||
import com.android.messaging.util.ContactUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
import java.text.Collator;
|
||||
@@ -129,30 +128,26 @@ public final class ContactRecipientAdapter extends BaseRecipientAdapter {
|
||||
new Cursor[]{personalFilterEmailsCursor, personalFilterPhonesCursor});
|
||||
final CursorResult cursorResult =
|
||||
new CursorResult(personalCursor, false /* sorted */);
|
||||
if (OsUtil.isAtLeastN()) {
|
||||
// Including enterprise result starting from N.
|
||||
final Cursor enterpriseFilterPhonesCursor = ContactUtil.filterPhonesEnterprise(
|
||||
getContext(), searchText).performSynchronousQuery();
|
||||
final Cursor enterpriseFilterEmailsCursor = ContactUtil.filterEmailsEnterprise(
|
||||
getContext(), searchText).performSynchronousQuery();
|
||||
final Cursor enterpriseCursor = new MergeCursor(
|
||||
new Cursor[]{enterpriseFilterEmailsCursor,
|
||||
enterpriseFilterPhonesCursor});
|
||||
cursorResult.enterpriseCursor = enterpriseCursor;
|
||||
}
|
||||
// Including enterprise result starting from N.
|
||||
final Cursor enterpriseFilterPhonesCursor = ContactUtil.filterPhonesEnterprise(
|
||||
getContext(), searchText).performSynchronousQuery();
|
||||
final Cursor enterpriseFilterEmailsCursor = ContactUtil.filterEmailsEnterprise(
|
||||
getContext(), searchText).performSynchronousQuery();
|
||||
final Cursor enterpriseCursor = new MergeCursor(
|
||||
new Cursor[]{enterpriseFilterEmailsCursor,
|
||||
enterpriseFilterPhonesCursor});
|
||||
cursorResult.enterpriseCursor = enterpriseCursor;
|
||||
return cursorResult;
|
||||
} else {
|
||||
final Cursor personalFilterDestinationCursor = ContactUtil
|
||||
.filterDestination(getContext(), searchText).performSynchronousQuery();
|
||||
final CursorResult cursorResult = new CursorResult(personalFilterDestinationCursor,
|
||||
true);
|
||||
if (OsUtil.isAtLeastN()) {
|
||||
// Including enterprise result starting from N.
|
||||
final Cursor enterpriseFilterDestinationCursor = ContactUtil
|
||||
.filterDestinationEnterprise(getContext(), searchText)
|
||||
.performSynchronousQuery();
|
||||
cursorResult.enterpriseCursor = enterpriseFilterDestinationCursor;
|
||||
}
|
||||
// Including enterprise result starting from N.
|
||||
final Cursor enterpriseFilterDestinationCursor = ContactUtil
|
||||
.filterDestinationEnterprise(getContext(), searchText)
|
||||
.performSynchronousQuery();
|
||||
cursorResult.enterpriseCursor = enterpriseFilterDestinationCursor;
|
||||
return cursorResult;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,6 @@ import com.android.messaging.util.BuglePrefs;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.MediaUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.SafeAsyncTask;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
@@ -867,18 +866,16 @@ public class ComposeMessageView extends LinearLayout
|
||||
|
||||
// Set accessibility traversal order of the components in the send widget.
|
||||
private void setSendWidgetAccessibilityTraversalOrder(final int mode) {
|
||||
if (OsUtil.isAtLeastL_MR1()) {
|
||||
mAttachMediaButton.setAccessibilityTraversalBefore(R.id.compose_message_text);
|
||||
switch (mode) {
|
||||
case SEND_WIDGET_MODE_SIM_SELECTOR:
|
||||
mComposeEditText.setAccessibilityTraversalBefore(R.id.self_send_icon);
|
||||
break;
|
||||
case SEND_WIDGET_MODE_SEND_BUTTON:
|
||||
mComposeEditText.setAccessibilityTraversalBefore(R.id.send_message_button);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mAttachMediaButton.setAccessibilityTraversalBefore(R.id.compose_message_text);
|
||||
switch (mode) {
|
||||
case SEND_WIDGET_MODE_SIM_SELECTOR:
|
||||
mComposeEditText.setAccessibilityTraversalBefore(R.id.self_send_icon);
|
||||
break;
|
||||
case SEND_WIDGET_MODE_SEND_BUTTON:
|
||||
mComposeEditText.setAccessibilityTraversalBefore(R.id.send_message_button);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -979,8 +976,7 @@ public class ComposeMessageView extends LinearLayout
|
||||
}
|
||||
|
||||
public static boolean shouldShowSimSelector(final ConversationData convData) {
|
||||
return OsUtil.isAtLeastL_MR1() &&
|
||||
convData.getSelfParticipantsCountExcludingDefault(true /* activeOnly */) > 1;
|
||||
return convData.getSelfParticipantsCountExcludingDefault(true /* activeOnly */) > 1;
|
||||
}
|
||||
|
||||
public void sendMessageIgnoreMessageSizeLimit() {
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.android.messaging.ui.conversationlist.ConversationListActivity;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
public class ConversationActivity extends BugleActionBarActivity
|
||||
@@ -348,11 +347,7 @@ public class ConversationActivity extends BugleActionBarActivity
|
||||
public void onFinishCurrentConversation() {
|
||||
// Simply finish the current activity. The current design is to leave any empty
|
||||
// conversations as is.
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
finishAfterTransition();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
finishAfterTransition();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.ConversationMessageData;
|
||||
import com.android.messaging.ui.ConversationDrawables;
|
||||
import com.android.messaging.util.Dates;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
/**
|
||||
* Adds a "fast-scroll" bar to the conversation RecyclerView that shows the current position within
|
||||
@@ -63,10 +62,7 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
|
||||
* (the feature requires Jellybean MR2 or newer)
|
||||
*/
|
||||
public static ConversationFastScroller addTo(RecyclerView rv, int position) {
|
||||
if (OsUtil.isAtLeastJB_MR2()) {
|
||||
return new ConversationFastScroller(rv, position);
|
||||
}
|
||||
return null;
|
||||
return new ConversationFastScroller(rv, position);
|
||||
}
|
||||
|
||||
public static final int POSITION_RIGHT_SIDE = 0;
|
||||
@@ -164,20 +160,12 @@ public class ConversationFastScroller extends RecyclerView.OnScrollListener impl
|
||||
public void refreshConversationThemeColor() {
|
||||
mPreviewTextView.setBackground(
|
||||
ConversationDrawables.get().getFastScrollPreviewDrawable(mPosRight));
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
final StateListDrawable drawable = new StateListDrawable();
|
||||
drawable.addState(new int[]{ android.R.attr.state_pressed },
|
||||
ConversationDrawables.get().getFastScrollThumbDrawable(true /* pressed */));
|
||||
drawable.addState(StateSet.WILD_CARD,
|
||||
ConversationDrawables.get().getFastScrollThumbDrawable(false /* pressed */));
|
||||
mThumbImageView.setImageDrawable(drawable);
|
||||
} else {
|
||||
// Android pre-L doesn't seem to handle a StateListDrawable containing a tinted
|
||||
// drawable (it's rendered in the filter base color, which is red), so fall back to
|
||||
// just the regular (non-pressed) drawable.
|
||||
mThumbImageView.setImageDrawable(
|
||||
ConversationDrawables.get().getFastScrollThumbDrawable(false /* pressed */));
|
||||
}
|
||||
final StateListDrawable drawable = new StateListDrawable();
|
||||
drawable.addState(new int[]{ android.R.attr.state_pressed },
|
||||
ConversationDrawables.get().getFastScrollThumbDrawable(true /* pressed */));
|
||||
drawable.addState(StateSet.WILD_CARD,
|
||||
ConversationDrawables.get().getFastScrollThumbDrawable(false /* pressed */));
|
||||
mThumbImageView.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1012,7 +1012,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
||||
}
|
||||
|
||||
private FragmentManager getFragmentManagerToUse() {
|
||||
return OsUtil.isAtLeastJB_MR1() ? getChildFragmentManager() : getFragmentManager();
|
||||
return getChildFragmentManager();
|
||||
}
|
||||
|
||||
public MediaPicker getMediaPicker() {
|
||||
@@ -1158,21 +1158,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null);
|
||||
if (OsUtil.isAtLeastJB_MR1()) {
|
||||
builder.setOnDismissListener(new OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(final DialogInterface dialog) {
|
||||
mHost.dismissActionMode();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
builder.setOnCancelListener(new OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(final DialogInterface dialog) {
|
||||
mHost.dismissActionMode();
|
||||
}
|
||||
});
|
||||
}
|
||||
builder.setOnDismissListener(dialog -> mHost.dismissActionMode());
|
||||
builder.create().show();
|
||||
} else {
|
||||
warnOfMissingActionConditions(false /*sending*/,
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.android.messaging.datamodel.data.SubscriptionListData.SubscriptionLis
|
||||
import com.android.messaging.ui.conversation.SimSelectorView.SimSelectorViewListener;
|
||||
import com.android.messaging.util.AccessibilityUtil;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.ThreadUtil;
|
||||
|
||||
/**
|
||||
@@ -47,7 +46,6 @@ abstract class ConversationSimSelector extends ConversationInput {
|
||||
mSimSelectorView.bind(subscriptionListData);
|
||||
mDataReady = subscriptionListData != null && subscriptionListData.hasData();
|
||||
if (mPendingShow != null && mDataReady) {
|
||||
Assert.isTrue(OsUtil.isAtLeastL_MR1());
|
||||
final boolean show = mPendingShow.first;
|
||||
final boolean animate = mPendingShow.second;
|
||||
ThreadUtil.getMainThreadHandler().post(new Runnable() {
|
||||
@@ -88,10 +86,6 @@ abstract class ConversationSimSelector extends ConversationInput {
|
||||
}
|
||||
|
||||
private boolean showHide(final boolean show, final boolean animate) {
|
||||
if (!OsUtil.isAtLeastL_MR1()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mDataReady) {
|
||||
mSimSelectorView.showOrHide(show, animate);
|
||||
return mSimSelectorView.isOpen() == show;
|
||||
|
||||
@@ -37,7 +37,6 @@ import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.Assert.DoesNotRunOnMainThread;
|
||||
import com.android.messaging.util.Dates;
|
||||
import com.android.messaging.util.DebugUtils;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.SafeAsyncTask;
|
||||
|
||||
@@ -356,9 +355,7 @@ public class MessageDetailsDialog {
|
||||
|
||||
private static void appendSimInfo(final Resources res,
|
||||
final ParticipantData self, final StringBuilder outString) {
|
||||
if (!OsUtil.isAtLeastL_MR1()
|
||||
|| self == null
|
||||
|| PhoneUtils.getDefault().getActiveSubscriptionCount() < 2) {
|
||||
if (self == null || PhoneUtils.getDefault().getActiveSubscriptionCount() < 2) {
|
||||
return;
|
||||
}
|
||||
// The appended SIM info would look like:
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.view.ViewOutlineProvider;
|
||||
import com.android.messaging.ui.ContactIconView;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.AvatarUriUtil;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
/**
|
||||
* Shows SIM avatar icon in the SIM switcher / Self-send button.
|
||||
@@ -34,14 +33,12 @@ import com.android.messaging.util.OsUtil;
|
||||
public class SimIconView extends ContactIconView {
|
||||
public SimIconView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View v, Outline outline) {
|
||||
outline.setOval(0, 0, v.getWidth(), v.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View v, Outline outline) {
|
||||
outline.setOval(0, 0, v.getWidth(), v.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,6 @@ import com.android.messaging.ui.SnackBarInteraction;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.ContentType;
|
||||
import com.android.messaging.util.ImageUtils;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.android.messaging.util.Typefaces;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
@@ -168,9 +167,7 @@ public class ConversationListItemView extends FrameLayout implements OnClickList
|
||||
mListItemReadTypeface = Typefaces.getRobotoNormal();
|
||||
mListItemUnreadTypeface = Typefaces.getRobotoBold();
|
||||
|
||||
if (OsUtil.isAtLeastL()) {
|
||||
setTransitionGroup(true);
|
||||
}
|
||||
setTransitionGroup(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,10 +31,8 @@ import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.sms.MmsConfig;
|
||||
import com.android.messaging.ui.debug.DebugMmsConfigItemView.MmsConfigItemListener;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -79,11 +77,8 @@ public class DebugMmsConfigFragment extends Fragment {
|
||||
}
|
||||
|
||||
public static Integer[] getActiveSubIds() {
|
||||
if (!OsUtil.isAtLeastL_MR1()) {
|
||||
return new Integer[] { ParticipantData.DEFAULT_SELF_SUB_ID };
|
||||
}
|
||||
final List<SubscriptionInfo> subRecords =
|
||||
PhoneUtils.getDefault().toLMr1().getActiveSubscriptionInfoList();
|
||||
PhoneUtils.getDefault().getActiveSubscriptionInfoList();
|
||||
if (subRecords == null) {
|
||||
return new Integer[0];
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.android.messaging.datamodel.data.MediaPickerData;
|
||||
import com.android.messaging.datamodel.data.DraftMessageData.DraftMessageSubscriptionDataProvider;
|
||||
import com.android.messaging.ui.BasePagerViewHolder;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
|
||||
abstract class MediaChooser extends BasePagerViewHolder
|
||||
implements DraftMessageSubscriptionDataProvider {
|
||||
@@ -107,8 +106,7 @@ abstract class MediaChooser extends BasePagerViewHolder
|
||||
}
|
||||
|
||||
protected FragmentManager getFragmentManager() {
|
||||
return OsUtil.isAtLeastJB_MR1() ? mMediaPicker.getChildFragmentManager() :
|
||||
mMediaPicker.getFragmentManager();
|
||||
return mMediaPicker.getChildFragmentManager();
|
||||
}
|
||||
protected LayoutInflater getLayoutInflater() {
|
||||
return LayoutInflater.from(getContext());
|
||||
|
||||
@@ -31,7 +31,6 @@ import android.widget.LinearLayout;
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.ui.PagingAwareViewPager;
|
||||
import com.android.messaging.util.Assert;
|
||||
import com.android.messaging.util.OsUtil;
|
||||
import com.android.messaging.util.UiUtils;
|
||||
|
||||
/**
|
||||
@@ -202,7 +201,7 @@ public class MediaPickerPanel extends ViewGroup {
|
||||
private int getDesiredHeight() {
|
||||
if (mFullScreen) {
|
||||
int fullHeight = getContext().getResources().getDisplayMetrics().heightPixels;
|
||||
if (OsUtil.isAtLeastKLP() && isAttachedToWindow()) {
|
||||
if (isAttachedToWindow()) {
|
||||
// When we're attached to the window, we can get an accurate height, not necessary
|
||||
// on older API level devices because they don't include the action bar height
|
||||
View composeContainer =
|
||||
|
||||
Reference in New Issue
Block a user