2 * Copyright (c) 2021 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.ComponentModel;
19 using Tizen.Applications;
20 using Tizen.NUI.BaseComponents;
25 /// Setting screen transition options.
26 /// This is used to describe the transition of NUIApplication.
28 /// <seealso cref="NUIApplication.TransitionOptions" />
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)
52 /// Set animated view of seamless animation.
54 [EditorBrowsable(EditorBrowsableState.Never)]
55 public View AnimatedTarget
59 return animatedTarget;
63 animatedTarget = value;
68 /// Gets or sets transition enable
70 [EditorBrowsable(EditorBrowsableState.Never)]
71 public bool EnableTransition
75 return enableTransition;
82 frameBroker = new DefaultFrameBroker(mainWindow);
83 frameBroker.mainView = animatedTarget;
84 frameBroker.AnimationInitialized += FrameBroker_TransitionAnimationInitialized;
85 frameBroker.AnimationFinished += FrameBroker_TransitionAnimationFinished;
88 enableTransition = value;
92 private void EnableProvider()
94 frameProvider = new FrameProvider(mainWindow);
95 frameProvider.Shown += FrameProvider_Shown;
96 frameProvider.Hidden += FrameProvider_Hidden;
100 /// Gets or sets the Shared object Id
102 [EditorBrowsable(EditorBrowsableState.Never)]
103 public String SharedId
116 /// Gets or sets the forward animation of launching
118 [EditorBrowsable(EditorBrowsableState.Never)]
119 public TransitionAnimation ForwardAnimation
123 return frameBroker?.ForwardAnimation;
127 if (frameBroker != null)
129 frameBroker.ForwardAnimation = value;
135 /// Gets or sets the backward animation of launching
137 [EditorBrowsable(EditorBrowsableState.Never)]
138 public TransitionAnimation BackwardAnimation
143 return frameBroker?.BackwardAnimation;
147 if (frameBroker != null)
149 frameBroker.BackwardAnimation = value;
155 /// Emits the event when the animation is started.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 public delegate void AnimationEventHandler(bool direction);
161 /// Emits the event when the animation is started.
163 [EditorBrowsable(EditorBrowsableState.Never)]
164 public event AnimationEventHandler AnimationInitialized;
167 /// Emits the event when the animation is finished.
169 [EditorBrowsable(EditorBrowsableState.Never)]
170 public event AnimationEventHandler AnimationFinished;
172 private void FrameBroker_TransitionAnimationFinished(bool direction)
174 AnimationFinished?.Invoke(direction);
177 private void FrameBroker_TransitionAnimationInitialized(bool direction)
179 AnimationInitialized?.Invoke(direction);
183 /// Occurs whenever the window is shown on caller application.
185 [EditorBrowsable(EditorBrowsableState.Never)]
186 public event EventHandler CallerScreenShown;
189 /// Occurs whenever the window is hidden on caller application.
191 [EditorBrowsable(EditorBrowsableState.Never)]
192 public event EventHandler CallerScreenHidden;
194 private void FrameProvider_Shown(object sender, EventArgs e)
196 Bundle bundle = new Bundle();
197 //Set information of shared object
198 frameProvider?.NotifyShowStatus(bundle);
200 CallerScreenShown?.Invoke(this, e);
205 private void FrameProvider_Hidden(object sender, EventArgs e)
207 Bundle bundle = new Bundle();
208 //Set information of shared object
209 frameProvider?.NotifyHideStatus(bundle);
211 CallerScreenHidden?.Invoke(this, e);
216 internal void SendLaunchRequest(AppControl appControl)
218 this.frameBroker.SendLaunchRequest(appControl, true);
222 /// Hidden API (Inhouse API).
225 /// <param name="disposing"></param>
226 [EditorBrowsable(EditorBrowsableState.Never)]
227 protected virtual void Dispose(bool disposing)
231 if (frameBroker != null)
233 frameBroker.Dispose();
236 if (frameProvider != null)
238 frameProvider.Dispose();
245 /// Dispose for IDisposable pattern
247 [EditorBrowsable(EditorBrowsableState.Never)]
248 public void Dispose()
251 System.GC.SuppressFinalize(this);