public SpeakersAdapter(Activity activity, IEnumerable <Animal> speakers)
        {
            data = (from s in speakers
                    orderby s.Name
                    select s).ToList();
            context = activity;

            // setup data for iSectionIndexer
            alphaIndex = new Dictionary <string, int> ();
            for (int i = 0; i < data.Count; i++)
            {
                var key = data [i].Name [0].ToString();                   // first character of name
                if (!alphaIndex.ContainsKey(key))
                {
                    alphaIndex.Add(key, i);
                }
            }
            sections = new string[alphaIndex.Keys.Count];
            alphaIndex.Keys.CopyTo(sections, 0);
            sectionsObjects = new Java.Lang.Object[sections.Length];
            for (int i = 0; i < sections.Length; i++)
            {
                sectionsObjects [i] = new Java.Lang.String(sections [i]);
            }
        }
Esempio n. 2
0
		public static View CreateAdView(Activity context, string id)
		{				
			var s = new Java.Lang.String(id);			
			IntPtr methodId = JNIEnv.GetStaticMethodID(_helperClass, "createAdView", "(Landroid/app/Activity;Ljava/lang/String;)Landroid/view/View;");
			IntPtr view = JNIEnv.CallStaticObjectMethod(_helperClass, methodId, new JValue[2] { new JValue(context), new JValue(s) });
			return new Java.Lang.Object(view, JniHandleOwnership.TransferLocalRef).JavaCast<View>();
		}
Esempio n. 3
0
        public BufferedReader reader(int bufferSize, Java.Lang.String encoding)
        {
            BufferedReader bufferedReader = new BufferedReader();

            bufferedReader._init_(reader(encoding), bufferSize);
            return(bufferedReader);
        }
Esempio n. 4
0
		public Java.Lang.ICharSequence FilterFormatted(Java.Lang.ICharSequence source, int start, int end, global::Android.Text.ISpanned dest, int dstart, int dend)
		{
			var s = source.ToString();
			var d = dest.ToString();
			var proposal = d.Remove(dstart, dend - dstart).Insert(dstart, s.Substring(start, end - start));
			if (_onChangeDelegate(proposal))
				return null;
			else
			{
				var r = new Java.Lang.String(d.Substring(dstart, dend - dstart));
				if (source is ISpanned)
				{
					// This spannable thing here, is needed to copy information about which part of
					// the string is being under composition by the keyboard (or other spans). A
					// spannable string has support for extra information to the string, besides
					// its characters and that information must not be lost!
					var ssb = new SpannableString(r);
					var spannableEnd = (end <= ssb.Length()) ? end : ssb.Length();
					global::Android.Text.TextUtils.CopySpansFrom((ISpanned)source, start, spannableEnd, null, ssb, 0);
					return ssb;
				}
				else
					return r;
			}
		}
Esempio n. 5
0
            public static string?Exec(string command)
            {
                var runtime = Java.Lang.Runtime.GetRuntime();

                if (runtime == null)
                {
                    throw new NullReferenceException("Java.Lang.Runtime.GetRuntime");
                }
                try
                {
                    var command2 = new Java.Lang.String(command);
                    using var process = runtime.Exec("sh");
                    if (process != null)
                    {
                        using var bufferedOutputStream = new Java.IO.BufferedOutputStream(process.OutputStream);
                        using var bufferedInputStream  = new Java.IO.BufferedInputStream(process.InputStream);
                        bufferedOutputStream.Write(command2.GetBytes());
                        bufferedOutputStream.Write('\n');
                        bufferedOutputStream.Flush();
                        bufferedOutputStream.Close();
                        process.WaitFor();
                        var outputStr = GetStrFromBufferInputSteam(bufferedInputStream);
                        return(outputStr);
                    }
                }
                catch (Java.Lang.Throwable t)
                {
                    t.PrintStackTraceWhenDebug();
                }
                return(null);
            }
Esempio n. 6
0
 public void setParameterf(Java.Lang.String str, Vector3 v)
 {
     tmpVector3.X = v.x_;
     tmpVector3.Y = v.y_;
     tmpVector3.Z = v.z_;
     shader.Parameters[(string)str].SetValue(tmpVector3);
 }
Esempio n. 7
0
 public void ScrollToPage(Java.Lang.String pageId, Java.Lang.String pboPage)
 {
     Application.SynchronizationContext.Post(_ =>
                                             keeper.OnScrollToPage(
                                                 pageId.ToString(),
                                                 pboPage == null ? null : pboPage.ToString()), null);
 }
Esempio n. 8
0
        public void writeString(Java.Lang.String str, bool append, Java.Lang.String encoding)
        {
            if (_isDirectory)
            {
                IOException exception = new IOException();
                exception._init_("Can't write string to a directory");
                throw exception;
            }

            if (type() == FileType.INTERNAL_)
            {
                IOException exception = new IOException();
                exception._init_("Can't write in an INTERNAL file");
                throw exception;
            }

            if (append)
            {
                File.AppendAllText(pathWithPrefix(), str, Encoding.GetEncoding((string)encoding));
            }
            else
            {
                File.WriteAllText(pathWithPrefix(), str, Encoding.GetEncoding((string)encoding));
            }
        }
