mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 02:35:19 +08:00
Changed: Make ExtraKeysView private functions public and variables protected
This commit is contained in:
@@ -134,15 +134,15 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
|
|
||||||
|
|
||||||
/** The implementation of the {@link IExtraKeysView} that acts as a client for the {@link ExtraKeysView}. */
|
/** The implementation of the {@link IExtraKeysView} that acts as a client for the {@link ExtraKeysView}. */
|
||||||
private IExtraKeysView mExtraKeysViewClient;
|
protected IExtraKeysView mExtraKeysViewClient;
|
||||||
|
|
||||||
/** The map for the {@link SpecialButton} and their {@link SpecialButtonState}. Defaults to
|
/** The map for the {@link SpecialButton} and their {@link SpecialButtonState}. Defaults to
|
||||||
* the one returned by {@link #getDefaultSpecialButtons(ExtraKeysView)}. */
|
* the one returned by {@link #getDefaultSpecialButtons(ExtraKeysView)}. */
|
||||||
private Map<SpecialButton, SpecialButtonState> mSpecialButtons;
|
protected Map<SpecialButton, SpecialButtonState> mSpecialButtons;
|
||||||
|
|
||||||
/** The keys for the {@link SpecialButton} added to {@link #mSpecialButtons}. This is automatically
|
/** The keys for the {@link SpecialButton} added to {@link #mSpecialButtons}. This is automatically
|
||||||
* set when the call to {@link #setSpecialButtons(Map)} is made. */
|
* set when the call to {@link #setSpecialButtons(Map)} is made. */
|
||||||
private Set<String> mSpecialButtonsKeys;
|
protected Set<String> mSpecialButtonsKeys;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,22 +151,22 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
* every {@link #mLongPressRepeatDelay} seconds after {@link #mLongPressTimeout} has passed.
|
* every {@link #mLongPressRepeatDelay} seconds after {@link #mLongPressTimeout} has passed.
|
||||||
* The default keys are defined by {@link ExtraKeysConstants#PRIMARY_REPETITIVE_KEYS}.
|
* The default keys are defined by {@link ExtraKeysConstants#PRIMARY_REPETITIVE_KEYS}.
|
||||||
*/
|
*/
|
||||||
private List<String> mRepetitiveKeys;
|
protected List<String> mRepetitiveKeys;
|
||||||
|
|
||||||
|
|
||||||
/** The text color for the extra keys button. Defaults to {@link #DEFAULT_BUTTON_TEXT_COLOR}. */
|
/** The text color for the extra keys button. Defaults to {@link #DEFAULT_BUTTON_TEXT_COLOR}. */
|
||||||
private int mButtonTextColor;
|
protected int mButtonTextColor;
|
||||||
/** The text color for the extra keys button when its active.
|
/** The text color for the extra keys button when its active.
|
||||||
* Defaults to {@link #DEFAULT_BUTTON_ACTIVE_TEXT_COLOR}. */
|
* Defaults to {@link #DEFAULT_BUTTON_ACTIVE_TEXT_COLOR}. */
|
||||||
private int mButtonActiveTextColor;
|
protected int mButtonActiveTextColor;
|
||||||
/** The background color for the extra keys button. Defaults to {@link #DEFAULT_BUTTON_BACKGROUND_COLOR}. */
|
/** The background color for the extra keys button. Defaults to {@link #DEFAULT_BUTTON_BACKGROUND_COLOR}. */
|
||||||
private int mButtonBackgroundColor;
|
protected int mButtonBackgroundColor;
|
||||||
/** The background color for the extra keys button when its active. Defaults to
|
/** The background color for the extra keys button when its active. Defaults to
|
||||||
* {@link #DEFAULT_BUTTON_ACTIVE_BACKGROUND_COLOR}. */
|
* {@link #DEFAULT_BUTTON_ACTIVE_BACKGROUND_COLOR}. */
|
||||||
private int mButtonActiveBackgroundColor;
|
protected int mButtonActiveBackgroundColor;
|
||||||
|
|
||||||
/** Defines whether text for the extra keys button should be all capitalized automatically. */
|
/** Defines whether text for the extra keys button should be all capitalized automatically. */
|
||||||
private boolean mButtonTextAllCaps = true;
|
protected boolean mButtonTextAllCaps = true;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -176,7 +176,7 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
* The duration must be in between {@link #MIN_LONG_PRESS_DURATION} and {@link #MAX_LONG_PRESS_DURATION},
|
* The duration must be in between {@link #MIN_LONG_PRESS_DURATION} and {@link #MAX_LONG_PRESS_DURATION},
|
||||||
* otherwise {@link #FALLBACK_LONG_PRESS_DURATION} is used.
|
* otherwise {@link #FALLBACK_LONG_PRESS_DURATION} is used.
|
||||||
*/
|
*/
|
||||||
private int mLongPressTimeout;
|
protected int mLongPressTimeout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the duration in milliseconds for the delay between trigger of each repeat of
|
* Defines the duration in milliseconds for the delay between trigger of each repeat of
|
||||||
@@ -184,17 +184,17 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
* The duration must be in between {@link #MIN_LONG_PRESS__REPEAT_DELAY} and
|
* The duration must be in between {@link #MIN_LONG_PRESS__REPEAT_DELAY} and
|
||||||
* {@link #MAX_LONG_PRESS__REPEAT_DELAY}, otherwise {@link #DEFAULT_LONG_PRESS_REPEAT_DELAY} is used.
|
* {@link #MAX_LONG_PRESS__REPEAT_DELAY}, otherwise {@link #DEFAULT_LONG_PRESS_REPEAT_DELAY} is used.
|
||||||
*/
|
*/
|
||||||
private int mLongPressRepeatDelay;
|
protected int mLongPressRepeatDelay;
|
||||||
|
|
||||||
|
|
||||||
/** The popup window shown if {@link ExtraKeyButton#getPopup()} returns a {@code non-null} value
|
/** The popup window shown if {@link ExtraKeyButton#getPopup()} returns a {@code non-null} value
|
||||||
* and a swipe up action is done on an extra key. */
|
* and a swipe up action is done on an extra key. */
|
||||||
private PopupWindow mPopupWindow;
|
protected PopupWindow mPopupWindow;
|
||||||
|
|
||||||
private ScheduledExecutorService mScheduledExecutor;
|
protected ScheduledExecutorService mScheduledExecutor;
|
||||||
private Handler mHandler;
|
protected Handler mHandler;
|
||||||
private SpecialButtonsLongHoldRunnable mSpecialButtonsLongHoldRunnable;
|
protected SpecialButtonsLongHoldRunnable mSpecialButtonsLongHoldRunnable;
|
||||||
private int mLongPressCount;
|
protected int mLongPressCount;
|
||||||
|
|
||||||
|
|
||||||
public ExtraKeysView(Context context, AttributeSet attrs) {
|
public ExtraKeysView(Context context, AttributeSet attrs) {
|
||||||
@@ -465,12 +465,12 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void onExtraKeyButtonClick(View view, ExtraKeyButton buttonInfo, Button button) {
|
public void onExtraKeyButtonClick(View view, ExtraKeyButton buttonInfo, MaterialButton button) {
|
||||||
if (mExtraKeysViewClient != null)
|
if (mExtraKeysViewClient != null)
|
||||||
mExtraKeysViewClient.onExtraKeyButtonClick(view, buttonInfo, button);
|
mExtraKeysViewClient.onExtraKeyButtonClick(view, buttonInfo, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performExtraKeyButtonHapticFeedback(View view, ExtraKeyButton buttonInfo, Button button) {
|
public void performExtraKeyButtonHapticFeedback(View view, ExtraKeyButton buttonInfo, MaterialButton button) {
|
||||||
if (mExtraKeysViewClient != null) {
|
if (mExtraKeysViewClient != null) {
|
||||||
// If client handled the feedback, then just return
|
// If client handled the feedback, then just return
|
||||||
if (mExtraKeysViewClient.performExtraKeyButtonHapticFeedback(view, buttonInfo, button))
|
if (mExtraKeysViewClient.performExtraKeyButtonHapticFeedback(view, buttonInfo, button))
|
||||||
@@ -493,7 +493,7 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void onAnyExtraKeyButtonClick(View view, @NonNull ExtraKeyButton buttonInfo, Button button) {
|
public void onAnyExtraKeyButtonClick(View view, @NonNull ExtraKeyButton buttonInfo, MaterialButton button) {
|
||||||
if (isSpecialButton(buttonInfo)) {
|
if (isSpecialButton(buttonInfo)) {
|
||||||
if (mLongPressCount > 0) return;
|
if (mLongPressCount > 0) return;
|
||||||
SpecialButtonState state = mSpecialButtons.get(SpecialButton.valueOf(buttonInfo.getKey()));
|
SpecialButtonState state = mSpecialButtons.get(SpecialButton.valueOf(buttonInfo.getKey()));
|
||||||
@@ -509,7 +509,7 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void startScheduledExecutors(View view, ExtraKeyButton buttonInfo, Button button) {
|
public void startScheduledExecutors(View view, ExtraKeyButton buttonInfo, MaterialButton button) {
|
||||||
stopScheduledExecutors();
|
stopScheduledExecutors();
|
||||||
mLongPressCount = 0;
|
mLongPressCount = 0;
|
||||||
if (mRepetitiveKeys.contains(buttonInfo.getKey())) {
|
if (mRepetitiveKeys.contains(buttonInfo.getKey())) {
|
||||||
@@ -534,7 +534,7 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopScheduledExecutors() {
|
public void stopScheduledExecutors() {
|
||||||
if (mScheduledExecutor != null) {
|
if (mScheduledExecutor != null) {
|
||||||
mScheduledExecutor.shutdownNow();
|
mScheduledExecutor.shutdownNow();
|
||||||
mScheduledExecutor = null;
|
mScheduledExecutor = null;
|
||||||
@@ -546,8 +546,8 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SpecialButtonsLongHoldRunnable implements Runnable {
|
public class SpecialButtonsLongHoldRunnable implements Runnable {
|
||||||
private final SpecialButtonState mState;
|
public final SpecialButtonState mState;
|
||||||
|
|
||||||
public SpecialButtonsLongHoldRunnable(SpecialButtonState state) {
|
public SpecialButtonsLongHoldRunnable(SpecialButtonState state) {
|
||||||
mState = state;
|
mState = state;
|
||||||
@@ -593,7 +593,7 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
mPopupWindow.showAsDropDown(view, 0, -2 * height);
|
mPopupWindow.showAsDropDown(view, 0, -2 * height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dismissPopup() {
|
public void dismissPopup() {
|
||||||
mPopupWindow.setContentView(null);
|
mPopupWindow.setContentView(null);
|
||||||
mPopupWindow.dismiss();
|
mPopupWindow.dismiss();
|
||||||
mPopupWindow = null;
|
mPopupWindow = null;
|
||||||
@@ -631,7 +631,7 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button createSpecialButton(String buttonKey, boolean needUpdate) {
|
public Button createSpecialButton(String buttonKey, boolean needUpdate) {
|
||||||
SpecialButtonState state = mSpecialButtons.get(SpecialButton.valueOf(buttonKey));
|
SpecialButtonState state = mSpecialButtons.get(SpecialButton.valueOf(buttonKey));
|
||||||
if (state == null) return null;
|
if (state == null) return null;
|
||||||
state.setIsCreated(true);
|
state.setIsCreated(true);
|
||||||
@@ -648,7 +648,7 @@ public final class ExtraKeysView extends GridLayout {
|
|||||||
/**
|
/**
|
||||||
* General util function to compute the longest column length in a matrix.
|
* General util function to compute the longest column length in a matrix.
|
||||||
*/
|
*/
|
||||||
static int maximumLength(Object[][] matrix) {
|
public static int maximumLength(Object[][] matrix) {
|
||||||
int m = 0;
|
int m = 0;
|
||||||
for (Object[] row : matrix)
|
for (Object[] row : matrix)
|
||||||
m = Math.max(m, row.length);
|
m = Math.max(m, row.length);
|
||||||
|
Reference in New Issue
Block a user