Loading app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.java +9 −7 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ public class BlurWallpaperProvider { } public void blurWithLauncherView(Bitmap view, int radius) { Log.d(TAG, "blurWithLauncherView() called with: view = [" + view + "], radius = [" + radius + "]"); cancelPreTask(false); mFuture = mDispatcher.submit(new BlurTask(view, blurProcessor, radius) { @Override Loading Loading @@ -178,15 +179,16 @@ public class BlurWallpaperProvider { wallpaper = Bitmap.createScaledBitmap(wallpaper, scaledWidth, scaledHeight, false); int x = 0; int y = (wallpaper.getHeight() - height) / 2; if (y < 0 || y + height > wallpaper.getHeight()) { y = 0; if(wallpaper.getWidth() >= wallpaper.getHeight()){ return Bitmap.createBitmap(wallpaper, 0, 0, width, height); } else { int x = (wallpaper.getWidth() - width) / 2; if (x < 0 || x + width > wallpaper.getWidth()) { x = 0; } Log.i(TAG, "X and Y: " + x + "*" + y); return Bitmap.createBitmap(wallpaper, x, 0, width, height); } } public interface Listener { void onBlurSuccess(Bitmap bitmap); Loading app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +16 −15 Original line number Diff line number Diff line Loading @@ -151,9 +151,6 @@ import me.relex.circleindicator.CircleIndicator; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static android.view.View.GONE; import static android.view.View.VISIBLE; public class LauncherActivity extends AppCompatActivity implements AutoCompleteAdapter.OnSuggestionClickListener, OnSwipeDownListener, BlurWallpaperProvider.Listener { Loading Loading @@ -1107,9 +1104,9 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onViewScrollFinished(int page) { BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); isViewScrolling = false; if (page != 0 && mFolderWindowContainer.getVisibility() != VISIBLE) { BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); } if (currentPageNumber != page) { Loading Loading @@ -1146,12 +1143,14 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onBlurSuccess(Bitmap bitmap) { Log.d(TAG, "onBlurSuccess() called with: bitmap = [" + bitmap + "]"); BitmapDrawable drawable = new BitmapDrawable(bitmap); runOnUiThread(() -> backgroundLayer.setBackground(drawable)); } @Override public void fallbackToDimBackground(float dimAlpha) { Log.d(TAG, "fallbackToDimBackground() called with: dimAlpha = [" + dimAlpha + "]"); int color = 0x44000000; int alpha = Math.round(Color.alpha(color) * dimAlpha); int red = Color.red(color); Loading Loading @@ -2800,13 +2799,11 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onAnimationEnd(Animator animation) { currentAnimator = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); } @Override public void onAnimationCancel(Animator animation) { currentAnimator = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); } }); set.start(); Loading Loading @@ -2873,19 +2870,19 @@ public class LauncherActivity extends AppCompatActivity implements set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); mFolderWindowContainer.setVisibility(View.GONE); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); } @Override public void onAnimationCancel(Animator animation) { BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); mFolderWindowContainer.setVisibility(View.GONE); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); mHorizontalPager.setAlpha(1f); mIndicator.setAlpha(1f); Loading Loading @@ -2937,6 +2934,7 @@ public class LauncherActivity extends AppCompatActivity implements } private void showSwipeSearchContainer() { Log.d(TAG, "showSwipeSearchContainer() called " + blurRadius + " " + (mergedView == null)); if (currentAnimator != null) { currentAnimator.cancel(); } Loading @@ -2955,21 +2953,22 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onAnimationCancel(Animator animation) { super.onAnimationCancel(animation); Log.d(TAG, "onAnimationCancel() called with: animation = [" + animation + "]"); currentAnimator = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); swipeSearchContainer.setVisibility(GONE); mHorizontalPager.setVisibility(VISIBLE); mIndicator.setVisibility(VISIBLE); mDock.setVisibility(VISIBLE); BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); } @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); Log.d(TAG, "onAnimationEnd() called with: animation = [" + animation + "]"); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); mHorizontalPager.setVisibility(GONE); mIndicator.setVisibility(GONE); mDock.setVisibility(GONE); Loading Loading @@ -3073,6 +3072,7 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); mHorizontalPager.setVisibility(VISIBLE); mIndicator.setVisibility(VISIBLE); mDock.setVisibility(VISIBLE); Loading @@ -3082,7 +3082,7 @@ public class LauncherActivity extends AppCompatActivity implements public void onAnimationCancel(Animator animation) { super.onAnimationCancel(animation); currentAnimator = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); swipeSearchContainer.setVisibility(VISIBLE); mHorizontalPager.setVisibility(GONE); mIndicator.setVisibility(GONE); mDock.setVisibility(GONE); Loading @@ -3093,8 +3093,8 @@ public class LauncherActivity extends AppCompatActivity implements super.onAnimationEnd(animation); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); swipeSearchContainer.setVisibility(GONE); BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); if (searchDisposableObserver != null && !searchDisposableObserver.isDisposed()) { Loading Loading @@ -3131,6 +3131,7 @@ public class LauncherActivity extends AppCompatActivity implements mIndicator.setAlpha(deltaAlpha); mDock.setAlpha(deltaAlpha); blurRadius = (int) ((1 - deltaAlpha) * 25); Log.d(TAG, "onSwipe() called with: position = [" + position + "]"); BlurWallpaperProvider.getInstance(this).blurWithLauncherView(mergedView, blurRadius); } Loading Loading
app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.java +9 −7 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ public class BlurWallpaperProvider { } public void blurWithLauncherView(Bitmap view, int radius) { Log.d(TAG, "blurWithLauncherView() called with: view = [" + view + "], radius = [" + radius + "]"); cancelPreTask(false); mFuture = mDispatcher.submit(new BlurTask(view, blurProcessor, radius) { @Override Loading Loading @@ -178,15 +179,16 @@ public class BlurWallpaperProvider { wallpaper = Bitmap.createScaledBitmap(wallpaper, scaledWidth, scaledHeight, false); int x = 0; int y = (wallpaper.getHeight() - height) / 2; if (y < 0 || y + height > wallpaper.getHeight()) { y = 0; if(wallpaper.getWidth() >= wallpaper.getHeight()){ return Bitmap.createBitmap(wallpaper, 0, 0, width, height); } else { int x = (wallpaper.getWidth() - width) / 2; if (x < 0 || x + width > wallpaper.getWidth()) { x = 0; } Log.i(TAG, "X and Y: " + x + "*" + y); return Bitmap.createBitmap(wallpaper, x, 0, width, height); } } public interface Listener { void onBlurSuccess(Bitmap bitmap); Loading
app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +16 −15 Original line number Diff line number Diff line Loading @@ -151,9 +151,6 @@ import me.relex.circleindicator.CircleIndicator; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static android.view.View.GONE; import static android.view.View.VISIBLE; public class LauncherActivity extends AppCompatActivity implements AutoCompleteAdapter.OnSuggestionClickListener, OnSwipeDownListener, BlurWallpaperProvider.Listener { Loading Loading @@ -1107,9 +1104,9 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onViewScrollFinished(int page) { BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); isViewScrolling = false; if (page != 0 && mFolderWindowContainer.getVisibility() != VISIBLE) { BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); } if (currentPageNumber != page) { Loading Loading @@ -1146,12 +1143,14 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onBlurSuccess(Bitmap bitmap) { Log.d(TAG, "onBlurSuccess() called with: bitmap = [" + bitmap + "]"); BitmapDrawable drawable = new BitmapDrawable(bitmap); runOnUiThread(() -> backgroundLayer.setBackground(drawable)); } @Override public void fallbackToDimBackground(float dimAlpha) { Log.d(TAG, "fallbackToDimBackground() called with: dimAlpha = [" + dimAlpha + "]"); int color = 0x44000000; int alpha = Math.round(Color.alpha(color) * dimAlpha); int red = Color.red(color); Loading Loading @@ -2800,13 +2799,11 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onAnimationEnd(Animator animation) { currentAnimator = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); } @Override public void onAnimationCancel(Animator animation) { currentAnimator = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); } }); set.start(); Loading Loading @@ -2873,19 +2870,19 @@ public class LauncherActivity extends AppCompatActivity implements set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); mFolderWindowContainer.setVisibility(View.GONE); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); } @Override public void onAnimationCancel(Animator animation) { BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); mFolderWindowContainer.setVisibility(View.GONE); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); mHorizontalPager.setAlpha(1f); mIndicator.setAlpha(1f); Loading Loading @@ -2937,6 +2934,7 @@ public class LauncherActivity extends AppCompatActivity implements } private void showSwipeSearchContainer() { Log.d(TAG, "showSwipeSearchContainer() called " + blurRadius + " " + (mergedView == null)); if (currentAnimator != null) { currentAnimator.cancel(); } Loading @@ -2955,21 +2953,22 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onAnimationCancel(Animator animation) { super.onAnimationCancel(animation); Log.d(TAG, "onAnimationCancel() called with: animation = [" + animation + "]"); currentAnimator = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); swipeSearchContainer.setVisibility(GONE); mHorizontalPager.setVisibility(VISIBLE); mIndicator.setVisibility(VISIBLE); mDock.setVisibility(VISIBLE); BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); } @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); Log.d(TAG, "onAnimationEnd() called with: animation = [" + animation + "]"); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); mHorizontalPager.setVisibility(GONE); mIndicator.setVisibility(GONE); mDock.setVisibility(GONE); Loading Loading @@ -3073,6 +3072,7 @@ public class LauncherActivity extends AppCompatActivity implements @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); mHorizontalPager.setVisibility(VISIBLE); mIndicator.setVisibility(VISIBLE); mDock.setVisibility(VISIBLE); Loading @@ -3082,7 +3082,7 @@ public class LauncherActivity extends AppCompatActivity implements public void onAnimationCancel(Animator animation) { super.onAnimationCancel(animation); currentAnimator = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); swipeSearchContainer.setVisibility(VISIBLE); mHorizontalPager.setVisibility(GONE); mIndicator.setVisibility(GONE); mDock.setVisibility(GONE); Loading @@ -3093,8 +3093,8 @@ public class LauncherActivity extends AppCompatActivity implements super.onAnimationEnd(animation); currentAnimator = null; mergedView = null; BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); swipeSearchContainer.setVisibility(GONE); BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); backgroundLayer.setBackground(null); if (searchDisposableObserver != null && !searchDisposableObserver.isDisposed()) { Loading Loading @@ -3131,6 +3131,7 @@ public class LauncherActivity extends AppCompatActivity implements mIndicator.setAlpha(deltaAlpha); mDock.setAlpha(deltaAlpha); blurRadius = (int) ((1 - deltaAlpha) * 25); Log.d(TAG, "onSwipe() called with: position = [" + position + "]"); BlurWallpaperProvider.getInstance(this).blurWithLauncherView(mergedView, blurRadius); } Loading