increased swipe escape velocity by 10x

This commit is contained in:
Daniel Gultsch 2018-04-25 12:56:48 +02:00
parent 8baef866ce
commit 2d7e5a12aa
2 changed files with 10 additions and 0 deletions

View File

@ -73,6 +73,7 @@ public class ConversationsOverviewFragment extends XmppFragment {
private FragmentConversationsOverviewBinding binding; private FragmentConversationsOverviewBinding binding;
private ConversationAdapter conversationsAdapter; private ConversationAdapter conversationsAdapter;
private XmppActivity activity; private XmppActivity activity;
private float mSwipeEscapeVelocity = 0f;
private PendingActionHelper pendingActionHelper = new PendingActionHelper(); private PendingActionHelper pendingActionHelper = new PendingActionHelper();
private ItemTouchHelper.SimpleCallback callback = new ItemTouchHelper.SimpleCallback(0,LEFT|RIGHT) { private ItemTouchHelper.SimpleCallback callback = new ItemTouchHelper.SimpleCallback(0,LEFT|RIGHT) {
@ -82,6 +83,11 @@ public class ConversationsOverviewFragment extends XmppFragment {
return false; return false;
} }
@Override
public float getSwipeEscapeVelocity (float defaultValue) {
return mSwipeEscapeVelocity;
}
@Override @Override
public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder,
float dX, float dY, int actionState, boolean isCurrentlyActive) { float dX, float dY, int actionState, boolean isCurrentlyActive) {
@ -232,6 +238,8 @@ public class ConversationsOverviewFragment extends XmppFragment {
@Override @Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d(Config.LOGTAG, "onCreateView"); Log.d(Config.LOGTAG, "onCreateView");
this.mSwipeEscapeVelocity = getResources().getDimension(R.dimen.swipe_escape_velocity);
Log.d(Config.LOGTAG,"swipe escape velocity: "+this.mSwipeEscapeVelocity);
this.binding = DataBindingUtil.inflate(inflater, R.layout.fragment_conversations_overview, container, false); this.binding = DataBindingUtil.inflate(inflater, R.layout.fragment_conversations_overview, container, false);
this.binding.fab.setOnClickListener((view) -> StartConversationActivity.launch(getActivity())); this.binding.fab.setOnClickListener((view) -> StartConversationActivity.launch(getActivity()));

View File

@ -22,4 +22,6 @@
<!-- scanner --> <!-- scanner -->
<dimen name="scan_laser_width">4dp</dimen> <dimen name="scan_laser_width">4dp</dimen>
<dimen name="scan_dot_size">8dp</dimen> <dimen name="scan_dot_size">8dp</dimen>
<dimen name="swipe_escape_velocity">1200dp</dimen> <!-- android default is 120dp -->
</resources> </resources>