use of com.farmerbb.taskbar.ui.TaskbarController in project Taskbar by farmerbb.
the class HomeActivityDelegate method startTaskbar.
private void startTaskbar() {
// Ensure that the freeform hack is started whenever Taskbar starts
if (U.hasFreeformSupport(this) && U.isFreeformModeEnabled(this) && !FreeformHackHelper.getInstance().isFreeformHackActive()) {
U.startFreeformHack(this, true);
}
SharedPreferences pref = U.getSharedPreferences(this);
if (pref.getBoolean(PREF_FIRST_RUN, true)) {
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean(PREF_FIRST_RUN, false);
editor.putBoolean(PREF_COLLAPSED, true);
editor.apply();
dialog = U.showRecentAppsDialog(U.wrapContext(this), new Callbacks(() -> dialog = U.showErrorDialog(U.wrapContext(this), "GET_USAGE_STATS"), null));
}
if (isSecondaryHome) {
// Stop any currently running services and switch to using HomeActivityDelegate as UI host
stopService(new Intent(this, TaskbarService.class));
stopService(new Intent(this, StartMenuService.class));
stopService(new Intent(this, DashboardService.class));
taskbarController = new TaskbarController(this);
startMenuController = new StartMenuController(this);
dashboardController = new DashboardController(this);
taskbarController.onCreateHost(this);
startMenuController.onCreateHost(this);
dashboardController.onCreateHost(this);
} else {
// We always start the Taskbar and Start Menu services, even if the app isn't normally running
try {
startService(new Intent(this, TaskbarService.class));
startService(new Intent(this, StartMenuService.class));
startService(new Intent(this, DashboardService.class));
} catch (IllegalStateException ignored) {
}
}
if (pref.getBoolean(PREF_TASKBAR_ACTIVE, false) && !U.isServiceRunning(this, NotificationService.class))
pref.edit().putBoolean(PREF_TASKBAR_ACTIVE, false).apply();
// Show the Taskbar temporarily, as nothing else will be visible on screen
U.newHandler().postDelayed(() -> U.sendBroadcast(this, ACTION_TEMP_SHOW_TASKBAR), 100);
}
Aggregations