mirror of
https://github.com/yuliskov/SmartTube.git
synced 2025-05-17 19:35:54 +08:00
add focus fix layout; message adapter small refactor
This commit is contained in:
Submodule MediaServiceCore updated: 12f40c7c8a...17acaaa2ba
@ -71,6 +71,7 @@ public class MessagesListAdapter<MESSAGE extends IMessage>
|
||||
private DateFormatter.Formatter dateHeadersFormatter;
|
||||
private SparseArray<OnMessageViewClickListener> viewClickListenersArray = new SparseArray<>();
|
||||
private boolean isTopDateEnabled;
|
||||
private int currentPosition = -1;
|
||||
|
||||
/**
|
||||
* For default list item layout and view holder.
|
||||
@ -711,6 +712,15 @@ public class MessagesListAdapter<MESSAGE extends IMessage>
|
||||
};
|
||||
}
|
||||
|
||||
private View.OnFocusChangeListener getMessageFocusChangeListener(final Wrapper<MESSAGE> wrapper) {
|
||||
return (v, hasFocus) -> {
|
||||
if (hasFocus) {
|
||||
MESSAGE message = (wrapper.item);
|
||||
currentPosition = getMessagePositionById(message.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private String getSelectedText(Formatter<MESSAGE> formatter, boolean reverse) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.liskovsoft.smartyoutubetv2.tv.ui.widgets.focus;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import androidx.leanback.widget.BrowseFrameLayout;
|
||||
|
||||
public class FocusFixBrowseFrameLayout extends BrowseFrameLayout {
|
||||
public FocusFixBrowseFrameLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public FocusFixBrowseFrameLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public FocusFixBrowseFrameLayout(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View focusSearch(View focused, int direction) {
|
||||
return focused;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user