コード例 #1
0
        private void handleSmoothScrolling(int velocityX)
        {
            int  distanceScrolled = (int)(accumulatedScrollOffset.X - (width * monthsScrolledSoFar));
            bool isEnoughTimeElapsedSinceLastSmoothScroll = JavaSystem.CurrentTimeMillis() - lastAutoScrollFromFling > LAST_FLING_THRESHOLD_MILLIS;

            if (velocityX > densityAdjustedSnapVelocity && isEnoughTimeElapsedSinceLastSmoothScroll)
            {
                scrollPreviousMonth();
            }
            else if (velocityX < -densityAdjustedSnapVelocity && isEnoughTimeElapsedSinceLastSmoothScroll)
            {
                scrollNextMonth();
            }
            else if (isScrolling && distanceScrolled > distanceThresholdForAutoScroll)
            {
                scrollPreviousMonth();
            }
            else if (isScrolling && distanceScrolled < -distanceThresholdForAutoScroll)
            {
                scrollNextMonth();
            }
            else
            {
                isSmoothScrolling = false;
                snapBackScroller();
            }
        }
コード例 #2
0
        public override void OnReceive(Context context, Intent intent)
        {
            var message = intent.GetStringExtra("message");
            var title   = intent.GetStringExtra("title");

            var notIntent     = new Intent(context, typeof(MainActivity));
            var contentIntent = PendingIntent.GetActivity(context, 0, notIntent, PendingIntentFlags.CancelCurrent);
            var manager       = NotificationManagerCompat.From(context);

            var style = new NotificationCompat.BigTextStyle();

            style.BigText(message);

            //Generate a notification with just short text and small icon
            var builder = new NotificationCompat.Builder(context)
                          .SetContentIntent(contentIntent)
                          .SetSmallIcon(Resource.Drawable.logo)
                          .SetContentTitle(title)
                          .SetContentText(message)
                          .SetStyle(style)
                          .SetWhen(JavaSystem.CurrentTimeMillis())
                          .SetPriority((int)NotificationPriority.High)
                          .SetDefaults((int)NotificationDefaults.All)
                          .SetAutoCancel(true);

            var notification = builder.Build();

            manager.Notify(0, notification);
        }
コード例 #3
0
        public void ScheduleNotification(int goalId, string title, string message, DateTime notificationTime)
        {
            if (!channelInitialized)
            {
                CreateNotificationChannel();
            }

            long repeatEveryDay    = 1000 * 60 * 60 * 24;
            long totalMilliSeconds = (long)(notificationTime.ToUniversalTime() - _jan1st1970).TotalMilliseconds;

            if (totalMilliSeconds < JavaSystem.CurrentTimeMillis())
            {
                totalMilliSeconds = totalMilliSeconds + repeatEveryDay;
            }

            var intent = CreateIntent(goalId);

            intent.PutExtra(Constants.NotificationTitleKey, title);
            intent.PutExtra(Constants.NotificationBodyKey, message);
            intent.PutExtra(Constants.NotificationIdKey, goalId);


            var pendingIntent = PendingIntent.GetBroadcast(Application.Context, goalId, intent, PendingIntentFlags.Immutable);
            var alarmManager  = GetAlarmManager();

            alarmManager.SetRepeating(AlarmType.RtcWakeup, totalMilliSeconds, repeatEveryDay, pendingIntent);
        }
コード例 #4
0
        protected override BaseDialogFragment.Builder Build(BaseDialogFragment.Builder builder)
        {
            string title = Title;

            if (!TextUtils.IsEmpty(title))
            {
                builder.SetTitle(title);
            }

            string positiveButtonText = PositiveButtonText;

            if (!TextUtils.IsEmpty(positiveButtonText))
            {
                builder.SetPositiveButton(positiveButtonText, new PositiveButtonClickListener(this));
            }

            string negativeButtonText = NegativeButtonText;

            if (!TextUtils.IsEmpty(negativeButtonText))
            {
                builder.SetNegativeButton(negativeButtonText, new NegativeButtonClickListener(this));
            }
            mDatePicker = (DatePicker)LayoutInflater.From(Activity).Inflate(Resource.Layout.sdl_datepicker, null);
            builder.SetView(mDatePicker);

            Java.Util.TimeZone zone = Java.Util.TimeZone.GetTimeZone(Arguments.GetString(ARG_ZONE));
            mCalendar = Calendar.GetInstance(zone);
            mCalendar.TimeInMillis = Arguments.GetLong(ARG_DATE, JavaSystem.CurrentTimeMillis());
            mDatePicker.UpdateDate(mCalendar.Get(CalendarField.Year), mCalendar.Get(CalendarField.Month), mCalendar.Get(CalendarField.Date));

            return(builder);
        }
コード例 #5
0
        protected async void loadFromFile(string mFilename)
        {
            mFile = new File(mFilename);
            mLoadingLastUpdateTime = JavaSystem.CurrentTimeMillis();
            mProgressDialog        = new ProgressDialog(Context);
            mProgressDialog.SetProgressStyle(ProgressDialogStyle.Horizontal);
            mProgressDialog.SetTitle("progress_dialog_loading");
            mProgressDialog.SetCancelable(true);

            mProgressDialog.Show();

            await Task.Run(() =>
            {
                _cheapSoundFile = CheapSoundFile.Create(App.SelectedFilePath, new ProgressListener()
                {
                    ReportProgressCallback = fractionComplete =>
                    {
                        long now = JavaSystem.CurrentTimeMillis();
                        if (now - mLoadingLastUpdateTime > 100)
                        {
                            mProgressDialog.Progress =
                                (int)(mProgressDialog.Max * fractionComplete);
                            mLoadingLastUpdateTime = now;
                        }
                    }
                });

                new Handler(Looper.MainLooper).Post(() => { finishOpeningSoundFile(); });
            });
        }
コード例 #6
0
        /**
         * Returns the {@link NotificationCompat} used as part of the foreground service.
         */
        Notification GetNotification()
        {
            Intent intent = new Intent(this, typeof(LocationUpdatesService));

            var text = Utils.GetLocationText(Location);

            // Extra to help us figure out if we arrived in onStartCommand via the notification or not.
            intent.PutExtra(ExtraStartedFromNotification, true);

            // The PendingIntent that leads to a call to onStartCommand() in this service.
            var servicePendingIntent = PendingIntent.GetService(this, 0, intent, PendingIntentFlags.UpdateCurrent);

            // The PendingIntent to launch activity.
            var activityPendingIntent = PendingIntent.GetActivity(this, 0, new Intent(this, typeof(MainActivity)), 0);

            NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
                                                 .AddAction(Resource.Drawable.ic_launch, GetString(Resource.String.launch_activity),
                                                            activityPendingIntent)
                                                 .AddAction(Resource.Drawable.ic_cancel, GetString(Resource.String.remove_location_updates),
                                                            servicePendingIntent)
                                                 .SetContentText(text)
                                                 .SetContentTitle(Utils.GetLocationTitle(this))
                                                 .SetOngoing(true)
                                                 .SetPriority((int)NotificationPriority.High)
                                                 .SetSmallIcon(Resource.Mipmap.ic_launcher)
                                                 .SetTicker(text)
                                                 .SetWhen(JavaSystem.CurrentTimeMillis());

            if (Build.VERSION.SdkInt >= Build.VERSION_CODES.O)
            {
                builder.SetChannelId(ChannelId);
            }

            return(builder.Build());
        }
コード例 #7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            mKeyboard   = new Keyboard(this, Resource.Xml.keyboard2);
            mTargetView = (EditText)FindViewById(Resource.Id.target);

            mKeyboardView          = (CustomKeyboardView)FindViewById(Resource.Id.keyboard_view);
            mKeyboardView.Keyboard = mKeyboard;

            mTargetView.Touch += (sender, e) => {
                Log.Info("onTouch", "true");
                ShowKeyboardWithAnimation();
                e.Handled = true;
            };

            mKeyboardView.Key += (sender, e) => {
                long     eventTime = JavaSystem.CurrentTimeMillis();
                KeyEvent ev        = new KeyEvent(eventTime, eventTime, KeyEventActions.Down, e.PrimaryCode, 0, 0, 0, 0, KeyEventFlags.SoftKeyboard | KeyEventFlags.KeepTouchMode);

                this.DispatchKeyEvent(ev);
            };
        }
コード例 #8
0
 private void TouchDown(MotionEvent @event)
 {
     downTime = JavaSystem.CurrentTimeMillis();
     downX    = preX = @event.RawX;
     downY    = preY = @event.RawY;
     Gesture  = GESTURE_PRESSED;
 }
コード例 #9
0
        private void TouchMove(MotionEvent @event)
        {
            float rangeX = @event.RawX - downX;
            float rangeY = @event.RawY - downY;

            if (Gesture == GESTURE_NONE || Gesture == GESTURE_PRESSED)
            {
                if (Math.Abs(rangeX) > pointSize || Math.Abs(rangeY) > pointSize)
                {
                    float ox = @event.RawX - preX;
                    float oy = @event.RawY - preY;
                    if (Math.Abs(ox) > xyScale * Math.Abs(oy))
                    {
                        Gesture = ox < 0 ? GESTURE_LEFT : GESTURE_RIGHT;
                    }
                    else
                    {
                        Gesture = oy < 0 ? GESTURE_UP : GESTURE_DOWN;
                    }
                }
                else
                {
                    Gesture = GESTURE_PRESSED;
                }
            }
            if (Gesture == GESTURE_PRESSED)
            {
                if (JavaSystem.CurrentTimeMillis() - downTime >= longClickTime)
                {
                    Gesture = GESTURE_LONG_CLICK;
                }
            }
            preX = @event.RawX;
            preY = @event.RawY;
        }
コード例 #10
0
 /**
  * Resumes the Ken Burns Effect animation.
  */
 public void Resume()
 {
     _mPaused = false;
     // This will make the animation to continue from where it stopped.
     _mLastFrameTime = JavaSystem.CurrentTimeMillis();
     Invalidate();
 }
コード例 #11
0
        //public void Cancel(int id)
        //{
        //    var notificationManager = NotificationManagerCompat.From(_context);
        //    notificationManager.CancelAll();
        //    notificationManager.Cancel(id);
        //}
        public void LocalNotification(string title, string body, DateTime time)
        {
            try
            {
                //long repeateDay = 1000 * 60 * 60 * 24;
                long repeateForMinute  = 60000; // In milliseconds
                long totalMilliSeconds = (long)(time.ToUniversalTime() - _jan1st1970).TotalMilliseconds;
                if (totalMilliSeconds < JavaSystem.CurrentTimeMillis())
                {
                    totalMilliSeconds = totalMilliSeconds + repeateForMinute;
                }
                var intent = new Intent(_context, typeof(MainActivity));
                intent.AddFlags(ActivityFlags.ClearTop);
                intent.PutExtra(title, body);
                var pendingIntent = PendingIntent.GetActivity(_context, 0, intent, PendingIntentFlags.OneShot);

                // Creating an Audio Attribute
                var alarmAttributes = new AudioAttributes.Builder()
                                      .SetContentType(AudioContentType.Sonification)
                                      .SetUsage(AudioUsageKind.Notification).Build();

                _builder = new NotificationCompat.Builder(_context);
                _builder.SetSmallIcon(Resource.Drawable.app_logo);
                _builder.SetContentTitle(title)
                .SetAutoCancel(true)
                .SetContentTitle(title)
                .SetContentText(body)
                .SetChannelId(NOTIFICATION_CHANNEL_ID)
                .SetPriority((int)NotificationPriority.High)
                .SetVibrate(new long[0])
                .SetDefaults((int)NotificationDefaults.Sound | (int)NotificationDefaults.Vibrate)
                .SetVisibility((int)NotificationVisibility.Public)
                .SetSmallIcon(Resource.Drawable.theWitcher);

                NotificationManager notificationManager = _context.GetSystemService(Context.NotificationService) as NotificationManager;

                if (global::Android.OS.Build.VERSION.SdkInt >= global::Android.OS.BuildVersionCodes.O)
                {
                    NotificationImportance importance = global::Android.App.NotificationImportance.High;

                    NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, title, importance);
                    notificationChannel.EnableLights(true);
                    notificationChannel.EnableVibration(true);
                    notificationChannel.SetShowBadge(true);
                    notificationChannel.Importance = NotificationImportance.High;
                    notificationChannel.SetVibrationPattern(new long[] { 100, 200, 300, 400, 500, 400, 300, 200, 400 });

                    if (notificationManager != null)
                    {
                        _builder.SetChannelId(NOTIFICATION_CHANNEL_ID);
                        notificationManager.CreateNotificationChannel(notificationChannel);
                    }
                }

                notificationManager.Notify(0, _builder.Build());
            }
            catch (Java.Lang.Exception ex)
            {
            }
        }
コード例 #12
0
        private void SetRepeatingAlarm(ICollection <string> numbers, bool isTest)
        {
            Intent       receiverIntent = new Intent(this, typeof(AlarmReceiver));
            AlarmManager alarmManager   = (AlarmManager)GetSystemService(AlarmService);

            if (isTest)
            {
                PendingIntent pendingIntent = PendingIntent.GetBroadcast(this, 0, receiverIntent, PendingIntentFlags.CancelCurrent);

                int seconds = 5;
                alarmManager.Set(AlarmType.RtcWakeup, JavaSystem.CurrentTimeMillis() + (seconds * 1000), pendingIntent);
                myTextViewOutput.Text = $"Test Alarm set in {seconds} seconds.";
            }
            else
            {
                PendingIntent pendingIntent = PendingIntent.GetBroadcast(this, 1, receiverIntent, PendingIntentFlags.CancelCurrent);

                Java.Util.Calendar calendar = Java.Util.Calendar.Instance;
                calendar.TimeInMillis = (JavaSystem.CurrentTimeMillis());
                calendar.Set(Java.Util.CalendarField.HourOfDay, 9);
                calendar.Set(Java.Util.CalendarField.Minute, 0);
                calendar.Set(Java.Util.CalendarField.Second, 0);

                alarmManager.SetRepeating(AlarmType.RtcWakeup, calendar.TimeInMillis, AlarmManager.IntervalDay, pendingIntent);
                myTextViewOutput.Text = "Repeating daily Alarm set. Begin at: " + calendar.Time.ToString();
            }
        }
コード例 #13
0
ファイル: DateTimeExtensions.cs プロジェクト: soniiic/Mealo
        internal static long ToElapsedRealtime(this DateTime value)
        {
            var utcValue = value.ToUniversalTime();
            var diff     = JavaSystem.CurrentTimeMillis() - SystemClock.ElapsedRealtime();

            return(Convert.ToInt64((utcValue - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).Add(TimeSpan.FromMilliseconds(-diff)).TotalMilliseconds) + 1000);
        }
        public void LocalNotification(string title, string message, Guid alarmId)
        {
            long repeateForMinute  = 60000; // In milliseconds
            long totalMilliSeconds = (long)(DateTime.Now.ToUniversalTime() - date).TotalMilliseconds;

            if (totalMilliSeconds < JavaSystem.CurrentTimeMillis())
            {
                totalMilliSeconds = totalMilliSeconds + repeateForMinute;
            }
            var intent       = CreateIntent(0);
            var notification = new LocalNotificationModel
            {
                Title = title,
                Body  = message,
                Id    = 0
            };

            var serializedNotification = SerializeNotification(notification);

            intent.PutExtra(ScheduledAlarmHandler.Key, serializedNotification);

            var pendingIntent = PendingIntent.GetBroadcast(Android.App.Application.Context, NotificationId, intent,
                                                           PendingIntentFlags.Immutable);

            var alarmManager = GetAlarmManager();

            alarmManager.SetRepeating(AlarmType.RtcWakeup, totalMilliSeconds, AlarmManager.IntervalDay, pendingIntent);
        }
コード例 #15
0
 public static string ToRelativeString(this DateTimeOffset dateTimeOffset, TimeSpan minimumResolution)
 {
     return(DateUtils.GetRelativeTimeSpanString(
                dateTimeOffset.ToUnixEpochMilliseconds(),
                JavaSystem.CurrentTimeMillis(),
                (long)minimumResolution.TotalMilliseconds
                ));
 }
コード例 #16
0
 private void scrollPreviousMonth()
 {
     lastAutoScrollFromFling = JavaSystem.CurrentTimeMillis();
     monthsScrolledSoFar     = monthsScrolledSoFar + 1;
     performScroll();
     isSmoothScrolling = true;
     performMonthScrollCallback();
 }
コード例 #17
0
 public Conversation(int conversationId, string participantName,
                     List <string> messages)
 {
     this.conversationId  = conversationId;
     this.participantName = participantName;
     this.messages        = messages ?? new List <string> ();
     this.timestamp       = JavaSystem.CurrentTimeMillis();
 }
コード例 #18
0
        public static void LogMessage(Context context, string message)
        {
            ISharedPreferences prefs = GetPrefs(context);

            message = DATE_FORMAT.Format(new Date(JavaSystem.CurrentTimeMillis())) + ": " + message;
            prefs.Edit()
            .PutString(LOG_KEY, prefs.GetString(LOG_KEY, "") + LINE_BREAKS + message)
            .Apply();
        }
コード例 #19
0
        private void WaitDiscoveryComplete()
        {
            Int64 nStartMillis = JavaSystem.CurrentTimeMillis(), nDeltaMillis = 0;

            while (!m_BTReceiver.IsDicoveryComplete() && (nDeltaMillis < 5000))
            {
                nDeltaMillis = JavaSystem.CurrentTimeMillis() - nStartMillis;
            }
        }
