on xenial help sign in
drop some obsolete code and bring back the appSwitchingAnimation
570e86fMichael Zanetti
qml/Stages/PhoneStage.qml+26−15
@@ -46,7 +46,7 @@ Item {
46 target: ApplicationManager
46 target: ApplicationManager
47
47
48 onFocusRequested: {
48 onFocusRequested: {
49− if (spreadView.visible) {
49+ if (spreadView.phase > 0) {
50 spreadView.snapTo(priv.indexOf(appId));
50 spreadView.snapTo(priv.indexOf(appId));
51 } else {
51 } else {
52 priv.switchToApp(appId);
52 priv.switchToApp(appId);
@@ -55,12 +55,8 @@ Item {
55
55
56 onFocusedApplicationIdChanged: {
56 onFocusedApplicationIdChanged: {
57 if (ApplicationManager.focusedApplicationId.length > 0) {
57 if (ApplicationManager.focusedApplicationId.length > 0) {
58− if (priv.secondApplicationStarting || priv.applicationStarting) {
59− appSplashTimer.restart();
60− } else {
61− var application = priv.focusedApplication;
58+ var application = priv.focusedApplication;
62− root.fullscreen = application.fullscreen;
59+ root.fullscreen = application.fullscreen;
63− }
64 } else {
60 } else {
65 spreadView.selectedIndex = -1;
61 spreadView.selectedIndex = -1;
66 spreadView.phase = 0;
62 spreadView.phase = 0;
@@ -69,7 +65,13 @@ Item {
69 }
65 }
70
66
71 onApplicationAdded: {
67 onApplicationAdded: {
68+ if (spreadView.phase > 0) {
72− spreadView.snapTo(0);
69+ spreadView.snapTo(0);
70+
71+// TODO: Enable this once a newly added app is not directly focused any more.
72+// } else {
73+// priv.switchToApp(appId)
74+ }
73 }
75 }
74 }
76 }
75
77
@@ -79,16 +81,11 @@ Item {
79 property string focusedAppId: ApplicationManager.focusedApplicationId
81 property string focusedAppId: ApplicationManager.focusedApplicationId
80 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
82 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
81
83
82− property bool applicationStarting: false
83− property bool secondApplicationStarting: false
84−
85− property string newFocusedAppId
86−
87 function switchToApp(appId) {
84 function switchToApp(appId) {
88 if (priv.focusedAppId) {
85 if (priv.focusedAppId) {
89− priv.newFocusedAppId = appId;
90 root.fullscreen = ApplicationManager.findApplication(appId).fullscreen;
86 root.fullscreen = ApplicationManager.findApplication(appId).fullscreen;
91− applicationSwitchingAnimation.start();
87+ spreadView.focusChanging = true
88+ ApplicationManager.focusApplication(appId);
92 } else {
89 } else {
93 ApplicationManager.focusApplication(appId);
90 ApplicationManager.focusApplication(appId);
94 }
91 }
@@ -154,6 +151,8 @@ Item {
154 property int draggedIndex: -1
151 property int draggedIndex: -1
155 property int closingIndex: -1
152 property int closingIndex: -1
156
153
154+ property bool focusChanging: false
155+
157 onShiftedContentXChanged: {
156 onShiftedContentXChanged: {
158 switch (phase) {
157 switch (phase) {
159 case 0:
158 case 0:
@@ -268,6 +267,18 @@ Item {
268 }
267 }
269 }
268 }
270
269
270+ Behavior on x {
271+ enabled: spreadView.focusChanging && index == 0
272+ UbuntuNumberAnimation {
273+ duration: UbuntuAnimation.FastDuration
274+ onRunningChanged: {
275+ if (!running) {
276+ spreadView.focusChanging = false
277+ }
278+ }
279+ }
280+ }
281+
271 // Each tile has a different progress value running from 0 to 1.
282 // Each tile has a different progress value running from 0 to 1.
272 // A progress value of 0 means the tile is at the right edge. 1 means the tile has reched the left edge.
283 // A progress value of 0 means the tile is at the right edge. 1 means the tile has reched the left edge.
273 progress: {
284 progress: {
qml/Stages/TransformedSpreadDelegate.qml+7
@@ -189,6 +189,10 @@ SpreadDelegate {
189 }
189 }
190
190
191 property real angle: {
191 property real angle: {
192+ if (spreadView.focusChanging) {
193+ return 0;
194+ }
195+
192 if (priv.otherSelected) {
196 if (priv.otherSelected) {
193 return priv.selectedAngle;
197 return priv.selectedAngle;
194 }
198 }
@@ -218,6 +222,9 @@ SpreadDelegate {
218 }
222 }
219
223
220 property real scale: {
224 property real scale: {
225+ if (spreadView.focusChanging) {
226+ return 1;
227+ }
221 if (priv.otherSelected) {
228 if (priv.otherSelected) {
222 return priv.selectedScale;
229 return priv.selectedScale;
223 }
230 }