コード例 #1
0
        public int Compare(Object lhs, Object rhs)
        {
            var left = lhs as Size;
            var right = rhs as Size;

            return Long.Signum((long)left.Width * left.Height - (long)right.Width * right.Height);
        }
コード例 #2
0
    //object.image.getUrl()
    public string Evaluate(Object obj, string call) {
        if (!call.Contains(".")) { //"object"
            CarpaccioLogger.d(TAG, "call " + call + " on " + obj.GetType().Name);
            return obj.ToString();
        }
	    string function = call.Substring(call.IndexOf('.') + 1); //image.getUrl(); or //image
	    string callToGetObject;
	    if (function.Contains(".")) {
		    callToGetObject = function.Substring(0, function.IndexOf('.')); //image
	    } else {
		    callToGetObject = function; //image
	    }
	    string realCallToGetObject = GetFunctionName(callToGetObject);
	    Object newObject = CarpaccioHelper.callFunction(obj, realCallToGetObject);
	        
	    if (newObject != null) {
		    CarpaccioLogger.d(TAG, "call " + realCallToGetObject + " return =" + newObject.GetType().Name);

		    if (newObject is Java.Lang.String) {
			    return (string) newObject;
		    }
		    if (newObject is Java.Lang.Number) {
			    return String.ValueOf(newObject);
		    }
		    return Evaluate(newObject, function);
	    }
	    CarpaccioLogger.d(TAG, "call " + realCallToGetObject + " return = NULL");

	    return null;
    }
コード例 #3
0
    /**
     * Add an object to the mapper
     * When the object is added, call all the mappingWaitings (views which need this object)
     *
     * @param name   the mapped object name, ex : for function($user), the name will be "user"
     * @param object the mapped object
     */
    public void MapObject(string name, Object obj) {
        MappedObjects.AddOrUpdate(name, obj);

        CarpaccioLogger.d(TAG, "map object [" + name + "," + obj.GetType().Name + "]");

        //call the waiting objects
        List<MappingWaiting> waitingsForThisName = MappingWaitings.GetOrDefault(name);
        if (waitingsForThisName != null) {
            foreach (MappingWaiting mappingWaiting in waitingsForThisName) {

                CarpaccioLogger.d(TAG, "call waiting mapped " + mappingWaiting.CarpaccioAction.CompleteCall);

                string value = Evaluate(obj, mappingWaiting.Call);

                CarpaccioLogger.d(TAG, "call waiting value =  " + value);

                if (value != null && MappingManagerCallback != null) {
                    mappingWaiting.CarpaccioAction.Values = new[]{value}; //TODO

                    MappingManagerCallback.CallActionOnView(mappingWaiting.CarpaccioAction, mappingWaiting.View);
                }
            }

            //remove all waitings for this name
            waitingsForThisName.Clear();
            MappingWaitings.Remove(name);
        }
    }
コード例 #4
0
 public int Compare(Object lhs, Object rhs)
 {
     var lhsSize = (Size)lhs;
     var rhsSize = (Size)rhs;
     // We cast here to ensure the multiplications won't overflow
     return Long.Signum((long)lhsSize.Width * lhsSize.Height - (long)rhsSize.Width * rhsSize.Height);
 }
		public override void DestroyItem(ViewGroup container, int position, Object obj)
		{
			if (0 <= _pages.IndexOfKey(position))
			{
				_pages.Remove(position);
			}
			base.DestroyItem(container, position, obj);
		}
コード例 #6
0
 public void OnAuthComplete(LiveStatus status, LiveConnectSession session, Object userState)
 {
     try
     {
         source.SetResult(session);
     }
     catch (Exception ex)
     {
         source.TrySetException(ex);
     }
 }
コード例 #7
0
		async Task SearchWithStringAsync (ICharSequence constraint)
		{
			var searchString = constraint?.ToString ();

			if (searchString == null) {
				LocationResults = new List<WuAcLocation> ();
				ResultStrings = new List<SpannableString> ();
				return;
			}

			bool canceled = false;

			try {

				ResultStrings = new List<SpannableString> ();

				if (!string.IsNullOrWhiteSpace (searchString)) {

					LocationResults = await WuAcClient.GetAsync (searchString);

					Java.Lang.Object [] matchObjects = new Java.Lang.Object [LocationResults.Count];

					for (int i = 0; i < LocationResults.Count; i++) {

						var name = LocationResults [i].name;

						ResultStrings.Add (name.GetSearchResultSpannableString (searchString));

						matchObjects [i] = new Java.Lang.String (name);
					}

					filterResults.Values = matchObjects;
					filterResults.Count = LocationResults.Count;

				} else {

					LocationResults = new List<WuAcLocation> ();
				}

			} catch (System.Exception ex) {

				System.Diagnostics.Debug.WriteLine (ex.Message);

				canceled = true;

			} finally {

				if (!canceled) {
					publish = true;
					Activity.RunOnUiThread (() => PublishResults (constraint, filterResults));
				}
			}
		}