コード例 #20
0
        private bool CheckForBTEnable()
        {
            Int64 nStartMillis = JavaSystem.CurrentTimeMillis(), nDeltaMillis = 0;

            while (!m_BluetoothAdapter.IsEnabled && (nDeltaMillis < 2000))
            {
                nDeltaMillis = JavaSystem.CurrentTimeMillis() - nStartMillis;
            }
            return(m_BluetoothAdapter.IsEnabled);
        }
コード例 #21
0
 public void Start()
 {
                 #if ANDROID
     millisecond = JavaSystem.CurrentTimeMillis();
                 #elif NaCl || SILVERLIGHT
     millisecond = DateTime.Now.Millisecond;
                 #else
     stopWatch.Start();
                 #endif
 }
コード例 #22
0
        public void ToJavaTime()
        {
            // covert java current time to a local date time
            long           currentTimeMillis = JavaSystem.CurrentTimeMillis();
            DateTimeOffset currentTime       = DateTimeOffset.FromUnixTimeMilliseconds(currentTimeMillis);
            DateTime       currentLocalTime  = currentTime.LocalDateTime;

            // ensure that our conversion of local date times equals the
            Assert.AreEqual(currentTimeMillis, currentLocalTime.ToJavaCurrentTimeMillis());
        }
コード例 #23
0
        public static File createWifiTempFile()
        {
            string src  = Constant.PATH_DATA + "/" + JavaSystem.CurrentTimeMillis();
            File   file = new File(src);

            if (!file.Exists())
            {
                createFile(file);
            }
            return(file);
        }
コード例 #24
0
 /**
  * Generates and starts a transition.
  */
 private void StartNewTransition()
 {
     if (!HasBounds())
     {
         return;                 // Can't start transition if the drawable has no bounds.
     }
     _mCurrentTrans  = _mTransGen.GenerateNextTransition(_mDrawableRect, _mViewportRect);
     _mElapsedTime   = 0;
     _mLastFrameTime = JavaSystem.CurrentTimeMillis();
     FireTransitionStart(_mCurrentTrans);
 }
コード例 #25
0
ファイル: MainActivity.cs プロジェクト: wrk-fmd/CoCeMoCl
        private void RequestAlarmForCleanup()
        {
            var pendingIntent = CreatePendingIntentForCleanup();
            var alarmManager  = GetAlarmManager();

            // Previous alarm has to be canceled explicitly, because cancel_current option did not work out.
            alarmManager.Cancel(pendingIntent);
            alarmManager.Set(
                AlarmType.RtcWakeup,
                JavaSystem.CurrentTimeMillis() + CleanupTimeoutInMilliseconds,
                pendingIntent);
        }
コード例 #26
0
        public static void ScheduleWatchdog()
        {
            //AlarmManager.SetExactAndAllowWhileIdle(
            //    AlarmType.ElapsedRealtimeWakeup,
            //    SystemClock.ElapsedRealtime() + Convert.ToInt64(WatchDogServiceInterval.TotalMilliseconds),
            //    MakeAlarmIntent(PendingIntentFlags.UpdateCurrent));

            var pendingIntent = MakeAlarmIntent(PendingIntentFlags.UpdateCurrent);
            var milliseconds  = JavaSystem.CurrentTimeMillis() + Convert.ToInt64(WatchDogServiceInterval.TotalMilliseconds);

            AlarmManager.SetAlarmClock(new AlarmManager.AlarmClockInfo(milliseconds, null), pendingIntent);
        }
コード例 #27
0
 private void ScheduleAtFixedRate()
 {
     started   = JavaSystem.CurrentTimeMillis() - diff;
     timerTask = new MyTimerTask(() =>
     {
         diff = JavaSystem.CurrentTimeMillis() - started;
         RunOnUiThread(() =>
         {
             SetTime();
         });
     });
     timer.ScheduleAtFixedRate(timerTask, 0, 200);
 }
