Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: emilsjolander/StickyListHeaders
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: mournblade/StickyListHeaders
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Aug 10, 2013

  1. Copy the full SHA
    9252a6f View commit details

Commits on Oct 9, 2013

  1. Copy the full SHA
    270b239 View commit details

Commits on Dec 8, 2013

  1. Copy the full SHA
    264d4b4 View commit details

Commits on Jan 29, 2014

  1. revert changes

    mtotschnig committed Jan 29, 2014
    Copy the full SHA
    d505062 View commit details
  2. Copy the full SHA
    7dd8989 View commit details
  3. Copy the full SHA
    af8f7ed View commit details

Commits on Nov 1, 2014

  1. Copy the full SHA
    12e956a View commit details
  2. onHeaderLongClick

    mtotschnig committed Nov 1, 2014
    Copy the full SHA
    97b92f7 View commit details
  3. Copy the full SHA
    a04ae31 View commit details
  4. work around bug in android plugin which is looking for library.aar in…

    … prepareMyExpensesStickyListHeadersLibraryUnspecifiedLibrary
    mtotschnig committed Nov 1, 2014
    Copy the full SHA
    714b51c View commit details

Commits on Sep 27, 2015

  1. Copy the full SHA
    dfa1dd5 View commit details

Commits on Mar 5, 2016

  1. Copy the full SHA
    7c5d2e8 View commit details

Commits on Mar 24, 2017

  1. Copy the full SHA
    4182d8f View commit details

Commits on Jun 9, 2017

  1. at least with O, we no longer can rely on superstate being empty. Imp…

    …lement proper parceling of both super and wrapped state
    mtotschnig committed Jun 9, 2017
    Copy the full SHA
    c9f9a44 View commit details
  2. Copy the full SHA
    979206b View commit details

Commits on Jun 10, 2017

  1. Copy the full SHA
    bfc4d66 View commit details
  2. Merge pull request #2 from Maxr1998/patch-1

    Gradle wrapper is too old to build on Jitpack
    mtotschnig authored Jun 10, 2017
    Copy the full SHA
    4625e84 View commit details
  3. update required by Jitpack

    mtotschnig committed Jun 10, 2017
    Copy the full SHA
    46728d5 View commit details
  4. Copy the full SHA
    64d43bf View commit details

Commits on Jun 26, 2017

  1. Copy the full SHA
    55096d3 View commit details

Commits on Jun 27, 2017

  1. Copy the full SHA
    d2055d1 View commit details
  2. Copy the full SHA
    7ef4793 View commit details

Commits on Nov 23, 2019

  1. Copy the full SHA
    7d5dd61 View commit details
  2. Copy the full SHA
    b9ebfc1 View commit details
  3. refactor

    mtotschnig committed Nov 23, 2019
    Copy the full SHA
    348bbe1 View commit details

Commits on May 17, 2020

  1. update

    mtotschnig committed May 17, 2020
    Copy the full SHA
    a17001c View commit details
  2. Copy the full SHA
    b2789b4 View commit details
  3. expose collapsed headers

    mtotschnig committed May 17, 2020
    Copy the full SHA
    2d5c904 View commit details
  4. set collapsed header ids

    mtotschnig committed May 17, 2020
    Copy the full SHA
    9294ffb View commit details
  5. encapsulate and protect

    mtotschnig committed May 17, 2020
    Copy the full SHA
    6a3fcbc View commit details
  6. no longer accessible

    mtotschnig committed May 17, 2020
    Copy the full SHA
    c0b5fc4 View commit details

Commits on May 18, 2020

  1. Copy the full SHA
    9292210 View commit details

Commits on May 24, 2020

  1. Copy the full SHA
    65e620a View commit details

Commits on Sep 9, 2020

  1. Migrate to AndroidX

    gdingenen committed Sep 9, 2020
    Copy the full SHA
    34b7ef7 View commit details
  2. Copy the full SHA
    4b52c9d View commit details
  3. Disable jetifier

    gdingenen committed Sep 9, 2020
    Copy the full SHA
    d64df11 View commit details
  4. Merge pull request #1 from gdingenen/androidx

    Androidx
    gdingenen authored Sep 9, 2020
    Copy the full SHA
    81b074e View commit details

