Giter Site home page Giter Site logo

janishar / placeholderview Goto Github PK

View Code? Open in Web Editor NEW
2.1K 80.0 365.0 67.22 MB

This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS -->

Home Page: http://janishar.com/PlaceHolderView

License: Apache License 2.0

Java 100.00%
placeholderview annotations android animation loadmore recyclerview swipeview swipe listview gridview

placeholderview's Introduction

PlaceHolderView
An advance view for lists and stacks

Download 2.x License

Some Implementations


Documentation

You can find the PlaceHolderView documentation here which has extended usage instructions and other useful information.


About PlaceHolderView

Some of the views in PlaceHolderView library is build on top of RecyclerView and rest are written in its own.

About The Author

You can connect with me here:

All the annotations are processed during build time to generate the binding classes

There are two versions available for use.

  1. Old version (branch 1.x): Uses Java reflection
  2. New version (branch 2.x): Uses Annotation Processing.

This library provides 5 different type of views

  1. PlaceHolderView
    It is build on top of RecyclerView and abstracts most of the boiler plate. It provides APIs through annotations.

  2. InfinitePlaceHolderView
    It is build on PlaceHolderView and adds the functionality of handling load more views when the user has scrolled to the bottom of the list.

  3. ExpandablePlaceHolderView
    It is build on PlaceHolderView and creates ExpandableListView with parent-child relation.

  4. SwipePlaceHolderView
    It is not build on RecyclerView. Its a ground up implementation. We can create a variety of card stack views using this class. It provides APIs that could easily build Tinder like cards.

  5. SwipeDirectionalView
    It is build on top of SwipePlaceHolderView. It provides callbacks for swipe directions and touch events.

How to use newer version (2.x branch) with annotation processing

Gradle dependency:

Java

dependencies {
    ...
    compile 'com.mindorks.android:placeholderview:1.0.3'
    annotationProcessor 'com.mindorks.android:placeholderview-compiler:1.0.3'

    // RecyclerView dependency is added to override the
    // default 25.4.1 RecyclerView dependency used by placeholderview.
    // If you are using the support libraries other than 25.x in the project
    compile 'com.android.support:recyclerview-v7:<current-version>' // example: 27.1.0
}

Kotlin

dependencies {
    ...
    // RecyclerView dependency is added to override the
    // default 25.4.1 RecyclerView dependency stated by placeholderview
    // since we are using the 27.+ support libraries in the project
    implementation 'com.android.support:recyclerview-v7:27.1.0'
    implementation 'com.mindorks.android:placeholderview:1.0.3'
    kapt 'com.mindorks.android:placeholderview-compiler:1.0.3'
}

For use with Kotlin refer to Kotlin docs.

Migration:

It is super easy to migrate to 2.x branch library version.

To migrate from 1.x to 2.x see Migration doc here.


How to Use older version (1.x branch)

If you want to use older version of PlaceHoldeView that used reflection, then you can use below dependecies.

Gradle dependency:

dependencies {
    compile 'com.mindorks:placeholderview:0.7.3'
}

Dependency: It depends on the RecyclerView

Add below lines in your app's build.gradle if recyclerview above v7:25 is being used

    // NOTE: change the version of recyclerview same as the your project's support library version
    com.android.support:recyclerview-v7:25.+

Proguard Note:

If you are using proguard, then add this rule in proguard-project.txt

  -keepattributes *Annotation*
  -keepclassmembers class ** {
    @com.mindorks.placeholderview.annotations.** <methods>;
  }

If this library helps you in anyway, show your love ❤️ by putting a ⭐ on this project ✌️

TO-DOs

  • Update/Refresh the View already shown in the stack.
  • Callback when a card comes on top of the stack.
  • Provide Undo for the entire swipe history.
  • Provide Sort for the PlaceHolderView.

License

   Copyright (C) 2023 Janishar Ali Anwar

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License

placeholderview's People

Contributors

amitshekhariitbhu avatar bloderxd avatar janishar avatar jtbrinkmann avatar passsy avatar praveen-pro avatar yavuzyurtbegendi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

placeholderview's Issues

Where to put @SwipeIn/Annotations?

I don't know where I do put the @SwipeIn annotation because in my main activity it doesn't work.
Thanks for help!

EDIT: Well I found it. You put it in (Tinder)Card.java

Crash: NullPointerException in PropertyValuesHolder.setupSetterAndGetter

Hi !

I have a regressed and big crash inside PropertyValuesHolder. It's appear mainly for users with API 19, 16 and 17. I used IntinitePlaceHolderView and PlaceHolderView with version 5.0, and I don't have any idea about this issue. Can you help me? Thanks!

Detail:


Exception java.lang.NullPointerException:
android.animation.PropertyValuesHolder.setupSetterAndGetter (PropertyValuesHolder.java:505)
android.animation.ObjectAnimator.initAnimation (ObjectAnimator.java:392)
android.animation.ValueAnimator.startAnimation (ValueAnimator.java:1031)
android.animation.ValueAnimator.access$100 (ValueAnimator.java:51)
android.animation.ValueAnimator$AnimationHandler.doAnimationFrame (ValueAnimator.java:572)
android.animation.ValueAnimator$AnimationHandler.run (ValueAnimator.java:639)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:725)
android.view.Choreographer.doCallbacks (Choreographer.java:555)
android.view.Choreographer.doFrame (Choreographer.java:524)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:711)
android.os.Handler.handleCallback (Handler.java:615)
android.os.Handler.dispatchMessage (Handler.java:92)
android.os.Looper.loop (Looper.java:137)
android.app.ActivityThread.main (ActivityThread.java:4867)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1007)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:774)
dalvik.system.NativeStart.main (NativeStart.java)

Gravity issue

Hi! Thank you for the cool library first of all. I have a problem using it. So, I have the following code in my Relative layout. So, it is just the all screen, you know.

<com.mindorks.placeholderview.SwipePlaceHolderView android:id="@+id/cards_container" android:layout_width="match_parent" android:layout_height="match_parent" />

I have the following layout for the cardview
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/pod_card" android:layout_width="@dimen/card_width" android:layout_height="@dimen/card_height" card_view:cardCornerRadius="4dp" card_view:cardElevation="4dp" card_view:cardUseCompatPadding="true">

With that layout I have the cards placed in the center of screen. That is fine, i think. But I want to place content at the bottom, with some padding. So, I write this in my Activity:

.setSwipeDecor(new SwipeDecor() .setViewGravity(Gravity.BOTTOM) .setRelativeScale(0.01f));

Am I correct, that this should place the content at the bottom of view? I see that it is showing the cards content at the center.

ExpandablePlaceHolderView inside InfinitePlaceHolderView

Hello,
I'm playing with the examples and I need to have expandable itens in infinite list loading.
I've got the News Feed and Infinite List with Load More and tried to merge both but with no success.
Is it possible to do that using this library or it would need some hack or anything like it?
Thank you

@Click behavior bug for SwipePlaceHolderView

Hey,

First of all, thanks for the awesome work on PlaceHolderView! It's by far the best and most professional Android library of its kind. 👏

I've noticed an odd behavior while using SwipePlaceHolderView. This is the context of the bug:

  1. I have a stack of 3 cards: A, B and C added in this order.
  2. Each card has a few buttons on it. I'm setting click handlers for the buttons with @Click.
  3. When I click a button on the first card of the deck (A), the last card of the deck (C) is triggered instead. C is not visible at all to the user as it's below in the deck.

I've created a repository demonstrating this: PlaceHolderView bug. If you run it and click the buttons, you'll notice in the debug log that the wrong button is being triggered.

Let me know if I'm doing something wrong - maybe this is not the proper way to do what I'm trying to achieve...

In addition, if this is really a bug and you don't have time to tackle it in the library, perhaps I could help with a PR if you give me some pointers as to where the issue might be.

Thanks again!

NullPointerException on bindSwipeCancelState() method.

Hello @janishar ,
I have been facing crash on swipe cards while i cancel swipe of cards. It is a random crash but happning too many times.

It happens while I have loaded cards on fragment and change the tab. When i came back and try to swiping a card. But when i cancel swiping card, app got crashed.

Please look on this bug. Thanks.

## Stack Trace :

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
at com.mindorks.placeholderview.SwipeViewBinder.bindSwipeCancelState(SwipeViewBinder.java:196)
at com.mindorks.placeholderview.SwipePlaceHolderView.onResetView(SwipePlaceHolderView.java:593)
at com.mindorks.placeholderview.SwipeViewBinder$2.onAnimationEnd(SwipeViewBinder.java:256)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1116)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1171)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:722)
at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:738)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:549)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

InfinitePlaceHolderView: some item doesn't display on first load

In my project. I added 20 item views into an InfinitiePlaceHolder using addView method.

At the first load, some of the item views doesn't display, some of them does.

Scrolling up/down or calling refresh method on InfinitiePlaceHolder make missing item views appear.

I'm using Kotlin. BTW

Cards Blank in release build

Hello, Cards are blank. Data is their and its working if i use debuggable apk but not shwoing any content in release apk

ActivityTinder can work using Fragment?

I'm Newbie in android. Can tell me the ActivityTinder how can work using Fragment?
I getting NullPointerException in Fragment.

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_swipe, container, false);
        ButterKnifeLite.bind(getActivity(),view);
        // Inflate the layout for this fragment
        return view;
    }
@Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);

        mSwipView.disableTouchSwipe();
        mSwipView.getBuilder()
//              .setSwipeType(SwipePlaceHolderView.SWIPE_TYPE_VERTICAL)
                .setDisplayViewCount(3)
                .setIsUndoEnabled(true)
                .setWidthSwipeDistFactor(15)
                .setHeightSwipeDistFactor(20)
                .setSwipeDecor(new SwipeDecor()
//                        .setMarginTop(300)
//                        .setMarginLeft(100)
//                        .setViewGravity(Gravity.TOP)
                        .setPaddingTop(20)
                        .setRelativeScale(0.01f)
                        .setSwipeInMsgLayoutId(R.layout.tinder_swipe_in_msg_view)
                        .setSwipeOutMsgLayoutId(R.layout.tinder_swipe_out_msg_view));

        mSwipView.addView(new TinderCard())
                .addView(new TinderCard())
                .addView(new TinderCard())
                .addView(new TinderCard())
                .addView(new TinderCard())
                .addView(new TinderCard())
                .addView(new TinderCard())
                .addView(new TinderCard())
                .addView(new TinderCard())
                .addView(new TinderCard());

        new Thread(new Runnable(){
            @Override
            public void run() {
                try {
                    Thread.currentThread().sleep(8000);
                    mSwipView.enableTouchSwipe();
//                    mSwipView.lockViews();
//                    Thread.currentThread().sleep(4000);
//                    mSwipView.unlockViews();
//                    Thread.currentThread().sleep(4000);
//                    mSwipView.lockViews();
//                    Thread.currentThread().sleep(4000);
//                    mSwipView.unlockViews();
                }catch (InterruptedException e){
                    e.printStackTrace();
                }
            }
        }).start();
    }

The error as:
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.mindorks.placeholderview.SwipePlaceHolderView.disableTouchSwipe()' on a null object reference

Undo is not working

Hi! I have the following setup:

