Commit 0d532748 authored by Amit Kumar's avatar Amit Kumar 💻
Browse files

Use simple way to fix folder animation view

parent 460e5f9a
Pipeline #130991 passed with stage
in 8 minutes and 43 seconds
...@@ -1488,7 +1488,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V ...@@ -1488,7 +1488,7 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
int[] targetCell, float distance, boolean external, DragView dragView int[] targetCell, float distance, boolean external, DragView dragView
) { ) {
if (distance > mMaxDistanceForFolderCreation) return false; if (distance > mMaxDistanceForFolderCreation) return false;
View v = target.getChildAt(targetCell[0], targetCell[1]); View targetView = target.getChildAt(targetCell[0], targetCell[1]);
boolean hasntMoved = false; boolean hasntMoved = false;
if (mDragInfo != null) { if (mDragInfo != null) {
...@@ -1498,22 +1498,22 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V ...@@ -1498,22 +1498,22 @@ public class LauncherPagedView extends PagedView<PageIndicatorDots> implements V
.getMCountX() == targetCell[1]) && (cellParent == target); .getMCountX() == targetCell[1]) && (cellParent == target);
} }
if (v == null || hasntMoved || !mCreateUserFolderOnDrop) return false; if (targetView == null || hasntMoved || !mCreateUserFolderOnDrop) return false;
mCreateUserFolderOnDrop = false; mCreateUserFolderOnDrop = false;
final long screenId = getIdForScreen(target); final long screenId = getIdForScreen(target);
boolean aboveShortcut = boolean aboveShortcut =
(v.getTag() instanceof ApplicationItem) || (v.getTag() instanceof ShortcutItem); (targetView.getTag() instanceof ApplicationItem) || (targetView.getTag() instanceof ShortcutItem);
boolean willBecomeShortcut = boolean willBecomeShortcut =
(v.getTag() instanceof ApplicationItem) || (v.getTag() instanceof ShortcutItem); (targetView.getTag() instanceof ApplicationItem) || (targetView.getTag() instanceof ShortcutItem);
if (aboveShortcut && willBecomeShortcut) { if (aboveShortcut && willBecomeShortcut) {
LauncherItem sourceItem = (LauncherItem) newView.getTag(); LauncherItem sourceItem = (LauncherItem) newView.getTag();
LauncherItem destItem = (LauncherItem) v.getTag(); LauncherItem destItem = (LauncherItem) targetView.getTag();
Rect folderLocation = new Rect(); Rect folderLocation = new Rect();
target.clearAnimation(); targetView.clearAnimation();
target.removeView(v); target.removeView(targetView);
FolderItem fi = new FolderItem(); FolderItem fi = new FolderItem();
fi.title = getResources().getString(R.string.untitled); fi.title = getResources().getString(R.string.untitled);
fi.id = String.valueOf(System.currentTimeMillis()); fi.id = String.valueOf(System.currentTimeMillis());
......
...@@ -113,7 +113,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers ...@@ -113,7 +113,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
import io.reactivex.observers.DisposableObserver import io.reactivex.observers.DisposableObserver
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import me.relex.circleindicator.CircleIndicator
import java.net.URISyntaxException import java.net.URISyntaxException
import java.util.ArrayList import java.util.ArrayList
import java.util.Arrays import java.util.Arrays
...@@ -121,6 +120,7 @@ import java.util.Comparator ...@@ -121,6 +120,7 @@ import java.util.Comparator
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import java.util.function.Predicate import java.util.function.Predicate
import me.relex.circleindicator.CircleIndicator
class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionClickListener { class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionClickListener {
...@@ -295,7 +295,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -295,7 +295,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
if (!enabled) { if (!enabled) {
val launcherApps: LauncherApps = getSystemService(LAUNCHER_APPS_SERVICE) as LauncherApps val launcherApps: LauncherApps = getSystemService(LAUNCHER_APPS_SERVICE) as LauncherApps
val launcherInfo = launcherApps.getApplicationInfo(packageName, 0, Process.myUserHandle()) val launcherInfo = launcherApps.getApplicationInfo(packageName, 0, Process.myUserHandle())
if(launcherInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0) { if (launcherInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0) {
val args = Bundle() val args = Bundle()
args.putString(":settings:fragment_args_key", cn.flattenToString()) args.putString(":settings:fragment_args_key", cn.flattenToString())
val intent = Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS) val intent = Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS)
...@@ -1223,7 +1223,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -1223,7 +1223,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
// In all these cases, only animate if we're already on home // In all these cases, only animate if we're already on home
AbstractFloatingView.closeAllOpenViews(this, isStarted) AbstractFloatingView.closeAllOpenViews(this, isStarted)
if(folderContainer.visibility == View.VISIBLE) { if (folderContainer.visibility == View.VISIBLE) {
closeFolder() closeFolder()
return return
} }
...@@ -1262,7 +1262,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -1262,7 +1262,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
} }
// We expire wobble animation as soon a back press is done and return if the animation was running. // We expire wobble animation as soon a back press is done and return if the animation was running.
if(getLauncherPagedView().setWobbleExpirationAlarm(0)) { if (getLauncherPagedView().setWobbleExpirationAlarm(0)) {
return return
} }
...@@ -1274,7 +1274,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -1274,7 +1274,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
// Handled by the floating view. // Handled by the floating view.
} else if (folderContainer.visibility == View.VISIBLE) { } else if (folderContainer.visibility == View.VISIBLE) {
closeFolder() closeFolder()
}else { } else {
mStateManager.state.onBackPressed(this) mStateManager.state.onBackPressed(this)
} }
} }
...@@ -1534,7 +1534,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -1534,7 +1534,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
) )
) )
.with(ObjectAnimator.ofFloat<View>(getLauncherPagedView(), View.ALPHA, 0f)) .with(ObjectAnimator.ofFloat<View>(getLauncherPagedView(), View.ALPHA, 0f))
//.with(ObjectAnimator.ofFloat<View>(mIndicator, View.ALPHA, 0f)) // .with(ObjectAnimator.ofFloat<View>(mIndicator, View.ALPHA, 0f))
.with(ObjectAnimator.ofFloat(hotseat, View.ALPHA, 0f)) .with(ObjectAnimator.ofFloat(hotseat, View.ALPHA, 0f))
set.duration = 300 set.duration = 300
set.interpolator = LinearInterpolator() set.interpolator = LinearInterpolator()
...@@ -1548,12 +1548,12 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -1548,12 +1548,12 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
// is the center of the view). // is the center of the view).
folderContainer.pivotX = 0f folderContainer.pivotX = 0f
folderContainer.pivotY = 0f folderContainer.pivotY = 0f
//BlurWallpaperProvider.getInstance(LauncherActivity.this).clear(); // BlurWallpaperProvider.getInstance(LauncherActivity.this).clear();
} }
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
currentAnimator = null currentAnimator = null
//blurLayer.setAlpha(1f) // blurLayer.setAlpha(1f)
getLauncherPagedView().alpha = 0f getLauncherPagedView().alpha = 0f
hotseat.alpha = 0f hotseat.alpha = 0f
} }
...@@ -1561,9 +1561,9 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -1561,9 +1561,9 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
override fun onAnimationCancel(animation: Animator) { override fun onAnimationCancel(animation: Animator) {
currentAnimator = null currentAnimator = null
folderContainer.visibility = View.GONE folderContainer.visibility = View.GONE
//blurLayer.setAlpha(0f) // blurLayer.setAlpha(0f)
getLauncherPagedView().alpha = 1f getLauncherPagedView().alpha = 1f
//mIndicator.setAlpha(1f) // mIndicator.setAlpha(1f)
hotseat.alpha = 1f hotseat.alpha = 1f
} }
}) })
...@@ -1586,7 +1586,6 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -1586,7 +1586,6 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
) )
} }
fun closeFolder() { fun closeFolder() {
mFolderTitleInput?.clearFocus() mFolderTitleInput?.clearFocus()
currentAnimator?.cancel() currentAnimator?.cancel()
...@@ -1626,11 +1625,11 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -1626,11 +1625,11 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
View.SCALE_Y, startScaleFinal View.SCALE_Y, startScaleFinal
) )
) )
//.with(ObjectAnimator.ofFloat<View>(blurLayer, View.ALPHA, 0f)) // .with(ObjectAnimator.ofFloat<View>(blurLayer, View.ALPHA, 0f))
.with(ObjectAnimator.ofFloat<View>(getLauncherPagedView(), View.ALPHA, 1f)) .with(ObjectAnimator.ofFloat<View>(getLauncherPagedView(), View.ALPHA, 1f))
.with(ObjectAnimator.ofFloat<View>(getLauncherPagedView().pageIndicator, View.ALPHA, 1f)) .with(ObjectAnimator.ofFloat<View>(getLauncherPagedView().pageIndicator, View.ALPHA, 1f))
.with(ObjectAnimator.ofFloat<View>(hotseat, View.ALPHA, 1f)) .with(ObjectAnimator.ofFloat<View>(hotseat, View.ALPHA, 1f))
//.with(valueAnimator); // .with(valueAnimator);
set.duration = 300 set.duration = 300
set.interpolator = LinearInterpolator() set.interpolator = LinearInterpolator()
set.addListener(object : AnimatorListenerAdapter() { set.addListener(object : AnimatorListenerAdapter() {
...@@ -1643,7 +1642,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -1643,7 +1642,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
folderContainer.setVisibility(View.GONE) folderContainer.setVisibility(View.GONE)
currentAnimator = null currentAnimator = null
//blurLayer.setAlpha(0f) // blurLayer.setAlpha(0f)
getLauncherPagedView().setAlpha(1f) getLauncherPagedView().setAlpha(1f)
getLauncherPagedView().pageIndicator.setAlpha(1f) getLauncherPagedView().pageIndicator.setAlpha(1f)
hotseat.setAlpha(1f) hotseat.setAlpha(1f)
...@@ -1652,7 +1651,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli ...@@ -1652,7 +1651,7 @@ class TestActivity : BaseDraggingActivity(), AutoCompleteAdapter.OnSuggestionCli
override fun onAnimationCancel(animation: Animator) { override fun onAnimationCancel(animation: Animator) {
folderContainer.setVisibility(View.GONE) folderContainer.setVisibility(View.GONE)
currentAnimator = null currentAnimator = null
//blurLayer.setAlpha(0f) // blurLayer.setAlpha(0f)
getLauncherPagedView().setAlpha(1f) getLauncherPagedView().setAlpha(1f)
getLauncherPagedView().pageIndicator.setAlpha(1f) getLauncherPagedView().pageIndicator.setAlpha(1f)
hotseat.setAlpha(1f) hotseat.setAlpha(1f)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment