View highlightGridView = null;
View highlightLabelView = null;
- Timer highlightGridTimer = null;
static int textLabelMinWidth = 40;
static int textLabelMinHeight = 40;
foreach (var grid in grids)
{
- int col = (grid.idx - 1) % 7 + 1;
- int row = (grid.idx - 1) / 7;
View boxView = new View()
{
BorderlineColor = Color.LightGray, // TODO: Change to white when Default Headed UI changed
WidthResizePolicy = ResizePolicyType.UseNaturalSize,
};
float stride = (indexTextLabel.NaturalSize.Width < textLabelMinWidth) ? textLabelMinWidth : indexTextLabel.NaturalSize.Width;
- indexTextLabel.Position = new Position(col * grid.width - stride - firstLayerTextLabelWidthPad, row * grid.height + firstLayerTextLabelHeightPad);
+ indexTextLabel.Position = new Position(grid.x + grid.width - stride - firstLayerTextLabelWidthPad, grid.y + firstLayerTextLabelHeightPad);
indexView.Add(indexTextLabel);
firstLayerTextLabelView.Add(indexView);
labelView.Add(indexView);
}
firstLayerTextLabelView.Clear();
- float basePositionX = grids[0].x;
- float basePositionY = grids[0].y;
foreach (var grid in grids)
{
- int col = (grid.idx - 1) % 4 + 1;
- int row = (grid.idx - 1) / 4;
-
-
TextLabel indexTextLabel = new TextLabel()
{
Text = grid.idx.ToString(),
WidthResizePolicy = ResizePolicyType.UseNaturalSize,
};
float stride = (indexTextLabel.NaturalSize.Width < textLabelMinWidth) ? textLabelMinWidth : indexTextLabel.NaturalSize.Width;
- indexTextLabel.Position = new Position(basePositionX + col * grid.width - stride - secondLayerTextLabelPad, basePositionY + row * grid.height + secondLayerTextLabelPad);
+ indexTextLabel.Position = new Position(grid.x + grid.width - stride - secondLayerTextLabelPad, grid.y + secondLayerTextLabelPad);
indexView.Add(indexTextLabel);
secondLayerTextLabelView.Add(indexView);
labelView.Add(indexView);
}
}
- public void HighlightGrid(ClickableObject obj, int selected)
+ public void HighlightGrid(ClickableObject obj, int depth)
{
- if (highlightGridView != null)
+ if (highlightLabelView != null)
{
return;
}
- View targetGridView = secondLayerGridView[selected - 1];
- View targetLabelView = secondLayerTextLabelView[selected - 1].GetChildAt(0);
+
highlightGridView = new View()
{
BorderlineColor = new Color("#FF6200"),
- BorderlineWidth = 2.0f,
+ BorderlineWidth = 1.5f,
BorderlineOffset = -1f,
BackgroundColor = Color.Transparent,
Size = new Size(obj.width, obj.height),
Position = new Position(obj.x, obj.y),
};
+
TextLabel indexTextLabel = new TextLabel()
{
- Text = selected.ToString(),
+ Text = obj.idx.ToString(),
BackgroundColor = new Color("#FF6200"),
MinimumSize = new Size2D(textLabelMinWidth, textLabelMinHeight),
WidthResizePolicy = ResizePolicyType.UseNaturalSize,
VerticalAlignment = VerticalAlignment.Center,
CornerRadius = new Vector4(0, 12, 0, 12),
Padding = new Extents(10, 10, 4, 4),
- Position = new Position(targetLabelView.Position.X, targetLabelView.Position.Y),
};
- highlightLabelView = new View()
+
+ float stride = (indexTextLabel.NaturalSize.Width < textLabelMinWidth) ? textLabelMinWidth : indexTextLabel.NaturalSize.Width;
+ if (depth == 1)
{
- WidthResizePolicy = ResizePolicyType.UseNaturalSize,
- };
+ indexTextLabel.Position = new Position(obj.x + obj.width - stride - firstLayerTextLabelWidthPad, obj.y + firstLayerTextLabelHeightPad);
+ }
+ else if (depth == 2)
+ {
+ indexTextLabel.Position = new Position(obj.x + obj.width - stride - secondLayerTextLabelPad, obj.y + secondLayerTextLabelPad);
+ }
+ highlightLabelView = new View();
highlightLabelView.Add(indexTextLabel);
- ClearGrid();
- Window.Instance.Add(highlightGridView);
+
Window.Instance.Add(highlightLabelView);
+ Window.Instance.Add(highlightGridView);
+
+ return;
}
}
}
{
View mView = null;
TextLabel mTextBubble = null;
+
+ View mResponseView = null;
+ TextLabel mResponseBubble = null;
+
static readonly int minWidth = 88;
static readonly int minHeight = 80;
static readonly int maxWidth = 788;
static readonly int maxHeight = 144;
- static Position2D rightTop;
+ static Position2D rightTop = new Position2D(1920 - 208, 93);
public TextBubbleLayer()
{
- rightTop = new Position2D(1920 - 208, 93);
+
}
- public void CleartextBubbles()
+ public void ClearTextBubbles()
{
if(mView)
{
{
if (mView)
{
- CleartextBubbles();
+ ClearTextBubbles();
}
mTextBubble = new TextLabel()
CornerRadius = new Vector4(40, 40, 40, 40),
Padding = new Extents(24, 24, 24, 24),
};
- mView = new View()
- {
- WidthResizePolicy = ResizePolicyType.UseNaturalSize,
- };
+ mView = new View();
float stride = (mTextBubble.NaturalSize.Width > minWidth) ? mTextBubble.NaturalSize.Width : minWidth;
mTextBubble.Position = new Position(rightTop.X - stride, rightTop.Y);
Padding = new Extents(24, 24, 24, 24),
MultiLine = true,
};
- mView = new View()
- {
- Size2D = new Size2D(maxWidth, maxHeight),
- };
+ mView = new View();
mTextBubble.Position = new Position(rightTop.X - maxWidth, rightTop.Y);
}
mView.Add(mTextBubble);
Window.Instance.Add(mView);
}
+
+ public void ClearResponseBubbles()
+ {
+ if(mResponseView)
+ {
+ mResponseView.Unparent();
+ mResponseView.Dispose();
+ mResponseView = null;
+ }
+ }
+
+
+ public void CreateResponseBubble(string text, Color color)
+ {
+ if (mResponseView)
+ {
+ return;
+ }
+
+ mResponseBubble = new TextLabel()
+ {
+ Text = text,
+ BackgroundColor = new Color("#DBE3FF"),
+ MinimumSize = new Size2D(minWidth, minHeight),
+ MaximumSize = new Size2D(maxWidth, maxHeight),
+ WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+ TextColor = color,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ CornerRadius = new Vector4(40, 40, 40, 40),
+ Padding = new Extents(24, 24, 24, 24),
+ };
+ mResponseView = new View();
+ float stride = (mResponseBubble.NaturalSize.Width > minWidth) ? mResponseBubble.NaturalSize.Width : minWidth;
+ mResponseBubble.Position = new Position(rightTop.X - stride, rightTop.Y + mTextBubble.Size.Height + 8);
+
+ mResponseView.Add(mResponseBubble);
+ Window.Instance.Add(mResponseView);
+ }
}
}
\ No newline at end of file
{
List<View> tooltips;
- Timer highlightObjectTimer = null;
- View highlightObjectView = null;
-
View highlightTooltipView = null;
- Timer highlightTooltipTimer = null;
static readonly int minWidth = 40;
static readonly int tooltipHeight = 40;
VerticalAlignment = VerticalAlignment.Center,
CornerRadius = new Vector4(0, 12, 0, 12),
Padding = new Extents(10, 10, 4, 4),
+ EnableAutoScroll = true,
+ AutoScrollSpeed = 40, // 100px per second
+ AutoScrollLoopCount = 0, //infite loop
+ AutoScrollGap = w - 20,
};
tooltipView = new View()
{
Size2D = new Size2D(w, tooltipHeight),
};
- tooltipTextLabel.Position = new Position(x + w - tooltipTextLabel.NaturalSize.Width, y);
+ tooltipTextLabel.Position = new Position(x + w - tooltipTextLabel.Size.Width, y);
}
tooltipView.Add(tooltipTextLabel);
window.SetNotificationLevel(NotificationLevel.Top);
window.SetTransparency(true);
window.BackgroundColor = Color.Transparent;
- window.SetAcceptFocus(true);
+ window.SetAcceptFocus(false);
window.SetInputRegion(new Rectangle(0, 0, 0, 0));
mVoiceTouchMmiManager = new VoiceTouchMmiManager();
}
return;
case UI_CLICKED_OBJECT:
- mVoiceTouchViewManager.HighlightTooltip(voiceTouchResult.uiClickedObject.infoOfClickedObjects, previousTooltipType);
+ if (voiceTouchResult.uiClickedObject.uiObjectResultType == UI_OBJECT_RESULT_BY_GRID)
+ {
+ mVoiceTouchViewManager.HighlightGrid(voiceTouchResult.uiClickedObject.infoOfClickedObjects, voiceTouchResult.uiClickedObject.gridDepth);
+ }
+ else
+ {
+ mVoiceTouchViewManager.HighlightTooltip(voiceTouchResult.uiClickedObject.infoOfClickedObjects, previousTooltipType);
+ }
return;
case ASR_PARTIAL_RESULT:
mVoiceTouchViewManager.ShowAsrPartialResult(voiceTouchResult.asrPartialResult.result);
mVoiceTouchViewManager.ShowAsrFinalResult(voiceTouchResult.asrFinalResult.result);
return;
case REJECT:
- mVoiceTouchViewManager.ShowAsrFinalResult(voiceTouchResult.reject.reason);
+ // mVoiceTouchViewManager.ShowResponse(voiceTouchResult.reject.reason);
+ mVoiceTouchViewManager.ShowResponse("Sorry, I don't know how to help with that. Let's try again.");
return;
case ERROR:
mVoiceTouchViewManager.ShowAsrFinalResult(voiceTouchResult.error.reason);
public string foregroundApp;
public ClickableObject infoOfClickedObjects;
public int timestamp;
+ public string uiObjectResultType;
+ public int gridDepth;
}
class ASRResult
{
protected TextBubbleLayer mTextBubbleLayer = null;
protected GridLayer mGridLayer = null;
- internal uint responseMilliseconds = 5000;
- internal uint successMilliseconds = 1000;
- protected TimerState currentTimerState;
+ protected Timer mResponseTimer = null;
+ protected Timer mTooltipTimer = null;
+ protected Timer mHighlightTooltipTimer = null;
+ protected Timer mGridTimer = null;
+ protected Timer mHighlightGridTimer = null;
+
+ internal uint responseMilliseconds = 2000;
+ internal uint successMilliseconds = 2000;
+ protected TimerState currentTextBubbleTimerState;
+ protected TimerState currentResponseBubbleTimerState;
+ protected TimerState currentHighlightTooltipTimerState;
+ protected TimerState currentHighlightGridTimerState;
public enum TimerState
{
Inactive = 0,
mTextBubbleLayer = new TextBubbleLayer();
mTooltipLayer = new TooltipLayer();
mGridLayer = new GridLayer();
- currentTimerState = TimerState.Inactive;
+ currentTextBubbleTimerState = TimerState.Inactive;
+ currentResponseBubbleTimerState = TimerState.Inactive;
+ currentHighlightTooltipTimerState = TimerState.Inactive;
+ currentHighlightGridTimerState = TimerState.Inactive;
currentVoiceTouchState = VoiceTouchState.Idle;
}
/// <param name="asrPartialResult"></param>
public void ShowAsrPartialResult(string asrPartialResult)
{
- if (currentTimerState == TimerState.Active)
+ if (currentTextBubbleTimerState == TimerState.Active)
{
return;
}
/// <param name="asrFinalResult"></param>
public void ShowAsrFinalResult(string asrFinalResult)
{
- if (currentTimerState == TimerState.Active)
+ if (currentTextBubbleTimerState == TimerState.Active)
{
- currentTimerState = TimerState.Inactive;
+ currentTextBubbleTimerState = TimerState.Inactive;
mGridLayer.ClearHighlightedGrid();
mTooltipLayer.ClearHighlightedTooltip();
}
/// <param name="asrFinalResult"></param>
public void ShowResponse(string response)
{
- mTextBubbleLayer.CreateTextBubble(response, new Color("#666666"));
- Timer timer = new Timer(responseMilliseconds);
- timer.Tick += ClearTextBubble;
- timer.Start();
- currentTimerState = TimerState.Active;
+ mTextBubbleLayer.CreateResponseBubble(response, new Color("#666666"));
+ mResponseTimer = new Timer(responseMilliseconds);
+ mResponseTimer.Tick += ClearResponseBubble;
+ mResponseTimer.Start();
+ currentResponseBubbleTimerState = TimerState.Active;
}
/// <summary>
/// <param name="tooltipMode">number, name</param>
public void ShowTooltip(List<ClickableObject> objs, string tooltipMode)
{
- Tizen.Log.Error("Tizen.Mmi", "show tooltip");
mGridLayer.ClearGrid();
if (tooltipMode == "tooltipNumber")
{
{
mTooltipLayer.CreateNameTooltips(objs);
}
- Tizen.Log.Error("Tizen.Mmi", "show tooltip");
// add timer for remove final result text bubble
- Timer timer = new Timer(successMilliseconds);
- timer.Tick += ClearTextBubble;
- timer.Start();
- currentTimerState = TimerState.Active;
+ mTooltipTimer = new Timer(successMilliseconds);
+ mTooltipTimer.Tick += ClearTextBubble;
+ mTooltipTimer.Start();
+ currentTextBubbleTimerState = TimerState.Active;
}
/// <summary>
{
mTooltipLayer.HighlightTooltip(obj, tooltipMode);
// add timer for remove final result text bubble, highlighted tooltip
- Timer timer = new Timer(successMilliseconds);
- timer.Tick += ClearHighlightedTooltip;
- timer.Start();
- currentTimerState = TimerState.Active;
+ mHighlightTooltipTimer = new Timer(successMilliseconds);
+ mHighlightTooltipTimer.Tick += ClearHighlightedTooltip;
+ mHighlightTooltipTimer.Start();
+ currentHighlightTooltipTimerState = TimerState.Active;
}
/// <summary>
}
// add timer for remove final result text bubble
- Timer timer = new Timer(successMilliseconds);
- timer.Tick += ClearHighlightedGrid;
- timer.Start();
- currentTimerState = TimerState.Active;
+ mGridTimer = new Timer(successMilliseconds);
+ mGridTimer.Tick += ClearTextBubble;
+ mGridTimer.Start();
+ currentTextBubbleTimerState = TimerState.Active;
}
/// <summary>
/// </summary>
/// <param name="obj">Clicked grid info</param>
/// <param name="idx">index of grid info</param>
- public void HighlightGrid(ClickableObject obj, int idx)
+ public void HighlightGrid(ClickableObject obj, int depth)
{
- mGridLayer.HighlightGrid(obj, idx);
+ mGridLayer.HighlightGrid(obj, depth);
// add timer for remove final result text bubble, highlighted tooltip
- Timer timer = new Timer(successMilliseconds);
- timer.Tick += ClearHighlightedGrid;
- timer.Start();
- currentTimerState = TimerState.Active;
+ mHighlightGridTimer = new Timer(successMilliseconds);
+ mHighlightGridTimer.Tick += ClearHighlightedGrid;
+ mHighlightGridTimer.Start();
+ currentHighlightGridTimerState = TimerState.Active;
}
/// <summary>
/// </summary>
public void ClearAll()
{
- mTextBubbleLayer.CleartextBubbles();
+ mTextBubbleLayer.ClearTextBubbles();
mTooltipLayer.ClearTooltips();
mGridLayer.ClearGrid();
}
- private bool ClearTextBubble(object target, Timer.TickEventArgs args)
+ public bool ClearTextBubble(object target, Timer.TickEventArgs args)
{
- if (currentTimerState == TimerState.Inactive)
- {
- return false;
- }
- mTextBubbleLayer.CleartextBubbles();
- currentTimerState = TimerState.Inactive;
+ mTextBubbleLayer.ClearTextBubbles();
+ currentTextBubbleTimerState = TimerState.Inactive;
return false;
}
- private bool ClearHighlightedTooltip(object target, Timer.TickEventArgs args)
+ public bool ClearResponseBubble(object target, Timer.TickEventArgs args)
+ {
+ mTextBubbleLayer.ClearResponseBubbles();
+ mResponseTimer = null;
+ currentResponseBubbleTimerState = TimerState.Inactive;
+ return false;
+ }
+
+ public bool ClearHighlightedTooltip(object target, Timer.TickEventArgs args)
{
- if (currentTimerState == TimerState.Inactive)
- {
- return false;
- }
mTooltipLayer.ClearHighlightedTooltip();
- mTextBubbleLayer.CleartextBubbles();
- currentTimerState = TimerState.Inactive;
+ mTextBubbleLayer.ClearTextBubbles();
+ mHighlightTooltipTimer = null;
+ currentHighlightTooltipTimerState = TimerState.Inactive;
return false;
}
- private bool ClearHighlightedGrid(object target, Timer.TickEventArgs args)
+ public bool ClearHighlightedGrid(object target, Timer.TickEventArgs args)
{
- if (currentTimerState == TimerState.Inactive)
- {
- return false;
- }
mGridLayer.ClearHighlightedGrid();
- mTextBubbleLayer.CleartextBubbles();
- currentTimerState = TimerState.Inactive;
+ mTextBubbleLayer.ClearTextBubbles();
+ mHighlightGridTimer = null;
+ currentHighlightGridTimerState = TimerState.Inactive;
return false;
}
}