diff --git a/src/main/java/ru/touchin/roboswag/components/adapters/AdapterDelegate.java b/src/main/java/ru/touchin/roboswag/components/adapters/AdapterDelegate.java index 3c70482..ee6155c 100644 --- a/src/main/java/ru/touchin/roboswag/components/adapters/AdapterDelegate.java +++ b/src/main/java/ru/touchin/roboswag/components/adapters/AdapterDelegate.java @@ -19,36 +19,20 @@ package ru.touchin.roboswag.components.adapters; -import android.arch.lifecycle.LifecycleOwner; import android.support.annotation.NonNull; import android.support.v4.view.ViewCompat; +import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; /** * Objects of such class controls creation and binding of specific type of RecyclerView's ViewHolders. * Default {@link #getItemViewType} is generating on construction of object. * - * @param Type of {@link LifecycleViewHolder} of delegate. + * @param Type of {@link RecyclerView.ViewHolder} of delegate. */ -public abstract class AdapterDelegate { +public abstract class AdapterDelegate { private final int defaultItemViewType = ViewCompat.generateViewId(); - @NonNull - private final LifecycleOwner lifecycleOwner; - - public AdapterDelegate(@NonNull final LifecycleOwner lifecycleOwner) { - this.lifecycleOwner = lifecycleOwner; - } - - /** - * Returns parent {@link LifecycleOwner} that this delegate created from (e.g. Activity, Fragment or ViewController). - * - * @return Parent {@link LifecycleOwner}. - */ - @NonNull - public LifecycleOwner getLifecycleOwner() { - return lifecycleOwner; - } /** * Unique ID of AdapterDelegate. diff --git a/src/main/java/ru/touchin/roboswag/components/adapters/ItemAdapterDelegate.java b/src/main/java/ru/touchin/roboswag/components/adapters/ItemAdapterDelegate.java index 4618479..b7a3a44 100644 --- a/src/main/java/ru/touchin/roboswag/components/adapters/ItemAdapterDelegate.java +++ b/src/main/java/ru/touchin/roboswag/components/adapters/ItemAdapterDelegate.java @@ -1,7 +1,7 @@ package ru.touchin.roboswag.components.adapters; -import android.arch.lifecycle.LifecycleOwner; import android.support.annotation.NonNull; +import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import java.util.List; @@ -11,14 +11,10 @@ import java.util.List; * Such delegates are creating and binding ViewHolders for specific items. * Default {@link #getItemViewType} is generating on construction of object. * - * @param Type of {@link LifecycleViewHolder} of delegate; - * @param Type of items to bind to {@link LifecycleViewHolder}s. + * @param Type of {@link RecyclerView.ViewHolder} of delegate; + * @param Type of items to bind to {@link RecyclerView.ViewHolder}s. */ -public abstract class ItemAdapterDelegate extends AdapterDelegate { - - public ItemAdapterDelegate(@NonNull final LifecycleOwner lifecycleOwner) { - super(lifecycleOwner); - } +public abstract class ItemAdapterDelegate extends AdapterDelegate { /** * Returns if object is processable by this delegate. diff --git a/src/main/java/ru/touchin/roboswag/components/adapters/LifecycleViewHolder.kt b/src/main/java/ru/touchin/roboswag/components/adapters/LifecycleViewHolder.kt deleted file mode 100644 index 42b4931..0000000 --- a/src/main/java/ru/touchin/roboswag/components/adapters/LifecycleViewHolder.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2015 RoboSwag (Gavriil Sitnikov, Vsevolod Ivanov) - * - * This file is part of RoboSwag library. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package ru.touchin.roboswag.components.adapters - -import android.arch.lifecycle.LifecycleOwner -import android.support.v7.widget.RecyclerView -import android.view.View - -/** - * Created by Denis Karmyshakov 14.03.2018. - * ViewHolder that implements {@link LifecycleOwner} and uses parent lifecycle - * object as bridge ([android.app.Activity], [android.support.v4.app.Fragment] etc.). - */ -open class LifecycleViewHolder( - private val lifecycleOwner: LifecycleOwner, - itemView: View -) : RecyclerView.ViewHolder(itemView), LifecycleOwner by lifecycleOwner diff --git a/src/main/java/ru/touchin/roboswag/components/adapters/PositionAdapterDelegate.java b/src/main/java/ru/touchin/roboswag/components/adapters/PositionAdapterDelegate.java index 1271d82..ac83c51 100644 --- a/src/main/java/ru/touchin/roboswag/components/adapters/PositionAdapterDelegate.java +++ b/src/main/java/ru/touchin/roboswag/components/adapters/PositionAdapterDelegate.java @@ -1,7 +1,7 @@ package ru.touchin.roboswag.components.adapters; -import android.arch.lifecycle.LifecycleOwner; import android.support.annotation.NonNull; +import android.support.v7.widget.RecyclerView; import android.view.ViewGroup; import java.util.List; @@ -11,13 +11,9 @@ import java.util.List; * Such delegates are creating and binding ViewHolders by position in adapter. * Default {@link #getItemViewType} is generating on construction of object. * - * @param Type of {@link LifecycleViewHolder} of delegate. + * @param Type of {@link RecyclerView.ViewHolder} of delegate. */ -public abstract class PositionAdapterDelegate extends AdapterDelegate { - - public PositionAdapterDelegate(@NonNull final LifecycleOwner lifecycleOwner) { - super(lifecycleOwner); - } +public abstract class PositionAdapterDelegate extends AdapterDelegate { /** * Returns if object is processable by this delegate.