mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-05 02:05:25 +08:00
Show window if launched when hidden
This commit is contained in:
@@ -124,13 +124,12 @@ public class TermuxFloatService extends Service {
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
String action = intent.getAction();
|
||||
if (ACTION_HIDE.equals(action)) {
|
||||
mVisibleWindow = false;
|
||||
mFloatingWindow.setVisibility(View.GONE);
|
||||
((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).notify(NOTIFICATION_ID, buildNotification());
|
||||
setVisible(false);
|
||||
} else if (ACTION_SHOW.equals(action)) {
|
||||
mFloatingWindow.setVisibility(View.VISIBLE);
|
||||
mVisibleWindow = true;
|
||||
((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).notify(NOTIFICATION_ID, buildNotification());
|
||||
setVisible(true);
|
||||
} else if (!mVisibleWindow) {
|
||||
// Show window if hidden when launched through launcher icon.
|
||||
setVisible(true);
|
||||
}
|
||||
return Service.START_NOT_STICKY;
|
||||
}
|
||||
@@ -141,6 +140,12 @@ public class TermuxFloatService extends Service {
|
||||
if (mFloatingWindow != null) mFloatingWindow.closeFloatingWindow();
|
||||
}
|
||||
|
||||
private void setVisible(boolean newVisibility) {
|
||||
mVisibleWindow = newVisibility;
|
||||
mFloatingWindow.setVisibility(newVisibility ? View.VISIBLE : View.GONE);
|
||||
((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).notify(NOTIFICATION_ID, buildNotification());
|
||||
}
|
||||
|
||||
public void changeFontSize(boolean increase) {
|
||||
mFontSize += (increase ? 1 : -1) * 2;
|
||||
mFontSize = Math.max(MIN_FONTSIZE, mFontSize);
|
||||
|
Reference in New Issue
Block a user