Commits on Dec 7, 2020

  1. Made WrapperListView not try to get reflectionfields mSelectorRect an…

    …d mSelectorPosition out from AbsListView if running in P or later, since access to them has been removed.
    mathiasafjochnick committed Dec 7, 2020
    Copy the full SHA
    7f792cf View commit details
  2. changed compileversion

    mathiasafjochnick committed Dec 7, 2020
    Copy the full SHA
    f48d59a View commit details
  3. fixed androidx inheritance

    mathiasafjochnick committed Dec 7, 2020
    Copy the full SHA
    379020c View commit details
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
buildscript {
repositories {
mavenCentral()
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.android.tools.build:gradle:4.0.1'
}
}

@@ -13,11 +14,12 @@ def isReleaseBuild() {
}

allprojects {
version = VERSION_NAME
group = GROUP

repositories {
google()
mavenCentral()
jcenter()
}
}

1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -12,3 +12,4 @@ POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=emilsjolander
POM_DEVELOPER_NAME=Emil Sjolander
POM_DEVELOPER_EMAIL=sjolander.emil@gmail.com
android.useAndroidX=true
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 @@
#Tue Nov 19 08:36:06 CET 2013
#Wed Sep 09 14:55:00 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
4 changes: 0 additions & 4 deletions library/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -4,8 +4,4 @@
android:versionCode="2"
android:versionName="2.0" >

<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="22" />

</manifest>
12 changes: 9 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
dependencies {
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.customview:customview:1.1.0'
}

android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 14
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Checkable;
@@ -27,6 +28,7 @@ class AdapterWrapper extends BaseAdapter implements StickyListHeadersAdapter {

interface OnHeaderClickListener {
void onHeaderClick(View header, int itemPosition, long headerId);
boolean onHeaderLongClick(View header, int itemPosition, long headerId);
}

StickyListHeadersAdapter mDelegate;
@@ -135,12 +137,23 @@ private View configureHeader(WrapperView wv, final int position) {

@Override
public void onClick(View v) {
if(mOnHeaderClickListener != null){
if(mOnHeaderClickListener != null && position < getCount()){
long headerId = mDelegate.getHeaderId(position);
mOnHeaderClickListener.onHeaderClick(v, position, headerId);
}
}
});
header.setOnLongClickListener(new OnLongClickListener() {

@Override
public boolean onLongClick(View v) {
if(mOnHeaderClickListener != null && position < getCount()){
long headerId = mDelegate.getHeaderId(position);
return mOnHeaderClickListener.onHeaderLongClick(v, position, headerId);
}
return false;
}
});
return header;
}

Original file line number Diff line number Diff line change
@@ -4,25 +4,33 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.ArrayList;
import java.util.List;


