Skip to content

Commit

Permalink
Merge branch 'release/v3.3.0-rc02'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Sep 15, 2018
2 parents c77f5de + b2d69a3 commit 32ec98f
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 19 deletions.
4 changes: 4 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
### Upgrade Notes

#### v3.3.x
* Upgraded the library to use `androidX` dependencies. This means your project will need to depend on `androidX` dependencies too. If you still use appcompat please consider using a version older than v3.3.x.
* Further details about migrating to androidX and a overview can be found on the official docs. https://developer.android.com/topic/libraries/support-library/refactor

#### v3.2.4
* Adjusted the `set(int position, Item item, int preItemCount)` to include the `preItemCount` to corretly notify the adapter about the changed element.

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,26 @@ You can try it out here [Google Play](https://play.google.com/store/apps/details

The library is split up into core, commons, and extensions. The core functions are included in the following dependency.
```gradle
implementation 'com.mikepenz:fastadapter:3.3.0-rc01'
implementation 'com.mikepenz:fastadapter:3.3.0-rc02'
implementation "androidx.appcompat:appcompat:${androidX}"
implementation "androidx.recyclerview:recyclerview:${androidX}"
```

The commons package comes with some useful helpers (which are not needed in all cases) This one for example includes the `FastItemAdapter`
```gradle
implementation 'com.mikepenz:fastadapter-commons:3.3.0-rc01'
implementation 'com.mikepenz:fastadapter-commons:3.3.0-rc02'
```

Expandable support is included and can be added via this
```gradle
implementation 'com.mikepenz:fastadapter-extensions-expandable:3.3.0-rc01'
implementation 'com.mikepenz:fastadapter-extensions-expandable:3.3.0-rc02'
//The tiny Materialize library used for its useful helper classes
implementation 'com.mikepenz:materialize:${latestVersion}' // at least 1.2.0-rc01
```

Many helper classes are included in the following dependency. (This functionality also needs the `Expandable` extension
```gradle
implementation 'com.mikepenz:fastadapter-extensions:3.3.0-rc01'
implementation 'com.mikepenz:fastadapter-extensions:3.3.0-rc02'
implementation "com.google.android.material:material:${androidX}"
//The tiny Materialize library used for its useful helper classes
implementation 'com.mikepenz:materialize:${latestVersion}' // at least 1.2.0-rc01
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ dependencies {

//used to generate the drawer on the left
//https://github.com/mikepenz/MaterialDrawer
implementation('com.mikepenz:materialdrawer:6.0.7@aar') {
implementation('com.mikepenz:materialdrawer:6.1.0-rc01') {
transitive = true
exclude group: "com.mikepenz"
}
Expand All @@ -82,7 +82,7 @@ dependencies {
implementation 'com.mikepenz:itemanimators:1.1.0-rc01'
//used to generate the Open Source section
//https://github.com/mikepenz/AboutLibraries
implementation('com.mikepenz:aboutlibraries:6.0.9@aar') {
implementation('com.mikepenz:aboutlibraries:6.2.0-rc01') {
transitive = true
exclude group: "com.mikepenz"
}
Expand Down Expand Up @@ -127,7 +127,7 @@ dependencies {
configurations.all {
resolutionStrategy.force "com.mikepenz:materialize:1.2.0-rc01"
resolutionStrategy.force "com.mikepenz:iconics-core:3.1.0-rc01"
resolutionStrategy.force "com.mikepenz:aboutlibraries:6.0.9"
resolutionStrategy.force "com.mikepenz:aboutlibraries:6.2.0-rc01"
resolutionStrategy.force "androidx.appcompat:appcompat:${versions.androidX}"
resolutionStrategy.force "androidx.recyclerview:recyclerview:${versions.androidX}"
resolutionStrategy.force "androidx.cardview:cardview:${versions.androidX}"
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
buildscript {
ext {
release = [
versionName: "3.3.0-rc01",
versionName: "3.3.0-rc02",
versionCode: 3300
]

Expand All @@ -14,7 +14,7 @@ buildscript {
]

versions = [
androidX: '1.0.0-rc01'
androidX: '1.0.0-rc02'
]
}

Expand All @@ -23,7 +23,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha05'
classpath 'com.android.tools.build:gradle:3.3.0-alpha10'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Jun 02 19:19:43 CEST 2018
#Sat Sep 15 11:46:33 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package com.mikepenz.fastadapter;

import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.collection.ArrayMap;
import androidx.core.util.Pair;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.util.SparseArray;
import android.view.MotionEvent;
Expand Down Expand Up @@ -39,6 +35,11 @@

import javax.annotation.Nullable;

import androidx.annotation.NonNull;
import androidx.collection.ArrayMap;
import androidx.core.util.Pair;
import androidx.recyclerview.widget.RecyclerView;

import static com.mikepenz.fastadapter.adapters.ItemAdapter.items;

/**
Expand Down Expand Up @@ -1409,6 +1410,23 @@ public static <Item extends IItem> Item getHolderAdapterItem(@Nullable RecyclerV
return null;
}

/**
* convenient helper method to get the Item from a holder via the defined tag
*
* @param holder the ViewHolder for which we want to retrieve the item
* @return the Item found for the given position and that ViewHolder
*/
@SuppressWarnings("unchecked")
public static <Item extends IItem> Item getHolderAdapterItemTag(@Nullable RecyclerView.ViewHolder holder) {
if (holder != null) {
Object item = holder.itemView.getTag(com.mikepenz.fastadapter.R.id.fastadapter_item);
if (item instanceof FastAdapter) {
return (Item) item;
}
}
return null;
}

/**
* util function which recursively iterates over all items and subItems of the given adapter.
* It executes the given `predicate` on every item and will either stop if that function returns true, or continue (if stopOnMatch is false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.mikepenz.fastadapter.listeners;

import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;

import com.mikepenz.fastadapter.FastAdapter;
Expand All @@ -9,6 +8,8 @@

import java.util.List;

import androidx.recyclerview.widget.RecyclerView;

public class OnBindViewHolderListenerImpl implements OnBindViewHolderListener {
/**
* is called in onBindViewHolder to bind the data on the ViewHolder
Expand Down Expand Up @@ -42,7 +43,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, L
*/
@Override
public void unBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
IItem item = (IItem) viewHolder.itemView.getTag(R.id.fastadapter_item);
IItem item = FastAdapter.getHolderAdapterItemTag(viewHolder);
if (item != null) {
item.unbindView(viewHolder);
if (viewHolder instanceof FastAdapter.ViewHolder) {
Expand Down Expand Up @@ -85,7 +86,7 @@ public void onViewAttachedToWindow(RecyclerView.ViewHolder viewHolder, int posit
*/
@Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder viewHolder, int position) {
IItem item = FastAdapter.getHolderAdapterItem(viewHolder, position);
IItem item = FastAdapter.getHolderAdapterItemTag(viewHolder);
if (item != null) {
item.detachFromWindow(viewHolder);
if (viewHolder instanceof FastAdapter.ViewHolder) {
Expand Down

0 comments on commit 32ec98f

Please sign in to comment.