コード例 #8
0
ファイル: Behavior.cs プロジェクト: slown1/Xamarin.Tsnackbar
 public override bool OnInterceptTouchEvent(CoordinatorLayout parent, Object child, MotionEvent ev)
 {
     if (parent.IsPointInChildBounds(child as SnackbarLayout, (int) ev.GetX(), (int) ev.GetY()))
     {
         switch (ev.ActionMasked)
         {
             case MotionEventActions.Down:
                 SnackbarManager.Instance().CancelTimeout(TSnackbar.getInstace().mManagerCallback);
                 break;
             case MotionEventActions.Up:
             case MotionEventActions.Cancel:
                 SnackbarManager.Instance().RestoreTimeout(TSnackbar.getInstace().mManagerCallback);
                 break;
         }
     }
     return base.OnInterceptTouchEvent(parent, child, ev);
 }
        public override void DestroyItem(ViewGroup container, int position, Object objectValue)
        {
            var fragment = (Fragment)objectValue;

            if (_curTransaction == null)
                _curTransaction = _fragmentManager.BeginTransaction();

            #if DEBUG
            Mvx.Trace("Removing item #" + position + ": f=" + objectValue + " v=" + ((Fragment) objectValue).View +
                      " t=" + fragment.Tag);
            #endif

            while (_savedState.Count <= position)
            {
                _savedState.Add(null);
                _savedFragmentTags.Add(null);
            }

            _savedState[position] = _fragmentManager.SaveFragmentInstanceState(fragment);
            _savedFragmentTags[position] = fragment.Tag;
            _fragments[position] = null;

            _curTransaction.Remove(fragment);
        }
コード例 #10
0
ファイル: ImageAdapter.cs プロジェクト: HardGITer/MinskWay
 public override bool IsViewFromObject(View view, Java.Lang.Object @object)
 {
     return(view == ((ImageView)@object));
 }
コード例 #11
0
            public void OnSingleManifest(Object manifest)
            {
                if (_canceled)
                {
                    return;
                }

                _manifest = manifest.JavaCast<MediaPresentationDescription>();
                if (_manifest.Dynamic && _manifest.UtcTiming != null)
                {
                    UtcTimingElementResolver.ResolveTimingElement(_manifestDataSource, _manifest.UtcTiming,
                        _manifestFetcher.ManifestLoadCompleteTimestamp, this);
                }
                else
                {
                    BuildRenderers();
                }
            }
コード例 #12
0
 public override bool IsViewFromObject(View view, Java.Lang.Object objectValue)
 {
     return(objectValue == view);
 }
コード例 #13
0
 public override bool IsViewFromObject(View view, Java.Lang.Object obj)
 {
     return(view == obj);
 }
コード例 #14
0
        public override int GetItemPosition(Object objectValue)
        {
            if (objectValue is NextEpisodeFragment)
            {
                ((NextEpisodeFragment)objectValue).UpdateEpisode(_myShow.GetNextUnwatchedEpisode());
            }
            else if (objectValue is DetailsShowSeasonListFragment)
            {
                ((DetailsShowSeasonListFragment)objectValue).UpdateShow(_myShow);
            }

            return base.GetItemPosition(objectValue);
        }
コード例 #15
0
 /// <summary>
 /// Reads the contants of <see cref="JavaObjectWrapper{TObj}"/>
 /// </summary>
 /// <param name="obj">Wrapper to extract the data from.</param>
 /// <typeparam name="TObj">Object that is contained by the wrpper.</typeparam>
 public static TObj Unwrap <TObj>(this Java.Lang.Object obj)
     where TObj : class
 {
     return((obj as JavaObjectWrapper <TObj>)?.Instance);
 }
コード例 #16
0
 Object ITypeEvaluator.Evaluate(float fraction, Object startValue, Object endValue)
 {
     return Evaluate (fraction, (Rect) startValue, (Rect) endValue);
 }
コード例 #17
0
        public override void SetPrimaryItem(ViewGroup container, int position, Object objectValue)
        {
            var fragment = (Fragment)objectValue;
            if (fragment == _currentPrimaryItem)
                return;

            if (_currentPrimaryItem != null)
            {
                _currentPrimaryItem.SetMenuVisibility(false);
                _currentPrimaryItem.UserVisibleHint = false;
            }
            if (fragment != null)
            {
                fragment.SetMenuVisibility(true);
                fragment.UserVisibleHint = true;
            }
            _currentPrimaryItem = fragment;
        }
コード例 #18
0
 public override bool IsViewFromObject(View view, Object objectValue)
 {
     return ((Fragment)objectValue).View == view;
 }
コード例 #19
0
 public override int CompareTo(Object obj)
 {
     return CompareTo((IO.Fabric.Sdk.Android.Kit)obj);
 }
コード例 #20
0
        public static T Cast <T>(Java.Lang.Object obj) where T : class
        {
            var propertyInfo = obj.GetType().GetProperty("Instance");

            return(propertyInfo == null ? null : propertyInfo.GetValue(obj, null) as T);
        }
コード例 #21
0
        public override int GetItemPosition(Object objectValue)
        {
            if (objectValue is DetailsShowEpisodeTabsPageFragment)
            {
                objectValue = DetailsShowEpisodeTabsPageFragment.NewInstance(_season.Episodes[GetItemPosition(objectValue)]);
            }

            return base.GetItemPosition(objectValue);
        }
コード例 #22
0
 public Object GetItem(int position)
 {
     if (_adapter == null) return null;
     var items = new Object[_itemsPerRow];
     for (var i = 0; i < _itemsPerRow; ++i)
     {
         var p = position * _itemsPerRow + i;
         if (p < _adapter.Count)
         {
             items[i] = _adapter.GetItem(p);
         }
     }
     return items;
 }
コード例 #23
0
 public override bool IsViewFromObject(View view, Java.Lang.Object @object)
 {
     return(view == (LinearLayout)@object);
 }
コード例 #24
0
 public override bool IsViewFromObject(View view, Object @object)
 {
     var fragment = @object as Fragment;
     if (fragment != null)
         @object = fragment.View;
     return view == @object;
 }
コード例 #25
0
 public override void DestroyItem(ViewGroup container, int position, Object @object)
 {
     container.RemoveView((View)@object);
 }
コード例 #26
0
 public override void DestroyItem(ViewGroup container, int position, Object @object)
 {
     var dataContext = @object.DataContext();
     if (position != PositionNone)
         position = GetPosition(dataContext);
     bool removed = position == PositionNone;
     if (removed && dataContext != null)
         ServiceProvider.AttachedValueProvider.Clear(dataContext, ContentPath);
     var fragment = @object as Fragment;
     if (fragment == null)
     {
         var view = (View)@object;
         container.RemoveView(view);
         if (removed)
             view.ClearBindingsRecursively(true, true);
     }
     else
     {
         if (_currentTransaction == null)
             _currentTransaction = _fragmentManager.BeginTransaction();
         if (removed)
             _currentTransaction.Remove(fragment);
         else
             _currentTransaction.Detach(fragment);
     }
 }
コード例 #27
0
        public View OnCreateView(string name, Context context, IAttributeSet attrs)
        {
            if (name.Equals("com.android.internal.view.menu.ActionMenuItemView", StringComparison.InvariantCultureIgnoreCase))
            {
                View view = null;

                try
                {
                    if (ActionMenuItemViewClass == null)
                    {
                        ActionMenuItemViewClass = ClassLoader.SystemClassLoader.LoadClass(name);
                    }
                }
                catch (ClassNotFoundException)
                {
                    return(null);
                }

                if (ActionMenuItemViewClass == null)
                {
                    return(null);
                }

                if (ActionMenuItemViewConstructor == null)
                {
                    try
                    {
                        ActionMenuItemViewConstructor = ActionMenuItemViewClass.GetConstructor(new Class[] {
                            Class.FromType(typeof(Context)),
                            Class.FromType(typeof(IAttributeSet))
                        });
                    }
                    catch (SecurityException)
                    {
                        return(null);
                    }
                    catch (NoSuchMethodException)
                    {
                        return(null);
                    }
                }
                if (ActionMenuItemViewConstructor == null)
                {
                    return(null);
                }

                try
                {
                    Java.Lang.Object[] args = new Java.Lang.Object[] { context, (Java.Lang.Object)attrs };
                    view = (View)(ActionMenuItemViewConstructor.NewInstance(args));
                }
                catch (IllegalArgumentException)
                {
                    return(null);
                }
                catch (InstantiationException)
                {
                    return(null);
                }
                catch (IllegalAccessException)
                {
                    return(null);
                }
                catch (InvocationTargetException)
                {
                    return(null);
                }
                if (null == view)
                {
                    return(null);
                }

                View v = view;

                new Handler().Post(() => {
                    try
                    {
                        if (v is LinearLayout)
                        {
                            var ll = (LinearLayout)v;
                            for (int i = 0; i < ll.ChildCount; i++)
                            {
                                var button = ll.GetChildAt(i) as Button;

                                if (button != null)
                                {
                                    var title = button.Text;

                                    if (!string.IsNullOrEmpty(title) && title.Length == 1)
                                    {
                                        button.SetTypeface(Typeface, TypefaceStyle.Normal);
                                    }
                                }
                            }
                        }
                        else if (v is TextView)
                        {
                            var tv       = (TextView)v;
                            string title = tv.Text;

                            if (!string.IsNullOrEmpty(title) && title.Length == 1)
                            {
                                tv.SetTypeface(Typeface, TypefaceStyle.Normal);
                            }
                        }
                    }
                    catch (ClassCastException)
                    {
                    }
                });

                return(view);
            }

            return(null);
        }
