Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cymcsg committed Jan 7, 2016
2 parents 1c9c840 + 79753c5 commit 6228e01
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 30 deletions.
2 changes: 1 addition & 1 deletion UltimateRecyclerView/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:1.2.3'
classpath 'com.android.tools.build:gradle:1.3.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public UltimateRecyclerviewViewHolder onCreateViewHolder(ViewGroup parent, int v

@Override
public void onBindViewHolder(UltimateRecyclerviewViewHolder viewHolder, int position) {
int binderPosition = getBinderPosition(position);
getDataBinder(viewHolder.getItemViewType()).bindViewHolder(viewHolder, binderPosition);
//int binderPosition = getBinderPosition(position);
getDataBinder(viewHolder.getItemViewType()).bindViewHolder(viewHolder, position);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class BiAdAdapterSwitcher<
protected ADMOB withad;
protected onLoadMore loading_more;
protected boolean with_the_ad, auto_disable_loadmore = false;
protected int page_now = 1, max_pages = 3, layoutLoadMoreResId = 0;
protected int page_now = 1, max_pages = 3, layoutLoadMoreResId = 0, container_data_items;
protected RecyclerView.LayoutManager mManager;

public void setMaxPages(final int n) {
Expand Down Expand Up @@ -68,6 +68,17 @@ public void init(final boolean adenabled) {
listview.enableLoadmore();
}
listview.setAdapter(adenabled ? this.withad : this.noad);
emptyViewControl();
}


protected void emptyViewControl() {
container_data_items = with_the_ad ? withad.getItemCount() : noad.getItemCount();
if (container_data_items > 0) {
listview.hideEmptyView();
} else {
listview.showEmptyView();
}
}

public void scrollToTop() {
Expand Down Expand Up @@ -96,11 +107,12 @@ public interface onLoadMore {
public void run() {
reset();
if (loading_more != null) {
final boolean success = loading_more.request_start(1, 0, 0, BiAdAdapterSwitcher.this, true);
if (success) {
final boolean success_onStart = loading_more.request_start(1, 0, 0, BiAdAdapterSwitcher.this, true);
if (success_onStart) {
page_now = 2;
max_pages = 3;
//notifyDataSetChanged();

} else {
if (auto_disable_loadmore) listview.disableLoadmore();
/** not okay, maybe consider to disable load more. **/
Expand Down Expand Up @@ -151,6 +163,8 @@ private void reset() {
} else {
noad.removeAll();
}


}

public void load_more_data(final List<T> new_data_list) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.view.ViewHelper;

import java.lang.reflect.Type;


public class FloatingActionButton extends ImageButton {

Expand All @@ -45,17 +43,25 @@ public class FloatingActionButton extends ImageButton {

private static final int HALF_TRANSPARENT_WHITE = Color.argb(128, 255, 255, 255);
private static final int HALF_TRANSPARENT_BLACK = Color.argb(128, 0, 0, 0);

private final Interpolator mInterpolator = new AccelerateDecelerateInterpolator();
protected int mColorNormal;
protected int mColorPressed;
@DrawableRes
protected int mIcon;
protected int mSize;

protected float mCircleSize;
protected float mShadowRadius;
protected float mShadowOffset;
protected int mDrawableSize;
private boolean mHidden = false;
/**
* The FAB button's Y position when it is displayed.
*/
private float mYDisplayed = -1;
/**
* The FAB button's Y position when it is hidden.
*/
private float mYHidden = -1;

public FloatingActionButton(Context context) {
this(context, null);
Expand Down Expand Up @@ -143,7 +149,6 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(mDrawableSize, mDrawableSize);
}


protected float getCircleSize(int mSize) {
switch (mSize) {
case SIZE_NORMAL:
Expand Down Expand Up @@ -197,7 +202,6 @@ protected Drawable getIconDrawable() {
}
}


/**
* @param circleRect the defined rectangle
* @param alpha between 0 - 1
Expand Down Expand Up @@ -308,17 +312,6 @@ private void setBackgroundCompat(Drawable drawable) {
}
}

private final Interpolator mInterpolator = new AccelerateDecelerateInterpolator();
private boolean mHidden = false;
/**
* The FAB button's Y position when it is displayed.
*/
private float mYDisplayed = -1;
/**
* The FAB button's Y position when it is hidden.
*/
private float mYHidden = -1;

public void hide(boolean hide) {
// If the hidden state is being updated
if (mHidden != hide) {
Expand All @@ -327,7 +320,8 @@ public void hide(boolean hide) {
mHidden = hide;

// Animate the FAB to it's new Y position
ObjectAnimator animator = ObjectAnimator.ofFloat(this, "y", mHidden ? mYHidden : mYDisplayed).setDuration(500);
ObjectAnimator animator = ObjectAnimator.ofFloat(this, "translationY", mHidden ? mYHidden - mYDisplayed : 0).setDuration(500);

animator.setInterpolator(mInterpolator);
animator.start();
}
Expand Down
12 changes: 6 additions & 6 deletions UpcomingChanges.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
###Upcoming changes in 0.4.0:
### Upcoming changes in 0.4.0:

- [ ] change an other sticky header for optimising
- [ ] setSwipeToDismissCallback() throws a null pointer exception if there is no adapter set;
- [ ] trigger to bring the item back when swipe to dismiss
Expand All @@ -11,15 +12,14 @@
- [ ] Make adapter more easy to use
- [x] Expandble feature
- [ ] Change toolbar into CollapsingToolbarLayout
- [ ] Swipe with undo action

### Other changes:

###Other changes:
* More animations
* add swipe to refresh at the bottom
* etc...

* etc...



If you have some good idea, please tell us.My email is cymcsg # gmail.com.And it is a good idea to put your idea on the issue.
If you have some good idea, please tell us.My email is cymcsg # gmail.com.And it is a good idea to put your idea on the issue.

0 comments on commit 6228e01

Please sign in to comment.