params.width = getResources().getDimensionPixelSize(R.dimen.context_menu_width);
params.dimAmount = 0;
+ if(U.isChromeOs(this) && U.getTaskbarPosition(this).contains("bottom")) {
+ SharedPreferences pref = U.getSharedPreferences(this);
+
+ if(pref.getBoolean("chrome_os_context_menu_fix", true)
+ && !pref.getBoolean("has_caption", false))
+ params.y = params.y - getResources().getDimensionPixelSize(R.dimen.caption_offset);
+ }
+
getWindow().setAttributes(params);
if(U.isChromeOs(this) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
+import android.os.Handler;
import android.support.design.widget.Snackbar;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.ActionBar;
}
};
+ private boolean hasCaption = false;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(!launcherEnabled)
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.KILL_HOME_ACTIVITY"));
+ // Update caption state
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && U.isChromeOs(this)) {
+ getWindow().setRestrictedCaptionAreaListener(rect -> hasCaption = true);
+
+ new Handler().postDelayed(() -> pref.edit().putBoolean("has_caption", hasCaption).apply(), 500);
+ }
+
if(BuildConfig.APPLICATION_ID.equals(BuildConfig.PAID_APPLICATION_ID)) {
File file = new File(getFilesDir() + File.separator + "imported_successfully");
if(freeVersionInstalled() && !file.exists()) {
@Override
protected void onDestroy() {
- super.onDestroy();
-
LocalBroadcastManager.getInstance(this).unregisterReceiver(switchReceiver);
+
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && U.isChromeOs(this))
+ getWindow().setRestrictedCaptionAreaListener(null);
+
+ super.onDestroy();
}
@SuppressWarnings("deprecation")