コード例 #28
0
 public override void SetPrimaryItem(View container, int position, Object @object)
 {
     var fragment = @object as Fragment;
     if (fragment != _currentPrimaryItem)
     {
         if (_currentPrimaryItem.IsAlive())
         {
             _currentPrimaryItem.SetMenuVisibility(false);
             _currentPrimaryItem.UserVisibleHint = false;
         }
         if (fragment != null)
         {
             fragment.SetMenuVisibility(true);
             fragment.UserVisibleHint = true;
         }
     }
     _currentPrimaryItem = fragment;
 }
コード例 #29
0
ファイル: CustomTagHandler.cs プロジェクト: nomada2/TextStyle
        /// <summary>
        /// Start the tag
        /// </summary>
        /// <param name="text">SpannableStringBuilder</param>
        /// <param name="mark">Java.Lang.Object</param>
        static void Start(SpannableStringBuilder text, Java.Lang.Object mark)
        {
            var length = text.Length();

            text.SetSpan(mark, length, length, SpanTypes.MarkMark);
        }
コード例 #30
0
 public override int GetItemPosition(Object @object)
 {
     if (ItemsSource == null)
         return PositionNone;
     var dataContext = @object.DataContext();
     return GetPosition(dataContext);
 }
コード例 #31
0
            public void OnSingleManifest(Object obj)
            {
                var manifest = obj.JavaCast<SmoothStreamingManifest>();
                if (_canceled)
                {
                    return;
                }

                var mainHandler = _player.MainHandler;
                var loadControl = new DefaultLoadControl(new DefaultAllocator(BufferSegmentSize));
                var bandwidthMeter = new DefaultBandwidthMeter(mainHandler, _player);

                // Check drm support if necessary.
                IDrmSessionManager drmSessionManager = null;
                if (manifest.ProtectionElement != null)
                {
                    if (ExoPlayerUtil.SdkInt < 18)
                    {
                        _player.OnRenderersError(
                            new UnsupportedDrmException(UnsupportedDrmException.ReasonUnsupportedScheme));
                        return;
                    }
                    try
                    {
                        drmSessionManager = new StreamingDrmSessionManager(manifest.ProtectionElement.Uuid,
                            _player.PlaybackLooper, _drmCallback, null, _player.MainHandler, _player);
                    }
                    catch (Exception e)
                    {
                        _player.OnRenderersError(e);
                        return;
                    }
                }

                // Build the video renderer.
                var videoDataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
                var videoChunkSource = new SmoothStreamingChunkSource(_manifestFetcher
                    , DefaultSmoothStreamingTrackSelector.NewVideoInstance(_context, true, false)
                    , videoDataSource
                    , new FormatEvaluatorAdaptiveEvaluator(bandwidthMeter)
                    , LiveEdgeLatencyMs);
                var videoSampleSource = new ChunkSampleSource(videoChunkSource
                    , loadControl
                    , VideoBufferSegments*BufferSegmentSize
                    , mainHandler
                    , _player
                    , VideoPlayer.TypeVideo);
                var videoRenderer = new MediaCodecVideoTrackRenderer(_context
                    , videoSampleSource
                    , MediaCodecSelector.Default
                    , (int)VideoScalingMode.ScaleToFit
                    , 5000
                    , drmSessionManager
                    , true
                    , mainHandler
                    , _player
                    , 50);

                // Build the audio renderer.
                var audioDataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
                var audioChunkSource = new SmoothStreamingChunkSource(_manifestFetcher
                    , DefaultSmoothStreamingTrackSelector.NewAudioInstance()
                    , audioDataSource
                    , null
                    , LiveEdgeLatencyMs);
                var audioSampleSource = new ChunkSampleSource(audioChunkSource
                    , loadControl
                    , AudioBufferSegments*BufferSegmentSize
                    , mainHandler
                    , _player
                    , VideoPlayer.TypeAudio);
                var audioRenderer = new MediaCodecAudioTrackRenderer(audioSampleSource
                    , MediaCodecSelector.Default
                    , drmSessionManager
                    , true
                    , mainHandler
                    , _player
                    , AudioCapabilities.GetCapabilities(_context)
                    , (int) Stream.Music);

                // Build the text renderer.
                var textDataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
                var textChunkSource = new SmoothStreamingChunkSource(_manifestFetcher
                    , DefaultSmoothStreamingTrackSelector.NewTextInstance()
                    , textDataSource
                    , null
                    , LiveEdgeLatencyMs);
                var textSampleSource = new ChunkSampleSource(textChunkSource
                    , loadControl
                    , TextBufferSegments*BufferSegmentSize
                    , mainHandler
                    , _player
                    , VideoPlayer.TypeText);
                var textRenderer = new TextTrackRenderer(textSampleSource
                    , _player
                    , mainHandler.Looper);

                // Invoke the callback.
                var renderers = new TrackRenderer[VideoPlayer.RendererCount];
                renderers[VideoPlayer.TypeVideo] = videoRenderer;
                renderers[VideoPlayer.TypeAudio] = audioRenderer;
                renderers[VideoPlayer.TypeText] = textRenderer;
                _player.OnRenderers(renderers, bandwidthMeter);
            }
