summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorTacoTheDank <SkytkRSfan3895@gmail.com>2021-12-12 14:56:31 -0500
committerTacoTheDank <SkytkRSfan3895@gmail.com>2021-12-12 14:56:31 -0500
commitca7f2d2d3d61ebc43a1f9d190f0aa720c5bd51d7 (patch)
treedc67a66136c47286fdd2e05b0cd95896b9b23cac /app
parentd4769620b74458ba355b2ae72717dca7caa0f132 (diff)
downloadAntennaPod-ca7f2d2d3d61ebc43a1f9d190f0aa720c5bd51d7.zip
Remove no longer needed compat methods
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java7
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/DataFolderAdapter.java3
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java3
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java6
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java6
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java10
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java10
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java3
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/preferences/DownloadStatisticsFragment.java3
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/preferences/ImportExportPreferencesFragment.java19
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackStatisticsFragment.java5
-rw-r--r--app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java3
12 files changed, 25 insertions, 53 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
index 7dc760e76..17411c7ce 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java
@@ -27,7 +27,6 @@ import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
-import androidx.core.view.ViewCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
@@ -153,14 +152,14 @@ public class MainActivity extends CastEnabledActivity {
}
/**
- * ViewCompat.generateViewId stores the current ID in a static variable.
+ * View.generateViewId stores the current ID in a static variable.
* When the process is killed, the variable gets reset.
* This makes sure that we do not get ID collisions
* and therefore errors when trying to restore state from another view.
*/
@SuppressWarnings("StatementWithEmptyBody")
private void ensureGeneratedViewIdGreaterThan(int minimum) {
- while (ViewCompat.generateViewId() <= minimum) {
+ while (View.generateViewId() <= minimum) {
// Generate new IDs
}
}
@@ -168,7 +167,7 @@ public class MainActivity extends CastEnabledActivity {
@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
- outState.putInt(KEY_GENERATED_VIEW_ID, ViewCompat.generateViewId());
+ outState.putInt(KEY_GENERATED_VIEW_ID, View.generateViewId());
}
private final BottomSheetBehavior.BottomSheetCallback bottomSheetCallback =
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DataFolderAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DataFolderAdapter.java
index bcad1b5a4..862dc2fe2 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/DataFolderAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/DataFolderAdapter.java
@@ -9,7 +9,6 @@ import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
-import androidx.core.content.ContextCompat;
import androidx.core.util.Consumer;
import androidx.recyclerview.widget.RecyclerView;
import de.danoeh.antennapod.R;
@@ -74,7 +73,7 @@ public class DataFolderAdapter extends RecyclerView.Adapter<DataFolderAdapter.Vi
}
private List<StoragePath> getStorageEntries(Context context) {
- File[] mediaDirs = ContextCompat.getExternalFilesDirs(context, null);
+ File[] mediaDirs = context.getExternalFilesDirs(null);
final List<StoragePath> entries = new ArrayList<>(mediaDirs.length);
for (File dir : mediaDirs) {
if (!isWritable(dir)) {
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java
index 383d670f1..42813c8d6 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java
@@ -7,7 +7,6 @@ import android.view.MenuInflater;
import android.view.MotionEvent;
import android.view.View;
-import androidx.core.view.ViewCompat;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.core.preferences.UserPreferences;
@@ -53,7 +52,7 @@ public class QueueRecyclerAdapter extends EpisodeItemListAdapter {
});
holder.coverHolder.setOnTouchListener((v1, event) -> {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
- boolean isLtr = ViewCompat.getLayoutDirection(holder.itemView) == ViewCompat.LAYOUT_DIRECTION_LTR;
+ boolean isLtr = holder.itemView.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;
float factor = isLtr ? 1 : -1;
if (factor * event.getX() < factor * 0.5 * v1.getWidth()) {
Log.d(TAG, "startDrag()");
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java
index 4bf787db5..eb2239177 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java
@@ -4,6 +4,7 @@ import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.text.TextUtils;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuInflater;
@@ -18,8 +19,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
-import androidx.core.text.TextUtilsCompat;
-import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
@@ -222,8 +221,7 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
feedTitle.setText(drawerItem.getTitle());
imageView.setContentDescription(drawerItem.getTitle());
feedTitle.setVisibility(View.VISIBLE);
- if (TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault())
- == ViewCompat.LAYOUT_DIRECTION_RTL) {
+ if (TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL) {
count.setCorner(TriangleLabelView.Corner.TOP_LEFT);
}
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java
index ae298cc1c..947b8aa6e 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java
@@ -24,7 +24,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.widget.AppCompatDrawableManager;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.Toolbar;
import androidx.documentfile.provider.DocumentFile;
import androidx.fragment.app.Fragment;
@@ -124,9 +124,9 @@ public class FeedInfoFragment extends Fragment implements Toolbar.OnMenuItemClic
@Override
protected void doTint(Context themedContext) {
toolbar.getMenu().findItem(R.id.visit_website_item)
- .setIcon(AppCompatDrawableManager.get().getDrawable(themedContext, R.drawable.ic_web));
+ .setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_web));
toolbar.getMenu().findItem(R.id.share_parent)
- .setIcon(AppCompatDrawableManager.get().getDrawable(themedContext, R.drawable.ic_share));
+ .setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_share));
}
};
iconTintManager.updateTint();
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java
index 148cf6582..aa50c346c 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java
@@ -22,7 +22,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.appcompat.widget.AppCompatDrawableManager;
+import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
@@ -187,13 +187,13 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
@Override
protected void doTint(Context themedContext) {
toolbar.getMenu().findItem(R.id.sort_items)
- .setIcon(AppCompatDrawableManager.get().getDrawable(themedContext, R.drawable.ic_sort));
+ .setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_sort));
toolbar.getMenu().findItem(R.id.filter_items)
- .setIcon(AppCompatDrawableManager.get().getDrawable(themedContext, R.drawable.ic_filter));
+ .setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_filter));
toolbar.getMenu().findItem(R.id.refresh_item)
- .setIcon(AppCompatDrawableManager.get().getDrawable(themedContext, R.drawable.ic_refresh));
+ .setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_refresh));
toolbar.getMenu().findItem(R.id.action_search)
- .setIcon(AppCompatDrawableManager.get().getDrawable(themedContext, R.drawable.ic_search));
+ .setIcon(AppCompatResources.getDrawable(themedContext, R.drawable.ic_search));
}
};
iconTintManager.updateTint();
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
index c261370e2..7361c8527 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
@@ -15,9 +15,6 @@ import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.Nullable;
-import androidx.core.text.TextUtilsCompat;
-import androidx.core.util.ObjectsCompat;
-import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.FitCenter;
@@ -71,6 +68,7 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
import java.util.Locale;
+import java.util.Objects;
/**
* Displays information about a FeedItem and actions.
@@ -148,7 +146,7 @@ public class ItemFragment extends Fragment {
webvDescription = layout.findViewById(R.id.webvDescription);
webvDescription.setTimecodeSelectedListener(time -> {
if (controller != null && item.getMedia() != null && controller.getMedia() != null
- && ObjectsCompat.equals(item.getMedia().getIdentifier(), controller.getMedia().getIdentifier())) {
+ && Objects.equals(item.getMedia().getIdentifier(), controller.getMedia().getIdentifier())) {
controller.seekTo(time);
} else {
((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.play_this_to_seek_position,
@@ -189,8 +187,8 @@ public class ItemFragment extends Fragment {
}
private void showOnDemandConfigBalloon(boolean offerStreaming) {
- boolean isLocaleRtl = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault())
- == ViewCompat.LAYOUT_DIRECTION_RTL;
+ boolean isLocaleRtl = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())
+ == View.LAYOUT_DIRECTION_RTL;
Balloon balloon = new Balloon.Builder(getContext())
.setArrowOrientation(ArrowOrientation.TOP)
.setArrowPosition(0.25f + ((isLocaleRtl ^ offerStreaming) ? 0f : 0.5f))
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java
index 14f6ae875..cae49c63e 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemPagerFragment.java
@@ -9,7 +9,6 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
-import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2;
@@ -78,7 +77,7 @@ public class ItemPagerFragment extends Fragment implements Toolbar.OnMenuItemCli
// > When using FragmentStatePagerAdapter the host ViewPager must have a valid ID set.
// When opening multiple ItemPagerFragments by clicking "item" -> "visit podcast" -> "item" -> etc,
// the ID is no longer unique and FragmentStatePagerAdapter does not display any pages.
- int newId = ViewCompat.generateViewId();
+ int newId = View.generateViewId();
if (savedInstanceState != null && savedInstanceState.getInt(KEY_PAGER_ID, 0) != 0) {
// Restore state by using the same ID as before. ID collisions are prevented in MainActivity.
newId = savedInstanceState.getInt(KEY_PAGER_ID, 0);
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/DownloadStatisticsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/DownloadStatisticsFragment.java
index 3059d7ad2..ff94cc20c 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/DownloadStatisticsFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/DownloadStatisticsFragment.java
@@ -17,7 +17,6 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.DownloadStatisticsListAdapter;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.StatisticsItem;
-import de.danoeh.antennapod.core.util.comparator.CompareCompat;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
@@ -75,7 +74,7 @@ public class DownloadStatisticsFragment extends Fragment {
Observable.fromCallable(() -> {
List<StatisticsItem> statisticsData = DBReader.getStatistics();
Collections.sort(statisticsData, (item1, item2) ->
- CompareCompat.compareLong(item1.totalDownloadSize, item2.totalDownloadSize));
+ Long.compare(item2.totalDownloadSize, item1.totalDownloadSize));
return statisticsData;
})
.subscribeOn(Schedulers.io())
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/ImportExportPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/ImportExportPreferencesFragment.java
index b72d1eb32..5156de432 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/ImportExportPreferencesFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/ImportExportPreferencesFragment.java
@@ -8,9 +8,7 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
-import android.os.Environment;
import android.util.Log;
import androidx.activity.result.ActivityResult;
@@ -42,7 +40,6 @@ import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import java.io.File;
-import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@@ -169,21 +166,7 @@ public class ImportExportPreferencesFragment extends PreferenceFragmentCompat {
}
private void exportDatabase() {
- if (Build.VERSION.SDK_INT >= 19) {
- backupDatabaseLauncher.launch(dateStampFilename(DATABASE_EXPORT_FILENAME));
- } else {
- File sd = Environment.getExternalStorageDirectory();
- File backupDB = new File(sd, dateStampFilename(DATABASE_EXPORT_FILENAME));
- progressDialog.show();
- disposable = Completable.fromAction(() ->
- DatabaseExporter.exportToStream(new FileOutputStream(backupDB), getContext()))
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(() -> {
- Snackbar.make(getView(), R.string.export_success_title, Snackbar.LENGTH_LONG).show();
- progressDialog.dismiss();
- }, this::showExportErrorDialog);
- }
+ backupDatabaseLauncher.launch(dateStampFilename(DATABASE_EXPORT_FILENAME));
}
private void importDatabase() {
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackStatisticsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackStatisticsFragment.java
index 04324f709..ba6164212 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackStatisticsFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/PlaybackStatisticsFragment.java
@@ -28,7 +28,6 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.core.storage.StatisticsItem;
-import de.danoeh.antennapod.core.util.comparator.CompareCompat;
import io.reactivex.Completable;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
@@ -188,10 +187,10 @@ public class PlaybackStatisticsFragment extends Fragment {
List<StatisticsItem> statisticsData = DBReader.getStatistics();
if (countAll) {
Collections.sort(statisticsData, (item1, item2) ->
- CompareCompat.compareLong(item1.timePlayedCountAll, item2.timePlayedCountAll));
+ Long.compare(item2.timePlayedCountAll, item1.timePlayedCountAll));
} else {
Collections.sort(statisticsData, (item1, item2) ->
- CompareCompat.compareLong(item1.timePlayed, item2.timePlayed));
+ Long.compare(item2.timePlayed, item1.timePlayed));
}
return statisticsData;
}
diff --git a/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java b/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java
index 37d8db03e..621b6ea95 100644
--- a/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java
+++ b/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java
@@ -6,7 +6,6 @@ import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.view.ContextThemeWrapper;
import androidx.appcompat.widget.Toolbar;
-import androidx.core.view.ViewCompat;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import de.danoeh.antennapod.R;
@@ -25,7 +24,7 @@ public abstract class ToolbarIconTintManager implements AppBarLayout.OnOffsetCha
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int offset) {
- boolean tint = (collapsingToolbar.getHeight() + offset) > (2 * ViewCompat.getMinimumHeight(collapsingToolbar));
+ boolean tint = (collapsingToolbar.getHeight() + offset) > (2 * collapsingToolbar.getMinimumHeight());
if (isTinted != tint) {
isTinted = tint;
updateTint();