Esempio n. 9
0
        private bool WriteNFC(Ndef ndef, string mensagem)
        {
            bool retorno = false;

            try
            {
                if (ndef != null)
                {
                    ndef.Connect();
                    NdefRecord mimeRecord = null;

                    Java.Lang.String str = new Java.Lang.String(mensagem);

                    mimeRecord = NdefRecord.CreateMime
                                     ("UTF-8", str.GetBytes(Charset.ForName("UTF-8")));

                    ndef.WriteNdefMessage(new NdefMessage(mimeRecord));
                    ndef.Close();
                    retorno = true;
                }
                else
                {
                    retorno = FormatNFC(ndef);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw new System.Exception("Não foi possível ler o cartão.");
            }

            return(retorno);
        }
Esempio n. 10
0
        /// <summary>
        /// 是否运行在兼容的PC中,例如Chromebook中的Chrome OS
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        static bool IsCompatiblePC(Context context)
        {
            const string ARC_DEVICE_PATTERN = ".+_cheets|cheets_.+";
            var          device             = Build.Device;

            if (device != null)
            {
                var j_device = new JString(device);
                if (j_device.Matches(ARC_DEVICE_PATTERN))
                {
                    return(true);
                }
            }
            var packageManager = context.PackageManager;

            if (packageManager != null)
            {
                if (packageManager.HasSystemFeature("org.chromium.arc.device_management"))
                {
                    return(true);
                }
                if (packageManager.HasSystemFeature(PackageManager.FeaturePc))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 11
0
        public Reader reader(Java.Lang.String encoding)
        {
            InputStreamReader inputStreamReader = new InputStreamReader();

            inputStreamReader._init_(read(), encoding);
            return(inputStreamReader);
        }
			protected override Filter.FilterResults PerformFiltering (Java.Lang.ICharSequence constraint)
			{
				FilterResults results = new FilterResults();
				if (constraint != null) {
					var searchFor = constraint.ToString ();
Console.WriteLine ("searchFor:" + searchFor);
					var matchList = new List<string>();
					
					// find matches, IndexOf means look for the input anywhere in the items
					// but it isn't case-sensitive by default!
					var matches = from i in customAdapter.AllItems
								where i.IndexOf(searchFor) >= 0
								select i;
	
					foreach (var match in matches) {
						matchList.Add (match);
					}
		
					customAdapter.MatchItems = matchList.ToArray ();
Console.WriteLine ("resultCount:" + matchList.Count);

// not sure if the Java array/FilterResults are used
Java.Lang.Object[] matchObjects;
matchObjects = new Java.Lang.Object[matchList.Count];
for (int i = 0; i < matchList.Count; i++) {
	matchObjects[i] = new Java.Lang.String(matchList[i]);
}

					results.Values = matchObjects;
					results.Count = matchList.Count;
				}
				return results;
			}
Esempio n. 13
0
        private void ShowPopupMenu(Android.Views.View view)
        {
            Android.Support.V7.Widget.PopupMenu popupMenu;
            if (_extendedPopupMenuButton.IsXamlPopup)
            {
                popupMenu = new Android.Support.V7.Widget.PopupMenu(_context, view, 1, 0, Resource.Style.CustomPopupMenuStyle);
            }
            else
            {
                popupMenu = new Android.Support.V7.Widget.PopupMenu(_context, view, 1, 0, Resource.Style.PopupMenuStyle);
            }

            foreach (var item in _extendedPopupMenuButton.Options)
            {
                if (item.IsVisible)
                {
                    Java.Lang.ICharSequence option = new Java.Lang.String(item.Text);
                    popupMenu.Menu.Add(option);
                }
            }

            if (popupMenu.Menu.Size() > 0)
            {
                popupMenu.MenuItemClick -= PopupMenuItemClick;
                popupMenu.MenuItemClick += PopupMenuItemClick;
                popupMenu.Show();
            }
        }
        public ExhibitorListAdapter(Activity context, IList <Exhibitor> exhibitors)
            : base()
        {
            this.context    = context;
            this.exhibitors = exhibitors;

            alphaIndexer = new Dictionary <string, int>();

            for (int i = 0; i < exhibitors.Count; i++)
            {
                var key = exhibitors[i].Index;
                if (alphaIndexer.ContainsKey(key))
                {
                    //alphaIndexer[key] = i;
                }
                else
                {
                    alphaIndexer.Add(key, i);
                }
            }
            sections = new string[alphaIndexer.Keys.Count];
            alphaIndexer.Keys.CopyTo(sections, 0);
            sectionsO = new Java.Lang.Object[sections.Length];
            for (int i = 0; i < sections.Length; i++)
            {
                sectionsO[i] = new Java.Lang.String(sections[i]);
            }
        }
        public void StartListen()
        {
            // UDP服务器监听的端口
            int port = 4000;

            // 接收的字节大小,客户端发送的数据不能超过这个大小
            byte[]         message        = new byte[512];
            DatagramSocket datagramSocket = new DatagramSocket(port);

            datagramSocket.Broadcast = true;
            DatagramPacket datagramPacket = new DatagramPacket(message, message.Length);

            try
            {
                while (!IsThreadDisable)
                {
                    datagramSocket.Receive(datagramPacket);
                    string   strMsg = new Java.Lang.String(datagramPacket.GetData()).Trim();
                    string[] msg    = strMsg.Split(new string[] { "\r\n" }, StringSplitOptions.None);
                }
            }
            catch (System.Exception e)
            {
            }
        }
Esempio n. 16
0
        public Java.Lang.String GetFormsViewModelProperty(Java.Lang.String query)
        {
            var propertyName = query.ToString();
            var vm           = FormsTestAutomationHelper.Instance.ResolveTopLevelViewModel();

            return(new Java.Lang.String(ReflectionHelper.GetPropertyValueAsString(vm, query.ToString())));
        }
        public MediaNotification(Context context)
        {
            this.context        = context;
            notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);

            var tickerText = "ShortCuts";
            var now        = DateTime.Now;

            var builder      = new Builder(context);
            var notification = builder.Notification;

            notification.When       = now.Ticks;
            notification.TickerText = new Java.Lang.String(tickerText);
            notification.Icon       = Resource.Drawable.Icon;

            var contentView = new RemoteViews(context.PackageName, Resource.Layout.MessageView);

            SetListeners(contentView);

            notification.ContentView = contentView;
            notification.Flags      |= NotificationFlags.OngoingEvent;
            var contentTitle = new Java.Lang.String("From Shortcuts");

            notificationManager.Notify(548853, notification);
        }
Esempio n. 18
0
        //Metodo de envio de datos la bluetooth
        private void writeData(Java.Lang.String data)
        {
            //Extraemos el stream de salida
            try
            {
                outStream = btSocket.OutputStream;
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error al enviar" + e.Message);
            }

            //creamos el string que enviaremos
            Java.Lang.String message = new Java.Lang.String(data.Concat("\n"));

            //lo convertimos en bytes
            byte[] msgBuffer = message.GetBytes();

            try
            {
                //Escribimos en el buffer el arreglo que acabamos de generar
                outStream.Write(msgBuffer, 0, msgBuffer.Length);
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error al enviar" + e.Message);
            }
        }
Esempio n. 19
0
        internal MonoGameFileHandle firstMatchingChildFile(Java.Lang.String prefix)
        {
            if (!_isDirectory)
            {
                return(null);
            }
            var childFiles = _directoryInfo.GetFiles();

            //Not using foreach or LINQ query because they could be as much as 10x slower.

            // ReSharper disable once ForCanBeConvertedToForeach
            // ReSharper disable once LoopCanBeConvertedToQuery
            for (var i = 0; i < childFiles.Length; i++)
            {
                var child = childFiles[i];
                if (child.Name.StartsWith(prefix))
                {
                    string path     = this.path();
                    var    fileName = child.Name;
                    if (_fileType == FileType.INTERNAL_)
                    {
                        fileName = fileName.Replace(".xnb", "");
                    }
                    return(new MonoGameFileHandle(_prefix, (path == string.Empty ? string.Empty : path + Path.DirectorySeparatorChar) + fileName, _fileType));
                }
            }

            return(null);
        }
Esempio n. 20
0
        public Java.Lang.String getArrangmentLst(Java.Lang.String national, Java.Lang.String idTipo)
        {
            using (var db = FactoryConn.GetConn()) {
                var n   = bool.Parse(national.ToString());
                var typ = int.Parse(idTipo.ToString());
                List <ArrangementView> lstArrmntView = new List <ArrangementView> ();

                var arras = db.Table <Arrangement> ().Where(ar => ar.IsNational == n &&
                                                            ar.Type == typ).OrderByDescending(ar => ar.Index).ToList();

                foreach (Arrangement ar in arras)
                {
                    ArrangementView arVnew = new ArrangementView();
                    arVnew.id        = ar.Id;
                    arVnew.name      = ar.Description;
                    arVnew.isDefault = ar.IsDefault;
                    if (arVnew.isDefault == true)
                    {
                        arVnew.selVal      = true;
                        arVnew.description = "--";
                    }
                    else
                    {
                        arVnew.selVal = false;
                    }
                    arVnew.isExclusive = ar.IsExclusive;
                    lstArrmntView.Add(arVnew);
                }
                db.Close();
                return(new Java.Lang.String(JsonConvert.SerializeObject(lstArrmntView)));
            }
        }
Esempio n. 21
0
		private void BuildSectionIndex()
		{


			partOfSpeechIndex = new Dictionary<string, int>();		// Dictionaray will contain section names
			for (var i = 0; i < Count; i++)
			{
				// Use the pos field as a key
				var key = (string)dataList[i][XmlVocabFileParser.POS];
				if (!partOfSpeechIndex.ContainsKey(key))
				{
					partOfSpeechIndex.Add(key, i);
				} 
			}

			// Get the count of sections
			sections = new string[partOfSpeechIndex.Keys.Count];
			// Copy section names into the sections array
			partOfSpeechIndex.Keys.CopyTo(sections, 0);

			// Copy section names into a Java object array
			sectionsObjects = new Java.Lang.Object[sections.Length];
			for (var i = 0; i < sections.Length; i++)
			{
				sectionsObjects[i] = new Java.Lang.String(sections[i]);
			}
		} 
Esempio n. 22
0
 public void debug(Java.Lang.String tag, Java.Lang.String msg)
 {
     if (_logLevel <= _static_Logger.LOG_DEBUG_)
     {
         Debug.WriteLine("[" + ((string)tag) + "] " + ((string)msg));
     }
 }
Esempio n. 23
0
        private Boolean FormatNFC(Ndef ndef)
        {
            bool retorno = false;

            NdefFormatable ndefFormatable = NdefFormatable.Get(ndef.Tag);

            Java.Lang.String msg = new Java.Lang.String(MENSAGEM_PADRAO);
            try
            {
                if (ndefFormatable == null)
                {
                    return(retorno);
                }

                if (!ndefFormatable.IsConnected)
                {
                    ndefFormatable.Connect();
                }
                ndefFormatable.Format(new NdefMessage(NdefRecord.CreateMime
                                                          ("UTF-8", msg.GetBytes(Charset.ForName("UTF-8")))));
                ndefFormatable.Close();
                retorno = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw new System.Exception("Não foi possível ler o cartão.");
            }

            return(retorno);
        }
Esempio n. 24
0
 public void error(Java.Lang.String tag, Java.Lang.String msg)
 {
     if (_logLevel <= _static_Logger.LOG_ERROR_)
     {
         Console.Error.WriteLine("[" + ((string)tag) + "] " + ((string)msg));
     }
 }
Esempio n. 25
0
 public void setParameterf(Java.Lang.String str, float f1, float f2, float f3)
 {
     tmpVector3.X = f1;
     tmpVector3.Y = f2;
     tmpVector3.Z = f3;
     shader.Parameters[(string)str].SetValue(tmpVector3);
 }
Esempio n. 26
0
 public void info(Java.Lang.String tag, Java.Lang.String msg)
 {
     if (_logLevel <= _static_Logger.LOG_INFO_)
     {
         Console.WriteLine("[" + ((string)tag) + "] " + ((string)msg));
     }
 }
Esempio n. 27
0
        private void BuildSectionIndex()
        {
            alphaIndex = new Dictionary <string, int>();                        // Map sequential numbers
            for (var i = 0; i < items.Count; i++)
            {
                // Use the part of speech as a key
                var key = items[i].PartOfSpeech;
                if (!alphaIndex.ContainsKey(key))
                {
                    alphaIndex.Add(key, i);
                }
            }

            // Get the count of sections
            sections = new string[alphaIndex.Keys.Count];
            // Copy section names into the sections array
            alphaIndex.Keys.CopyTo(sections, 0);

            // Copy section names into a Java object array
            sectionsObjects = new Java.Lang.Object[sections.Length];
            for (var i = 0; i < sections.Length; i++)
            {
                sectionsObjects[i] = new Java.Lang.String(sections[i]);
            }
        }
Esempio n. 28
0
        private void BuildSectionIndex()
        {
            partOfSpeechIndex = new Dictionary <string, int>();                         // Dictionaray will contain section names
            for (var i = 0; i < Count; i++)
            {
                // Use the pos field as a key
                var key = (string)dataList[i][XmlVocabFileParser.POS];
                if (!partOfSpeechIndex.ContainsKey(key))
                {
                    partOfSpeechIndex.Add(key, i);
                }
            }

            // Get the count of sections
            sections = new string[partOfSpeechIndex.Keys.Count];
            // Copy section names into the sections array
            partOfSpeechIndex.Keys.CopyTo(sections, 0);

            // Copy section names into a Java object array
            sectionsObjects = new Java.Lang.Object[sections.Length];
            for (var i = 0; i < sections.Length; i++)
            {
                sectionsObjects[i] = new Java.Lang.String(sections[i]);
            }
        }
Esempio n. 29
0
        public void BthSend(string data)
        {
            //System.Diagnostics.Process.GetCurrentProcess().CloseMainWindow();
            //    Process.KillProcess(Process.MyPid());
            Stream outStream = null;

            //Extraemos el stream de salida
            try
            {
                outStream = BthSocket.OutputStream;
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error al enviar" + e.Message);
            }

            //creamos el string que enviaremos
            Java.Lang.String message = new Java.Lang.String(data);

            //lo convertimos en bytes
            byte[] msgBuffer = message.GetBytes();

            try
            {
                //Escribimos en el buffer el arreglo que acabamos de generar
                outStream.Write(msgBuffer, 0, msgBuffer.Length);
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error al enviar" + e.Message);
                Xamarin.Forms.MessagingCenter.Send <App, string>((App)Xamarin.Forms.Application.Current, "Barcode", "BT DISCONNECTED");
                _ct.Cancel();
            }
        }
            public static void ShowNotification(Context context, int progress, bool isfinished)
            {
                var notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);

                if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
                {
                    var channelNameJava = new Java.Lang.String("xamarindownloadchannel");
                    var channel         = new NotificationChannel("defaultxamarindownloadchannel", channelNameJava, NotificationImportance.High)
                    {
                        Description = "xamarindownloadchannel"
                    };
                    notificationManager.CreateNotificationChannel(channel);
                }
                var notificationBuilder = new NotificationCompat.Builder(context, "defaultxamarindownloadchannel")
                                          .SetSmallIcon(isfinished ? Android.Resource.Drawable.StatSysDownloadDone : Android.Resource.Drawable.StatSysDownload)
                                          .SetAutoCancel(isfinished);

                if (!isfinished)
                {
                    notificationBuilder.SetProgress(100, progress, false);
                }
                else
                {
                    notificationBuilder.SetProgress(0, progress, false);
                }

                var notification = notificationBuilder.Build();

                notificationManager.Notify(NotificationId, notification);
            }
Esempio n. 31
0
        public Writer writer(bool append, Java.Lang.String encoding)
        {
            OutputStreamWriter writer = new OutputStreamWriter();

            writer._init_(write(append), encoding);
            return(writer);
        }
Esempio n. 32
0
        /// <summary>
        /// 打印文本内容
        /// </summary>
        /// <param name="message">打印的内容</param>
        /// <param name="err">2:没有开启蓝牙,3:没有连接打印机,4:butmap为null,5:程序出现异常</param>
        /// <returns></returns>
        public bool SendMessage(Java.Lang.String message, out int err)
        {
            err = 0;
            if (!isopen)
            {
                err = 2;
                return(false);
            }
            if (this.chatService.GetState() != BluetoothService.STATE_CONNECTED)
            {
                err = 3;
                return(false);
            }

            if (message.Length() <= 0)
            {
                err = 4;
                return(false);
            }
            try
            {
                byte[] send = message.GetBytes();
                chatService.Write(send);
                return(true);
            }
            catch
            {
                err = 5;
                return(false);
            }

            // Get the message bytes and tell the BluetoothService to write
        }
Esempio n. 33
0
            protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint)
            {
                FilterResults results = new FilterResults();

                if (constraint != null)
                {
                    var searchFor = constraint.ToString().ToLower();

                    var matches = from i in customAdapter._list where i.SampleID.ToLower().Contains(searchFor) select i;
                    //foreach (var match in matches) {
                    //matchList.Add (match);
                    //}
                    customAdapter._list = matches.ToList();
                    // Console.System.Diagnostics.Debug.WriteLine("resultCount:" + customAdapter.MatchItems.Count);
                    // not sure if the Java array/FilterResults are used
                    Java.Lang.Object[] matchObjects;
                    matchObjects = new Java.Lang.Object[customAdapter._list.Count];
                    for (int i = 0; i < customAdapter._list.Count; i++)
                    {
                        matchObjects[i] = new Java.Lang.String(customAdapter._list[i].SampleID.ToLower());
                    }
                    results.Values = matchObjects;
                    results.Count  = customAdapter._list.Count;
                }
                return(results);
            }
