Skip to content

Commit

Permalink
Remove the fullscreen setting
Browse files Browse the repository at this point in the history
Trying to use fullscreen doesn't work well in a multi-windowed world
and makes using translucent navigation and status bars more complicated.
  • Loading branch information
fornwall committed Dec 7, 2017
1 parent ab205ae commit de4f334
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 102 deletions.
67 changes: 0 additions & 67 deletions app/src/main/java/com/termux/app/FullScreenHelper.java

This file was deleted.

24 changes: 5 additions & 19 deletions app/src/main/java/com/termux/app/TermuxActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -95,7 +96,6 @@ public final class TermuxActivity extends Activity implements ServiceConnection
private static final int CONTEXTMENU_KILL_PROCESS_ID = 4;
private static final int CONTEXTMENU_RESET_TERMINAL_ID = 5;
private static final int CONTEXTMENU_STYLING_ID = 6;
private static final int CONTEXTMENU_TOGGLE_FULLSCREEN_ID = 7;
private static final int CONTEXTMENU_HELP_ID = 8;

private static final int MAX_SESSIONS = 8;
Expand All @@ -111,8 +111,6 @@ public final class TermuxActivity extends Activity implements ServiceConnection

ExtraKeysView mExtraKeysView;

final FullScreenHelper mFullScreenHelper = new FullScreenHelper(this);

TermuxPreferences mSettings;

/**
Expand Down Expand Up @@ -215,7 +213,6 @@ public void onCreate(Bundle bundle) {
mTerminalView.setOnKeyListener(new TermuxViewClient(this));

mTerminalView.setTextSize(mSettings.getFontSize());
mFullScreenHelper.setImmersive(mSettings.isFullScreen());
mTerminalView.requestFocus();

final ViewPager viewPager = findViewById(R.id.viewpager);
Expand Down Expand Up @@ -642,7 +639,7 @@ void noteSessionInfo() {
TerminalSession session = getCurrentTermSession();
final int indexOfSession = mTermService.getSessions().indexOf(session);
showToast(toToastTitle(session), false);
mListViewAdapter.notifyDataSetChanged();
mListViewAdapter.notifyDataSetChanged();
final ListView lv = findViewById(R.id.left_drawer_list);
lv.setItemChecked(indexOfSession, true);
lv.smoothScrollToPosition(indexOfSession);
Expand All @@ -657,7 +654,6 @@ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuIn
menu.add(Menu.NONE, CONTEXTMENU_SHARE_TRANSCRIPT_ID, Menu.NONE, R.string.select_all_and_share);
menu.add(Menu.NONE, CONTEXTMENU_RESET_TERMINAL_ID, Menu.NONE, R.string.reset_terminal);
menu.add(Menu.NONE, CONTEXTMENU_KILL_PROCESS_ID, Menu.NONE, getResources().getString(R.string.kill_process, getCurrentTermSession().getPid())).setEnabled(currentSession.isRunning());
menu.add(Menu.NONE, CONTEXTMENU_TOGGLE_FULLSCREEN_ID, Menu.NONE, R.string.toggle_fullscreen).setCheckable(true).setChecked(mSettings.isFullScreen());
menu.add(Menu.NONE, CONTEXTMENU_STYLING_ID, Menu.NONE, R.string.style_terminal);
menu.add(Menu.NONE, CONTEXTMENU_HELP_ID, Menu.NONE, R.string.help);
}
Expand Down Expand Up @@ -791,11 +787,8 @@ public void onClick(DialogInterface dialog, int which) {
}
}).setNegativeButton(android.R.string.cancel, null).show();
}
}
return true;
case CONTEXTMENU_TOGGLE_FULLSCREEN_ID:
toggleImmersive();
return true;
}
case CONTEXTMENU_HELP_ID:
startActivity(new Intent(this, TermuxHelpActivity.class));
return true;
Expand All @@ -811,12 +804,6 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String permissi
}
}

void toggleImmersive() {
boolean newValue = !mSettings.isFullScreen();
mSettings.setFullScreen(this, newValue);
mFullScreenHelper.setImmersive(newValue);
}

void changeFontSize(boolean increase) {
mSettings.changeFontSize(this, increase);
mTerminalView.setTextSize(mSettings.getFontSize());
Expand All @@ -835,9 +822,8 @@ void doPaste() {
public TerminalSession getStoredCurrentSessionOrLast() {
TerminalSession stored = TermuxPreferences.getCurrentSession(this);
if (stored != null) return stored;
int numberOfSessions = mTermService.getSessions().size();
if (numberOfSessions == 0) return null;
return mTermService.getSessions().get(numberOfSessions - 1);
List<TerminalSession> sessions = mTermService.getSessions();
return sessions.isEmpty() ? null : sessions.get(sessions.size() - 1);
}

/** Show a toast and dismiss the last one if still visible. */
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/java/com/termux/app/TermuxPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ final class TermuxPreferences {
private final int MIN_FONTSIZE;
private static final int MAX_FONTSIZE = 256;

private static final String FULLSCREEN_KEY = "fullscreen";
private static final String SHOW_EXTRA_KEYS_KEY = "show_extra_keys";
private static final String FONTSIZE_KEY = "fontsize";
private static final String CURRENT_SESSION_KEY = "current_session";

private boolean mFullScreen;
private int mFontSize;

@AsciiBellBehaviour
Expand All @@ -56,7 +54,6 @@ final class TermuxPreferences {
// to prevent invisible text due to zoom be mistake:
MIN_FONTSIZE = (int) (4f * dipInPixels);

mFullScreen = prefs.getBoolean(FULLSCREEN_KEY, false);
mShowExtraKeys = prefs.getBoolean(SHOW_EXTRA_KEYS_KEY, false);

// http://www.google.com/design/spec/style/typography.html#typography-line-height
Expand All @@ -72,15 +69,6 @@ final class TermuxPreferences {
mFontSize = Math.max(MIN_FONTSIZE, Math.min(mFontSize, MAX_FONTSIZE));
}

boolean isFullScreen() {
return mFullScreen;
}

void setFullScreen(Context context, boolean newValue) {
mFullScreen = newValue;
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(FULLSCREEN_KEY, newValue).apply();
}

boolean isShowExtraKeys() {
return mShowExtraKeys;
}
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/termux/app/TermuxViewClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public boolean onKeyDown(int keyCode, KeyEvent e, TerminalSession currentSession
mActivity.getDrawer().openDrawer(Gravity.LEFT);
} else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
mActivity.getDrawer().closeDrawers();
} else if (unicodeChar == 'f'/* full screen */) {
mActivity.toggleImmersive();
} else if (unicodeChar == 'k'/* keyboard */) {
InputMethodManager imm = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/drawer_layout.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:fitsSystemWindows="true">

<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<string name="toggle_soft_keyboard">Keyboard</string>
<string name="reset_terminal">Reset</string>
<string name="style_terminal">Style</string>
<string name="toggle_fullscreen">Fullscreen</string>
<string name="share_transcript_title">Terminal transcript</string>
<string name="help">Help</string>

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
selecting text on pre-6.0 (non-floating toolbar). -->
<item name="android:windowActionModeOverlay">true</item>

<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>

<!-- https://developer.android.com/training/tv/start/start.html#transition-color -->
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
Expand Down

0 comments on commit de4f334

Please sign in to comment.