Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -99,11 +98,7 @@ protected void onCreate(Bundle savedInstanceState) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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;
Expand All @@ -33,7 +32,6 @@
import com.owncloud.android.R;
import com.owncloud.android.utils.ThemeUtils;

import androidx.annotation.RequiresApi;
import androidx.core.graphics.drawable.DrawableCompat;


Expand All @@ -58,12 +56,11 @@ public ThemeableSwitchPreference(Context context, AttributeSet attrs) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
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;
Expand All @@ -42,7 +41,6 @@
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;
Expand Down Expand Up @@ -939,7 +937,6 @@ private void startSynchronization() {
/**
* Called, when the user selected something for uploading
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

Expand Down Expand Up @@ -1077,10 +1074,7 @@ private void requestUploadOfContentFromApps(Intent contentIntent, int resultCode

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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
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;
Expand Down Expand Up @@ -717,33 +716,27 @@ public void onLoadFailed(Exception e, Drawable errorDrawable) {
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();
}
}

private void toggleVCard(ContactListFragment.ContactItemViewHolder holder, int verifiedPosition) {
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,7 @@ public void run() {
}

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);
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/com/owncloud/android/utils/ThemeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,9 @@ public static void colorProgressBar(ProgressBar progressBar, @ColorInt int color
*/
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);
}

/**
Expand Down Expand Up @@ -508,7 +506,7 @@ public static void themeEditText(Context context, EditText editText, boolean the
color = ContextCompat.getColor(context, R.color.themed_fg_inverse);
}
}

editText.setTextColor(color);
editText.setHighlightColor(context.getResources().getColor(R.color.fg_contrast));
setEditTextCursorColor(editText, color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ class TestPowerManagementService {
}

@Test
fun `battery charging status on API 14-16`() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are targeting >= 16 so the tests are still valid, since we still support 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(
Expand All @@ -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)

Expand Down