コード例 #32
0
ファイル: LoginActivity.cs プロジェクト: mnknedim/Training
 public void OnResult(Java.Lang.Object result)
 {
 }
コード例 #33
0
 public virtual byte[] ToBytes(Java.Lang.Object p1)
 {
     return(ToBytes((ScribeEvent)p1));
 }
コード例 #34
0
 public override bool IsViewFromObject(View view, Java.Lang.Object objectValue)
 {
     return(view == ((ImageView)objectValue));
 }
コード例 #35
0
ファイル: ImageAdapter.cs プロジェクト: HardGITer/MinskWay
 public override void DestroyItem(View container, int position, Java.Lang.Object @object)
 {
     ((ViewPager)container).RemoveView((ImageView)@object);
 }
コード例 #36
0
 public override bool IsViewFromObject(View view, Java.Lang.Object @object)
 {
     //throw new NotImplementedException();
     return(view == ((ImageView)@object));
 }
コード例 #37
0
 public void OnSuccess(Java.Lang.Object result)
 {
     Success?.Invoke(this, new EventArgs());
 }
 public int Compare(Java.Lang.Object lhs, Java.Lang.Object rhs)
 {
     return(Compare((Com.Zipow.Videobox.View.MM.MMCommentsEmojiCountItem)lhs, (Com.Zipow.Videobox.View.MM.MMCommentsEmojiCountItem)rhs));
 }
コード例 #39
0
 public void OnSuccess(Java.Lang.Object result)
 {
     Sucess?.Invoke(this, new TaskSuccessEventArgs {
         Result = result
     });
 }
コード例 #40
0
 protected override void OnPostExecute(Java.Lang.Object result)
 {
     Toast.MakeText(context, "Adf saved:" + result, ToastLength.Long).Show();
     base.OnPostExecute(result);
 }
コード例 #41
0
 public override int GetItemPosition(Object @object)
 {
     return(PositionNone);
 }
コード例 #42
0
 public virtual Object Evaluate(float fraction, Object startValue, Object endValue)
 {
     return Evaluate (fraction, startValue.JavaCast<Number> (), endValue.JavaCast<Number> ());
 }
コード例 #43
0
 public override void DestroyItem(ViewGroup container, int position, Java.Lang.Object @object)
 {
     container.RemoveView((LinearLayout)@object);
 }
コード例 #44
0
 public RequestBuilder GetPreloadRequestBuilder(Java.Lang.Object p0)
 {
     return(GlideImageLoader.GetPreLoadRequestBuilder(ActivityContext, p0.ToString(), ImageStyle.CenterCrop));
 }
コード例 #45
0
 public override bool IsViewFromObject(View view, Object @object)
 {
     return view.Equals(@object);
 }
コード例 #46
0
 public override void OnDismissed(Java.Lang.Object transientBottomBar, int @event)
 {
     base.OnDismissed(transientBottomBar, @event);
     currentActivity.loading = false;
     currentActivity.adapter.AddFooter();
 }