Esempio n. 34
0
        public TotemAdapter(Activity activity, List <Totem> list)
        {
            _activity  = activity;
            totemList  = list;
            showDelete = false;

            var items = list.ToArray();

            alphaIndex = new Dictionary <string, int>();
            for (int i = 0; i < items.Length; i++)
            {
                var key = items[i].title[0].ToString();
                if (!alphaIndex.ContainsKey(key))
                {
                    alphaIndex.Add(key, i);
                }
            }
            sections = new string[alphaIndex.Keys.Count];
            alphaIndex.Keys.CopyTo(sections, 0);
            sectionsObjects = new Java.Lang.Object[sections.Length];
            for (int i = 0; i < sections.Length; i++)
            {
                sectionsObjects[i] = new Java.Lang.String(sections[i]);
            }
        }
        private void initView()
        {
            //MainActivity的布局文件中的主要控件初始化
            mToolbar = FindViewById<Toolbar>(Resource.Id.tool_bar);
            mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            mNavigationView = FindViewById<NavigationView>(Resource.Id.navigation_view);
            mTabLayout = FindViewById<TabLayout>(Resource.Id.tab_layout);
            mViewPager = FindViewById<ViewPager>(Resource.Id.view_pager);
            mTabLayout.Post(() =>
            {
                ShowTipMask();

            });


            mTabLayout.TabMode = TabLayout.ModeFixed;//固定
            // mTabLayout.TabMode = TabLayout.ModeScrollable;//滚动
            mTabLayout.TabGravity = TabLayout.GravityFill;//标签填充栏
            //mTabLayout.TabGravity = TabLayout.GravityCenter;//固定在中间
            //初始化ToolBar
            SetSupportActionBar(mToolbar);
            Android.Support.V7.App.ActionBar actionBar = SupportActionBar;
            actionBar.SetHomeAsUpIndicator(Android.Resource.Drawable.IcDialogAlert);
            actionBar.SetDisplayHomeAsUpEnabled(true);
            //对NavigationView添加item的监听事件
            mNavigationView.SetNavigationItemSelectedListener(naviListener);
            //开启应用默认打开DrawerLayout
            // mDrawerLayout.OpenDrawer(mNavigationView);

            //初始化TabLayout的title数据集
            List<Java.Lang.String> titles = new List<Java.Lang.String>();
            Java.Lang.String detail = new Java.Lang.String("我的活动");
            Java.Lang.String share = new Java.Lang.String("招募活动");
            Java.Lang.String agenda = new Java.Lang.String("缺席活动");
            Java.Lang.String other = new Java.Lang.String("其他活动");
            titles.Add(detail);
            titles.Add(share);
            titles.Add(agenda);
            titles.Add(other);
            //初始化TabLayout的title
            mTabLayout.AddTab(mTabLayout.NewTab().SetText(titles[0]));
            mTabLayout.AddTab(mTabLayout.NewTab().SetText(titles[1]));
            mTabLayout.AddTab(mTabLayout.NewTab().SetText(titles[2]));
            mTabLayout.AddTab(mTabLayout.NewTab().SetText(titles[3]));
            //初始化ViewPager的数据集
            List<Android.Support.V4.App.Fragment> fragments = new List<Android.Support.V4.App.Fragment>();
            fragments.Add(new InfoDetailsFragment());
            fragments.Add(new ShareFragment());
            fragments.Add(new AgendaFragment());
            fragments.Add(new AgendaFragment());
            //创建ViewPager的adapter
            FragmentAdapter adapter = new FragmentAdapter(SupportFragmentManager, fragments, titles);
            mViewPager.Adapter = adapter;
            //千万别忘了,关联TabLayout与ViewPager
            //同时也要覆写PagerAdapter的getPageTitle方法,否则Tab没有title
            mTabLayout.SetupWithViewPager(mViewPager);
            mTabLayout.SetTabsFromPagerAdapter(adapter);
        }
