From: Akash Kumar Date: Tue, 24 Jan 2023 11:29:05 +0000 (+0530) Subject: Update InfoPage: disable edit box pop up for un-editable fields X-Git-Tag: accepted/tizen/unified/20230303.162802~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c2f1b7df25c374c52b2d7e7a6636509b39dc4fe;p=profile%2Fiot%2Fapps%2Fdotnet%2Fsetting-wifi.git Update InfoPage: disable edit box pop up for un-editable fields Change-Id: I5c8f79ee4504e10615432ae91b3e15e85b055f07 Signed-off-by: Akash Kumar --- diff --git a/SettingWiFi/SettingWiFi/view/ApInfoSource.cs b/SettingWiFi/SettingWiFi/view/ApInfoSource.cs index 8ce95af..755aae2 100644 --- a/SettingWiFi/SettingWiFi/view/ApInfoSource.cs +++ b/SettingWiFi/SettingWiFi/view/ApInfoSource.cs @@ -52,6 +52,7 @@ namespace SettingWiFi private void ShowStaticInfo(bool isConfigChanged) { + /* if (isConfigChanged) { mAp.IPv4 = ""; @@ -62,6 +63,7 @@ namespace SettingWiFi mAp.ProxyAddress = ""; mAp.ProxyPort = 0; } + */ Add(new ApInfoText(Resources.IDS_WIFI_BODY_IP_ADDRESS, mAp.IPv4, UpdateIPAddress)); Add(new ApInfoText(Resources.IDS_WIFI_BODY_SUBNET_MASK, mAp.SubnetMask, UpdateSubnetMask)); @@ -169,4 +171,4 @@ namespace SettingWiFi } } } -} \ No newline at end of file +} diff --git a/SettingWiFi/SettingWiFi/view/InfoInputPage.cs b/SettingWiFi/SettingWiFi/view/InfoInputPage.cs index 2856136..89168a3 100644 --- a/SettingWiFi/SettingWiFi/view/InfoInputPage.cs +++ b/SettingWiFi/SettingWiFi/view/InfoInputPage.cs @@ -10,13 +10,24 @@ namespace SettingWiFi { internal class InfoInputPage : DialogPage { - internal InfoInputPage() + private AP mAp; + ApInfoSource mApInfoSource; + + private TextField mValueField; + private string mTitle; + private bool mIsStaticIpConfig; + + internal InfoInputPage(AP ap, ApInfoSource apInfoSource, bool isStaticIpConfig) { Debug("InfoInputPage"); + mAp = ap; + mApInfoSource = apInfoSource; + mIsStaticIpConfig = isStaticIpConfig; } internal void CreateComponents(string title, string value) { + mTitle = title; var infoView = new RecyclerViewItem() { Layout = new LinearLayout() @@ -27,12 +38,12 @@ namespace SettingWiFi HeightSpecification = LayoutParamPolicies.WrapContent, }; - var valueField = new TextField() + var mValueField = new TextField() { WidthSpecification = 600, PlaceholderText = value, }; - infoView.Add(valueField); + infoView.Add(mValueField); var cancelButton = new Button() { @@ -55,7 +66,10 @@ namespace SettingWiFi private void OnOkClicked(object sender, ClickedEventArgs e) { - Debug("OnOkClicked"); + Debug("OnOkClicked " + mValueField.Text + " : " + mTitle); + UpdateInfo(mTitle, mValueField.Text); + mApInfoSource.Clear(); + mApInfoSource.ShowInfo(mIsStaticIpConfig, true); Navigator.Pop(); } @@ -64,5 +78,50 @@ namespace SettingWiFi Debug("OnCancelClicked"); Navigator.Pop(); } + + private void UpdateInfo(string fieldName, string value) + { + Debug("UpdateInfo"); + + if (fieldName == Resources.IDS_WIFI_BODY_IP_ADDRESS) + { + mAp.IPv4 = value; + } + else if (fieldName == Resources.IDS_WIFI_BODY_SUBNET_MASK) + { + mAp.SubnetMask = value; + } + else if (fieldName == Resources.IDS_WIFI_BODY_GATEWAY_ADDRESS) + { + mAp.GatewayAddress = value; + } + else if (fieldName == Resources.IDS_WIFI_BODY_DNS_1) + { + mAp.Dns1 = value; + } + else if (fieldName == Resources.IDS_WIFI_BODY_DNS_2) + { + mAp.Dns2 = value; + } + else if (fieldName == Resources.IDS_ST_SBODY_PROXY_ADDRESS) + { + mAp.ProxyAddress = value; + } + else if (fieldName == Resources.IDS_ST_SBODY_PROXY_PORT) + { + try + { + mAp.ProxyPort = int.Parse(value); + } + catch (Exception e) + { + Error("Exception occured while parsing port number " + e.Message); + } + } + else + { + Debug("Invalid field name"); + } + } } -} \ No newline at end of file +} diff --git a/SettingWiFi/SettingWiFi/view/InfoPage.cs b/SettingWiFi/SettingWiFi/view/InfoPage.cs index 608b20e..a1eaa0c 100644 --- a/SettingWiFi/SettingWiFi/view/InfoPage.cs +++ b/SettingWiFi/SettingWiFi/view/InfoPage.cs @@ -100,13 +100,43 @@ namespace SettingWiFi else { Debug("Ok info"); - Navigator.Push(CreateInfoInputPage(info.InfoTitle, info.InfoValue)); + if(IsFieldEditable(info.InfoTitle)) + { + Navigator.Push(CreateInfoInputPage(info.InfoTitle, info.InfoValue)); + } + } + } + + private bool IsFieldEditable(string fieldName) + { + // Checks if particular field on info page is editable or not. + if (fieldName == Resources.IDS_WIFI_BODY_MAC_ADDRESS) + { + return false; + } + else + { + if (mOnOffSwitch.IsSelected) + { + return true; + } + else + { + if(fieldName == Resources.IDS_ST_SBODY_PROXY_ADDRESS || fieldName == Resources.IDS_ST_SBODY_PROXY_PORT) + { + return true; + } + else + { + return false; + } + } } } private Page CreateInfoInputPage(string title, string value) { - var page = new InfoInputPage(); + var page = new InfoInputPage(mAp, mApInfoSource, mOnOffSwitch.IsSelected); page.CreateComponents(title, value); return page; } diff --git a/packaging/org.tizen.cssetting-wifi-1.0.0.tpk b/packaging/org.tizen.cssetting-wifi-1.0.0.tpk index df5bda3..52b40ad 100644 Binary files a/packaging/org.tizen.cssetting-wifi-1.0.0.tpk and b/packaging/org.tizen.cssetting-wifi-1.0.0.tpk differ