LifecycleViewHolder removed
This commit is contained in:
parent
b64e1c9e35
commit
e3e978b7f7
|
|
@ -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 <TViewHolder> Type of {@link LifecycleViewHolder} of delegate.
|
||||
* @param <TViewHolder> Type of {@link RecyclerView.ViewHolder} of delegate.
|
||||
*/
|
||||
public abstract class AdapterDelegate<TViewHolder extends LifecycleViewHolder> {
|
||||
public abstract class AdapterDelegate<TViewHolder extends RecyclerView.ViewHolder> {
|
||||
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -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 <TViewHolder> Type of {@link LifecycleViewHolder} of delegate;
|
||||
* @param <TItem> Type of items to bind to {@link LifecycleViewHolder}s.
|
||||
* @param <TViewHolder> Type of {@link RecyclerView.ViewHolder} of delegate;
|
||||
* @param <TItem> Type of items to bind to {@link RecyclerView.ViewHolder}s.
|
||||
*/
|
||||
public abstract class ItemAdapterDelegate<TViewHolder extends LifecycleViewHolder, TItem> extends AdapterDelegate<TViewHolder> {
|
||||
|
||||
public ItemAdapterDelegate(@NonNull final LifecycleOwner lifecycleOwner) {
|
||||
super(lifecycleOwner);
|
||||
}
|
||||
public abstract class ItemAdapterDelegate<TViewHolder extends RecyclerView.ViewHolder, TItem> extends AdapterDelegate<TViewHolder> {
|
||||
|
||||
/**
|
||||
* Returns if object is processable by this delegate.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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 <TViewHolder> Type of {@link LifecycleViewHolder} of delegate.
|
||||
* @param <TViewHolder> Type of {@link RecyclerView.ViewHolder} of delegate.
|
||||
*/
|
||||
public abstract class PositionAdapterDelegate<TViewHolder extends LifecycleViewHolder> extends AdapterDelegate<TViewHolder> {
|
||||
|
||||
public PositionAdapterDelegate(@NonNull final LifecycleOwner lifecycleOwner) {
|
||||
super(lifecycleOwner);
|
||||
}
|
||||
public abstract class PositionAdapterDelegate<TViewHolder extends RecyclerView.ViewHolder> extends AdapterDelegate<TViewHolder> {
|
||||
|
||||
/**
|
||||
* Returns if object is processable by this delegate.
|
||||
|
|
|
|||
Loading…
Reference in New Issue