Esempio n. 36
0
        public static View CreateAdView(Activity activity, string publisherID)
        {
            IntPtr methodId = JNIEnv.GetStaticMethodID(_helperClass, "createAdView", "(Landroid/app/Activity;Ljava/lang/String;)Landroid/view/View;");
            var javaPublisherID = new Java.Lang.String(publisherID);
            IntPtr viewPtr = JNIEnv.CallStaticObjectMethod(_helperClass, methodId, new JValue(activity), new JValue(javaPublisherID));
            var view = Java.Lang.Object.GetObject<View>(viewPtr, JniHandleOwnership.TransferLocalRef);
            //JNIEnv.DeleteLocalRef(viewPtr);// Throws Error

            return view;
        }
Esempio n. 37
0
        public static void OnStartSession(Context context, string appKey)
        {
            #if DEBUG
            #else

            IntPtr Flurry_onStartSession = JNIEnv.GetStaticMethodID(m_FlurryClass, "onStartSession", "(Landroid/content/Context;Ljava/lang/String;)V");
            Java.Lang.String key = new Java.Lang.String(appKey);
            JNIEnv.CallStaticVoidMethod(m_FlurryClass, Flurry_onStartSession, new JValue(context), new JValue(key));
            #endif
        }
Esempio n. 38
0
        public static Java.Lang.ICharSequence[] ArrayFromStringArray(string[] val)
        {
            if (val == null)
                return null;

            Java.Lang.ICharSequence[] ret = new Java.Lang.ICharSequence [val.Length];
            for (int i = 0; i < val.Length; i++)
                ret [i] = new Java.Lang.String (val [i]);

            return ret;
        }