/**
* @author lsjwzh
*/
class ExpandableStickyListHeadersAdapter extends BaseAdapter implements StickyListHeadersAdapter {
class ExpandableStickyListHeadersAdapter extends BaseAdapter implements StickyListHeadersAdapter {

final StickyListHeadersAdapter mInnerAdapter;
private DualHashMap<View,Long> mViewToItemIdMap = new DualHashMap<>();
private DistinctMultiHashMap<Integer,View> mHeaderIdToViewMap = new DistinctMultiHashMap<>();

private final StickyListHeadersAdapter mInnerAdapter;
DualHashMap<View,Long> mViewToItemIdMap = new DualHashMap<View, Long>();
DistinctMultiHashMap<Integer,View> mHeaderIdToViewMap = new DistinctMultiHashMap<Integer, View>();
List<Long> mCollapseHeaderIds = new ArrayList<Long>();
private List<Long> mCollapseHeaderIds = new ArrayList<>();

ExpandableStickyListHeadersAdapter(StickyListHeadersAdapter innerAdapter){
this.mInnerAdapter = innerAdapter;
}

public List<Long> getCollapseHeaderIds() {
return mCollapseHeaderIds;
}

public void setCollapseHeaderIds(List<Long> collapseHeaderIds) {
this.mCollapseHeaderIds = new ArrayList<>(collapseHeaderIds);
}

@Override
public View getHeaderView(int position, View convertView, ViewGroup parent) {
return mInnerAdapter.getHeaderView(position,convertView,parent);
@@ -111,7 +119,7 @@ public boolean isHeaderCollapsed(long headerId){

public void expand(long headerId) {
if(isHeaderCollapsed(headerId)){
mCollapseHeaderIds.remove((Object) headerId);
mCollapseHeaderIds.remove(headerId);
}
}

Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package se.emilsjolander.stickylistheaders;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.customview.view.AbsSavedState;
import android.util.AttributeSet;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

/**
@@ -20,8 +23,6 @@ public interface IAnimationExecutor{

ExpandableStickyListHeadersAdapter mExpandableStickyListHeadersAdapter;



IAnimationExecutor mDefaultAnimExecutor = new IAnimationExecutor() {
@Override
public void executeAnim(View target, int animType) {
@@ -53,7 +54,9 @@ public ExpandableStickyListHeadersAdapter getAdapter() {

@Override
public void setAdapter(StickyListHeadersAdapter adapter) {
mExpandableStickyListHeadersAdapter = new ExpandableStickyListHeadersAdapter(adapter);
mExpandableStickyListHeadersAdapter = (adapter instanceof SectionIndexingStickyListHeadersAdapter) ?
new SectionIndexingExpandableStickyListHeadersAdapter(((SectionIndexingStickyListHeadersAdapter) adapter)) :
new ExpandableStickyListHeadersAdapter(adapter);
super.setAdapter(mExpandableStickyListHeadersAdapter);
}

@@ -99,6 +102,14 @@ public boolean isHeaderCollapsed(long headerId){
return mExpandableStickyListHeadersAdapter.isHeaderCollapsed(headerId);
}

public List<Long> getCollapsedHeaderIds() {
return mExpandableStickyListHeadersAdapter.getCollapseHeaderIds();
}

public void setCollapsedHeaderIds(List<Long> collapsedHeaderIds ) {
mExpandableStickyListHeadersAdapter.setCollapseHeaderIds(collapsedHeaderIds);
}

public void setAnimExecutor(IAnimationExecutor animExecutor) {
this.mDefaultAnimExecutor = animExecutor;
}
@@ -123,4 +134,63 @@ private void animateView(final View target, final int type) {

}

@Override
public Parcelable onSaveInstanceState() {
return new SavedState(super.onSaveInstanceState(), mExpandableStickyListHeadersAdapter.getCollapseHeaderIds());
}

@Override
public void onRestoreInstanceState(Parcelable state) {
SavedState ss = (SavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
if (mExpandableStickyListHeadersAdapter != null) {
mExpandableStickyListHeadersAdapter.setCollapseHeaderIds(ss.collapsedHeaderIds);
}
}

static class SavedState extends AbsSavedState {
private List<Long> collapsedHeaderIds;

/**
* Constructor called from {@link StickyListHeadersListView#onSaveInstanceState()}
*/
SavedState(Parcelable superState, List<Long> collapsedHeaderIds) {
super(superState);
this.collapsedHeaderIds = collapsedHeaderIds;
}

private void readValues(Parcel in, ClassLoader loader) {
collapsedHeaderIds = new ArrayList<>();
in.readList(collapsedHeaderIds, loader);
}

SavedState(Parcel in, ClassLoader loader) {
super(in, loader);
readValues(in, loader);
}

@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeList(collapsedHeaderIds);
}

public static final Creator<SavedState> CREATOR = new ClassLoaderCreator<SavedState>() {
@Override
public SavedState createFromParcel(Parcel source, ClassLoader loader) {
return new SavedState(source, loader);
}

@Override
public SavedState createFromParcel(Parcel source) {
return createFromParcel(source, null);
}

@Override
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package se.emilsjolander.stickylistheaders;

import android.widget.SectionIndexer;

public class SectionIndexingExpandableStickyListHeadersAdapter extends ExpandableStickyListHeadersAdapter implements SectionIndexer {

SectionIndexingExpandableStickyListHeadersAdapter(SectionIndexingStickyListHeadersAdapter innerAdapter) {
super(innerAdapter);
}

@Override
public Object[] getSections() {
return getAdapter().getSections();
}

@Override
public int getPositionForSection(int sectionIndex) {
return getAdapter().getPositionForSection(sectionIndex);
}

@Override
public int getSectionForPosition(int position) {
return getAdapter().getSectionForPosition(position);
}

private SectionIndexingStickyListHeadersAdapter getAdapter() {
return ((SectionIndexingStickyListHeadersAdapter) mInnerAdapter);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package se.emilsjolander.stickylistheaders;

import android.widget.SectionIndexer;

public interface SectionIndexingStickyListHeadersAdapter extends StickyListHeadersAdapter, SectionIndexer {}
Loading