use of com.saggitt.omega.OmegaPreferences in project Neo-Launcher by NeoApplications.
the class AllAppsQsbLayout method setContentVisibility.
@Override
public void setContentVisibility(int visibleElements, PropertySetter setter, Interpolator interpolator) {
OmegaPreferences prefs = Utilities.getOmegaPrefs(getContext());
boolean hotseatQsbEnabled = prefs.getDockSearchBar() || widgetMode;
boolean hotseatQsbVisible = (visibleElements & HOTSEAT_SEARCH_BOX) != 0;
boolean drawerQsbEnabled = prefs.getAllAppsSearch();
boolean drawerQsbVisible = (visibleElements & ALL_APPS_HEADER) != 0;
boolean qsbVisible = (hotseatQsbEnabled && hotseatQsbVisible) || (drawerQsbEnabled && drawerQsbVisible);
float hotseatProgress, micProgress;
if (!hotseatQsbEnabled) {
hotseatProgress = 0;
} else if (!drawerQsbEnabled) {
hotseatProgress = 1;
} else {
hotseatProgress = (visibleElements & ALL_APPS_CONTENT) != 0 ? 0 : 1;
}
if (prefs.getAllAppsGlobalSearch()) {
micProgress = 1f;
} else {
micProgress = hotseatProgress;
}
setter.setFloat(this, HOTSEAT_PROGRESS, hotseatProgress, LINEAR);
setter.setViewAlpha(this, qsbVisible ? 1 : 0, interpolator);
setter.setViewAlpha(mLogoIconView, 1 - hotseatProgress, interpolator);
setter.setViewAlpha(mHotseatLogoIconView, hotseatProgress, interpolator);
setter.setViewAlpha(mMicIconView, micProgress, interpolator);
if (mMicIconView != null) {
mMicIconView.setVisibility(micProgress > 0 ? View.VISIBLE : View.INVISIBLE);
}
}
use of com.saggitt.omega.OmegaPreferences in project Neo-Launcher by NeoApplications.
the class BubbleTextView method applyIconAndLabel.
private void applyIconAndLabel(ItemInfoWithIcon info) {
FastBitmapDrawable iconDrawable = DrawableFactory.INSTANCE.get(getContext()).newIcon(getContext(), info);
OmegaPreferences prefs = Utilities.getOmegaPrefs(getContext());
if (prefs.getNotificationCount()) {
mDotParams.color = prefs.getNotificationBackground();
} else {
mDotParams.color = IconPalette.getMutedColor(info.iconColor, 0.54f);
}
setIcon(iconDrawable);
if (!isTextHidden())
setText(getTitle(info));
if (info.contentDescription != null) {
setContentDescription(info.isDisabled() ? getContext().getString(R.string.disabled_app_label, info.contentDescription) : info.contentDescription);
}
}
use of com.saggitt.omega.OmegaPreferences in project Neo-Launcher by NeoApplications.
the class BubbleTextView method drawDotIfNecessary.
/**
* Draws the notification dot in the top right corner of the icon bounds.
* @param canvas The canvas to draw to.
*/
protected void drawDotIfNecessary(Canvas canvas) {
if (!mForceHideDot && (hasDot() || mDotParams.scale > 0)) {
getIconBounds(mDotParams.iconBounds);
Utilities.scaleRectAboutCenter(mDotParams.iconBounds, IconShape.getNormalizationScale());
final int scrollX = getScrollX();
final int scrollY = getScrollY();
canvas.translate(scrollX, scrollY);
if (mDotInfo != null) {
OmegaPreferences prefs = Utilities.getOmegaPrefs(getContext());
mDotParams.count = mDotInfo.getNotificationCount();
mDotParams.notificationKeys = mDotInfo.getNotificationKeys().size();
mDotParams.showCount = prefs.getNotificationCount();
if (prefs.getNotificationCount()) {
mDotParams.showCount = true;
mDotParams.color = prefs.getNotificationBackground();
}
}
mDotRenderer.draw(canvas, mDotParams);
canvas.translate(-scrollX, -scrollY);
}
}
use of com.saggitt.omega.OmegaPreferences in project Neo-Launcher by NeoApplications.
the class Launcher method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
RaceConditionTracker.onEvent(ON_CREATE_EVT, ENTER);
if (DEBUG_STRICT_MODE) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());
}
TraceHelper.beginSection("Launcher-onCreate");
super.onCreate(savedInstanceState);
TraceHelper.partitionSection("Launcher-onCreate", "super call");
LauncherAppState app = LauncherAppState.getInstance(this);
OmegaPreferences prefs = Utilities.getOmegaPrefs(this);
prefs.getDrawerGridSize();
prefs.getGridSize();
prefs.getDockGridSize();
mOldConfig = new Configuration(getResources().getConfiguration());
mModel = app.setLauncher(this);
mRotationHelper = new RotationHelper(this);
InvariantDeviceProfile idp = app.getInvariantDeviceProfile();
initDeviceProfile(idp);
idp.addOnChangeListener(this);
mSharedPrefs = Utilities.getPrefs(this);
mIconCache = app.getIconCache();
mAccessibilityDelegate = new LauncherAccessibilityDelegate(this);
mDragController = new DragController(this);
mAllAppsController = new AllAppsTransitionController(this);
mStateManager = new LauncherStateManager(this);
UiFactory.onCreate(this);
mAppWidgetManager = AppWidgetManagerCompat.getInstance(this);
mAppWidgetHost = new LauncherAppWidgetHost(this, appWidgetId -> getWorkspace().removeWidget(appWidgetId));
mAppWidgetHost.startListening();
mLauncherView = LayoutInflater.from(this).inflate(R.layout.launcher, null);
setupViews();
mPopupDataProvider = new PopupDataProvider(this);
mAppTransitionManager = LauncherAppTransitionManager.newInstance(this);
boolean internalStateHandled = InternalStateHandler.handleCreate(this, getIntent());
if (internalStateHandled) {
if (savedInstanceState != null) {
// InternalStateHandler has already set the appropriate state.
// We dont need to do anything.
savedInstanceState.remove(RUNTIME_STATE);
}
}
restoreState(savedInstanceState);
mStateManager.reapplyState();
// We only load the page synchronously if the user rotates (or triggers a
// configuration change) while launcher is in the foreground
int currentScreen = PagedView.INVALID_RESTORE_PAGE;
if (savedInstanceState != null) {
currentScreen = savedInstanceState.getInt(RUNTIME_STATE_CURRENT_SCREEN, currentScreen);
}
if (!mModel.startLoader(currentScreen)) {
if (!internalStateHandled) {
// If we are not binding synchronously, show a fade in animation when
// the first page bind completes.
mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD).setValue(0);
}
} else {
// Pages bound synchronously.
mWorkspace.setCurrentPage(currentScreen);
setWorkspaceLoading(true);
}
// For handling default keys
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
setContentView(mLauncherView);
getRootView().dispatchInsets();
// Listen for broadcasts
registerReceiver(mScreenOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW, Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText));
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onCreate(savedInstanceState);
}
mRotationHelper.initialize();
TraceHelper.endSection("Launcher-onCreate");
RaceConditionTracker.onEvent(ON_CREATE_EVT, EXIT);
mStateManager.addStateListener(new LauncherStateManager.StateListener() {
@Override
public void onStateTransitionStart(LauncherState toState) {
}
@Override
public void onStateTransitionComplete(LauncherState finalState) {
float alpha = 1f - mCurrentAssistantVisibility;
if (finalState == NORMAL) {
mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
} else if (finalState == OVERVIEW || finalState == OVERVIEW_PEEK) {
mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
mScrimView.getAlphaProperty(SCRIM_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
} else {
mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(1f);
mScrimView.getAlphaProperty(SCRIM_VIEW_ALPHA_CHANNEL_INDEX).setValue(1f);
}
}
});
}
use of com.saggitt.omega.OmegaPreferences in project Neo-Launcher by NeoApplications.
the class Utilities method checkRestoreSuccess.
public static void checkRestoreSuccess(Context context) {
OmegaPreferences prefs = Utilities.getOmegaPrefs(context);
if (prefs.getRestoreSuccess()) {
prefs.setRestoreSuccess(false);
context.startActivity(new Intent(context, RestoreBackupActivity.class).putExtra(RestoreBackupActivity.EXTRA_SUCCESS, true));
}
}
Aggregations