remove unneeded CollectionUtil and Either.java (#1201)

main
Konrad Pozniak 6 years ago committed by GitHub
parent cf6a33e83a
commit cd24eda424
  1. 3
      app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt
  2. 6
      app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java
  3. 6
      app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java
  4. 38
      app/src/main/java/com/keylesspalace/tusky/util/CollectionUtil.java
  5. 0
      app/src/main/java/com/keylesspalace/tusky/util/Either.java

@ -47,7 +47,6 @@ import com.keylesspalace.tusky.fragment.ViewImageFragment
import com.keylesspalace.tusky.pager.AvatarImagePagerAdapter
import com.keylesspalace.tusky.pager.ImagePagerAdapter
import com.keylesspalace.tusky.util.CollectionUtil.map
import com.keylesspalace.tusky.util.getTemporaryMediaFilename
import com.keylesspalace.tusky.viewdata.AttachmentViewData
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider
@ -116,7 +115,7 @@ class ViewMediaActivity : BaseActivity(), ViewImageFragment.PhotoActionsListener
val initialPosition = intent.getIntExtra(EXTRA_ATTACHMENT_INDEX, 0)
val adapter = if (attachments != null) {
val realAttachs = map(attachments, AttachmentViewData::attachment)
val realAttachs = attachments!!.map(AttachmentViewData::attachment)
// Setup the view pager.
ImagePagerAdapter(supportFragmentManager, realAttachs, initialPosition)

@ -51,7 +51,6 @@ import com.keylesspalace.tusky.entity.Status;
import com.keylesspalace.tusky.interfaces.ActionButtonActivity;
import com.keylesspalace.tusky.interfaces.ReselectableFragment;
import com.keylesspalace.tusky.interfaces.StatusActionListener;
import com.keylesspalace.tusky.util.CollectionUtil;
import com.keylesspalace.tusky.util.Either;
import com.keylesspalace.tusky.util.HttpHeaderLink;
import com.keylesspalace.tusky.util.ListStatusAccessibilityDelegate;
@ -96,6 +95,7 @@ import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function1;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
@ -985,11 +985,11 @@ public class NotificationsFragment extends SFragment implements
updateAdapter();
}
private final Function<Notification, Either<Placeholder, Notification>> notificationLifter =
private final Function1<Notification, Either<Placeholder, Notification>> notificationLifter =
Either.Right::new;
private List<Either<Placeholder, Notification>> liftNotificationList(List<Notification> list) {
return CollectionUtil.map(list, notificationLifter);
return CollectionsKt.map(list, notificationLifter);
}
private void fullyRefreshWithProgressBar(boolean isShow) {

@ -53,7 +53,6 @@ import com.keylesspalace.tusky.network.MastodonApi;
import com.keylesspalace.tusky.repository.Placeholder;
import com.keylesspalace.tusky.repository.TimelineRepository;
import com.keylesspalace.tusky.repository.TimelineRequestMode;
import com.keylesspalace.tusky.util.CollectionUtil;
import com.keylesspalace.tusky.util.Either;
import com.keylesspalace.tusky.util.ListStatusAccessibilityDelegate;
import com.keylesspalace.tusky.util.ListUtils;
@ -97,6 +96,7 @@ import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function1;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@ -1159,7 +1159,7 @@ public class TimelineFragment extends SFragment implements
return -1;
}
private final Function<Status, Either<Placeholder, Status>> statusLifter =
private final Function1<Status, Either<Placeholder, Status>> statusLifter =
Either.Right::new;
private @Nullable
@ -1221,7 +1221,7 @@ public class TimelineFragment extends SFragment implements
}
private List<Either<Placeholder, Status>> liftStatusList(List<Status> list) {
return CollectionUtil.map(list, statusLifter);
return CollectionsKt.map(list, statusLifter);
}
private void updateAdapter() {

@ -1,38 +0,0 @@
/* Copyright 2017 Andrew Dawson
*
* This file is a part of Tusky.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tusky; if not,
* see <http://www.gnu.org/licenses>. */
package com.keylesspalace.tusky.util;
import androidx.arch.core.util.Function;
import java.util.ArrayList;
import java.util.List;
/**
* Created by charlag on 05/11/17.
*/
public final class CollectionUtil {
private CollectionUtil() {
throw new AssertionError();
}
public static <E, R> List<R> map(List<E> list, Function<E, R> mapper) {
final List<R> newList = new ArrayList<>(list.size());
for (E el : list) {
newList.add(mapper.apply(el));
}
return newList;
}
}
Loading…
Cancel
Save