Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve annotation & implement shared element transition #40

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ You can use this `FragmentRigger` with one line annotation.
- [x] **Option to configure fragment tag**
- [x] **Add `onBackPressed` method support for the fragment that is not added into stack**
- [ ] **Option to configure fragment launch mode**
- [ ] **Fragment shared elements transition animations**
- [x] **Fragment shared elements transition animations**
- [ ] **Swipe edge to exit Fragment/Activity**
- [ ] **Support DialogFragment**
- [ ] **Support DialogFragment** [WIP]

### Problem solved
* ~~Fragment view overlapping~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,15 @@
* @return The default value is false.
*/
boolean stickyStack() default false;

/**
* Allow or not exit the host {@link android.app.Activity}/{@link android.support.v4.app.Fragment} when
* the stack size = 0
*
* If the value is true , the host object(Activity/Fragment) will not be exit
* Otherwise , the host object(Activity/Fragment) will act as normal.
*
* @return The default value is true.
*/
boolean closeIfEmpty() default true;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you tried bondContainerView = true or stickyStack = true ?

Copy link
Author

@namkazt namkazt Jul 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes i was but it just not work on my case.
Example: i have main screen with 5 fragments (5 nav menu items) and i using addFragment to add it and this method do not add to stack. so when i create new fragment with startFragment and after finish i close it. it will check onBackPress because my stack = 0 so it close activity

i meant the case when you have like 5 fragments on Map ( will not change on app life cycle ) but 0 on stack and you want to keep it when you add and remove other fragment from stack without trigger close() if stack size = 0

Copy link
Author

@namkazt namkazt Jul 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JustKiddingBaby check show demo you will see it close application when you press back button that is something maybe user want to avoid

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@namkazt OK, i got it , thanks for the PR , i will review in weekend and merge it as soon .

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@namkazt please change the target branch to dev

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okey. will fix conflict when have free time.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.jkb.fragment.rigger.helper;

import android.support.v4.view.ViewCompat;
import android.view.View;

import java.lang.ref.WeakReference;

public class SharedElement {
public WeakReference<View> referenceView;
public String transactionName;
public static SharedElement create(View refView, String transName){
SharedElement sharedElement = new SharedElement();
sharedElement.referenceView = new WeakReference<>(refView);
sharedElement.transactionName = transName;
return sharedElement;
}
public static SharedElement create(View refView){
return create(refView, ViewCompat.getTransitionName(refView));
}
}
Loading