From d72ca686a3e262693f8a6e45e747e8e8da43335b Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 06 七月 2021 09:39:03 +0800
Subject: [PATCH] 2021-07-06 1.更新
---
HDL-ON_Android/Other/JLCountrycode.cs | 72 ++++++++++++++++++++++++++++++++++++
1 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/HDL-ON_Android/Other/JLCountrycode.cs b/HDL-ON_Android/Other/JLCountrycode.cs
index cdf913a..487892b 100644
--- a/HDL-ON_Android/Other/JLCountrycode.cs
+++ b/HDL-ON_Android/Other/JLCountrycode.cs
@@ -1,6 +1,9 @@
锘縰sing System;
using Android.Content;
using Com.Widget.Jlcountrycode;
+using Com.Widget.Jlcountrycode.Sortselect;
+using System.Collections.Generic;
+using Java.Util;
namespace JLCountrycode
{
@@ -34,6 +37,53 @@
JLCountryCodeActivity.OnCountryCodeCallback = new OnCountryCodeCallback(action);
Shared.Application.Activity.StartActivity(new Intent(Shared.Application.Activity, typeof(JLCountryCodeActivity)));
}
+
+ /// <summary>
+ /// 鑷畾涔変紶鍏ュ瓧鍏告暟鎹� 閫夋嫨
+ /// </summary>
+ /// <param name="titleStr"></param>
+ /// <param name="dic"></param>
+ /// <param name="action"></param>
+ public void ShowSortSelection(string titleStr, Dictionary<string, List<string>> dic, Action<string> action)
+ {
+ try
+ {
+ SortSelectionUtils.Instance.OnSortSelectCallback = new OnSSCallback(action);
+ SortSelectionUtils.Instance.SortSelectTitle = titleStr;
+ SortSelectionUtils.Instance.MSortSelectList = ConvertToHashMap(dic);
+ Shared.Application.Activity.StartActivity(new Intent(Shared.Application.Activity, typeof(JLSortSelectionActivity)));
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+
+ }
+
+ /// <summary>
+ /// Dictionary 杞� Android HashMap
+ /// </summary>
+ /// <param name="dict"></param>
+ /// <returns></returns>
+ Dictionary<string, ArrayList> ConvertToHashMap(Dictionary<string, List<string>> dict)
+ {
+ Dictionary<string, ArrayList> newDictionary = new Dictionary<string, ArrayList>();
+ try
+ {
+ foreach (string key in dict.Keys)
+ {
+ var value = dict[key];
+ var arrayList = new ArrayList();
+ arrayList.AddAll(value.ToArray());
+ newDictionary.Add(key, arrayList);
+ }
+ }
+ catch (Exception Ex)
+ {
+ //Logger.LogException(Ex);
+ }
+ return newDictionary;
+ }
}
/// <summary>
@@ -53,4 +103,26 @@
mAction?.Invoke(countryName, code);
}
}
+
+
+
+ /// <summary>
+ /// OnSortSelectCallback
+ /// </summary>
+ public class OnSSCallback : Java.Lang.Object, IOnSortSelectCallback
+ {
+
+ Action<string> mAction;
+ public OnSSCallback(Action<string> action)
+ {
+ mAction = action;
+ }
+
+ public void OnSortSelectCallback(string countryName)
+ {
+ mAction?.Invoke(countryName);
+ }
+
+ }
+
}
\ No newline at end of file
--
Gitblit v1.8.0