Esempio n. 39
0
 public void LaunchApp(String appFile, String appDataDir)
 {
     if (launchAppMethodId == IntPtr.Zero)
     {
         launchAppMethodId = JNIEnv.GetMethodID(ClassRef, "launchApp", "(Ljava/lang/String;Ljava/lang/String;)V");
     }
     using (var jAppFile = new Java.Lang.String(appFile))
     using (var jAppDataDir = new Java.Lang.String(appDataDir))
     {
         JNIEnv.CallVoidMethod(Handle, launchAppMethodId, new JValue(jAppFile), new JValue(jAppDataDir));
     }
 }
 public override Response ParseNetworkResponse(NetworkResponse response)
 {
     Java.Lang.String parsed;
     try
     {
         parsed = new Java.Lang.String(response.Data, HttpHeaderParser.ParseCharset(response.Headers));
     }
     catch (Java.IO.UnsupportedEncodingException)
     {
         parsed = new Java.Lang.String(response.Data);
     }
     return Response.Success(parsed.ToString(), HttpHeaderParser.ParseCacheHeaders(response));
 }
        public static void invoke(string developerId)
        {
            if (jc_class != IntPtr.Zero) {
                Log.Info (LOG_TAG, "Found AsyncCppOuyaSetDeveloperId class");
            } else {
                Log.Info (LOG_TAG, "Failed to find AsyncCppOuyaSetDeveloperId class");
                return;
            }
            if (method_invoke != IntPtr.Zero) {
                Log.Info (LOG_TAG, "Found invoke method");

                Java.Lang.String developerIdString = new Java.Lang.String(developerId);
                JNIEnv.CallStaticVoidMethod (jc_class, method_invoke, new JValue(developerIdString));
            } else {
                Log.Info (LOG_TAG, "Failed to find invoke method");
                return;
            }
        }
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			
			
			SetContentView (Resource.Layout.activity_singlepane_empty);
			ActivityHelper.SetupActionBar (new Java.Lang.String (Title), new Color (0));
			
			var customTitle = Intent.GetStringExtra (Intent.ExtraTitle);
			var title = new Java.Lang.String (customTitle != null ? customTitle : Title);
			ActivityHelper.SetActionBarTitle (title);
			
			if (savedInstanceState == null) {
				fragment = OnCreatePane ();
				fragment.Arguments = IntentToFragmentArguments (Intent);
				
				SupportFragmentManager.BeginTransaction ().Add (Resource.Id.root_container, fragment).Commit ();
			}
		}
 public static String SHA1Hash(String text)
 {
     String hash = null;
     try
     {
         var digest = Java.Security.MessageDigest.GetInstance("SHA-1");
         byte[] bytes = new Java.Lang.String(text).GetBytes("UTF-8");
         digest.Update(bytes, 0, bytes.Length);
         hash = ConvertToHex(digest.Digest());
     }
     catch (Java.Security.NoSuchAlgorithmException e)
     {
         e.PrintStackTrace();
     }
     catch (Java.IO.UnsupportedEncodingException e)
     {
         e.PrintStackTrace();
     }
     return hash;
 }
 public override void OnCreateContextMenu(Android.Views.IContextMenu menu, View v,
     Android.Views.IContextMenuContextMenuInfo menuInfo)
 {
     base.OnCreateContextMenu(menu, v, menuInfo);
     Java.Lang.ICharSequence str0 = new Java.Lang.String("Context Menu");
     Java.Lang.ICharSequence str1 = new Java.Lang.String("Item 1");
     Java.Lang.ICharSequence str2 = new Java.Lang.String("Item 2");
     Java.Lang.ICharSequence str3 = new Java.Lang.String("Item 3");
     Java.Lang.ICharSequence strSubMenu = new Java.Lang.String("Submenu");
     Java.Lang.ICharSequence strSubMenuItem = new Java.Lang.String("Submenu Item");
     menu.SetHeaderTitle(str0);
     menu.Add(0, Android.Views.Menu.First,
         Android.Views.Menu.None, str1).SetIcon(Resource.Drawable.Icon);
     menu.Add(0, Android.Views.Menu.First + 1, Android.Views.Menu.None, str2)
         .SetCheckable(true);
     menu.Add(0, Android.Views.Menu.First + 2, Android.Views.Menu.None, str3)
         .SetShortcut('3', '3');
     ISubMenu sub = menu.AddSubMenu(strSubMenu);
     sub.Add(strSubMenuItem);
 }
Esempio n. 45
0
		public void Connect() {
			BluetoothDevice device = mBluetoothAdapter.GetRemoteDevice(address);
			System.Console.WriteLine("Conexion en curso" + device);
			mBluetoothAdapter.CancelDiscovery();
			try {
				btSocket = device.CreateRfcommSocketToServiceRecord(MY_UUID);
				btSocket.Connect();
				System.Console.WriteLine("Conexion Correcta");
			} catch (System.Exception e) {
				Console.WriteLine (e.Message);
				try {
					btSocket.Close();
				} catch (System.Exception) {
					System.Console.WriteLine("Imposible Conectar");
				}
				System.Console.WriteLine("Socket Creado");
			}
			beginListenForData();
			dataToSend = new Java.Lang.String("e");
			writeData(dataToSend);
		}
Esempio n. 46
0
		void tgConnect_HandleCheckedChange (object sender, CompoundButton.CheckedChangeEventArgs e)
		{
			if (e.IsChecked) {
				driver = UsbSerialProber.Acquire(manager);
				if (driver != null) {
					driver.Open ();
					driver.SetBaudRate (9600);
					beginListenForData ();
					dataToSend = new Java.Lang.String("e");
					writeData(dataToSend);
				}
				else
				{
					Toast.MakeText (this, "Error Arduino no detectado", ToastLength.Short).Show();
				}
			} else {
					try {
						driver.Close();
					} catch (System.Exception ex) {
						Console.WriteLine (ex.Message);
					}
			}
		}
Esempio n. 47
0
		/// <summary>
		/// Send the data. The serialization is defined when connecting to the peer, will be the serialization used.
		/// </summary>
		/// <param name="data">data in string format..</param>
		public void Send (string data)
		{
			Java.Lang.String dataString = new Java.Lang.String (data);
			Java.Nio.ByteBuffer bufferData = Java.Nio.ByteBuffer.AllocateDirect (data.Length);
			bufferData.Put (dataString.GetBytes ("UTF-8"));
			bufferData.Flip ();
			DataChannel.Buffer buffer = new DataChannel.Buffer (bufferData, false);
			Channel.Send (buffer);
		}
 public Java.Lang.Object[] GetSections()
 {
     if (sectionObjects == null) {
         var keys = sections.Keys.ToArray ();
         sectionObjects = new Java.Lang.Object[keys.Length];
         for (int i = 0; i < keys.Length; i++) {
             sectionObjects [i] = new Java.Lang.String (keys [i]);
         }
     }
     return sectionObjects;
 }
Esempio n. 49
0
			private static Java.Lang.Object[] CreateJavaStringArray(List<Category> inputList)
			{
				if (inputList == null)
					return null;

				var toReturn = new Java.Lang.Object[inputList.Count];
				for (var i = 0; i < inputList.Count; i++)
				{
					toReturn [i] = new Java.Lang.String(inputList[i].Title);
				}

				return toReturn;
			}
        public int ReadMessageEventReceived(byte[] readBuf)
        {
            var message = new Java.Lang.String (readBuf);

            #if DEBUG
            Log.Debug(Tag, "MessageType = read, " + message);
            #endif

            return 0;
        }
Esempio n. 51
0
 public RecordInfo(int avgTime, int gamesPlayed, Java.Lang.String difficulty)
 {
     this.avgTime = avgTime;
     this.gamesPlayed = gamesPlayed;
     this.difficulty = difficulty;
 }
 DropDownItem(string name, JavaString value, int flag)
 {
     this.Name = name;
     this.value = value;
     this.flag = flag;
 }
        public static void AnnounceForAccessibilityCompat(Context context, String text)
        {
            if ((int) Build.VERSION.SdkInt >= 4)
            {
                AccessibilityManager accessibilityManager = null;
                if (null != context)
                {
                    accessibilityManager = (AccessibilityManager) context.GetSystemService(Context.AccessibilityService);
                }
                if (null == accessibilityManager || !accessibilityManager.IsEnabled)
                {
                    return;
                }

                // Prior to SDK 16, announcements could only be made through FOCUSED
                // events. Jelly Bean (SDK 16) added support for speaking text verbatim
                // using the ANNOUNCEMENT event type.
                EventTypes eventType;
                if ((int) Build.VERSION.SdkInt < 16)
                {
                    eventType = EventTypes.ViewFocused;
                }
                else
                {
                    eventType = EventTypes.Announcement;
                }

                // Construct an accessibility event with the minimum recommended
                // attributes. An event without a class name or package may be dropped.
                AccessibilityEvent ev = AccessibilityEvent.Obtain(eventType);
                var textProxy = new Java.Lang.String(text);
                ev.Text.Add(textProxy);
                ev.ClassName = _instance.GetType().ToString();
                ev.PackageName = context.PackageName;

                // Sends the event directly through the accessibility manager. If your
                // application only targets SDK 14+, you should just call
                // getParent().requestSendAccessibilityEvent(this, event);
                accessibilityManager.SendAccessibilityEvent(ev);
            }
        }
