コード例 #1
0
ファイル: AdapterCustom.cs プロジェクト: nearit/Xamarin-SDK
 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);
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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();
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 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);
 }
コード例 #7
0
        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();
        }
コード例 #8
0
        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();
        }
コード例 #9
0
        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);
        }