From 59877a08d134d7a56119d7c80caedac89850baa7 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Mon, 28 Jun 2021 11:05:20 +0500 Subject: [PATCH] Add termux settings button to left drawer too since apparently people can't find the one in context menu --- .../main/java/com/termux/app/TermuxActivity.java | 12 ++++++++++++ app/src/main/res/layout/activity_termux.xml | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/app/src/main/java/com/termux/app/TermuxActivity.java b/app/src/main/java/com/termux/app/TermuxActivity.java index bd54677e8a..eff4fa3565 100644 --- a/app/src/main/java/com/termux/app/TermuxActivity.java +++ b/app/src/main/java/com/termux/app/TermuxActivity.java @@ -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; @@ -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; @@ -218,6 +220,8 @@ public void onCreate(Bundle savedInstanceState) { setTerminalToolbarView(savedInstanceState); + setSettingsButtonView(); + setNewSessionButtonView(); setToggleKeyboardView(); @@ -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); } } @@ -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)); diff --git a/app/src/main/res/layout/activity_termux.xml b/app/src/main/res/layout/activity_termux.xml index 32bb354b72..c659f57711 100644 --- a/app/src/main/res/layout/activity_termux.xml +++ b/app/src/main/res/layout/activity_termux.xml @@ -42,6 +42,19 @@ android:descendantFocusability="blocksDescendants" android:orientation="vertical"> + + + +