Esempio n. 54
0
        public void SelectCampus(object sender, EventArgs e )
        {
            // build an alert dialog containing all the campus choices
            AlertDialog.Builder builder = new AlertDialog.Builder( Activity );
            Java.Lang.ICharSequence [] campusStrings = new Java.Lang.ICharSequence[ RockGeneralData.Instance.Data.Campuses.Count ];
            for( int i = 0; i < RockGeneralData.Instance.Data.Campuses.Count; i++ )
            {
                campusStrings[ i ] = new Java.Lang.String( App.Shared.Network.RockGeneralData.Instance.Data.Campuses[ i ].Name );
            }

            builder.SetTitle( new Java.Lang.String( SpringboardStrings.SelectCampus_SourceTitle ) );

            // launch the dialog, and on selection, update the viewing campus text.
            builder.SetItems( campusStrings, delegate(object s, DialogClickEventArgs clickArgs) 
                {
                    Rock.Mobile.Threading.Util.PerformOnUIThread( delegate
                        {
                            // get the ID for the campus they selected
                            string campusTitle = campusStrings[ clickArgs.Which ].ToString( );
                            RockMobileUser.Instance.ViewingCampus = RockGeneralData.Instance.Data.CampusNameToId( campusTitle );

                            // build a label showing what they picked
                            RefreshCampusSelection( );
                        });
                });

            builder.Show( );
        }
Esempio n. 55
0
		public static void AddTestDevice(View view,string deviceid)
		{
			var s = new Java.Lang.String(deviceid);	
			IntPtr methodId = JNIEnv.GetStaticMethodID(_helperClass, "addTestDevice", "(Landroid/view/View;Ljava/lang/String;)V");
			JNIEnv.CallStaticVoidMethod(_helperClass, methodId, new JValue[2] { new JValue(view), new JValue(s) });
		}
