mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-21 01:10:24 +00:00
upgrade build.gradle and do some code inspection stuff
This commit is contained in:
parent
f825436449
commit
528bbb4f7f
33 changed files with 192 additions and 256 deletions
|
@ -67,8 +67,8 @@ import java.util.ArrayList;
|
|||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
public final class SuggestionStripView extends RelativeLayout implements OnClickListener,
|
||||
OnLongClickListener {
|
||||
|
@ -76,7 +76,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
void pickSuggestionManually(SuggestedWordInfo word);
|
||||
void onCodeInput(int primaryCode, int x, int y, boolean isKeyRepeat);
|
||||
void removeSuggestion(final String word);
|
||||
CharSequence getSelection();
|
||||
}
|
||||
|
||||
public static boolean DEBUG_SUGGESTIONS;
|
||||
|
@ -124,8 +123,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
}
|
||||
|
||||
public void setLayoutDirection(final int layoutDirection) {
|
||||
ViewCompat.setLayoutDirection(mSuggestionStripView, layoutDirection);
|
||||
ViewCompat.setLayoutDirection(mSuggestionsStrip, layoutDirection);
|
||||
mSuggestionStripView.setLayoutDirection(layoutDirection);
|
||||
mSuggestionsStrip.setLayoutDirection(layoutDirection);
|
||||
}
|
||||
|
||||
public void showSuggestionsStrip() {
|
||||
|
@ -141,6 +140,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
this(context, attrs, R.attr.suggestionStripViewStyle);
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams") // does not seem suitable here
|
||||
public SuggestionStripView(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||
|
@ -183,6 +183,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
R.dimen.config_more_suggestions_modal_tolerance);
|
||||
mMoreSuggestionsSlidingDetector = new GestureDetector(context, mMoreSuggestionsSlidingListener);
|
||||
|
||||
@SuppressLint("CustomViewStyleable")
|
||||
final TypedArray keyboardAttr = context.obtainStyledAttributes(attrs, R.styleable.Keyboard, defStyle, R.style.SuggestionStripView);
|
||||
mIncognitoIcon = keyboardAttr.getDrawable(R.styleable.Keyboard_iconIncognitoKey);
|
||||
mToolbarArrowIcon = keyboardAttr.getDrawable(R.styleable.Keyboard_iconToolbarKey);
|
||||
|
@ -262,9 +263,9 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
public void setRtl(final boolean isRtlLanguage) {
|
||||
final int layoutDirection;
|
||||
if (!Settings.getInstance().getCurrent().mVarToolbarDirection)
|
||||
layoutDirection = ViewCompat.LAYOUT_DIRECTION_LOCALE;
|
||||
layoutDirection = View.LAYOUT_DIRECTION_LOCALE;
|
||||
else{
|
||||
layoutDirection = isRtlLanguage ? ViewCompat.LAYOUT_DIRECTION_RTL : ViewCompat.LAYOUT_DIRECTION_LTR;
|
||||
layoutDirection = isRtlLanguage ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR;
|
||||
mRtl = isRtlLanguage ? -1 : 1;
|
||||
}
|
||||
mStripVisibilityGroup.setLayoutDirection(layoutDirection);
|
||||
|
@ -528,7 +529,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
private final GestureDetector.OnGestureListener mMoreSuggestionsSlidingListener =
|
||||
new GestureDetector.SimpleOnGestureListener() {
|
||||
@Override
|
||||
public boolean onScroll(MotionEvent down, MotionEvent me, float deltaX, float deltaY) {
|
||||
public boolean onScroll(@Nullable MotionEvent down, @NonNull MotionEvent me, float deltaX, float deltaY) {
|
||||
if (down == null) return false;
|
||||
final float dy = me.getY() - down.getY();
|
||||
if (mToolbarContainer.getVisibility() != VISIBLE && deltaY > 0 && dy < 0) {
|
||||
return showMoreSuggestions();
|
||||
|
@ -637,7 +639,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
AudioAndHapticFeedbackManager.getInstance().performHapticAndAudioFeedback(KeyCode.NOT_SPECIFIED, this);
|
||||
final Object tag = view.getTag();
|
||||
if (tag instanceof ToolbarKey) {
|
||||
final Integer code = getCodeForToolbarKey((ToolbarKey) tag);
|
||||
final int code = getCodeForToolbarKey((ToolbarKey) tag);
|
||||
if (code != KeyCode.UNSPECIFIED) {
|
||||
Log.d(TAG, "click toolbar key "+tag);
|
||||
mListener.onCodeInput(code, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue