Skip to content

Commit

Permalink
Merge branch 'release/v0.3.3-SNAPSHOT'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Jan 5, 2016
2 parents 3c91217 + c653cc7 commit 6ca30e5
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Beside being blazing fast, minimizing the code you need to write, it is also rea
#Include in your project
##Using Maven
```javascript
compile('com.mikepenz:fastadapter:0.3.2-SNAPSHOT@aar') {
compile('com.mikepenz:fastadapter:0.3.3-SNAPSHOT@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 @@ -13,8 +13,8 @@ android {
applicationId "com.mikepenz.crossfader.app"
minSdkVersion 11
targetSdkVersion 23
versionCode 32
versionName '0.3.2-SNAPSHOT'
versionCode 33
versionName '0.3.3-SNAPSHOT'

applicationVariants.all { variant ->
variant.outputs.each { output ->
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ org.gradle.daemon=true
org.gradle.parallel=true

# Maven stuff
VERSION_NAME=0.3.2-SNAPSHOT
VERSION_CODE=32
VERSION_NAME=0.3.3-SNAPSHOT
VERSION_CODE=33
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 32
versionName '0.3.2-SNAPSHOT'
versionCode 33
versionName '0.3.3-SNAPSHOT'
}
buildTypes {
release {
Expand Down
31 changes: 27 additions & 4 deletions library/src/main/java/com/mikepenz/fastadapter/FastAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,29 @@ public FastAdapter withMultiSelectOnLongClick(boolean multiSelectOnLongClick) {
* @return
*/
public FastAdapter withSavedInstanceState(Bundle savedInstanceState) {
return withSavedInstanceState(savedInstanceState, "");
}

/**
* re-selects all elements stored in the savedInstanceState
* IMPORTANT! Call this method only after all items where added to the adapters again. Otherwise it may select wrong items!
*
* @param savedInstanceState
* @param prefix a prefix added to the savedInstance key so we can store multiple states
* @return
*/
public FastAdapter withSavedInstanceState(Bundle savedInstanceState, String prefix) {
if (savedInstanceState != null) {
//first restore opened collasable items, as otherwise may not all selections could be restored
int[] collapsibles = savedInstanceState.getIntArray(BUNDLE_COLLAPSIBLE);
int[] collapsibles = savedInstanceState.getIntArray(BUNDLE_COLLAPSIBLE + prefix);
if (collapsibles != null) {
for (Integer collapsible : collapsibles) {
open(collapsible);
}
}

//restore the selections
int[] selections = savedInstanceState.getIntArray(BUNDLE_SELECTIONS);
int[] selections = savedInstanceState.getIntArray(BUNDLE_SELECTIONS + prefix);
if (selections != null) {
for (Integer selection : selections) {
select(selection);
Expand Down Expand Up @@ -388,6 +400,17 @@ public int getItemCount(int order) {
* @return
*/
public Bundle saveInstanceState(Bundle savedInstanceState) {
return saveInstanceState(savedInstanceState, "");
}

/**
* add the values to the bundle for saveInstanceState
*
* @param savedInstanceState
* @param prefix a prefix added to the savedInstance key so we can store multiple states
* @return
*/
public Bundle saveInstanceState(Bundle savedInstanceState, String prefix) {
if (savedInstanceState != null) {
//remember the selections
int[] selections = new int[mSelections.size()];
Expand All @@ -396,10 +419,10 @@ public Bundle saveInstanceState(Bundle savedInstanceState) {
selections[index] = selection;
index++;
}
savedInstanceState.putIntArray(BUNDLE_SELECTIONS, selections);
savedInstanceState.putIntArray(BUNDLE_SELECTIONS + prefix, selections);

//remember the collapsed states
savedInstanceState.putIntArray(BUNDLE_COLLAPSIBLE, getOpenedCollapsibleItems());
savedInstanceState.putIntArray(BUNDLE_COLLAPSIBLE + prefix, getOpenedCollapsibleItems());
}
return savedInstanceState;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
The <b>FastAdapter</b> is here to simplify this process. You do not have to worry about the adapter anymore. Just write the logic for how your view should look like, and you are done. This library has a fast and highly optimized core which provides core functionality, most apps require. It also prevents common mistakes by taking away those steps from the devs. Beside being blazing fast, minimizing the code you need to write, it is also really easy to extend. Just provide another Adapter implementation, hook into the adapter chain, custom select / deselection behaviors. Everything is possible.
]]>
</string>
<string name="library_fastadapter_libraryVersion">0.3.2-SNAPSHOT</string>
<string name="library_fastadapter_libraryVersion">0.3.3-SNAPSHOT</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 6ca30e5

Please sign in to comment.