mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-08 11:34:07 +08:00
Reformat all code in float/, getting rid of tabs
This commit is contained in:
@@ -3,7 +3,9 @@ package com.termux.window;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
/** Simple activity which immediately launches {@link TermuxFloatService} and exits. */
|
/**
|
||||||
|
* Simple activity which immediately launches {@link TermuxFloatService} and exits.
|
||||||
|
*/
|
||||||
public class TermuxFloatActivity extends Activity {
|
public class TermuxFloatActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -15,7 +15,9 @@ import com.termux.view.TerminalKeyListener;
|
|||||||
public class TermuxFloatKeyListener implements TerminalKeyListener {
|
public class TermuxFloatKeyListener implements TerminalKeyListener {
|
||||||
|
|
||||||
private final TermuxFloatView view;
|
private final TermuxFloatView view;
|
||||||
/** Keeping track of the special keys acting as Ctrl and Fn for the soft keyboard and other hardware keys. */
|
/**
|
||||||
|
* Keeping track of the special keys acting as Ctrl and Fn for the soft keyboard and other hardware keys.
|
||||||
|
*/
|
||||||
boolean mVirtualControlKeyDown, mVirtualFnKeyDown;
|
boolean mVirtualControlKeyDown, mVirtualFnKeyDown;
|
||||||
|
|
||||||
public TermuxFloatKeyListener(TermuxFloatView view) {
|
public TermuxFloatKeyListener(TermuxFloatView view) {
|
||||||
@@ -195,7 +197,9 @@ public class TermuxFloatKeyListener implements TerminalKeyListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handle dedicated volume buttons as virtual keys if applicable. */
|
/**
|
||||||
|
* Handle dedicated volume buttons as virtual keys if applicable.
|
||||||
|
*/
|
||||||
private boolean handleVirtualKeys(int keyCode, KeyEvent event, boolean down) {
|
private boolean handleVirtualKeys(int keyCode, KeyEvent event, boolean down) {
|
||||||
InputDevice inputDevice = event.getDevice();
|
InputDevice inputDevice = event.getDevice();
|
||||||
if (inputDevice != null && inputDevice.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) {
|
if (inputDevice != null && inputDevice.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) {
|
||||||
|
@@ -30,7 +30,9 @@ public class TermuxFloatView extends LinearLayout {
|
|||||||
|
|
||||||
TerminalView mTerminalView;
|
TerminalView mTerminalView;
|
||||||
|
|
||||||
/** The last toast shown, used cancel current toast before showing new in {@link #showToast(String, boolean)}. */
|
/**
|
||||||
|
* The last toast shown, used cancel current toast before showing new in {@link #showToast(String, boolean)}.
|
||||||
|
*/
|
||||||
Toast mLastToast;
|
Toast mLastToast;
|
||||||
|
|
||||||
private boolean withFocus = true;
|
private boolean withFocus = true;
|
||||||
@@ -118,7 +120,9 @@ public class TermuxFloatView extends LinearLayout {
|
|||||||
showTouchKeyboard();
|
showTouchKeyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Intercept touch events to obtain and loose focus on touch events. */
|
/**
|
||||||
|
* Intercept touch events to obtain and loose focus on touch events.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||||
if (isInLongPressState) return true;
|
if (isInLongPressState) return true;
|
||||||
@@ -164,7 +168,9 @@ public class TermuxFloatView extends LinearLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Motion events should only be dispatched here when {@link #onInterceptTouchEvent(MotionEvent)} returns true. */
|
/**
|
||||||
|
* Motion events should only be dispatched here when {@link #onInterceptTouchEvent(MotionEvent)} returns true.
|
||||||
|
*/
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
@@ -187,7 +193,9 @@ public class TermuxFloatView extends LinearLayout {
|
|||||||
return super.onTouchEvent(event);
|
return super.onTouchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Visually indicate focus and show the soft input as needed. */
|
/**
|
||||||
|
* Visually indicate focus and show the soft input as needed.
|
||||||
|
*/
|
||||||
void changeFocus(boolean newFocus) {
|
void changeFocus(boolean newFocus) {
|
||||||
if (newFocus == withFocus) {
|
if (newFocus == withFocus) {
|
||||||
if (newFocus) showTouchKeyboard();
|
if (newFocus) showTouchKeyboard();
|
||||||
@@ -199,7 +207,9 @@ public class TermuxFloatView extends LinearLayout {
|
|||||||
setAlpha(newFocus ? ALPHA_FOCUS : ALPHA_NOT_FOCUS);
|
setAlpha(newFocus ? ALPHA_FOCUS : ALPHA_NOT_FOCUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Show a toast and dismiss the last one if still visible. */
|
/**
|
||||||
|
* Show a toast and dismiss the last one if still visible.
|
||||||
|
*/
|
||||||
void showToast(String text, boolean longDuration) {
|
void showToast(String text, boolean longDuration) {
|
||||||
if (mLastToast != null) mLastToast.cancel();
|
if (mLastToast != null) mLastToast.cancel();
|
||||||
mLastToast = Toast.makeText(getContext(), text, longDuration ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);
|
mLastToast = Toast.makeText(getContext(), text, longDuration ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);
|
||||||
|
Reference in New Issue
Block a user