diff --git a/app/src/main/java/com/keylesspalace/tusky/db/TootDao.java b/app/src/main/java/com/keylesspalace/tusky/db/TootDao.java index dc1b8f7d..bec94622 100644 --- a/app/src/main/java/com/keylesspalace/tusky/db/TootDao.java +++ b/app/src/main/java/com/keylesspalace/tusky/db/TootDao.java @@ -19,8 +19,6 @@ import android.arch.persistence.room.Dao; import android.arch.persistence.room.Insert; import android.arch.persistence.room.OnConflictStrategy; import android.arch.persistence.room.Query; -import android.arch.persistence.room.Transaction; -import android.arch.persistence.room.Update; import java.util.List; diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java index 7bf0126d..9eedf178 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java @@ -16,7 +16,6 @@ package com.keylesspalace.tusky.fragment; import android.app.Activity; -import android.app.NotificationManager; import android.arch.core.util.Function; import android.content.Context; import android.content.SharedPreferences; @@ -38,7 +37,6 @@ import android.view.View; import android.view.ViewGroup; import com.keylesspalace.tusky.MainActivity; -import com.keylesspalace.tusky.NotificationPullJobCreator; import com.keylesspalace.tusky.adapter.FooterViewHolder; import com.keylesspalace.tusky.adapter.NotificationsAdapter; import com.keylesspalace.tusky.R; @@ -493,12 +491,7 @@ public class NotificationsFragment extends SFragment implements /* When this is called by the EndlessScrollListener it cannot refresh the footer state * using adapter.notifyItemChanged. So its necessary to postpone doing so until a * convenient time for the UI thread using a Runnable. */ - recyclerView.post(new Runnable() { - @Override - public void run() { - adapter.setFooterState(FooterViewHolder.State.LOADING); - } - }); + recyclerView.post(() -> adapter.setFooterState(FooterViewHolder.State.LOADING)); } Call> call = mastodonApi.notifications(fromId, uptoId, LOAD_AT_ONCE); @@ -613,7 +606,7 @@ public class NotificationsFragment extends SFragment implements int newIndex = liftedNew.indexOf(notifications.get(0)); if (newIndex == -1) { if (index == -1 && liftedNew.size() >= LOAD_AT_ONCE) { - liftedNew.add(Either.left(Placeholder.getInstance())); + liftedNew.add(Either.left(Placeholder.getInstance())); } notifications.addAll(0, liftedNew); } else { @@ -678,7 +671,7 @@ public class NotificationsFragment extends SFragment implements // If we fetched at least as much it means that there are more posts to load and we should // insert new placeholder if (newNotifications.size() >= LOAD_AT_ONCE) { - liftedNew.add(Either.left(Placeholder.getInstance())); + liftedNew.add(Either.left(Placeholder.getInstance())); } notifications.addAll(pos, liftedNew); @@ -686,12 +679,7 @@ public class NotificationsFragment extends SFragment implements } private final Function> notificationLifter = - new Function>() { - @Override - public Either apply(Notification input) { - return Either.right(input); - } - }; + Either::right; private List> liftNotificationList(List list) { return CollectionUtil.map(list, notificationLifter); diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java index c5ddfafa..452120a9 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java @@ -552,12 +552,7 @@ public class TimelineFragment extends SFragment implements /* When this is called by the EndlessScrollListener it cannot refresh the footer state * using adapter.notifyItemChanged. So its necessary to postpone doing so until a * convenient time for the UI thread using a Runnable. */ - recyclerView.post(new Runnable() { - @Override - public void run() { - adapter.setFooterState(FooterViewHolder.State.LOADING); - } - }); + recyclerView.post(() -> adapter.setFooterState(FooterViewHolder.State.LOADING)); } Callback> callback = new Callback>() { @@ -705,7 +700,7 @@ public class TimelineFragment extends SFragment implements int newIndex = liftedNew.indexOf(statuses.get(0)); if (newIndex == -1) { if (index == -1 && fullFetch) { - liftedNew.add(Either.left(Placeholder.getInstance())); + liftedNew.add(Either.left(Placeholder.getInstance())); } statuses.addAll(0, liftedNew); } else { @@ -755,7 +750,7 @@ public class TimelineFragment extends SFragment implements List> liftedNew = listStatusList(newStatuses); if (fullFetch) { - liftedNew.add(Either.left(Placeholder.getInstance())); + liftedNew.add(Either.left(Placeholder.getInstance())); } statuses.addAll(pos, liftedNew); @@ -773,12 +768,7 @@ public class TimelineFragment extends SFragment implements } private final Function> statusLifter = - new Function>() { - @Override - public Either apply(Status input) { - return Either.right(input); - } - }; + Either::right; private @Nullable Pair diff --git a/app/src/main/java/com/keylesspalace/tusky/util/MediaUtils.java b/app/src/main/java/com/keylesspalace/tusky/util/MediaUtils.java index 5166dca3..424cbdc5 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/MediaUtils.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/MediaUtils.java @@ -20,23 +20,15 @@ import android.content.Context; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.graphics.drawable.Drawable; import android.media.MediaMetadataRetriever; import android.media.ThumbnailUtils; import android.net.Uri; -import android.os.Environment; import android.provider.OpenableColumns; import android.support.annotation.Nullable; import android.support.annotation.Px; -import android.support.v4.content.FileProvider; - -import com.squareup.picasso.Picasso; -import com.squareup.picasso.Target; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream;