Loading app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.java +8 −9 Original line number Diff line number Diff line Loading @@ -68,10 +68,6 @@ public class BlurWallpaperProvider { updateWallpaper(); } private void updateAsync() { mDispatcher.submit(updateRunnable); } private void updateWallpaper() { if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { return; Loading @@ -92,8 +88,7 @@ public class BlurWallpaperProvider { @Override void onBlurSuccess(Bitmap bitmap) { if (bitmap != null && listener != null) { listener.onBlurSuccess(bitmap); //bitmap.recycle(); listener.blurBackgroundLayer(bitmap); } } Loading Loading @@ -134,8 +129,8 @@ public class BlurWallpaperProvider { @Override void onBlurSuccess(Bitmap bitmap) { if (bitmap != null && listener != null) { listener.onBlurSuccess(bitmap); //bitmap.recycle(); Log.d(TAG, "blurBackgroundLayer() called with: bitmap = [" + bitmap + "]"); listener.blurFrontLayer(bitmap); } } Loading @@ -148,6 +143,7 @@ public class BlurWallpaperProvider { public void cancelPreTask(boolean interrupt) { if (mFuture != null && !mFuture.isCancelled() && !mFuture.isDone()) { Log.d(TAG, "cancelPreTask() called with: interrupt = [" + interrupt + "]"); mFuture.cancel(interrupt); mFuture = null; } Loading Loading @@ -191,12 +187,15 @@ public class BlurWallpaperProvider { } public interface Listener { void onBlurSuccess(Bitmap bitmap); void blurBackgroundLayer(Bitmap bitmap); void blurFrontLayer(Bitmap bitmap); void fallbackToDimBackground(float dimAlpha); } public void clear() { Log.d(TAG, "clear() called"); listener = null; cancelPreTask(true); sInstance = null; Loading app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +48 −11 Original line number Diff line number Diff line Loading @@ -204,7 +204,8 @@ public class LauncherActivity extends AppCompatActivity implements private List<UsageStats> mUsageStats; private FrameLayout swipeSearchContainer; private RelativeLayout workspace; private View backgroundLayer; private View backgroundLayer; // Blur layer for horizontal pager. private View frontLayer; // Blur layer for folders and search container. private BroadcastReceiver mWeatherReceiver = new BroadcastReceiver() { @Override Loading Loading @@ -306,6 +307,7 @@ public class LauncherActivity extends AppCompatActivity implements workspace = mLauncherView.findViewById(R.id.workspace); mHorizontalPager = mLauncherView.findViewById(R.id.pages_container); backgroundLayer = mLauncherView.findViewById(R.id.background_layer); frontLayer = mLauncherView.findViewById(R.id.blur_layer); statusBarHeight = 0; int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { Loading Loading @@ -1104,11 +1106,15 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onViewScrollFinished(int page) { Log.d(TAG, "onViewScrollFinished() called with: page = [" + page + "]"); isViewScrolling = false; if (page != 0 && mFolderWindowContainer.getVisibility() != VISIBLE) { BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); if (page != 0) { backgroundLayer.setBackground(null); } if (mFolderWindowContainer.getVisibility() != VISIBLE) { frontLayer.setBackground(null); } if (currentPageNumber != page) { currentPageNumber = page; // Remove mIndicator and mDock from widgets page, and make them Loading Loading @@ -1142,12 +1148,19 @@ public class LauncherActivity extends AppCompatActivity implements } @Override public void onBlurSuccess(Bitmap bitmap) { Log.d(TAG, "onBlurSuccess() called with: bitmap = [" + bitmap + "]"); public void blurBackgroundLayer(Bitmap bitmap) { Log.d(TAG, "blurBackgroundLayer() called with: bitmap = [" + bitmap + "]"); BitmapDrawable drawable = new BitmapDrawable(bitmap); runOnUiThread(() -> backgroundLayer.setBackground(drawable)); } @Override public void blurFrontLayer(Bitmap bitmap) { Log.d(TAG, "blurFrontLayer() called with: bitmap = [" + bitmap + "]"); BitmapDrawable drawable = new BitmapDrawable(bitmap); runOnUiThread(() -> frontLayer.setBackground(drawable)); } @Override public void fallbackToDimBackground(float dimAlpha) { Log.d(TAG, "fallbackToDimBackground() called with: dimAlpha = [" + dimAlpha + "]"); Loading @@ -1159,6 +1172,14 @@ public class LauncherActivity extends AppCompatActivity implements runOnUiThread(() -> backgroundLayer.setBackgroundColor(Color.argb(alpha, red, green, blue))); } private void removeBlur(View view) { new Handler(Looper.getMainLooper()) .post(() -> { Log.d(TAG, "removeBlur() called"); view.setBackground(null); }); } public void refreshSuggestedApps(ViewGroup viewGroup, boolean forceRefresh) { TextView openUsageAccessSettingsTv = viewGroup.findViewById(R.id.openUsageAccessSettings); GridLayout suggestedAppsGridLayout = viewGroup.findViewById(R.id.suggestedAppGrid); Loading Loading @@ -2761,6 +2782,8 @@ public class LauncherActivity extends AppCompatActivity implements startBounds.bottom += deltaHeight; } Log.d("ShowFolder", "displayFolder() called with: app = [" + app + "], v = [" + v + "]"); // Construct and run the parallel animation of the four translation and // scale properties (X, Y, SCALE_X, and SCALE_Y). AnimatorSet set = new AnimatorSet(); Loading @@ -2786,6 +2809,7 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); Log.d("ShowFolder", "onAnimationStart() called with: animation = [" + animation + "]"); mFolderWindowContainer.setVisibility(View.VISIBLE); // Set the pivot point for SCALE_X and SCALE_Y transformations Loading @@ -2798,12 +2822,21 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onAnimationEnd(Animator animation) { Log.d("ShowFolder", "onAnimationEnd() called with: animation = [" + animation + "]"); currentAnimator = null; } @Override public void onAnimationCancel(Animator animation) { Log.d("ShowFolder", "onAnimationCancel() called with: animation = [" + animation + "]"); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); removeBlur(frontLayer); mFolderWindowContainer.setVisibility(GONE); mHorizontalPager.setAlpha(1f); mIndicator.setAlpha(1f); mDock.setAlpha(1f); } }); set.start(); Loading Loading @@ -2844,6 +2877,8 @@ public class LauncherActivity extends AppCompatActivity implements currentAnimator.cancel(); } Log.d("HideFolder", "hideFolderWindowContainer() called"); // Animate the four positioning/sizing properties in parallel, // back to their original values. AnimatorSet set = new AnimatorSet(); Loading @@ -2870,20 +2905,22 @@ public class LauncherActivity extends AppCompatActivity implements set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { Log.d("HideFolder", "onAnimationEnd() called with: animation = [" + animation + "]"); mFolderWindowContainer.setVisibility(View.GONE); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); removeBlur(frontLayer); } @Override public void onAnimationCancel(Animator animation) { Log.d("HideFolder", "onAnimationCancel() called with: animation = [" + animation + "]"); mFolderWindowContainer.setVisibility(View.GONE); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); removeBlur(frontLayer); mHorizontalPager.setAlpha(1f); mIndicator.setAlpha(1f); mDock.setAlpha(1f); Loading Loading @@ -2955,12 +2992,12 @@ public class LauncherActivity extends AppCompatActivity implements super.onAnimationCancel(animation); Log.d(TAG, "onAnimationCancel() called with: animation = [" + animation + "]"); currentAnimator = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); removeBlur(frontLayer); swipeSearchContainer.setVisibility(GONE); mHorizontalPager.setVisibility(VISIBLE); mIndicator.setVisibility(VISIBLE); mDock.setVisibility(VISIBLE); BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); } @Override Loading Loading @@ -3093,9 +3130,9 @@ public class LauncherActivity extends AppCompatActivity implements super.onAnimationEnd(animation); currentAnimator = null; mergedView = null; swipeSearchContainer.setVisibility(GONE); BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); removeBlur(frontLayer); swipeSearchContainer.setVisibility(GONE); if (searchDisposableObserver != null && !searchDisposableObserver.isDisposed()) { searchDisposableObserver.dispose(); Loading app/src/main/res/layout/activity_main.xml +6 −3 Original line number Diff line number Diff line Loading @@ -10,9 +10,7 @@ <View android:id="@+id/background_layer" android:layout_width="match_parent" android:layout_height="match_parent" android:alpha="1" android:background="@color/dark_grey_44" /> android:layout_height="match_parent" /> <foundation.e.blisslauncher.core.customviews.HorizontalPager android:id="@+id/pages_container" Loading Loading @@ -42,6 +40,11 @@ android:columnCount="@integer/col_count" android:rowCount="1" /> <View android:id="@+id/blur_layer" android:layout_width="match_parent" android:layout_height="match_parent" /> <RelativeLayout android:id="@+id/folder_window_container" android:layout_width="match_parent" Loading Loading
app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.java +8 −9 Original line number Diff line number Diff line Loading @@ -68,10 +68,6 @@ public class BlurWallpaperProvider { updateWallpaper(); } private void updateAsync() { mDispatcher.submit(updateRunnable); } private void updateWallpaper() { if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { return; Loading @@ -92,8 +88,7 @@ public class BlurWallpaperProvider { @Override void onBlurSuccess(Bitmap bitmap) { if (bitmap != null && listener != null) { listener.onBlurSuccess(bitmap); //bitmap.recycle(); listener.blurBackgroundLayer(bitmap); } } Loading Loading @@ -134,8 +129,8 @@ public class BlurWallpaperProvider { @Override void onBlurSuccess(Bitmap bitmap) { if (bitmap != null && listener != null) { listener.onBlurSuccess(bitmap); //bitmap.recycle(); Log.d(TAG, "blurBackgroundLayer() called with: bitmap = [" + bitmap + "]"); listener.blurFrontLayer(bitmap); } } Loading @@ -148,6 +143,7 @@ public class BlurWallpaperProvider { public void cancelPreTask(boolean interrupt) { if (mFuture != null && !mFuture.isCancelled() && !mFuture.isDone()) { Log.d(TAG, "cancelPreTask() called with: interrupt = [" + interrupt + "]"); mFuture.cancel(interrupt); mFuture = null; } Loading Loading @@ -191,12 +187,15 @@ public class BlurWallpaperProvider { } public interface Listener { void onBlurSuccess(Bitmap bitmap); void blurBackgroundLayer(Bitmap bitmap); void blurFrontLayer(Bitmap bitmap); void fallbackToDimBackground(float dimAlpha); } public void clear() { Log.d(TAG, "clear() called"); listener = null; cancelPreTask(true); sInstance = null; Loading
app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +48 −11 Original line number Diff line number Diff line Loading @@ -204,7 +204,8 @@ public class LauncherActivity extends AppCompatActivity implements private List<UsageStats> mUsageStats; private FrameLayout swipeSearchContainer; private RelativeLayout workspace; private View backgroundLayer; private View backgroundLayer; // Blur layer for horizontal pager. private View frontLayer; // Blur layer for folders and search container. private BroadcastReceiver mWeatherReceiver = new BroadcastReceiver() { @Override Loading Loading @@ -306,6 +307,7 @@ public class LauncherActivity extends AppCompatActivity implements workspace = mLauncherView.findViewById(R.id.workspace); mHorizontalPager = mLauncherView.findViewById(R.id.pages_container); backgroundLayer = mLauncherView.findViewById(R.id.background_layer); frontLayer = mLauncherView.findViewById(R.id.blur_layer); statusBarHeight = 0; int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { Loading Loading @@ -1104,11 +1106,15 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onViewScrollFinished(int page) { Log.d(TAG, "onViewScrollFinished() called with: page = [" + page + "]"); isViewScrolling = false; if (page != 0 && mFolderWindowContainer.getVisibility() != VISIBLE) { BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); if (page != 0) { backgroundLayer.setBackground(null); } if (mFolderWindowContainer.getVisibility() != VISIBLE) { frontLayer.setBackground(null); } if (currentPageNumber != page) { currentPageNumber = page; // Remove mIndicator and mDock from widgets page, and make them Loading Loading @@ -1142,12 +1148,19 @@ public class LauncherActivity extends AppCompatActivity implements } @Override public void onBlurSuccess(Bitmap bitmap) { Log.d(TAG, "onBlurSuccess() called with: bitmap = [" + bitmap + "]"); public void blurBackgroundLayer(Bitmap bitmap) { Log.d(TAG, "blurBackgroundLayer() called with: bitmap = [" + bitmap + "]"); BitmapDrawable drawable = new BitmapDrawable(bitmap); runOnUiThread(() -> backgroundLayer.setBackground(drawable)); } @Override public void blurFrontLayer(Bitmap bitmap) { Log.d(TAG, "blurFrontLayer() called with: bitmap = [" + bitmap + "]"); BitmapDrawable drawable = new BitmapDrawable(bitmap); runOnUiThread(() -> frontLayer.setBackground(drawable)); } @Override public void fallbackToDimBackground(float dimAlpha) { Log.d(TAG, "fallbackToDimBackground() called with: dimAlpha = [" + dimAlpha + "]"); Loading @@ -1159,6 +1172,14 @@ public class LauncherActivity extends AppCompatActivity implements runOnUiThread(() -> backgroundLayer.setBackgroundColor(Color.argb(alpha, red, green, blue))); } private void removeBlur(View view) { new Handler(Looper.getMainLooper()) .post(() -> { Log.d(TAG, "removeBlur() called"); view.setBackground(null); }); } public void refreshSuggestedApps(ViewGroup viewGroup, boolean forceRefresh) { TextView openUsageAccessSettingsTv = viewGroup.findViewById(R.id.openUsageAccessSettings); GridLayout suggestedAppsGridLayout = viewGroup.findViewById(R.id.suggestedAppGrid); Loading Loading @@ -2761,6 +2782,8 @@ public class LauncherActivity extends AppCompatActivity implements startBounds.bottom += deltaHeight; } Log.d("ShowFolder", "displayFolder() called with: app = [" + app + "], v = [" + v + "]"); // Construct and run the parallel animation of the four translation and // scale properties (X, Y, SCALE_X, and SCALE_Y). AnimatorSet set = new AnimatorSet(); Loading @@ -2786,6 +2809,7 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); Log.d("ShowFolder", "onAnimationStart() called with: animation = [" + animation + "]"); mFolderWindowContainer.setVisibility(View.VISIBLE); // Set the pivot point for SCALE_X and SCALE_Y transformations Loading @@ -2798,12 +2822,21 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onAnimationEnd(Animator animation) { Log.d("ShowFolder", "onAnimationEnd() called with: animation = [" + animation + "]"); currentAnimator = null; } @Override public void onAnimationCancel(Animator animation) { Log.d("ShowFolder", "onAnimationCancel() called with: animation = [" + animation + "]"); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); removeBlur(frontLayer); mFolderWindowContainer.setVisibility(GONE); mHorizontalPager.setAlpha(1f); mIndicator.setAlpha(1f); mDock.setAlpha(1f); } }); set.start(); Loading Loading @@ -2844,6 +2877,8 @@ public class LauncherActivity extends AppCompatActivity implements currentAnimator.cancel(); } Log.d("HideFolder", "hideFolderWindowContainer() called"); // Animate the four positioning/sizing properties in parallel, // back to their original values. AnimatorSet set = new AnimatorSet(); Loading @@ -2870,20 +2905,22 @@ public class LauncherActivity extends AppCompatActivity implements set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { Log.d("HideFolder", "onAnimationEnd() called with: animation = [" + animation + "]"); mFolderWindowContainer.setVisibility(View.GONE); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); removeBlur(frontLayer); } @Override public void onAnimationCancel(Animator animation) { Log.d("HideFolder", "onAnimationCancel() called with: animation = [" + animation + "]"); mFolderWindowContainer.setVisibility(View.GONE); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); removeBlur(frontLayer); mHorizontalPager.setAlpha(1f); mIndicator.setAlpha(1f); mDock.setAlpha(1f); Loading Loading @@ -2955,12 +2992,12 @@ public class LauncherActivity extends AppCompatActivity implements super.onAnimationCancel(animation); Log.d(TAG, "onAnimationCancel() called with: animation = [" + animation + "]"); currentAnimator = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); removeBlur(frontLayer); swipeSearchContainer.setVisibility(GONE); mHorizontalPager.setVisibility(VISIBLE); mIndicator.setVisibility(VISIBLE); mDock.setVisibility(VISIBLE); BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); } @Override Loading Loading @@ -3093,9 +3130,9 @@ public class LauncherActivity extends AppCompatActivity implements super.onAnimationEnd(animation); currentAnimator = null; mergedView = null; swipeSearchContainer.setVisibility(GONE); BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); removeBlur(frontLayer); swipeSearchContainer.setVisibility(GONE); if (searchDisposableObserver != null && !searchDisposableObserver.isDisposed()) { searchDisposableObserver.dispose(); Loading
app/src/main/res/layout/activity_main.xml +6 −3 Original line number Diff line number Diff line Loading @@ -10,9 +10,7 @@ <View android:id="@+id/background_layer" android:layout_width="match_parent" android:layout_height="match_parent" android:alpha="1" android:background="@color/dark_grey_44" /> android:layout_height="match_parent" /> <foundation.e.blisslauncher.core.customviews.HorizontalPager android:id="@+id/pages_container" Loading Loading @@ -42,6 +40,11 @@ android:columnCount="@integer/col_count" android:rowCount="1" /> <View android:id="@+id/blur_layer" android:layout_width="match_parent" android:layout_height="match_parent" /> <RelativeLayout android:id="@+id/folder_window_container" android:layout_width="match_parent" Loading