@Override
public void terminate() {
- layout.removeAllViews();
+ // no-op
}
}
editor.putBoolean("taskbar_active", false);
// Ensure that components that should be enabled are enabled properly
- boolean launcherEnabled = (pref.getBoolean("launcher", false) && U.canDrawOverlays(this))
+ boolean launcherEnabled = (pref.getBoolean("launcher", false) && U.canDrawOverlays(this, true))
|| U.isLauncherPermanentlyEnabled(this);
editor.putBoolean("launcher", launcherEnabled);
theSwitch.setOnCheckedChangeListener((compoundButton, b) -> {
if(b) {
- if(U.canDrawOverlays(this)) {
+ if(U.canDrawOverlays(this, false)) {
boolean firstRun = pref.getBoolean("first_run", true);
startTaskbarService();
boolean taskbarNotActive = !U.isServiceRunning(context, NotificationService.class);
boolean taskbarActiveButHidden = !taskbarNotActive && pref.getBoolean("is_hidden", false);
- if(!U.canDrawOverlays(context)) {
+ if(!U.canDrawOverlays(context, false)) {
new Handler().postDelayed(() -> {
Intent intent2 = new Intent(context, DummyActivity.class);
intent2.putExtra("show_permission_dialog", true);
SharedPreferences pref = U.getSharedPreferences(this);
if(pref.getBoolean("taskbar_active", false)) {
- if(U.canDrawOverlays(this)) {
+ if(U.canDrawOverlays(this, false)) {
isHidden = U.getSharedPreferences(this).getBoolean("is_hidden", false);
Intent intent = new Intent(this, MainActivity.class);
? R.drawable.ic_system
: R.drawable.ic_allapps));
- if(U.canDrawOverlays(this))
+ if(U.canDrawOverlays(this, false))
tile.setState(U.isServiceRunning(this, NotificationService.class)
? Tile.STATE_ACTIVE
: Tile.STATE_INACTIVE);
import com.farmerbb.taskbar.R;
import com.farmerbb.taskbar.activity.DashboardActivity;
+import com.farmerbb.taskbar.activity.HomeActivityDelegate;
import com.farmerbb.taskbar.activity.dark.DashboardActivityDark;
import com.farmerbb.taskbar.util.DashboardHelper;
import com.farmerbb.taskbar.widget.DashboardCell;
SharedPreferences pref = U.getSharedPreferences(context);
if(pref.getBoolean("dashboard", false)) {
if(pref.getBoolean("taskbar_active", false) || LauncherHelper.getInstance().isOnHomeScreen()) {
- if(U.canDrawOverlays(context))
+ if(U.canDrawOverlays(context, host instanceof HomeActivityDelegate))
drawDashboard(host);
else {
pref.edit().putBoolean("taskbar_active", false).apply();
} catch (IllegalArgumentException e) { /* Gracefully fail */ }
SharedPreferences pref = U.getSharedPreferences(context);
- if(U.canDrawOverlays(context))
+ if(U.canDrawOverlays(context, host instanceof HomeActivityDelegate))
drawDashboard(host);
else {
pref.edit().putBoolean("taskbar_active", false).apply();
import android.widget.TextView;
import com.farmerbb.taskbar.R;
+import com.farmerbb.taskbar.activity.HomeActivity;
+import com.farmerbb.taskbar.activity.HomeActivityDelegate;
import com.farmerbb.taskbar.activity.InvisibleActivity;
import com.farmerbb.taskbar.activity.InvisibleActivityAlt;
import com.farmerbb.taskbar.adapter.StartMenuAdapter;
SharedPreferences pref = U.getSharedPreferences(context);
if(pref.getBoolean("taskbar_active", false) || LauncherHelper.getInstance().isOnHomeScreen()) {
- if(U.canDrawOverlays(context))
+ if(U.canDrawOverlays(context, host instanceof HomeActivityDelegate))
drawStartMenu(host);
else {
pref.edit().putBoolean("taskbar_active", false).apply();
host.removeView(layout);
} catch (IllegalArgumentException e) { /* Gracefully fail */ }
- if(U.canDrawOverlays(context))
+ if(U.canDrawOverlays(context, host instanceof HomeActivityDelegate))
drawStartMenu(host);
else {
SharedPreferences pref = U.getSharedPreferences(context);
import android.widget.Space;
import com.farmerbb.taskbar.BuildConfig;
+import com.farmerbb.taskbar.activity.HomeActivityDelegate;
import com.farmerbb.taskbar.activity.MainActivity;
import com.farmerbb.taskbar.R;
import com.farmerbb.taskbar.activity.HomeActivity;
public void onCreateHost(Host host) {
SharedPreferences pref = U.getSharedPreferences(context);
if(pref.getBoolean("taskbar_active", false) || LauncherHelper.getInstance().isOnHomeScreen()) {
- if(U.canDrawOverlays(context))
+ if(U.canDrawOverlays(context, host instanceof HomeActivityDelegate))
drawTaskbar(host);
else {
pref.edit().putBoolean("taskbar_active", false).apply();
currentTaskbarPosition = 0;
- if(U.canDrawOverlays(context))
+ if(U.canDrawOverlays(context, host instanceof HomeActivityDelegate))
drawTaskbar(host);
else {
SharedPreferences pref = U.getSharedPreferences(context);
if(checkMultiWindow)
freeformHackIntent.putExtra("check_multiwindow", true);
- if(canDrawOverlays(context))
+ if(canDrawOverlays(context, false))
startActivityLowerRight(context, freeformHackIntent);
}
return pref.getInt("accent_color", context.getResources().getInteger(R.integer.translucent_white));
}
- public static boolean canDrawOverlays(Context context) {
- return canDrawOverlays(context, false);
- }
-
@TargetApi(Build.VERSION_CODES.M)
public static boolean canDrawOverlays(Context context, boolean forHomeScreen) {
return (forHomeScreen && !canBootToFreeform(context))
SharedPreferences pref = U.getSharedPreferences(context);
if(intent.hasExtra("secondscreen") && pref.getBoolean("launcher", false))
pref.edit().putBoolean("skip_disable_home_receiver", true).apply();
- else if(U.canDrawOverlays(context)) {
+ else if(U.canDrawOverlays(context, true)) {
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean("launcher", true);
editor.apply();