コード例 #28
0
ファイル: MyEntry2.cs プロジェクト: maexsp/CustomKeyboardDemo
        protected override TextInputLayout CreateNativeControl()
        {
            var textInputLayout = new TextInputLayout(Context);
            var editText        = new EditText(Context);

            #region Add the Keyboard in your Page
            var activity = Forms.Context as Activity;
            var rootView = activity.Window.DecorView.FindViewById(Android.Resource.Id.Content);

            //activity.Window.SetSoftInputMode(SoftInput.StateAlwaysHidden); // (SoftInput.StateAlwaysHidden);

            activityRootView = ((ViewGroup)rootView).GetChildAt(0) as ViewGroup;
            mKeyboardView    = new CustomKeyboardView(Forms.Context, null);

            Android.Widget.RelativeLayout.LayoutParams layoutParams =
                new Android.Widget.RelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); // or wrap_content
            layoutParams.AddRule(LayoutRules.AlignParentBottom);
            activityRootView.AddView(mKeyboardView, layoutParams);
            #endregion

            //First open the current page, hide the Keyboard
            mKeyboardView.Visibility = ViewStates.Gone;

            //Use the custom Keyboard
            mKeyboard = new Android.InputMethodServices.Keyboard(Context, Resource.Xml.keyboard);
            mKeyboardView.Keyboard = mKeyboard;

            mKeyboardView.Key += async(sender, e) =>
            {
                if (e.PrimaryCode == Keycode.NavigateNext)
                {
                    this.mKeyboardView.Visibility = ViewStates.Gone;
                    // or this (not working yet)
                    // https://forums.xamarin.com/discussion/58763/key-detection-on-form-plus-making-the-keyboard-disappear-on-a-device-with-physical-keys
                    //var inputMethodManager = (InputMethodManager)this.Context.GetSystemService(Activity.InputMethodService);
                    //this.mKeyboard.Dispose();
                    ////this.mKeyboardView.WindowToken
                    //inputMethodManager.HideSoftInputFromWindow(this.mKeyboardView.WindowToken, 0);
                    return;
                }
                long     eventTime = JavaSystem.CurrentTimeMillis();
                KeyEvent ev        = new KeyEvent(eventTime, eventTime, KeyEventActions.Down, e.PrimaryCode, 0, 0, 0, 0, KeyEventFlags.SoftKeyboard | KeyEventFlags.EditorAction);

                DispatchKeyEvent(ev);

                await Task.Delay(1);
            };

            textInputLayout.AddView(editText);
            return(textInputLayout);
        }
コード例 #29
0
            public override void OnDraw(Canvas canvas, Rect bounds)
            {
                var now = DateTime.Now;

                // Show colons for the first half of each second so the colons blink on when the time
                // updates.
                shouldDrawColons = (JavaSystem.CurrentTimeMillis() % 1000) < 500;

                // Draw the background.
                canvas.DrawRect(0, 0, bounds.Width(), bounds.Height(), backgroundPaint);

                // Draw the hours.
                float x          = xOffset;
                var   hourString = string.Format("{0:hh}", now);

                canvas.DrawText(hourString, x, yOffset, hourPaint);
                x += hourPaint.MeasureText(hourString);

                // In ambient and mute modes, always draw the first colon. Otherwise, draw the
                // first colon for the first half of each second.
                if (IsInAmbientMode || mute || shouldDrawColons)
                {
                    canvas.DrawText(ColonString, x, yOffset, colonPaint);
                }
                x += colonWidth;

                // Draw the minutes.
                var minuteString = string.Format("{0:mm}", now);

                canvas.DrawText(minuteString, x, yOffset, minutePaint);
                x += minutePaint.MeasureText(minuteString);

                // In ambient and mute modes, draw AM/PM. Otherwise, draw a second blinking
                // colon followed by the seconds.
                if (IsInAmbientMode || mute)
                {
                    x += colonWidth;
                    string amPmString = string.Format("{0:tt}", now);
                    canvas.DrawText(amPmString, x, yOffset, amPmPaint);
                }
                else
                {
                    if (shouldDrawColons)
                    {
                        canvas.DrawText(ColonString, x, yOffset, colonPaint);
                    }
                    x += colonWidth;
                    var secondString = string.Format("{0:ss}", now);
                    canvas.DrawText(secondString, x, yOffset, secondPaint);
                }
            }
コード例 #30
0
        public void OnExit(DanmakuView view)
        {
            long expire = JavaSystem.CurrentTimeMillis() + DanmakuViewPool.KeepAliveTime;

            view.Restore();
            DanmakuViewWithExpireTime item = new DanmakuViewWithExpireTime
            {
                DanmakuView = view,
                ExpireTime  = expire
            };

            DanmakuViewPool.Cache.Offer(item);
            DanmakuViewPool.InUseSize--;
        }