Skip to content

Commit

Permalink
Merge branch 'release/v1.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Feb 12, 2016
2 parents 1cd871b + ddbcbde commit 7a767aa
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 48 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ You can try it out here [Google Play](https://play.google.com/store/apps/details
#Include in your project
##Using Maven
```javascript
compile('com.mikepenz:fastadapter:1.0.4@aar') {
compile('com.mikepenz:fastadapter:1.0.5@aar') {
transitive = true
}
```
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
defaultConfig {
minSdkVersion 11
targetSdkVersion 23
versionCode 104
versionName '1.0.4'
versionCode 105
versionName '1.0.5'

applicationVariants.all { variant ->
variant.outputs.each { output ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public class AdvancedSampleActivity extends AppCompatActivity {
private static final String[] headers = new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};

//save our FastAdapter
private FastAdapter mFastAdapter;
private HeaderAdapter mHeaderAdapter;
private ItemAdapter mItemAdapter;
private FastAdapter<IItem> mFastAdapter;
private HeaderAdapter<SampleItem> mHeaderAdapter;
private ItemAdapter<ExpandableItem> mItemAdapter;

private ActionModeHelper mActionModeHelper;

Expand All @@ -65,22 +65,22 @@ protected void onCreate(Bundle savedInstanceState) {
new MaterializeBuilder().withActivity(this).build();

//create our FastAdapter
mFastAdapter = new FastAdapter();
mFastAdapter = new FastAdapter<>();

//we init our ActionModeHelper
mActionModeHelper = new ActionModeHelper(mFastAdapter, R.menu.cab, new ActionBarCallBack());

//create our adapters
final StickyHeaderAdapter stickyHeaderAdapter = new StickyHeaderAdapter();
mItemAdapter = new ItemAdapter();
mHeaderAdapter = new HeaderAdapter();
mItemAdapter = new ItemAdapter<>();
mHeaderAdapter = new HeaderAdapter<>();

//configure our mFastAdapter
//as we provide id's for the items we want the hasStableIds enabled to speed up things
mFastAdapter.setHasStableIds(true);
mFastAdapter.withMultiSelect(true);
mFastAdapter.withSelectOnLongClick(true);
mFastAdapter.withOnPreClickListener(new FastAdapter.OnClickListener() {
mFastAdapter.withOnPreClickListener(new FastAdapter.OnClickListener<IItem>() {
@Override
public boolean onClick(View v, IAdapter adapter, IItem item, int position) {
//we handle the default onClick behavior for the actionMode. This will return null if it didn't do anything and you can handle a normal onClick
Expand All @@ -98,7 +98,7 @@ public boolean onClick(View v, IAdapter adapter, IItem item, int position) {
}
});

mFastAdapter.withOnPreLongClickListener(new FastAdapter.OnLongClickListener() {
mFastAdapter.withOnPreLongClickListener(new FastAdapter.OnLongClickListener<IItem>() {
@Override
public boolean onLongClick(View v, IAdapter adapter, IItem item, int position) {
ActionMode actionMode = mActionModeHelper.onLongClick(AdvancedSampleActivity.this, position);
Expand Down Expand Up @@ -147,7 +147,7 @@ public void onChanged() {
private void setItems() {
mHeaderAdapter.add(new SampleItem().withName("Header").withSelectable(false).withIdentifier(1));
//fill with some sample data
List<IItem> items = new ArrayList<>();
List<ExpandableItem> items = new ArrayList<>();
int size = new Random().nextInt(25) + 10;
for (int i = 1; i <= size; i++) {

Expand All @@ -168,7 +168,7 @@ private void setItems() {
expandableItem.withSubItems(subItems);
items.add(expandableItem);
} else {
items.add(new SampleItem().withName("Test " + i).withHeader(headers[i / 5]));
items.add(new ExpandableItem().withName("Test " + i).withHeader(headers[i / 5]));
}
}
mItemAdapter.set(items);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
public class CheckBoxSampleActivity extends AppCompatActivity {
private static final String[] ALPHABET = new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};

//our recyclerView
private RecyclerView recyclerView;

//save our FastAdapter
private FastItemAdapter<CheckBoxSampleItem> fastItemAdapter;

Expand Down Expand Up @@ -78,7 +75,7 @@ public RecyclerView.ViewHolder onPreCreateViewHolder(ViewGroup parent, int viewT

@Override
public RecyclerView.ViewHolder onPostCreateViewHolder(final RecyclerView.ViewHolder viewHolder) {
mClickListenerHelper.listen(viewHolder, ((CheckBoxSampleItem.ViewHolder)viewHolder).checkBox, new ClickListenerHelper.OnClickListener<CheckBoxSampleItem>() {
mClickListenerHelper.listen(viewHolder, ((CheckBoxSampleItem.ViewHolder) viewHolder).checkBox, new ClickListenerHelper.OnClickListener<CheckBoxSampleItem>() {
@Override
public void onClick(View v, int position, CheckBoxSampleItem item) {
fastItemAdapter.toggleSelection(position);
Expand All @@ -89,7 +86,7 @@ public void onClick(View v, int position, CheckBoxSampleItem item) {
});

//get our recyclerView and do basic setup
recyclerView = (RecyclerView) findViewById(R.id.rv);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(fastItemAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public class ExpandableSampleActivity extends AppCompatActivity {
//save our FastAdapter
private FastItemAdapter fastItemAdapter;
private FastItemAdapter<IItem> fastItemAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -47,10 +47,10 @@ protected void onCreate(Bundle savedInstanceState) {
new MaterializeBuilder().withActivity(this).build();

//create our FastAdapter
fastItemAdapter = new FastItemAdapter();
fastItemAdapter = new FastItemAdapter<>();

//configure our fastAdapter
fastItemAdapter.withOnPreClickListener(new FastAdapter.OnClickListener() {
fastItemAdapter.withOnPreClickListener(new FastAdapter.OnClickListener<IItem>() {
@Override
public boolean onClick(View v, IAdapter adapter, IItem item, int position) {
if (item instanceof ExpandableItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,13 @@ protected void onCreate(Bundle savedInstanceState) {
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3);

//if you need multiple items for different models you can also do this be defining a Function which get's the model object and returns the item (extends IItem)
GenericItemAdapter itemAdapter = new GenericItemAdapter(new Function() {
GenericItemAdapter<IconModel, GenericIconItem> itemAdapter = new GenericItemAdapter<>(new Function<IconModel, GenericIconItem>() {
@Override
public Object apply(Object o) {
//depending on your logic you can now decide which model maps to which item.
if (o instanceof IconModel) {
if (((IconModel) o).normal) {
return new GenericIconItem((IconModel) o);
} else {
return new RightGenericIconItem((IconModel) o);
}
public GenericIconItem apply(IconModel o) {
if (o.normal) {
return new GenericIconItem(o);
} else {
throw new IllegalArgumentException("The passed model can't be created within this Factory");
return new RightGenericIconItem(o);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
public class RadioButtonSampleActivity extends AppCompatActivity {
private static final String[] ALPHABET = new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};

//our recyclerView
private RecyclerView recyclerView;

//save our FastAdapter
private FastItemAdapter<RadioButtonSampleItem> fastItemAdapter;

Expand Down Expand Up @@ -79,7 +76,7 @@ public RecyclerView.ViewHolder onPreCreateViewHolder(ViewGroup parent, int viewT

@Override
public RecyclerView.ViewHolder onPostCreateViewHolder(final RecyclerView.ViewHolder viewHolder) {
mClickListenerHelper.listen(viewHolder, ((RadioButtonSampleItem.ViewHolder)viewHolder).radioButton, new ClickListenerHelper.OnClickListener<RadioButtonSampleItem>() {
mClickListenerHelper.listen(viewHolder, ((RadioButtonSampleItem.ViewHolder) viewHolder).radioButton, new ClickListenerHelper.OnClickListener<RadioButtonSampleItem>() {
@Override
public void onClick(View v, int position, RadioButtonSampleItem item) {
if (!item.isSelected()) {
Expand All @@ -98,7 +95,7 @@ public void onClick(View v, int position, RadioButtonSampleItem item) {
});

//get our recyclerView and do basic setup
recyclerView = (RecyclerView) findViewById(R.id.rv);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(fastItemAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
public class SimpleItemListActivity extends AppCompatActivity implements ItemTouchCallback {
private static final String[] ALPHABET = new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};

//our recyclerView
private RecyclerView recyclerView;

//save our FastAdapter
private FastItemAdapter<SampleItem> fastItemAdapter;

Expand Down Expand Up @@ -86,7 +83,7 @@ public boolean filter(SampleItem item, CharSequence constraint) {
});

//get our recyclerView and do basic setup
recyclerView = (RecyclerView) findViewById(R.id.rv);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(fastScrollIndicatorAdapter.wrap(fastItemAdapter));
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta2'
classpath 'com.android.tools.build:gradle:2.0.0-beta4'
classpath 'com.novoda:bintray-release:0.3.4'
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Maven stuff
VERSION_NAME=1.0.4
VERSION_CODE=104
VERSION_NAME=1.0.5
VERSION_CODE=105
GROUP=com.mikepenz

POM_DESCRIPTION=FastAdapter Library
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 10
targetSdkVersion 23
versionCode 104
versionName '1.0.4'
versionCode 105
versionName '1.0.5'
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class AbstractAdapter<Item extends IItem> extends RecyclerView.A
* @param fastAdapter the FastAdapter which contains the base logic
* @return this
*/
public AbstractAdapter<Item> wrap(FastAdapter<Item> fastAdapter) {
public AbstractAdapter wrap(FastAdapter fastAdapter) {
//this.mParentAdapter = abstractAdapter;
this.mFastAdapter = fastAdapter;
this.mFastAdapter.registerAdapter(this);
Expand All @@ -32,7 +32,7 @@ public AbstractAdapter<Item> wrap(FastAdapter<Item> fastAdapter) {
* @param abstractAdapter an AbstractWrapper which wraps another AbstractAdapter or FastAdapter
* @return this
*/
public AbstractAdapter<Item> wrap(IAdapter<Item> abstractAdapter) {
public AbstractAdapter wrap(IAdapter abstractAdapter) {
//this.mParentAdapter = abstractAdapter;
this.mFastAdapter = abstractAdapter.getFastAdapter();
this.mFastAdapter.registerAdapter(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<b>FastAdapter</b>, the bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction...
]]>
</string>
<string name="library_fastadapter_libraryVersion">1.0.4</string>
<string name="library_fastadapter_libraryVersion">1.0.5</string>
<string name="library_fastadapter_libraryWebsite">https://github.com/mikepenz/FastAdapter</string>
<string name="library_fastadapter_licenseId">apache_2_0</string>
<string name="library_fastadapter_isOpenSource">true</string>
Expand Down

0 comments on commit 7a767aa

Please sign in to comment.