mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-20 13:17:08 +00:00
Allow hardware select, focus fixes
This commit is contained in:
parent
c01293a53c
commit
7286b3ac25
8 changed files with 29 additions and 20 deletions
|
@ -61,6 +61,7 @@ import android.text.style.ImageSpan;
|
|||
import android.text.style.QuoteSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.TypedValue;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -218,8 +219,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
));
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements
|
||||
View.OnClickListener,
|
||||
BottomNavigationView.OnNavigationItemSelectedListener, View.OnLongClickListener {
|
||||
View.OnClickListener, View.OnLongClickListener, View.OnKeyListener,
|
||||
BottomNavigationView.OnNavigationItemSelectedListener {
|
||||
private View view;
|
||||
private View vwColor;
|
||||
private ImageView ivExpander;
|
||||
|
@ -471,6 +472,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
view.setTouchDelegate(new TouchDelegate(rect, touch));
|
||||
}
|
||||
});
|
||||
view.setOnKeyListener(this);
|
||||
|
||||
ivSnoozed.setOnClickListener(this);
|
||||
ivFlagged.setOnClickListener(this);
|
||||
|
@ -499,11 +501,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
}
|
||||
|
||||
private void unwire() {
|
||||
if (viewType == ViewType.THREAD) {
|
||||
vwColor.setOnClickListener(null);
|
||||
ivExpander.setOnClickListener(null);
|
||||
} else
|
||||
view.setOnClickListener(null);
|
||||
final View touch = (viewType == ViewType.THREAD ? ivExpander : vwColor);
|
||||
touch.setOnClickListener(null);
|
||||
view.setOnKeyListener(null);
|
||||
|
||||
ivSnoozed.setOnClickListener(null);
|
||||
ivFlagged.setOnClickListener(null);
|
||||
|
@ -1540,6 +1540,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKey(View view, int keyCode, KeyEvent keyEvent) {
|
||||
if (keyEvent.getAction() == KeyEvent.ACTION_DOWN &&
|
||||
(keyCode == KeyEvent.KEYCODE_ENTER ||
|
||||
keyCode == KeyEvent.KEYCODE_DPAD_CENTER ||
|
||||
keyCode == KeyEvent.KEYCODE_BUTTON_A)) {
|
||||
onClick(view);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
private void onShowSnoozed(TupleMessageEx message) {
|
||||
if (message.ui_snoozed != null) {
|
||||
DateFormat DTF = Helper.getDateTimeInstance(context, SimpleDateFormat.MEDIUM, SimpleDateFormat.SHORT);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--item android:drawable="@color/colorPrimary" android:state_focused="true" /-->
|
||||
<item android:drawable="@color/darkColorItemSelected" android:state_activated="true" />
|
||||
<item android:drawable="@android:color/transparent" />
|
||||
</selector>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--item android:drawable="@color/colorPrimary" android:state_focused="true" /-->
|
||||
<item android:drawable="@color/lightColorItemSelected" android:state_activated="true" />
|
||||
<item android:drawable="@android:color/transparent" />
|
||||
</selector>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clItem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clItem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/activatableItemBackground"
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:paddingEnd="3dp">
|
||||
|
||||
<View
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clItem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/activatableItemBackground"
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:paddingEnd="3dp">
|
||||
|
||||
<View
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
android:id="@+id/clItem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/activatableItemBackground">
|
||||
android:background="?attr/activatableItemBackground"
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<include
|
||||
android:id="@+id/inHeader"
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
android:id="@+id/clItem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/activatableItemBackground">
|
||||
android:background="?attr/activatableItemBackground"
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<include
|
||||
android:id="@+id/inHeader"
|
||||
|
|
Loading…
Reference in a new issue