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