@@ -214,7 +214,7 @@ public void onStart() {
214
214
// Get the session stored in shared preferences stored by {@link #onStop} if its valid,
215
215
// otherwise get the last session currently running.
216
216
mTermuxSessionClient .setCurrentSession (mTermuxSessionClient .getCurrentStoredSessionOrLast ());
217
- terminalSessionListNotifyUpdated ();
217
+ termuxSessionListNotifyUpdated ();
218
218
}
219
219
220
220
registerReceiver (mTermuxActivityBroadcastReceiever , new IntentFilter (TERMUX_ACTIVITY .ACTION_RELOAD_STYLE ));
@@ -242,7 +242,7 @@ public void onServiceConnected(ComponentName componentName, IBinder service) {
242
242
243
243
setTermuxSessionsListView ();
244
244
245
- if (mTermuxService .getSessions (). isEmpty ()) {
245
+ if (mTermuxService .isTermuxSessionsEmpty ()) {
246
246
if (mIsVisible ) {
247
247
TermuxInstaller .setupIfNeeded (TermuxActivity .this , () -> {
248
248
if (mTermuxService == null ) return ; // Activity might have been destroyed.
@@ -395,9 +395,10 @@ private void setNewSessionButtonView() {
395
395
View newSessionButton = findViewById (R .id .new_session_button );
396
396
newSessionButton .setOnClickListener (v -> mTermuxSessionClient .addNewSession (false , null ));
397
397
newSessionButton .setOnLongClickListener (v -> {
398
- DialogUtils .textInput (TermuxActivity .this , R .string .title_create_named_session , null , R .string .action_create_named_session_confirm ,
399
- text -> mTermuxSessionClient .addNewSession (false , text ), R .string .action_new_session_failsafe , text -> mTermuxSessionClient .addNewSession (true , text )
400
- , -1 , null , null );
398
+ DialogUtils .textInput (TermuxActivity .this , R .string .title_create_named_session , null ,
399
+ R .string .action_create_named_session_confirm , text -> mTermuxSessionClient .addNewSession (false , text ),
400
+ R .string .action_new_session_failsafe , text -> mTermuxSessionClient .addNewSession (true , text ),
401
+ -1 , null , null );
401
402
return true ;
402
403
});
403
404
}
@@ -439,7 +440,7 @@ private void setTermuxTerminalViewAndClients() {
439
440
440
441
private void setTermuxSessionsListView () {
441
442
ListView termuxSessionsListView = findViewById (R .id .terminal_sessions_list );
442
- mTermuxSessionListViewController = new TermuxSessionsListViewController (this , mTermuxService .getSessions ());
443
+ mTermuxSessionListViewController = new TermuxSessionsListViewController (this , mTermuxService .getTermuxSessions ());
443
444
termuxSessionsListView .setAdapter (mTermuxSessionListViewController );
444
445
termuxSessionsListView .setOnItemClickListener (mTermuxSessionListViewController );
445
446
termuxSessionsListView .setOnItemLongClickListener (mTermuxSessionListViewController );
@@ -468,6 +469,7 @@ public void finishActivityIfNotFinishing() {
468
469
469
470
/** Show a toast and dismiss the last one if still visible. */
470
471
public void showToast (String text , boolean longDuration ) {
472
+ if (text == null || text .isEmpty ()) return ;
471
473
if (mLastToast != null ) mLastToast .cancel ();
472
474
mLastToast = Toast .makeText (TermuxActivity .this , text , longDuration ? Toast .LENGTH_LONG : Toast .LENGTH_SHORT );
473
475
mLastToast .setGravity (Gravity .TOP , 0 , 0 );
@@ -642,7 +644,7 @@ public DrawerLayout getDrawer() {
642
644
return (DrawerLayout ) findViewById (R .id .drawer_layout );
643
645
}
644
646
645
- public void terminalSessionListNotifyUpdated () {
647
+ public void termuxSessionListNotifyUpdated () {
646
648
mTermuxSessionListViewController .notifyDataSetChanged ();
647
649
}
648
650
@@ -683,6 +685,13 @@ public TermuxSharedProperties getProperties() {
683
685
684
686
685
687
688
+ public static void updateTermuxActivityStyling (Context context ) {
689
+ // Make sure that terminal styling is always applied.
690
+ Intent stylingIntent = new Intent (TERMUX_ACTIVITY .ACTION_RELOAD_STYLE );
691
+ stylingIntent .putExtra (TERMUX_ACTIVITY .EXTRA_RELOAD_STYLE , "styling" );
692
+ context .sendBroadcast (stylingIntent );
693
+ }
694
+
686
695
class TermuxActivityBroadcastReceiever extends BroadcastReceiver {
687
696
@ Override
688
697
public void onReceive (Context context , Intent intent ) {
0 commit comments