mCardsContainer.builder`
                .setDisplayViewCount(1)
                .setSwipeDecor(SwipeDecor()
                        .setPaddingTop(10)
                        .setRelativeScale(0.01f))

        mCardsContainer.disableTouchSwipe()

For SwipePlaceHolderView.
When I'm doing the mCardsContainer.undoLastSwipe() nothing happens at all. Is this because of disableTouchSwipe?

update events call upons

just a quick question if the holder support supports late update events in the view holder.
for example, I got this hierarchy...
PlaceHolderView
.
.
PlaceHolderView
.
.
.
PlaceHolderView
.
.
The Child Holder

Can I possibly update this child with late event with http request?

Intermediate callback before @SwipeIn / @SwipeOut

is it possible to get a callback before @SwipeIn, @SwipeOut event completes which will return a boolean. True completes the operation and False cancels the operation (ie puts the card back on the stack where it was).
you can dispatch the @SwipeIn and @SwipeOut after that.

ie. @SwipeIn generates a @SwipeInConfirm and @SwipeIn if @SwipeInConfirm returns True.

why do I need it? I want to be able to confirm with user whether that was their intended action. If 'Yes' I return True if 'Cancel' I return False.

@Click annotation

if i set @click on profileImageView (from your eg) it does not receive any of onSwipe* events!
how does one go about it?

Implementation for Endless Adapter be implemented?

The PlaceHolderView really looks promising. Is there a way we can effortlessly implement endless adapter kinda functionality. Say, I have thousands of itemsData to be displayed and I want to display them in sets of 10 at a time. I need a call back to LoadMore once I reach the last item.
I hope you get the idea.
Thanks

Reusing ExpandablePlaceHolderView

In my code I need to clear ExpandablePlaceHolderView list content and reload new itens on there ate the same screen, beause I have a filter in that.
But seems it has some problem in clearing or notifying the adapter, since after I call expandableView.removeAllViews() and after add the new itens, it gives the following error:
08-02 12:06:26.721 15844-15844/ E/AndroidRuntime: FATAL EXCEPTION: main Process: , PID: 15844 java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 0(offset:11).state:6 at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5504) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595) at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3534) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3310) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3844) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:736) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2480) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2199) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1385) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6722) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:886) at android.view.Choreographer.doCallbacks(Choreographer.java:698) at android.view.Choreographer.doFrame(Choreographer.java:633) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:872) at android.os.Handler.handleCallback(Handler.java:769) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6540) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 08-02 12:06:26.722 15844-15844/ E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 08-02 12:06:26.723 15844-15844/ E/UncaughtException: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 0(offset:11).state:6 at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5504) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595) at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3534) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3310) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3844) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:736) at android.view.View.layout(View.java:19393) at android.view.ViewGroup.layout(ViewGroup.java:6022) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2480) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2199) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1385) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6722) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:886) at android.view.Choreographer.doCallbacks(Choreographer.java:698) at android.view.Choreographer.doFrame(Choreographer.java:633) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:872) at android.os.Handler.handleCallback(Handler.java:769) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6540) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

SwipePlaceHolderView in a ViewPager

Hi,
I have a ViewPager containing two fragments. Each of those fragments have a SwipePlaceHolderView.
When I try to swipe purely horizontaly a card, the ViewPager intercept the touch action, and swipe between the fragments instead of the card.

How to solve this issue ?

Edit: using requestDisallowInterceptTouchEvent() method on the ViewPager works to disable its swipe. I try calling it in onSwipeInState() and onSwipeOutState(). It work when doing the swipe slowly only.

Edit2: a solution would be to be able to call requestDisallowInterceptTouchEvent() whenever the card in touched or released. Can I catch this event without going deep into your code ?

Swipe turn off

Hi! As I see in the changelog of last version you have added the possibility to turn off the swipe functionality. Unfortunately it is turning off all animations of swipe.

I will briefly describe my case: I want user to have ability to pass through cards by clicking buttons on them. But I don't want him to have ability to swipe or drag cards.

Is this possible using your library?

Disable swiping for SwipePlaceHolderView

Hey, I was wondering if the library allows us to disable swiping somehow for SwipePlaceHolderView? Meaning cards could only be swiped programatically.

If it doesn't, this would be a cool feature to have - something like swipePHView.setSwipeEnabled(false).

Let me know if a pull request for this would be desirable 😃 Thanks!

Checkbox missing value

I have added checkbox in placeholderview. When i scroll, checkbox is reset to first value.

Get Swipe distance

I would like to change the background color of the card. For smooth color fading I want to set the alpha of the background color based on the distance swiped.
Is there any way to get the swipe distance (left and right)?

I tried @position annotation but it always seems to be returning zero.

miss touch event for the sub children

There is a situation where the CoordinatorLayout or AppBarLayout didnt response to the touch of the sub children of the placeholderview.

<android.support.design.widget.CoordinatorLayout
<android.support.design.widget.AppBarLayout
</android.support...AppBarLayout>

< com.mindorks.placeholderview.PlaceHolderView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>

It is observed that only the first layer of children with the touch event can dictate the movement of the AppBarLayout.

Nested PlaceHolderView: rapid scroll up and down cause crash

There is an dimension issue when scrolling up and down on the placeholderview.

com.mindorks.placeholderview.PlaceHolderView#onMeasure() did not set the measured dimension by calling setMeasuredDimension()

It seems to be too heavy when calling refresh on the parent placeholderview when the child has an update on the dimensions and items.

I think the problem would be better to ask how to make the parent placeviewholder to refresh at the marked child placviewholder.

Continuation to #3

the fixes seem to send @click to the TinderCard class. However, the click listeners in the MainActivity.java (for eg: R.id.acceptBtn, R.id.rejectBtn) do not work any more!

I have not exactly tested with the above classes but have code that parallel's that. So, I'm guessing the issue exists here too. My code does not receive the click events for buttons sitting in the parent frame.

Knowing the view that was swiped

Hello, placeHolderView is quite good but I can't for instance get the profile of the current view because I can't access it's number consistently through onItemRemoved.

Is there a way I can get the view whenever doSwipe was done? Is it also possible to see if it received a true or false when it was called?

Gratefull
Matheus

PlaceHolderView inside Placeholderview

Hi how are you?
while I use this library. I have found issue as follow.
I'd like to place horizontal phv inside vertical phv cell's.
But outside phv has another cells that does not include phv.

At that time, I added cells to v-phv like below order.

  1. cell without h-phv
  2. cell with h-phv
  3. repeat 2 as much as need.

Issue : when view loaded, initial scroll position of v-phv is offset to show second cell's h-phv.
Please ref attached image.
image

What I tried :

  1. force scroll to (0, 0) after add cells.
  2. h-phv's focusable = false

but I did not resolve this.
How could i fix it?
Looking forward your help.

Thanks

Unwanted card displayed

When swipe cards then suddenly a random card occurred with small size but swipe gesture is working fine.

StickyHeaderItemDecoration for PlaceHolderView

Hi, nice job on PlaceholderView. It's awesome.

I already have a StickyHeaderItemDecoration, how can I attach it to PlaceHolderView to get Headers that stick to the top on scroll, Like on WhatsApp Chat Screen. Thanks.

lifecycle

There are leaks found in side of the viewholder because there is an object that has been declared in static level at the constructor. What is the proper annotation that i can declare to destroy such objects?
@janishar
I have found..

@PreDestroy
    private void destroy() {

    }

Animate undoLastSwipe

Is there any easy way to animate the card when undoLastSwipe is called?
Animation similar to activatePutBack.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.