Beispiel #1
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;
			}
		}
		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]);
			}
		} 
			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;
			}
Beispiel #4
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>();
		}
        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);
        }
        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
        }
Beispiel #7
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;
        }
        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;
        }
Beispiel #9
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 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);
 }
 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;
 }
Beispiel #15
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);
		}
Beispiel #16
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);
					}
			}
		}
        public int ReadMessageEventReceived(byte[] readBuf)
        {
            var message = new Java.Lang.String (readBuf);

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

            return 0;
        }
        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);
            }
        }
Beispiel #19
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( );
        }
 public androidMessageHandler(Activity activity, MessageHandler handler, string token)
 {
     this.activity = activity;
     this.handler = handler;
     this.token = new Java.Lang.String(token);
 }
Beispiel #21
0
 public RecordInfo(int avgTime, int gamesPlayed, Java.Lang.String difficulty)
 {
     this.avgTime = avgTime;
     this.gamesPlayed = gamesPlayed;
     this.difficulty = difficulty;
 }
Beispiel #22
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;
        }
            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;
            }
 DropDownItem(string name, JavaString value)
 {
     this.Name = name;
     this.value = value;
 }
Beispiel #25
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) });
		}
			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 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;
 }
Beispiel #28
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);
		}
Beispiel #29
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;
 }
 DropDownItem(string name, JavaString value, int flag)
 {
     this.Name = name;
     this.value = value;
     this.flag = flag;
 }