-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f7a29f
commit b35ce23
Showing
11 changed files
with
582 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0-tizen</TargetFramework> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Folder Include="res\images\" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33122.133 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IMEManager", "IMEManager.csproj", "{DF8F0922-5A9F-4E9A-9328-8550F210E178}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{DF8F0922-5A9F-4E9A-9328-8550F210E178}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{DF8F0922-5A9F-4E9A-9328-8550F210E178}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{DF8F0922-5A9F-4E9A-9328-8550F210E178}.Debug|Any CPU.Deploy.0 = Debug|Any CPU | ||
{DF8F0922-5A9F-4E9A-9328-8550F210E178}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{DF8F0922-5A9F-4E9A-9328-8550F210E178}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{DF8F0922-5A9F-4E9A-9328-8550F210E178}.Release|Any CPU.Deploy.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {2C0EFC83-798D-4A7F-9B2B-BAFB078CA32B} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,311 @@ | ||
using System.Collections.Generic; | ||
using Tizen.NUI; | ||
using Tizen.NUI.BaseComponents; | ||
using Tizen.NUI.Components; | ||
using Tizen.NUI.Binding; | ||
using System; | ||
using Tizen.Uix.InputMethodManager; | ||
|
||
namespace IMEManager | ||
{ | ||
public class Operations | ||
{ | ||
public Operations(string name) | ||
{ | ||
Name = name; | ||
} | ||
|
||
public string Name { get; set; } | ||
|
||
public string ViewLabel | ||
{ | ||
get | ||
{ | ||
return Name; | ||
} | ||
} | ||
|
||
public bool Selected { get; set; } | ||
} | ||
internal class Program : NUIApplication | ||
{ | ||
private Window window; | ||
private Navigator navigator; | ||
private AppBar mainAppBar, customAppBar; | ||
private ContentPage mainPage, customPage; | ||
private View mainView, customView; | ||
private CollectionView mainCollectionView; | ||
private List<Operations> operations = new List<Operations> { new Operations(" ShowIMEList"), new Operations(" ShowIMESelector"), new Operations(" IsIMEEnabled"), new Operations(" GetActiveIME"), new Operations(" GetEnabledIMECount") }; | ||
TextLabel IMEStatusLabel; | ||
LinearLayout customPageLayout; | ||
|
||
protected override void OnCreate() | ||
{ | ||
base.OnCreate(); | ||
Initialize(); | ||
SetMainPage(); | ||
} | ||
|
||
public void OnKeyEvent(object sender, Window.KeyEventArgs e) | ||
{ | ||
if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape")) | ||
{ | ||
Exit(); | ||
} | ||
} | ||
|
||
void Initialize() | ||
{ | ||
//Initialize the defined variables | ||
window = GetDefaultWindow(); | ||
window.Title = "IMEManager"; | ||
window.KeyEvent += OnKeyEvent; | ||
navigator = window.GetDefaultNavigator(); | ||
var statusLabelTextStyle = new PropertyMap(); | ||
statusLabelTextStyle.Add("slant", new PropertyValue(FontSlantType.Normal.ToString())); | ||
statusLabelTextStyle.Add("width", new PropertyValue(FontWidthType.Expanded.ToString())); | ||
statusLabelTextStyle.Add("weight", new PropertyValue(FontWeightType.Light.ToString())); | ||
IMEStatusLabel = new TextLabel() | ||
{ | ||
HeightSpecification = LayoutParamPolicies.MatchParent, | ||
WidthSpecification = LayoutParamPolicies.MatchParent, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Center, | ||
TextColor = Color.Black, | ||
PointSize = 10f, | ||
FontStyle = statusLabelTextStyle, | ||
}; | ||
customPageLayout = new LinearLayout() | ||
{ | ||
LinearOrientation = LinearLayout.Orientation.Vertical, | ||
HorizontalAlignment = HorizontalAlignment.Center, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
}; | ||
} | ||
|
||
//This function will be called when the event clicked or select. | ||
public void OnSelectionChanged(object sender, SelectionChangedEventArgs ev) | ||
{ | ||
Console.WriteLine($"@@@ OnSelectionChanged() {ev.CurrentSelection}"); | ||
|
||
customView.Layout = customPageLayout; | ||
|
||
foreach (object item in ev.CurrentSelection) | ||
{ | ||
if (item == null) | ||
{ | ||
break; | ||
} | ||
|
||
var selItem = item as Operations; | ||
|
||
if (selItem.Name == " ShowIMEList") | ||
{ | ||
try | ||
{ | ||
customView.ClearBackground(); | ||
IMEStatusLabel.Text = "ShowIMEList"; | ||
customView.Add(IMEStatusLabel); | ||
Manager.ShowIMEList(); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e.Message); | ||
Exit(); | ||
} | ||
|
||
} | ||
else if (selItem.Name == " ShowIMESelector") | ||
{ | ||
try | ||
{ | ||
customView.ClearBackground(); | ||
IMEStatusLabel.Text = "ShowIMESelection"; | ||
customView.Add(IMEStatusLabel); | ||
Manager.ShowIMESelector(); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e.Message); | ||
Exit(); | ||
} | ||
} | ||
else if (selItem.Name == " IsIMEEnabled") | ||
{ | ||
try | ||
{ | ||
customView.ClearBackground(); | ||
bool IMEEnabled = Manager.IsIMEEnabled(this.ApplicationInfo.ApplicationId); | ||
string status = IMEEnabled ? " ON" : "Off"; | ||
IMEStatusLabel.Text = "IME State : " + status; | ||
customView.Add(IMEStatusLabel); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e.Message); | ||
Exit(); | ||
} | ||
} | ||
else if (selItem.Name == " GetActiveIME") | ||
{ | ||
try | ||
{ | ||
customView.ClearBackground(); | ||
IMEStatusLabel.Text = "IME Active : " + Manager.GetActiveIME(); | ||
customView.Add(IMEStatusLabel); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e.Message); | ||
Exit(); | ||
} | ||
} | ||
else if (selItem.Name == " GetEnabledIMECount") | ||
{ | ||
try | ||
{ | ||
customView.ClearBackground(); | ||
IMEStatusLabel.Text = "IME Count : " + Manager.GetEnabledIMECount(); | ||
customView.Add(IMEStatusLabel); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e.Message); | ||
Exit(); | ||
} | ||
} | ||
} | ||
navigator.Push(customPage); | ||
} | ||
|
||
private void SetMainPage() | ||
{ | ||
//Setting the AppBar variable. | ||
var mainAppBarTextStyle = new PropertyMap(); | ||
mainAppBarTextStyle.Add("slant", new PropertyValue(FontSlantType.Normal.ToString())); | ||
mainAppBarTextStyle.Add("width", new PropertyValue(FontWidthType.Expanded.ToString())); | ||
mainAppBarTextStyle.Add("weight", new PropertyValue(FontWeightType.Medium.ToString())); | ||
mainAppBar = new() | ||
{ | ||
TitleContent = new TextLabel() | ||
{ | ||
HeightSpecification = LayoutParamPolicies.MatchParent, | ||
WidthSpecification = LayoutParamPolicies.MatchParent, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Center, | ||
TextColor = Color.White, | ||
PointSize = 12, | ||
Text = "IMEManager", | ||
FontStyle = mainAppBarTextStyle, | ||
}, | ||
AutoNavigationContent = false, | ||
SizeWidth = window.Size.Width, | ||
SizeHeight = window.Size.Height / 12, | ||
BackgroundColor = Color.Transparent, | ||
WidthSpecification = LayoutParamPolicies.MatchParent, | ||
ActionContent = new View(), | ||
NavigationContent = new View(), | ||
}; | ||
|
||
//Creating the mainView to display for the user. | ||
mainView = new() | ||
{ | ||
Layout = new LinearLayout() | ||
{ | ||
LinearOrientation = LinearLayout.Orientation.Vertical, | ||
}, | ||
|
||
//Without adding specification items will now show in the collection | ||
WidthSpecification = LayoutParamPolicies.MatchParent, | ||
HeightSpecification = LayoutParamPolicies.MatchParent, | ||
BackgroundColor = Color.White, | ||
}; | ||
|
||
//Putting all galleries in collection as list to display it . | ||
mainCollectionView = new() | ||
{ | ||
ItemsSource = operations, | ||
ItemsLayouter = new LinearLayouter(), | ||
ItemTemplate = new DataTemplate(() => | ||
{ | ||
DefaultLinearItem item = new DefaultLinearItem() | ||
{ | ||
WidthSpecification = LayoutParamPolicies.MatchParent, | ||
}; | ||
item.Label.SetBinding(TextLabel.TextProperty, "ViewLabel"); | ||
item.Label.HorizontalAlignment = HorizontalAlignment.Begin; | ||
item.SizeHeight = window.Size.Height / 8; | ||
//BaseComponents' Focusable is false as a default value, true should be set to navigate key focus. | ||
return item; | ||
|
||
}), | ||
ScrollingDirection = ScrollableBase.Direction.Vertical, | ||
HideScrollbar = true, | ||
WidthSpecification = LayoutParamPolicies.MatchParent, | ||
HeightSpecification = LayoutParamPolicies.MatchParent, | ||
SelectionMode = ItemSelectionMode.Single,//For selecting only one item from list. | ||
}; | ||
|
||
//When the event SelectionChanged ocures will cal the function OnSelectionChanged. | ||
mainCollectionView.SelectionChanged += OnSelectionChanged; | ||
|
||
//The custom appbar will have a back button this is the reason its created to get the user back to the main page. | ||
customAppBar = new()//every page needs a new App bar ** do not use the same app bar for more than one page | ||
{ | ||
TitleContent = new TextLabel() | ||
{ | ||
HeightSpecification = LayoutParamPolicies.MatchParent, | ||
WidthSpecification = LayoutParamPolicies.MatchParent, | ||
VerticalAlignment = VerticalAlignment.Center, | ||
HorizontalAlignment = HorizontalAlignment.Center, | ||
TextColor = Color.White, | ||
PointSize = 12, | ||
Text = "IMEManager", | ||
FontStyle = mainAppBarTextStyle, | ||
}, | ||
AutoNavigationContent = false, | ||
SizeWidth = window.Size.Width, | ||
SizeHeight = window.Size.Height / 12, | ||
BackgroundColor = Color.Transparent, | ||
WidthSpecification = LayoutParamPolicies.MatchParent, | ||
ActionContent = new View(), | ||
}; | ||
|
||
//Creating custom view for the new page which will be opened after the selection . | ||
customView = new() | ||
{ | ||
Layout = new LinearLayout() | ||
{ | ||
LinearOrientation = LinearLayout.Orientation.Vertical, | ||
}, | ||
WidthSpecification = LayoutParamPolicies.MatchParent, | ||
HeightSpecification = LayoutParamPolicies.MatchParent, | ||
}; | ||
|
||
//Custome page is the page that will be opened after the selection. | ||
//Seting the appbar and contenet for the pages. | ||
customPage = new ContentPage() | ||
{ | ||
AppBar = customAppBar, | ||
Content = customView, | ||
BackgroundImage = DirectoryInfo.Resource + "images/bg.png", | ||
}; | ||
|
||
mainView.Add(mainCollectionView); | ||
mainPage = new ContentPage() | ||
{ | ||
AppBar = mainAppBar, | ||
Content = mainView, | ||
BackgroundImage = DirectoryInfo.Resource + "images/bg.png", | ||
}; | ||
|
||
//Pushing the main page for the user. | ||
navigator.Push(mainPage); | ||
} | ||
static void Main(string[] args) | ||
{ | ||
var app = new Program(); | ||
app.Run(args); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest package="org.tizen.IMEManager" version="1.0.0" api-version="7.0" xmlns="http://tizen.org/ns/packages"> | ||
<profile name="common" /> | ||
<ui-application appid="org.tizen.IMEManager" exec="IMEManager.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single"> | ||
<label>IMEManager</label> | ||
<icon>IMEManager.png</icon> | ||
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" /> | ||
<splash-screens /> | ||
</ui-application> | ||
<shortcut-list /> | ||
<privileges> | ||
<privilege>http://tizen.org/privilege/imemanager</privilege> | ||
</privileges> | ||
<dependencies /> | ||
<provides-appdefined-privileges /> | ||
</manifest> |
Oops, something went wrong.