2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
21 using Tizen.Applications;
22 using Tizen.NUI.BaseComponents;
27 /// Setting screen transition options.
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class TransitionOptions : IDisposable
32 private bool disposed = false;
33 private FrameProvider frameProvider;
34 private DefaultFrameBroker frameBroker;
36 private bool enableTransition = false;
37 private Window mainWindow;
38 private View animatedTarget;
39 private string sharedId;
42 /// Initializes the TransitionOptions class.
44 /// <param name="window">The window instance of NUI Window</param>
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public TransitionOptions(Window window)
53 /// Set animated view of seamless animation.
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public View AnimatedTarget
60 return animatedTarget;
64 animatedTarget = value;
69 /// Gets or sets transition enable
71 [EditorBrowsable(EditorBrowsableState.Never)]
72 public bool EnableTransition
76 return enableTransition;
83 frameBroker = new DefaultFrameBroker(mainWindow);
84 frameBroker.mainView = animatedTarget;
85 frameBroker.AnimationInitialized += FrameBroker_TransitionAnimationInitialized;
86 frameBroker.AnimationFinished += FrameBroker_TransitionAnimationFinished;
89 enableTransition = value;
93 private void EnableProvider()
95 frameProvider = new FrameProvider(mainWindow);
96 frameProvider.Shown += FrameProvider_Shown;
97 frameProvider.Hidden += FrameProvider_Hidden;
101 /// Gets or sets the Shared object Id
103 [EditorBrowsable(EditorBrowsableState.Never)]
104 public String SharedId
117 /// Gets or sets the forward animation of launching
119 [EditorBrowsable(EditorBrowsableState.Never)]
120 public TransitionAnimation ForwardAnimation
124 return frameBroker?.ForwardAnimation;
128 if (frameBroker != null)
130 frameBroker.ForwardAnimation = value;
136 /// Gets or sets the backward animation of launching
138 [EditorBrowsable(EditorBrowsableState.Never)]
139 public TransitionAnimation BackwardAnimation
144 return frameBroker?.BackwardAnimation;
148 if (frameBroker != null)
150 frameBroker.BackwardAnimation = value;
156 /// Emits the event when the animation is started.
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 public delegate void AnimationEventHandler(bool direction);
162 /// Emits the event when the animation is started.
164 [EditorBrowsable(EditorBrowsableState.Never)]
165 public event AnimationEventHandler AnimationInitialized;
168 /// Emits the event when the animation is finished.
170 [EditorBrowsable(EditorBrowsableState.Never)]
171 public event AnimationEventHandler AnimationFinished;
173 private void FrameBroker_TransitionAnimationFinished(bool direction)
175 AnimationFinished?.Invoke(direction);
178 private void FrameBroker_TransitionAnimationInitialized(bool direction)
180 AnimationInitialized?.Invoke(direction);
184 /// Occurs whenever the window is shown on caller application.
186 [EditorBrowsable(EditorBrowsableState.Never)]
187 public event EventHandler CallerScreenShown;
190 /// Occurs whenever the window is hidden on caller application.
192 [EditorBrowsable(EditorBrowsableState.Never)]
193 public event EventHandler CallerScreenHidden;
195 private void FrameProvider_Shown(object sender, EventArgs e)
197 Bundle bundle = new Bundle();
198 //Set information of shared object
199 frameProvider?.NotifyShowStatus(bundle);
201 CallerScreenShown?.Invoke(this, e);
206 private void FrameProvider_Hidden(object sender, EventArgs e)
208 Bundle bundle = new Bundle();
209 //Set information of shared object
210 frameProvider?.NotifyHideStatus(bundle);
212 CallerScreenHidden?.Invoke(this, e);
217 internal void SendLaunchRequest(AppControl appControl)
219 this.frameBroker.SendLaunchRequest(appControl, true);
222 [EditorBrowsable(EditorBrowsableState.Never)]
223 protected virtual void Dispose(bool disposing)
227 if (frameBroker != null)
229 frameBroker.Dispose();
232 if (frameProvider != null)
234 frameProvider.Dispose();
241 /// Dispose for IDisposable pattern
243 [EditorBrowsable(EditorBrowsableState.Never)]
244 public void Dispose()