コード例 #47
0
 public override bool IsViewFromObject(View view, Object objectValue)
 {
     return(((Fragment)objectValue).View == view);
 }
        public View OnCreateView(View parent, string name, Context context, IAttributeSet attrs)
        {
            System.Diagnostics.Debug.WriteLine (name);

            if (name.Equals("android.support.v7.internal.view.menu.ActionMenuItemView", StringComparison.InvariantCultureIgnoreCase))
            {
                View view = null;

                try
                {
                    if (ActionMenuItemViewClass == null)
                        ActionMenuItemViewClass = ClassLoader.SystemClassLoader.LoadClass(name);
                }
                catch (ClassNotFoundException)
                {
                    return null;
                }

                if (ActionMenuItemViewClass == null)
                    return null;

                if (ActionMenuItemViewConstructor == null)
                {
                    try
                    {
                        ActionMenuItemViewConstructor = ActionMenuItemViewClass.GetConstructor(new Class[] {
                            Class.FromType(typeof(Context)),
                                 Class.FromType(typeof(IAttributeSet))
                        });
                    }
                    catch (SecurityException)
                    {
                        return null;
                    }
                    catch (NoSuchMethodException)
                    {
                        return null;
                    }
                }
                if (ActionMenuItemViewConstructor == null)
                    return null;

                try
                {
                    Java.Lang.Object[] args = new Java.Lang.Object[] { context, (Java.Lang.Object)attrs };
                    view = (View)(ActionMenuItemViewConstructor.NewInstance(args));
                }
                catch (IllegalArgumentException)
                {
                    return null;
                }
                catch (InstantiationException)
                {
                    return null;
                }
                catch (IllegalAccessException)
                {
                    return null;
                }
                catch (InvocationTargetException)
                {
                    return null;
                }
                if (null == view)
                    return null;

                View v = view;

                new Handler().Post(() => {

                    try
                    {
                        if(v is LinearLayout) {
                            var ll = (LinearLayout)v;
                            for(int i = 0; i < ll.ChildCount; i++) {
                                var button = ll.GetChildAt(i) as Button;

                                if(button != null) {
                                    var title = button.Text;

                                    if (!string.IsNullOrEmpty(title) && title.Length == 1)
                                    {
                                        button.SetTypeface(Typeface, TypefaceStyle.Normal);
                                    }
                                }
                            }
                        }
                        else if(v is TextView) {
                            var tv = (TextView)v;
                            string title = tv.Text;

                            if (!string.IsNullOrEmpty(title) && title.Length == 1)
                            {
                                tv.SetTypeface(Typeface, TypefaceStyle.Normal);
                            }
                        }
                    }
                    catch (ClassCastException)
                    {
                    }
                });

                return view;
            }

            return null;
        }
コード例 #49
0
            public void OnSearchResult(Java.Lang.Object results)
            {
                QueryAutocompleteResponse ResultWrapper = (QueryAutocompleteResponse)results;

                if (ResultWrapper == null)
                {
                    ResultTextView.Text = "Result is Empty!";
                    return;
                }

                System.Text.StringBuilder ResultText = new System.Text.StringBuilder();
                IList <Site> SiteList;
                IList <AutoCompletePrediction> predictions;

                predictions = ResultWrapper.Predictions;
                if (predictions != null && predictions.Count > 0)
                {
                    ResultText.Append("AutoCompletePrediction[ ]:\n");
                    int PredictionCount = 1;
                    foreach (AutoCompletePrediction mPrediction in predictions)
                    {
                        ResultText.Append(string.Format("[{0}] Prediction, description = {1} ,", "" + (PredictionCount++), mPrediction.Description));

                        Word[] matchedKeywords = mPrediction.GetMatchedKeywords();
                        foreach (Word matchedKeyword in matchedKeywords)
                        {
                            ResultText.Append("matchedKeywords: " + matchedKeyword.ToString());
                        }

                        Word[] matchedWords = mPrediction.GetMatchedWords();
                        foreach (Word matchedWord in matchedWords)
                        {
                            ResultText.Append(",matchedWords: " + matchedWord.ToString());
                        }

                        ResultText.Append("\n");
                    }
                }
                else
                {
                    ResultText.Append("Predictions 0 results");
                }

                ResultText.Append("\n\nSite[ ]:\n");
                SiteList = ResultWrapper.Sites;
                if (SiteList != null && SiteList.Count > 0)
                {
                    int              SiteCount = 1;
                    AddressDetail    addressDetail;
                    Coordinate       location;
                    Poi              poi;
                    CoordinateBounds viewport;
                    foreach (Site site in SiteList)
                    {
                        addressDetail = site.Address;
                        location      = site.Location;
                        poi           = site.Poi;
                        viewport      = site.Viewport;
                        string item = "[{0}] siteId: '{1}', name: {2}, formatAddress: {3}, utcOffset: {4}, country: {5}, countryCode: {6}, location: {7}, distance: {8}, poiTypes: {9}, viewport: {10}, streetNumber: {11}, postalCode: {12} , tertiaryAdminArea: {13}, ";
                        ResultText.Append(string.Format(item,
                                                        (SiteCount++).ToString(), site.SiteId, site.Name, site.FormatAddress, site.UtcOffset,
                                                        (addressDetail == null ? "" : addressDetail.Country),
                                                        (addressDetail == null ? "" : addressDetail.CountryCode),
                                                        (location == null ? "" : (location.Lat + "," + location.Lng)), site.Distance,
                                                        (poi == null ? "" : string.Join(",", poi.PoiTypes.ToArray())),
                                                        (viewport == null ? "" : "northeast{lat=" + viewport.Northeast.Lat + ", lng=" + viewport.Northeast.Lng + "},"
                                                         + "southwest{lat=" + viewport.Southwest.Lat + ", lng=" + viewport.Southwest.Lng + "}"),
                                                        (addressDetail == null ? "" : addressDetail.StreetNumber),
                                                        (addressDetail == null ? "" : addressDetail.PostalCode),
                                                        (addressDetail == null ? "" : addressDetail.TertiaryAdminArea)));
                        if ((poi != null))
                        {
                            Gson   gson       = new Gson();
                            string jsonString = gson.ToJson(poi.GetChildrenNodes());
                            ResultText.Append(string.Format("childrenNode: {0} \n\n", jsonString));
                        }
                    }
                }
                else
                {
                    ResultText.Append("sites 0 results\n");
                }
                ResultTextView.Text = ResultText.ToString();
                Log.Debug(QueryAutoCompleteActivity.TAG, "OnAutoCompleteResult: " + ResultText.ToString());
            }