Esempio n. 56
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // grab our resource file
            View view = inflater.Inflate(Resource.Layout.Springboard, container, false);

            // let the springboard elements setup their buttons
            foreach( SpringboardElement element in Elements )
            {
                element.OnCreateView( view );

                element.Button.SetOnTouchListener( this );
            }

            view.SetOnTouchListener( this );
            view.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_BackgroundColor ) );

            // set the task we wish to have active
            ActivateElement( Elements[ ActiveElementIndex ] );

            // setup our profile pic button, which displays either their profile picture or an icon if they're not logged in / don't have a pic
            ProfileImageButton = view.FindViewById<Button>( Resource.Id.springboard_profile_image );
            ProfileImageButton.Click += (object sender, EventArgs e) =>
                {
                    // if we're logged in, manage their profile pic
                    if( RockMobileUser.Instance.LoggedIn == true )
                    {
                        ManageProfilePic( );
                    }
                    else
                    {
                        // otherwise, use it to let them log in
                        StartModalFragment( LoginFragment );
                    }
                };
            Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Primary );
            ProfileImageButton.SetTypeface( fontFace, TypefaceStyle.Normal );
            ProfileImageButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateSpringboardConfig.ProfileSymbolFontSize );
            ProfileImageButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) );
            ProfileImageButton.LayoutParameters.Width = (int)Rock.Mobile.Graphics.Util.UnitToPx( 140 );
            ProfileImageButton.LayoutParameters.Height = (int)Rock.Mobile.Graphics.Util.UnitToPx( 140 );
            ProfileImageButton.SetBackgroundColor( Color.Transparent );

            // create and add a simple circle to border the image
            RelativeLayout layout = view.FindViewById<RelativeLayout>( Resource.Id.springboard_profile_image_layout );
            layout.SetBackgroundColor( Color.Transparent );

            CircleView circle = new Rock.Mobile.PlatformSpecific.Android.Graphics.CircleView( Activity.BaseContext );

            //note: these are converted from dp to pixels, so don't do it here.
            circle.StrokeWidth = 4;

            circle.Color = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor );
            circle.SetBackgroundColor( Color.Transparent );
            circle.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
            ( (RelativeLayout.LayoutParams)circle.LayoutParameters ).AddRule( LayoutRules.CenterInParent );
            circle.LayoutParameters.Width = (int)Rock.Mobile.Graphics.Util.UnitToPx( 150 );
            circle.LayoutParameters.Height = (int)Rock.Mobile.Graphics.Util.UnitToPx( 150 );
            layout.AddView( circle );

            // setup our login button
            LoginProfileButton = view.FindViewById<Button>( Resource.Id.springboard_login_button );
            LoginProfileButton.Click += (object sender, EventArgs e) =>
                {
                    // if we're logged in, it'll be the profile one
                    if( RockMobileUser.Instance.LoggedIn == true )
                    {
                        StartModalFragment( ProfileFragment );
                    }
                    else
                    {
                        // else it'll be the login one
                        StartModalFragment( LoginFragment );
                    }
                };

            // setup the textView for rendering either "Tap to Personalize" or "View Profile"
            ViewProfileLabel = view.FindViewById<TextView>( Resource.Id.view_profile );
            ViewProfileLabel.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) );
            ViewProfileLabel.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
            ViewProfileLabel.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );

            // get the size of the display. We will use this rather than Resources.DeviceManager because this
            // is absolute and won't change based on orientation
            Point displaySize = new Point( );
            Activity.WindowManager.DefaultDisplay.GetSize( displaySize );
            float displayWidth = displaySize.X;

            float revealPercent = MainActivity.IsLandscapeWide( ) ? PrivatePrimaryNavBarConfig.Landscape_RevealPercentage_Android : PrivatePrimaryNavBarConfig.Portrait_RevealPercentage_Android;

            // setup the width of the springboard area and campus selector
            ProfileContainer = view.FindViewById<LinearLayout>( Resource.Id.springboard_profile_image_container );
            ProfileContainer.LayoutParameters.Width = (int) ( displayWidth * revealPercent );

            // setup the textView for rendering the user's name when they're logged in "Welcome: Jered"
            ProfilePrefix = view.FindViewById<TextView>( Resource.Id.profile_prefix );
            ProfilePrefix.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
            ProfilePrefix.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Large_FontSize );
            ProfilePrefix.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) );
            ProfilePrefix.Text = SpringboardStrings.LoggedIn_Prefix;
            ProfilePrefix.Measure( 0, 0 );

            ProfileName = view.FindViewById<TextView>( Resource.Id.profile_name );
            ProfileName.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) );
            ProfileName.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
            ProfileName.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Large_FontSize );
            ProfileName.SetMaxLines( 1 );
            ProfileName.Ellipsize = Android.Text.TextUtils.TruncateAt.End;

            CampusContainer = view.FindViewById<View>( Resource.Id.campus_container );
            CampusContainer.LayoutParameters.Width = (int) ( displayWidth * revealPercent );
            CampusContainer.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_BackgroundColor ) );

            View seperator = view.FindViewById<View>( Resource.Id.end_seperator );
            seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );

            // setup the bottom campus / settings selector
            CampusText = CampusContainer.FindViewById<TextView>( Resource.Id.campus_selection_text );
            CampusText.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
            CampusText.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) );
            CampusText.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
            CampusText.SetTextSize(Android.Util.ComplexUnitType.Dip,  ControlStylingConfig.Small_FontSize );
            CampusText.SetSingleLine( );

            TextView settingsIcon = CampusContainer.FindViewById<TextView>( Resource.Id.campus_selection_icon );
            settingsIcon.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Primary ), TypefaceStyle.Normal );
            settingsIcon.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) );
            settingsIcon.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateSpringboardConfig.CampusSelectSymbolSize );
            settingsIcon.Text = PrivateSpringboardConfig.CampusSelectSymbol;

            // set the campus text to whatever their profile has set for viewing.
            CampusText.Text = string.Format( SpringboardStrings.Viewing_Campus, RockGeneralData.Instance.Data.CampusIdToName( RockMobileUser.Instance.ViewingCampus ) ).ToUpper( );

            // setup the campus selection button.
            Button campusSelectionButton = CampusContainer.FindViewById<Button>( Resource.Id.campus_selection_button );
            campusSelectionButton.Click += (object sender, EventArgs e ) =>
                {
                    // build an alert dialog containing all the campus choices
                    AlertDialog.Builder builder = new AlertDialog.Builder( Activity );
                    Java.Lang.ICharSequence [] campusStrings = new Java.Lang.ICharSequence[ RockGeneralData.Instance.Data.Campuses.Count ];
                    for( int i = 0; i < RockGeneralData.Instance.Data.Campuses.Count; i++ )
                    {
                        campusStrings[ i ] = new Java.Lang.String( App.Shared.Network.RockGeneralData.Instance.Data.Campuses[ i ].Name );
                    }

                    // launch the dialog, and on selection, update the viewing campus text.
                    builder.SetItems( campusStrings, delegate(object s, DialogClickEventArgs clickArgs)
                        {
                            Rock.Mobile.Threading.Util.PerformOnUIThread( delegate
                                {
                                    // get the ID for the campus they selected
                                    string campusTitle = campusStrings[ clickArgs.Which ].ToString( );
                                    RockMobileUser.Instance.ViewingCampus = RockGeneralData.Instance.Data.CampusNameToId( campusTitle );

                                    // build a label showing what they picked
                                    RefreshCampusSelection( );
                                });
                        });

                    builder.Show( );
                };

            Billboard = new NotificationBillboard( displayWidth, Rock.Mobile.PlatformSpecific.Android.Core.Context );
            Billboard.SetLabel( SpringboardStrings.TakeNotesNotificationIcon,
                                PrivateControlStylingConfig.Icon_Font_Primary,
                                ControlStylingConfig.Small_FontSize,
                                SpringboardStrings.TakeNotesNotificationLabel,
                                ControlStylingConfig.Font_Light,
                                ControlStylingConfig.Small_FontSize,
                                ControlStylingConfig.TextField_ActiveTextColor,
                                ControlStylingConfig.Springboard_Element_SelectedColor,
                delegate
                {
                    // find the Notes task, activate it, and tell it to jump to the read page.
                    foreach( SpringboardElement element in Elements )
                    {
                        if ( element.Task as Droid.Tasks.Notes.NotesTask != null )
                        {
                            ActivateElement( element );
                            PerformTaskAction( PrivateGeneralConfig.TaskAction_NotesRead );
                        }
                    }
                } );
            Billboard.Hide( );

            return view;
        }
 DropDownItem(string name, JavaString value)
 {
     this.Name = name;
     this.value = value;
 }
            protected override Filter.FilterResults PerformFiltering(Java.Lang.ICharSequence constraint)
            {
                FilterResults results = new FilterResults();
                if (!String.IsNullOrEmpty (constraint.ToString ())) {
                    var searchFor = constraint.ToString ();
                    Console.WriteLine ("searchFor:" + searchFor);
                    var matchList = new List<string> ();

                    var matches =
                        from i in _adapter.AllItems
                        where i.IndexOf (searchFor, StringComparison.InvariantCultureIgnoreCase) >= 0
                        select i;

                    foreach (var match in matches) {
                        matchList.Add (match);
                    }

                    _adapter.MatchItems = matchList.ToArray ();
                    Console.WriteLine ("resultCount:" + matchList.Count);

                    Java.Lang.Object[] matchObjects;
                    matchObjects = new Java.Lang.Object[matchList.Count];
                    for (int i = 0; i < matchList.Count; i++) {
                        matchObjects [i] = new Java.Lang.String (matchList [i]);
                    }

                    results.Values = matchObjects;
                    results.Count = matchList.Count;
                } else {
                    _adapter.ResetSearch ();
                }
                return results;
            }
Esempio n. 59
0
 private async Task<string> ReadAsyncRaw()
 {
     byte[] buffer = new byte[1024];
     var bytes = await reader.ReadAsync(buffer, 0, buffer.Length);
     var s1 = new Java.Lang.String(buffer, 0, bytes);
     var s = s1.ToString();
     System.Diagnostics.Debug.WriteLine(s);
     return s;
 }
 public androidMessageHandler(Activity activity, MessageHandler handler, string token)
 {
     this.activity = activity;
     this.handler = handler;
     this.token = new Java.Lang.String(token);
 }