Use touch delegate from inbox / unified folders

pull/205/head
M66B 3 years ago
parent c82171f930
commit 58cc8c4ad1

@ -29,6 +29,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -40,6 +41,7 @@ import android.text.style.StyleSpan;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.TouchDelegate;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
@ -149,6 +151,23 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
} }
private void wire() { private void wire() {
view.post(new Runnable() {
@Override
public void run() {
int left = ibInbox.getLeft();
int right = ibInbox.getRight();
if (view.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR)
left = Math.min(left, right - view.getHeight());
else
right = Math.max(right, left + view.getHeight());
Rect rect = new Rect(
left,
view.getTop(),
right,
view.getBottom());
view.setTouchDelegate(new TouchDelegate(rect, ibInbox));
}
});
view.setOnClickListener(this); view.setOnClickListener(this);
view.setOnLongClickListener(this); view.setOnLongClickListener(this);
ibInbox.setOnClickListener(this); ibInbox.setOnClickListener(this);

Loading…
Cancel
Save