コード例 #50
0
 public void OnReceiveValue(Java.Lang.Object value)
 {
     _act(value);
 }
		public View OnCreateView(string name, Context context, IAttributeSet attrs)
		{
			if (name.Equals("com.android.internal.view.menu.ActionMenuItemView", StringComparison.InvariantCultureIgnoreCase))
			{
				View view = null;

				try
				{
					if (ActionMenuItemViewClass == null)
						ActionMenuItemViewClass = ClassLoader.SystemClassLoader.LoadClass(name);
				}
				catch (ClassNotFoundException)
				{
					return null;
				}

				if (ActionMenuItemViewClass == null)
					return null;

				if (ActionMenuItemViewConstructor == null)
				{
					try
					{
						ActionMenuItemViewConstructor = ActionMenuItemViewClass.GetConstructor(new Class[] {
							Class.FromType(typeof(Context)),
							Class.FromType(typeof(IAttributeSet))
						});
					}
					catch (SecurityException)
					{
						return null;
					}
					catch (NoSuchMethodException)
					{
						return null;
					}
				}
				if (ActionMenuItemViewConstructor == null)
					return null;

				try
				{
					Java.Lang.Object[] args = new Java.Lang.Object[] { context, (Java.Lang.Object)attrs };
					view = (View)(ActionMenuItemViewConstructor.NewInstance(args));
				}
				catch (IllegalArgumentException)
				{
					return null;
				}
				catch (InstantiationException)
				{
					return null;
				}
				catch (IllegalAccessException)
				{
					return null;
				}
				catch (InvocationTargetException)
				{
					return null;
				}
				if (null == view)
					return null;

				View v = view;

				new Handler().Post(() => {

					try
					{
						var tv = (TextView)v;

						string title = tv.Text;

						if (!string.IsNullOrEmpty(title) && title.Length == 1)
						{
							tv.SetTypeface(Typeface, TypefaceStyle.Normal);
						}
					}
					catch (ClassCastException)
					{
					}
				});

				return view;
			}

			return null;
		}
コード例 #52
0
            public void OnSingleManifest(Object obj)
            {
                var manifest = obj.JavaCast<HlsPlaylist>();
                if (_canceled)
                {
                    return;
                }

                var mainHandler = _player.MainHandler;
                var loadControl = new DefaultLoadControl(new DefaultAllocator(BufferSegmentSize));
                var bandwidthMeter = new DefaultBandwidthMeter();
                var timestampAdjusterProvider = new PtsTimestampAdjusterProvider();

                var dataSource = new DefaultUriDataSource(_context, bandwidthMeter, _userAgent);
                var chunkSource = new HlsChunkSource(true
                    , dataSource
                    , _url
                    , manifest
                    , DefaultHlsTrackSelector.NewDefaultInstance(_context)
                    , bandwidthMeter
                    , timestampAdjusterProvider
                    , HlsChunkSource.AdaptiveModeSplice);
                var sampleSource = new HlsSampleSource(chunkSource
                    , loadControl
                    , BufferSegments*BufferSegmentSize
                    , mainHandler
                    , _player
                    , VideoPlayer.TypeVideo);
                var videoRenderer = new MediaCodecVideoTrackRenderer(_context
                    , sampleSource
                    , MediaCodecSelector.Default
                    , (int) VideoScalingMode.ScaleToFit
                    , 5000
                    , mainHandler
                    , _player
                    , 50);
                var audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource
                    , MediaCodecSelector.Default
                    , null
                    , true
                    , _player.MainHandler
                    , _player
                    , AudioCapabilities.GetCapabilities(_context)
                    , (int) Stream.Music);
                // TODO: The Id3Parser is currently not part of the binding
                //MetadataTrackRenderer id3Renderer = new MetadataTrackRenderer(sampleSource, new Id3Parser(), player, mainHandler.getLooper());
                var closedCaptionRenderer = new Eia608TrackRenderer(sampleSource, _player,
                    mainHandler.Looper);

                var renderers = new TrackRenderer[VideoPlayer.RendererCount];
                renderers[VideoPlayer.TypeVideo] = videoRenderer;
                renderers[VideoPlayer.TypeAudio] = audioRenderer;
                //renderers[DemoPlayer.TYPE_METADATA] = id3Renderer;
                renderers[VideoPlayer.TypeText] = closedCaptionRenderer;
                _player.OnRenderers(renderers, bandwidthMeter);
            }
