Skip to content

rtlMenuSidebar solved #90

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layoutDirection="rtl"
>

<io.codetail.widget.RevealFrameLayout
android:id="@+id/container_frame"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
* Created by Konstantin on 12.01.2015.
*/
public class ViewAnimator<T extends Resourceble> {
private final int ANIMATION_DURATION = 175;
private final int ANIMATION_DURATION = 250;
public static final int CIRCULAR_REVEAL_ANIMATION_DURATION = 500;

private AppCompatActivity appCompatActivity;

private List<T> list;

private List<View> viewList = new ArrayList<>();
Expand Down Expand Up @@ -58,13 +58,15 @@ public void showMenuContent() {
viewMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int[] location = {0, 0};
int[] location = {appCompatActivity.getWindow().getDecorView().getWidth(), 0};
v.getLocationOnScreen(location);
switchItem(list.get(finalI), location[1] + v.getHeight() / 2);
}
});
((ImageView) viewMenu.findViewById(R.id.menu_item_image)).setImageResource(list.get(i).getImageRes());
viewMenu.setVisibility(View.GONE);

viewMenu.setVisibility(View.INVISIBLE);

viewMenu.setEnabled(false);
viewList.add(viewMenu);
animatorListener.addViewToContainer(viewMenu);
Expand Down Expand Up @@ -112,8 +114,7 @@ private void setViewsClickable(boolean clickable) {
private void animateView(int position) {
final View view = viewList.get(position);
view.setVisibility(View.VISIBLE);
FlipAnimation rotation =
new FlipAnimation(90, 0, 0.0f, view.getHeight() / 2.0f);
FlipAnimation rotation = new FlipAnimation(-90, 0, view.getWidth(), view.getHeight() / 2.0f);
rotation.setDuration(ANIMATION_DURATION);
rotation.setFillAfter(true);
rotation.setInterpolator(new AccelerateInterpolator());
Expand All @@ -139,8 +140,7 @@ public void onAnimationRepeat(Animation animation) {

private void animateHideView(final int position) {
final View view = viewList.get(position);
FlipAnimation rotation =
new FlipAnimation(0, 90, 0.0f, view.getHeight() / 2.0f);
FlipAnimation rotation = new FlipAnimation(0, -90, view.getWidth(), view.getHeight() / 2.0f);
rotation.setDuration(ANIMATION_DURATION);
rotation.setFillAfter(true);
rotation.setInterpolator(new AccelerateInterpolator());
Expand Down Expand Up @@ -185,4 +185,4 @@ public interface ViewAnimatorListener {
public void addViewToContainer(View view);

}
}
}