From b3501a3a897c9266304414c2a767fd1d6ee530bf Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Wed, 11 Jul 2018 13:23:54 -0500 Subject: [PATCH] Remove contacts list bouncy efect for now --- .../fragments/ContactsFragment.java | 51 ------------------- app/src/main/res/layout/board.xml | 5 +- 2 files changed, 2 insertions(+), 54 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/ContactsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/ContactsFragment.java index e141f91..3d9d608 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/ContactsFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/ContactsFragment.java @@ -1,18 +1,15 @@ package cy.agorise.crystalwallet.fragments; -import android.app.Activity; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.Observer; import android.arch.lifecycle.ViewModelProviders; import android.arch.paging.PagedList; -import android.graphics.Point; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; -import android.view.Display; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -21,7 +18,6 @@ import butterknife.BindView; import butterknife.ButterKnife; import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.models.Contact; -import cy.agorise.crystalwallet.util.BounceTouchListener; import cy.agorise.crystalwallet.viewmodels.ContactListViewModel; import cy.agorise.crystalwallet.views.ContactListAdapter; @@ -32,10 +28,6 @@ public class ContactsFragment extends Fragment { ContactListAdapter adapter; - // Fields used to achieve bounce effect while over-scrolling the contacts list - private BounceTouchListener bounceTouchListener; - float pivotY1, pivotY2; - public ContactsFragment() { // Required empty public constructor } @@ -64,8 +56,6 @@ public class ContactsFragment extends Fragment { adapter = new ContactListAdapter(); rvContacts.setAdapter(adapter); - configureListBounceEffect(); - // Gets contacts LiveData instance from ContactsViewModel ContactListViewModel contactListViewModel = ViewModelProviders.of(this).get(ContactListViewModel.class); @@ -80,45 +70,4 @@ public class ContactsFragment extends Fragment { return view; } - - private void configureListBounceEffect() { - rvContacts.setPivotX(getScreenWidth(getActivity()) * 0.5f); - - pivotY1 = 0; - pivotY2 = (getScreenHeight(getActivity())) * .5f; - - bounceTouchListener = BounceTouchListener.create(rvContacts, new BounceTouchListener.OnTranslateListener() { - @Override - public void onTranslate(float translation) { - if(translation > 0) { - bounceTouchListener.setMaxAbsTranslation(-99); - rvContacts.setPivotY(pivotY1); - float scale = ((2 * translation) / rvContacts.getMeasuredHeight()) + 1; - rvContacts.setScaleY((float) Math.pow(scale, .6f)); - } else { - bounceTouchListener.setMaxAbsTranslation((int) (pivotY2 * .33f)); - rvContacts.setPivotY(pivotY2); - float scale = ((2 * translation) / rvContacts.getMeasuredHeight()) + 1; - rvContacts.setScaleY((float) Math.pow(scale, .5f)); - } - } - }); - - // Sets custom touch listener to handle bounce/stretch effect - rvContacts.setOnTouchListener(bounceTouchListener); - } - - public static int getScreenWidth(Activity activity) { - Display display = activity.getWindowManager().getDefaultDisplay(); - Point size = new Point(); - display.getSize(size); - return size.x; - } - - public static int getScreenHeight(Activity activity) { - Display display = activity.getWindowManager().getDefaultDisplay(); - Point size = new Point(); - display.getSize(size); - return size.y; - } } diff --git a/app/src/main/res/layout/board.xml b/app/src/main/res/layout/board.xml index 8e0b8e4..b53fe90 100644 --- a/app/src/main/res/layout/board.xml +++ b/app/src/main/res/layout/board.xml @@ -3,16 +3,15 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" + android:fitsSystemWindows="true" tools:context=".activities.BoardActivity"> @@ -102,7 +101,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_collapseMode="pin" - android:animateLayoutChanges="true" /> + app:tabIndicatorHeight="0dp"/>