mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-07 03:05:18 +08:00
Replace "if(" with "if ("
This commit is contained in:
@@ -52,7 +52,7 @@ public class RunCommandService extends Service {
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Logger.logDebug(LOG_TAG, "onStartCommand");
|
||||
|
||||
if(intent == null) return Service.START_NOT_STICKY;
|
||||
if (intent == null) return Service.START_NOT_STICKY;
|
||||
|
||||
// Run again in case service is already started and onCreate() is not called
|
||||
runStartForeground();
|
||||
@@ -195,7 +195,7 @@ public class RunCommandService extends Service {
|
||||
TermuxConstants.TERMUX_RUN_COMMAND_NOTIFICATION_CHANNEL_ID, Notification.PRIORITY_LOW,
|
||||
TermuxConstants.TERMUX_RUN_COMMAND_NOTIFICATION_CHANNEL_NAME, null, null,
|
||||
null, NotificationUtils.NOTIFICATION_MODE_SILENT);
|
||||
if(builder == null) return null;
|
||||
if (builder == null) return null;
|
||||
|
||||
// No need to show a timestamp:
|
||||
builder.setShowWhen(false);
|
||||
|
@@ -362,7 +362,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
setTerminalToolbarHeight();
|
||||
|
||||
String savedTextInput = null;
|
||||
if(savedInstanceState != null)
|
||||
if (savedInstanceState != null)
|
||||
savedTextInput = savedInstanceState.getString(ARG_TERMINAL_TOOLBAR_TEXT_INPUT);
|
||||
|
||||
terminalToolbarViewPager.setAdapter(new TerminalToolbarViewPager.PageAdapter(this, savedTextInput));
|
||||
@@ -371,7 +371,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
|
||||
private void setTerminalToolbarHeight() {
|
||||
final ViewPager terminalToolbarViewPager = findViewById(R.id.terminal_toolbar_view_pager);
|
||||
if(terminalToolbarViewPager == null) return;
|
||||
if (terminalToolbarViewPager == null) return;
|
||||
ViewGroup.LayoutParams layoutParams = terminalToolbarViewPager.getLayoutParams();
|
||||
layoutParams.height = (int) Math.round(mTerminalToolbarDefaultHeight *
|
||||
(mProperties.getExtraKeysInfo() == null ? 0 : mProperties.getExtraKeysInfo().getMatrix().length) *
|
||||
@@ -381,7 +381,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
|
||||
public void toggleTerminalToolbar() {
|
||||
final ViewPager terminalToolbarViewPager = findViewById(R.id.terminal_toolbar_view_pager);
|
||||
if(terminalToolbarViewPager == null) return;
|
||||
if (terminalToolbarViewPager == null) return;
|
||||
|
||||
final boolean showNow = mPreferences.toogleShowTerminalToolbar();
|
||||
Logger.showToast(this, (showNow ? getString(R.string.msg_enabling_terminal_toolbar) : getString(R.string.msg_disabling_terminal_toolbar)), true);
|
||||
@@ -393,12 +393,12 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
}
|
||||
|
||||
private void saveTerminalToolbarTextInput(Bundle savedInstanceState) {
|
||||
if(savedInstanceState == null) return;
|
||||
if (savedInstanceState == null) return;
|
||||
|
||||
final EditText textInputView = findViewById(R.id.terminal_toolbar_text_input);
|
||||
if(textInputView != null) {
|
||||
if (textInputView != null) {
|
||||
String textInput = textInputView.getText().toString();
|
||||
if(!textInput.isEmpty()) savedInstanceState.putString(ARG_TERMINAL_TOOLBAR_TEXT_INPUT, textInput);
|
||||
if (!textInput.isEmpty()) savedInstanceState.putString(ARG_TERMINAL_TOOLBAR_TEXT_INPUT, textInput);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,14 +431,14 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
|
||||
private void setSoftKeyboardState() {
|
||||
// If soft keyboard is to disabled
|
||||
if(!mPreferences.getSoftKeyboardEnabled()) {
|
||||
if (!mPreferences.getSoftKeyboardEnabled()) {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
} else {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
}
|
||||
|
||||
// If soft keyboard is to be hidden on startup
|
||||
if(mProperties.shouldSoftKeyboardBeHiddenOnStartup()) {
|
||||
if (mProperties.shouldSoftKeyboardBeHiddenOnStartup()) {
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
|
||||
}
|
||||
}
|
||||
@@ -496,7 +496,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
|
||||
/** Show a toast and dismiss the last one if still visible. */
|
||||
public void showToast(String text, boolean longDuration) {
|
||||
if(text == null || text.isEmpty()) return;
|
||||
if (text == null || text.isEmpty()) return;
|
||||
if (mLastToast != null) mLastToast.cancel();
|
||||
mLastToast = Toast.makeText(TermuxActivity.this, text, longDuration ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);
|
||||
mLastToast.setGravity(Gravity.TOP, 0, 0);
|
||||
@@ -611,7 +611,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
}
|
||||
}
|
||||
private void toggleKeepScreenOn() {
|
||||
if(mTerminalView.getKeepScreenOn()) {
|
||||
if (mTerminalView.getKeepScreenOn()) {
|
||||
mTerminalView.setKeepScreenOn(false);
|
||||
mPreferences.setKeepScreenOn(false);
|
||||
} else {
|
||||
@@ -696,7 +696,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
|
||||
@Nullable
|
||||
public TerminalSession getCurrentSession() {
|
||||
if(mTerminalView != null)
|
||||
if (mTerminalView != null)
|
||||
return mTerminalView.getCurrentSession();
|
||||
else
|
||||
return null;
|
||||
@@ -766,11 +766,11 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
}
|
||||
|
||||
private void reloadTermuxActivityStyling() {
|
||||
if(mTermuxTerminalSessionClient != null) {
|
||||
if (mTermuxTerminalSessionClient != null) {
|
||||
mTermuxTerminalSessionClient.checkForFontAndColors();
|
||||
}
|
||||
|
||||
if(mProperties!= null) {
|
||||
if (mProperties!= null) {
|
||||
mProperties.loadTermuxPropertiesFromDisk();
|
||||
|
||||
if (mExtraKeysView != null) {
|
||||
|
@@ -689,7 +689,7 @@ public final class TermuxService extends Service implements TermuxTask.TermuxTas
|
||||
TermuxConstants.TERMUX_APP_NOTIFICATION_CHANNEL_ID, priority,
|
||||
getText(R.string.application_name), notificationText, null,
|
||||
pendingIntent, NotificationUtils.NOTIFICATION_MODE_SILENT);
|
||||
if(builder == null) return null;
|
||||
if (builder == null) return null;
|
||||
|
||||
// No need to show a timestamp:
|
||||
builder.setShowWhen(false);
|
||||
@@ -742,7 +742,7 @@ public final class TermuxService extends Service implements TermuxTask.TermuxTas
|
||||
|
||||
|
||||
private void setCurrentStoredTerminalSession(TerminalSession session) {
|
||||
if(session == null) return;
|
||||
if (session == null) return;
|
||||
// Make the newly created session the current one to be displayed:
|
||||
TermuxAppSharedPreferences preferences = new TermuxAppSharedPreferences(this);
|
||||
preferences.setCurrentSession(session.mHandle);
|
||||
@@ -762,7 +762,7 @@ public final class TermuxService extends Service implements TermuxTask.TermuxTas
|
||||
|
||||
@Nullable
|
||||
public synchronized TermuxSession getTermuxSession(int index) {
|
||||
if(index >= 0 && index < mTermuxSessions.size())
|
||||
if (index >= 0 && index < mTermuxSessions.size())
|
||||
return mTermuxSessions.get(index);
|
||||
else
|
||||
return null;
|
||||
|
@@ -32,7 +32,7 @@ public class DebuggingPreferencesFragment extends PreferenceFragmentCompat {
|
||||
}
|
||||
|
||||
protected ListPreference setLogLevelListPreferenceData(ListPreference logLevelListPreference, Context context) {
|
||||
if(logLevelListPreference == null)
|
||||
if (logLevelListPreference == null)
|
||||
logLevelListPreference = new ListPreference(context);
|
||||
|
||||
CharSequence[] logLevels = Logger.getLogLevelsArray();
|
||||
@@ -73,7 +73,7 @@ class DebuggingPreferencesDataStore extends PreferenceDataStore {
|
||||
@Override
|
||||
@Nullable
|
||||
public String getString(String key, @Nullable String defValue) {
|
||||
if(key == null) return null;
|
||||
if (key == null) return null;
|
||||
|
||||
switch (key) {
|
||||
case "log_level":
|
||||
@@ -85,7 +85,7 @@ class DebuggingPreferencesDataStore extends PreferenceDataStore {
|
||||
|
||||
@Override
|
||||
public void putString(String key, @Nullable String value) {
|
||||
if(key == null) return;
|
||||
if (key == null) return;
|
||||
|
||||
switch (key) {
|
||||
case "log_level":
|
||||
@@ -102,7 +102,7 @@ class DebuggingPreferencesDataStore extends PreferenceDataStore {
|
||||
|
||||
@Override
|
||||
public void putBoolean(String key, boolean value) {
|
||||
if(key == null) return;
|
||||
if (key == null) return;
|
||||
|
||||
switch (key) {
|
||||
case "terminal_view_key_logging_enabled":
|
||||
|
@@ -45,7 +45,7 @@ class TerminalIOPreferencesDataStore extends PreferenceDataStore {
|
||||
|
||||
@Override
|
||||
public void putBoolean(String key, boolean value) {
|
||||
if(key == null) return;
|
||||
if (key == null) return;
|
||||
|
||||
switch (key) {
|
||||
case "soft_keyboard_enabled":
|
||||
|
@@ -70,7 +70,7 @@ public class TermuxAppSharedProperties extends TermuxSharedProperties implements
|
||||
* Set the terminal sessions shortcuts.
|
||||
*/
|
||||
private void setSessionShortcuts() {
|
||||
if(mSessionShortcuts == null)
|
||||
if (mSessionShortcuts == null)
|
||||
mSessionShortcuts = new ArrayList<>();
|
||||
else
|
||||
mSessionShortcuts.clear();
|
||||
|
@@ -188,7 +188,7 @@ public final class ExtraKeysView extends GridLayout {
|
||||
int width = view.getMeasuredWidth();
|
||||
int height = view.getMeasuredHeight();
|
||||
Button button;
|
||||
if(isSpecialButton(extraButton)) {
|
||||
if (isSpecialButton(extraButton)) {
|
||||
button = createSpecialButton(extraButton.getKey(), false);
|
||||
if (button == null) return;
|
||||
} else {
|
||||
@@ -240,7 +240,7 @@ public final class ExtraKeysView extends GridLayout {
|
||||
*/
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
public void reload(ExtraKeysInfo infos) {
|
||||
if(infos == null)
|
||||
if (infos == null)
|
||||
return;
|
||||
|
||||
for(SpecialButtonState state : specialButtons.values())
|
||||
@@ -258,7 +258,7 @@ public final class ExtraKeysView extends GridLayout {
|
||||
final ExtraKeyButton buttonInfo = buttons[row][col];
|
||||
|
||||
Button button;
|
||||
if(isSpecialButton(buttonInfo)) {
|
||||
if (isSpecialButton(buttonInfo)) {
|
||||
button = createSpecialButton(buttonInfo.getKey(), true);
|
||||
if (button == null) return;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user