Skip to content

Commit 59877a0

Browse files
Add termux settings button to left drawer too since apparently people can't find the one in context menu
1 parent 9c92251 commit 59877a0

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

app/src/main/java/com/termux/app/TermuxActivity.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import android.content.IntentFilter;
1313
import android.content.ServiceConnection;
1414
import android.content.pm.PackageManager;
15+
import android.graphics.Color;
1516
import android.net.Uri;
1617
import android.os.Build;
1718
import android.os.Bundle;
@@ -26,6 +27,7 @@
2627
import android.view.WindowManager;
2728
import android.view.autofill.AutofillManager;
2829
import android.widget.EditText;
30+
import android.widget.ImageButton;
2931
import android.widget.ListView;
3032
import android.widget.Toast;
3133

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

219221
setTerminalToolbarView(savedInstanceState);
220222

223+
setSettingsButtonView();
224+
221225
setNewSessionButtonView();
222226

223227
setToggleKeyboardView();
@@ -402,6 +406,7 @@ private void setDrawerTheme() {
402406
if (mProperties.isUsingBlackUI()) {
403407
findViewById(R.id.left_drawer).setBackgroundColor(ContextCompat.getColor(this,
404408
android.R.color.background_dark));
409+
((ImageButton) findViewById(R.id.settings_button)).setColorFilter(Color.WHITE);
405410
}
406411
}
407412

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

497502

498503

504+
private void setSettingsButtonView() {
505+
ImageButton settingsButton = findViewById(R.id.settings_button);
506+
settingsButton.setOnClickListener(v -> {
507+
startActivity(new Intent(this, SettingsActivity.class));
508+
});
509+
}
510+
499511
private void setNewSessionButtonView() {
500512
View newSessionButton = findViewById(R.id.new_session_button);
501513
newSessionButton.setOnClickListener(v -> mTermuxTerminalSessionClient.addNewSession(false, null));

app/src/main/res/layout/activity_termux.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@
4242
android:descendantFocusability="blocksDescendants"
4343
android:orientation="vertical">
4444

45+
<LinearLayout
46+
android:layout_width="match_parent"
47+
android:layout_height="wrap_content"
48+
android:orientation="horizontal">
49+
<ImageButton
50+
android:id="@+id/settings_button"
51+
android:layout_width="40dp"
52+
android:layout_height="40dp"
53+
android:src="@drawable/ic_settings"
54+
android:background="@null"
55+
android:contentDescription="@string/action_open_settings" />
56+
</LinearLayout>
57+
4558
<ListView
4659
android:id="@+id/terminal_sessions_list"
4760
android:layout_width="match_parent"

0 commit comments

Comments
 (0)