private static object NormalizeDicValue(object value) { if (value is JavaDictionary) { return(From(value as JavaDictionary)); } else if (value is Java.Util.ArrayList) { List <object> list = new List <object>(); Java.Util.ArrayList nativeList = (Java.Util.ArrayList)value; for (int i = 0; i < nativeList.Size(); i++) { list.Add(NormalizeDicValue(nativeList.Get(i))); } return(list); } else if (value is Java.Lang.Double) { return((value as Java.Lang.Double).DoubleValue()); } else { return(value); } }
private List <Developer> ConvertJavaListToCSharpList(Java.Util.ArrayList arrayListDevelopers) { List <Developer> lstDevelopers = new List <Developer>(); for (int i = 0; i < arrayListDevelopers.Size(); i++) { lstDevelopers.Add((ProjectManager.Droid.code.entity.Developer)arrayListDevelopers.Get(i)); } return(lstDevelopers); }
private List <Project> ConvertJavaListToCSharpList(Java.Util.ArrayList arrayListProjects) { List <Project> lstProjects = new List <Project>(); for (int i = 0; i < arrayListProjects.Size(); i++) { lstProjects.Add((ProjectManager.Droid.code.entity.Project)arrayListProjects.Get(i)); } return(lstProjects); }
public void OnLoadStarted() { MyListViewAdapter adapter = (MyListViewAdapter)listView.GetAdapter(); Java.Util.ArrayList dataPage = getDataPage(10); for (int i = 0; i < dataPage.Size(); i++) { adapter.Add((Java.Lang.Object)dataPage.Get(i)); } adapter.NotifyLoadingFinished(); }
public bool IsRegistered(string taskName) { var infos = AppWorkManager.GetWorkInfosByTag(taskName).Get(); Java.Util.ArrayList list = infos.JavaCast <Java.Util.ArrayList>(); if (list.IsEmpty) { return(false); } WorkInfo info = (WorkInfo)list.Get(0); Log.Info(Tag, "Work {0} is {1}", taskName, info.GetState().ToString()); #if DEBUG for (int i = 0; i < list.Size(); i++) { info = (WorkInfo)list.Get(i); Log.Debug(Tag, "Work state: {0}", info.GetState().ToString()); } #endif return(true); }
public void OnRefreshRequested() { MyListViewAdapter currentAdapter = (MyListViewAdapter)listView.GetAdapter(); Java.Util.ArrayList dataPage = getDataPage(10); for (int i = 0; i < dataPage.Size(); i++) { currentAdapter.Add(0, dataPage.Get(i)); } srb.EndRefresh(false); }
public void DbOperSuccess(int p0, Java.Lang.Object obj) { if (obj != null && obj.GetType().ToString() != "Java.Lang.Long" && obj.GetType().ToString() != "Java.Lang.Integer") { Java.Util.ArrayList lstJsonObj = (Java.Util.ArrayList)obj; for (int i = 0; i < lstJsonObj.Size(); i++) { JSONObject castedJObj = (JSONObject)lstJsonObj.Get(i); string str = castedJObj.GetString("username"); } } Log.I("DB Oper", "Success " + p0); }
protected override void OnPostExecute(Java.Lang.Object result) { base.OnPostExecute(result); Java.Util.ArrayList dataPage = (Java.Util.ArrayList)result; MyListViewAdapter adapter = (MyListViewAdapter)listView.GetAdapter(); for (int i = 0; i < dataPage.Size(); i++) { adapter.Add(dataPage.Get(i)); } adapter.NotifyLoadingFinished(); }
public void Update(Java.Util.ArrayList list) { Clear(); if (list != null) { // AddAll throws an UnsupportedOperationException int size = list.Size(); for (int i = 0; i < size; i++) { Add(list.Get(i)); } } NotifyDataSetChanged(); }
public DateTime GetNextExecutionDate(string taskName) { var infos = AppWorkManager.GetWorkInfosByTag(taskName).Get(); Java.Util.ArrayList list = infos.JavaCast <Java.Util.ArrayList>(); if (list.IsEmpty) { return(DateTime.MinValue); } WorkInfo info = (WorkInfo)list.Get(0); /* Non avrò mai un valore in quanto OutputData non è disponibile per i PeriodicWorkRequest perché * non vanno mai nello stato di SUCCEEDED. * https://stackoverflow.com/questions/57845459/android-workmanager-cannot-get-output-data-from-periodicworkrequest * https://developer.android.com/reference/androidx/work/WorkInfo.html */ string nextRun = info.OutputData.GetString("NextDate"); if (string.IsNullOrEmpty(nextRun)) { return(DateTime.MinValue); } return(DateTime.ParseExact(nextRun, "dd-MM-yyyy, HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture)); }