Skip to content

Commit

Permalink
Add termux settings button to left drawer too since apparently people…
Browse files Browse the repository at this point in the history
… can't find the one in context menu
  • Loading branch information
agnostic-apollo committed Jun 28, 2021
1 parent 9c92251 commit 59877a0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/src/main/java/com/termux/app/TermuxActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
Expand All @@ -26,6 +27,7 @@
import android.view.WindowManager;
import android.view.autofill.AutofillManager;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.Toast;

Expand Down Expand Up @@ -218,6 +220,8 @@ public void onCreate(Bundle savedInstanceState) {

setTerminalToolbarView(savedInstanceState);

setSettingsButtonView();

setNewSessionButtonView();

setToggleKeyboardView();
Expand Down Expand Up @@ -402,6 +406,7 @@ private void setDrawerTheme() {
if (mProperties.isUsingBlackUI()) {
findViewById(R.id.left_drawer).setBackgroundColor(ContextCompat.getColor(this,
android.R.color.background_dark));
((ImageButton) findViewById(R.id.settings_button)).setColorFilter(Color.WHITE);
}
}

Expand Down Expand Up @@ -496,6 +501,13 @@ private void saveTerminalToolbarTextInput(Bundle savedInstanceState) {



private void setSettingsButtonView() {
ImageButton settingsButton = findViewById(R.id.settings_button);
settingsButton.setOnClickListener(v -> {
startActivity(new Intent(this, SettingsActivity.class));
});
}

private void setNewSessionButtonView() {
View newSessionButton = findViewById(R.id.new_session_button);
newSessionButton.setOnClickListener(v -> mTermuxTerminalSessionClient.addNewSession(false, null));
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/res/layout/activity_termux.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:id="@+id/settings_button"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_settings"
android:background="@null"
android:contentDescription="@string/action_open_settings" />
</LinearLayout>

<ListView
android:id="@+id/terminal_sessions_list"
android:layout_width="match_parent"
Expand Down

0 comments on commit 59877a0

Please sign in to comment.