コード例 #53
0
        public override void DestroyItem(ViewGroup container, int position, Java.Lang.Object view)
        {
            var viewPager = container.JavaCast <ViewPager>();

            viewPager.RemoveView(view as View);
        }
コード例 #54
0
 protected override void OnBindRowViewHolder(RowPresenter.ViewHolder vh, Object item)
 {
     base.OnBindRowViewHolder(vh, item);
 }
コード例 #55
0
ファイル: CustomTagHandler.cs プロジェクト: nomada2/TextStyle
        /// <summary>
        /// End the specified tag
        /// </summary>
        /// <param name="style">TextStyleParameters</param>
        /// <param name="text">SpannableStringBuilder</param>
        /// <param name="kind">Class</param>
        /// <param name="newSpan">Java.Lang.Object</param>
        static void End(TextStyleParameters style, SpannableStringBuilder text, Class kind, Java.Lang.Object newSpan)
        {
            var length = text.Length();
            var span   = GetLast(text, kind);
            var start  = text.GetSpanStart(span);

            text.RemoveSpan(span);

            // Parse the text in the span
            var parsedString = TextStyle.ParseString(style, text.SubSequence(start, length));               // Note this hardcodes the text this way and only works on parsed tags!

            text.Replace(start, length, parsedString);

            if (start != length)
            {
                text.SetSpan(newSpan, start, length, SpanTypes.InclusiveExclusive);
            }
        }
コード例 #56
0
 public void OnTimelineChanged(Timeline timeline, Object manifest)
 {
     Console.WriteLine("OnTimelineChanged");
 }
コード例 #57
0
ファイル: VideoPlayer.cs プロジェクト: mayuki/AgqrPlayer4Tv
 public void OnMetadata(Object metadata)
 {
     if (_id3MetadataListener != null && GetSelectedTrack(TypeMetadata) != TrackDisabled)
     {
         _id3MetadataListener.OnId3Metadata(metadata);
     }
 }
コード例 #58
0
 public override void DestroyItem(View container, int position, Java.Lang.Object @object)
 {
     container.JavaCast <ViewPager>().RemoveView(_views[position]);
 }
コード例 #59
0
 public override int GetItemPosition(Java.Lang.Object @object)
 {
     Log.Info(tag, "call GetItemPosition");
     return(PagerAdapter.PositionNone);
 }
コード例 #60
0
    /**
     * Called when a view loaded and call a mapping function
     *
     * @param view         the calling view
     * @param mappedObject If available, the object to map with the view. Else add the view to mappingWaitings
     */
    public void CallMappingOnView(CarpaccioAction action, View view, Object mappedObject) {

        if (action.IsCallMapping) {

            CarpaccioLogger.d(TAG, "callMappingOnView mapping=" + mappedObject + " action=" + action.CompleteCall + " view=" + view.GetType().Name);

            string arg = action.Args[0]; //only map the first argument

            string objectName;

            string call;
            if (arg.Contains(".")) { //"$user.getName()"
                call = arg.Substring(1, arg.Length - 1); // "user.getName()"
                objectName = call.Substring(0, arg.IndexOf('.') - 1); // "user"
            } else {
                objectName = arg.Substring(1, arg.Length - 1); // "user"
                call = objectName; // "user"
            }

            //if you already have the object
            if (mappedObject != null) {
                string value = Evaluate(mappedObject, call);

                CarpaccioLogger.d(TAG, "callMappingOnView evaluate(" + call + ")" + " on " + mappedObject.GetType().Name + " returned " + value);

                action.Values = new[]{value}; //TODO

                MappingManagerCallback.CallActionOnView(action, view);
            } else {
                //add to waiting
                List<MappingWaiting> waitings = MappingWaitings.GetOrDefault(objectName) ?? new List<MappingWaiting>(); //["user"] = List<MappingWaiting>
	            waitings.Add(new MappingWaiting(view, action, call, objectName));

                CarpaccioLogger.d(TAG, "added to waiting " + call + " for " + view.GetType().Name);

                MappingWaitings.AddOrUpdate(objectName, waitings);
            }
        }
    }