Remove contacts list bouncy efect for now

This commit is contained in:
Severiano Jaramillo 2018-07-11 13:23:54 -05:00
parent 656ce4afb2
commit b3501a3a89
2 changed files with 2 additions and 54 deletions

View file

@ -1,18 +1,15 @@
package cy.agorise.crystalwallet.fragments; package cy.agorise.crystalwallet.fragments;
import android.app.Activity;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.arch.paging.PagedList; import android.arch.paging.PagedList;
import android.graphics.Point;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.Display;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -21,7 +18,6 @@ import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.models.Contact; import cy.agorise.crystalwallet.models.Contact;
import cy.agorise.crystalwallet.util.BounceTouchListener;
import cy.agorise.crystalwallet.viewmodels.ContactListViewModel; import cy.agorise.crystalwallet.viewmodels.ContactListViewModel;
import cy.agorise.crystalwallet.views.ContactListAdapter; import cy.agorise.crystalwallet.views.ContactListAdapter;
@ -32,10 +28,6 @@ public class ContactsFragment extends Fragment {
ContactListAdapter adapter; ContactListAdapter adapter;
// Fields used to achieve bounce effect while over-scrolling the contacts list
private BounceTouchListener bounceTouchListener;
float pivotY1, pivotY2;
public ContactsFragment() { public ContactsFragment() {
// Required empty public constructor // Required empty public constructor
} }
@ -64,8 +56,6 @@ public class ContactsFragment extends Fragment {
adapter = new ContactListAdapter(); adapter = new ContactListAdapter();
rvContacts.setAdapter(adapter); rvContacts.setAdapter(adapter);
configureListBounceEffect();
// Gets contacts LiveData instance from ContactsViewModel // Gets contacts LiveData instance from ContactsViewModel
ContactListViewModel contactListViewModel = ContactListViewModel contactListViewModel =
ViewModelProviders.of(this).get(ContactListViewModel.class); ViewModelProviders.of(this).get(ContactListViewModel.class);
@ -80,45 +70,4 @@ public class ContactsFragment extends Fragment {
return view; 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;
}
} }

View file

@ -3,16 +3,15 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activities.BoardActivity"> tools:context=".activities.BoardActivity">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height" android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
app:theme="@style/AppTheme.AppBarOverlay"> app:theme="@style/AppTheme.AppBarOverlay">
@ -102,7 +101,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
android:animateLayoutChanges="true" /> app:tabIndicatorHeight="0dp"/>
</android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.CollapsingToolbarLayout>