remove all checks for <= JELLY_BEAN as we have this as our new minimum.

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2019-12-03 15:40:09 +01:00
parent 2dbf724b33
commit fb69c1bd51
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
7 changed files with 19 additions and 43 deletions

View file

@ -23,7 +23,6 @@
*/
package com.nextcloud.client.onboarding;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
@ -99,11 +98,7 @@ public class WhatsNewActivity extends FragmentActivity implements ViewPager.OnPa
updateNextButtonIfNeeded();
});
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mForwardFinishButton.setBackground(null);
} else {
mForwardFinishButton.setBackgroundDrawable(null);
}
mForwardFinishButton.setBackground(null);
mSkipButton = findViewById(R.id.skip);
mSkipButton.setTextColor(fontColor);

View file

@ -23,7 +23,6 @@ package com.owncloud.android.ui;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Build;
import android.preference.SwitchPreference;
import android.util.AttributeSet;
import android.view.View;
@ -33,7 +32,6 @@ import android.widget.Switch;
import com.owncloud.android.R;
import com.owncloud.android.utils.ThemeUtils;
import androidx.annotation.RequiresApi;
import androidx.core.graphics.drawable.DrawableCompat;
@ -58,12 +56,11 @@ public class ThemeableSwitchPreference extends SwitchPreference {
protected void onBindView(View view) {
super.onBindView(view);
if (view instanceof ViewGroup && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (view instanceof ViewGroup) {
findSwitch((ViewGroup) view);
}
}
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN)
private void findSwitch(ViewGroup viewGroup) {
ColorStateList thumbColorStateList = null;
ColorStateList trackColorStateList = null;

View file

@ -28,7 +28,6 @@ package com.owncloud.android.ui.activity;
import android.Manifest;
import android.accounts.Account;
import android.accounts.AuthenticatorException;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@ -42,7 +41,6 @@ import android.content.SyncRequest;
import android.content.pm.PackageManager;
import android.content.res.Resources.NotFoundException;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
@ -939,7 +937,6 @@ public class FileDisplayActivity extends FileActivity
/**
* Called, when the user selected something for uploading
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
@ -1077,10 +1074,7 @@ public class FileDisplayActivity extends FileActivity
ArrayList<Parcelable> streamsToUpload = new ArrayList<>();
//getClipData is only supported on api level 16+, Jelly Bean
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN &&
contentIntent.getClipData() != null &&
contentIntent.getClipData().getItemCount() > 0) {
if (contentIntent.getClipData() != null && contentIntent.getClipData().getItemCount() > 0) {
for (int i = 0; i < contentIntent.getClipData().getItemCount(); i++) {
streamsToUpload.add(contentIntent.getClipData().getItemAt(i).getUri());

View file

@ -34,7 +34,6 @@ import android.graphics.BitmapFactory;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.provider.ContactsContract;
@ -717,13 +716,11 @@ class ContactListAdapter extends RecyclerView.Adapter<ContactListFragment.Contac
private void setChecked(boolean checked, CheckedTextView checkedTextView) {
checkedTextView.setChecked(checked);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (checked) {
checkedTextView.getCheckMarkDrawable()
.setColorFilter(ThemeUtils.primaryColor(context), PorterDuff.Mode.SRC_ATOP);
} else {
checkedTextView.getCheckMarkDrawable().clearColorFilter();
}
if (checked) {
checkedTextView.getCheckMarkDrawable()
.setColorFilter(ThemeUtils.primaryColor(context), PorterDuff.Mode.SRC_ATOP);
} else {
checkedTextView.getCheckMarkDrawable().clearColorFilter();
}
}
@ -731,19 +728,15 @@ class ContactListAdapter extends RecyclerView.Adapter<ContactListFragment.Contac
holder.getName().setChecked(!holder.getName().isChecked());
if (holder.getName().isChecked()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.getName().getCheckMarkDrawable()
.setColorFilter(ThemeUtils.primaryColor(context), PorterDuff.Mode.SRC_ATOP);
}
holder.getName().getCheckMarkDrawable().setColorFilter(ThemeUtils.primaryColor(context),
PorterDuff.Mode.SRC_ATOP);
checkedVCards.add(verifiedPosition);
if (checkedVCards.size() == SINGLE_SELECTION) {
EventBus.getDefault().post(new VCardToggleEvent(true));
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.getName().getCheckMarkDrawable().clearColorFilter();
}
holder.getName().getCheckMarkDrawable().clearColorFilter();
checkedVCards.remove(verifiedPosition);

View file

@ -557,8 +557,7 @@ public class PreviewTextFragment extends FileFragment implements SearchView.OnQu
}
private void setText(TextView textView, String text, OCFile file) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN
&& MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN.equals(file.getMimeType())) {
if (MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN.equals(file.getMimeType())) {
textView.setText(getRenderedMarkdownText(getContext(), text));
} else {
textView.setText(text);

View file

@ -404,11 +404,9 @@ public final class ThemeUtils {
*/
public static void colorHorizontalSeekBar(SeekBar seekBar, Context context) {
int color = ThemeUtils.primaryAccentColor(context);
colorHorizontalProgressBar(seekBar, color);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
colorHorizontalProgressBar(seekBar, color);
seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
/**
@ -508,7 +506,7 @@ public final class ThemeUtils {
color = ContextCompat.getColor(context, R.color.themed_fg_inverse);
}
}
editText.setTextColor(color);
editText.setHighlightColor(context.getResources().getColor(R.color.fg_contrast));
setEditTextCursorColor(editText, color);

View file

@ -176,9 +176,9 @@ class TestPowerManagementService {
}
@Test
fun `battery charging status on API 14-16`() {
fun `battery charging status on API 16`() {
// GIVEN
// device has API level 16 or below
// device has API level 16
// battery status sticky intent is available
whenever(deviceInfo.apiLevel).thenReturn(Build.VERSION_CODES.JELLY_BEAN)
val powerSources = setOf(
@ -199,9 +199,9 @@ class TestPowerManagementService {
}
@Test
fun `wireless charging is not supported in API 14-16`() {
fun `wireless charging is not supported in API 16`() {
// GIVEN
// device has API level 16 or below
// device has API level 16
// battery status sticky intent is available
whenever(deviceInfo.apiLevel).thenReturn(Build.VERSION_CODES.JELLY_BEAN)