private void ConfigureNotificationAdapter()
 {
     if (_settings.NotificationAdapter == "Test")
     {
         var notificationAdapter = new NotificationAdapter();
         notificationAdapter.Initialize();
         notificationAdapter.Register(Container);
         _notificationAdapterShutdown = () => { };
     }
     else if (_settings.NotificationAdapter == "RabbitMq")
     {
         var notificationAdapter = new Adapter.Notification.RabbitMq.NotificationAdapter();
         notificationAdapter.Initialize();
         notificationAdapter.Register(Container);
         _notificationAdapterShutdown = () => notificationAdapter.Shutdown();
     }
     else if (_settings.NotificationAdapter == "Email")
     {
         Adapter.Notification.Email.NotificationAdapterSettings settings =
             new Adapter.Notification.Email.NotificationAdapterSettings(
                 "localhost", 1025, bookSupplierEmail: "*****@*****.**");
         var notificationAdapter = new Adapter.Notification.Email.NotificationAdapter(settings);
         notificationAdapter.Initialize();
         notificationAdapter.Register(Container);
         _notificationAdapterShutdown = () => notificationAdapter.Shutdown();
     }
 }
Beispiel #2
0
        protected virtual void RegisterNotificationAdapter()
        {
            var notificationAdapter = new NotificationAdapter();

            notificationAdapter.Initialize();
            notificationAdapter.Register(_container);
            _notificationAdapterShutdown = () => { notificationAdapter.Shutdown(); };
        }
Beispiel #3
0
 //Válido para Lollipop en Adelante, no KitKat.
 public override void OnListenerConnected()
 {
     base.OnListenerConnected();
     catcherInstance     = this;
     listaNotificaciones = GetActiveNotifications().ToList();
     adapter             = new NotificationAdapter(listaNotificaciones);
     RegisterReceiver(new ScreenOnOffReceiver(), new IntentFilter(Intent.ActionScreenOn));
     Log.Info("Listener connected, list: ", listaNotificaciones.Count.ToString());
 }
Beispiel #4
0
 /// <summary>
 /// Constructor of the Class
 /// </summary>
 /// <param name="statusBarNotifications">This list is sent by Catcher, and is used to fill the Adapter
 /// that the RecyclerView will use.
 /// </param>
 public CatcherHelper(List <StatusBarNotification> statusBarNotifications)
 {
     CatcherHelper.statusBarNotifications = statusBarNotifications;
     notificationAdapter = new NotificationAdapter(statusBarNotifications);
     if (statusBarNotifications.Count > 0)
     {
         thereAreNotifications = true;
     }
 }
Beispiel #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);
            Cheeseknife.Inject(this);

            data    = DataProvider.Instance;
            adapter = new NotificationAdapter(data.Notifications);
            rvNotifications.SetLayoutManager(new LinearLayoutManager(this));
            rvNotifications.SetAdapter(adapter);
        }
Beispiel #6
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View v = inflater.Inflate(Resource.Layout.NotificationFragment, container, false);

            v.SetLayerType(LayerType.Hardware, null);
            lstSource = new List <NotificationModel>();
            lstview   = v.FindViewById <ListView>(Resource.Id.list);

            lstSource.Add(new NotificationModel()
            {
                sid = 1, name = "George", msg = "Hiiii,How are u???", time = "4:00 AM", count = 10, image = Resource.Drawable.user5
            });
            lstSource.Add(new NotificationModel()
            {
                sid = 2, name = "Hank", msg = "Hellooo", time = "5:00 AM", count = 20, image = Resource.Drawable.user5
            });
            lstSource.Add(new NotificationModel()
            {
                sid = 3, name = "Harry", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM", count = 1, image = Resource.Drawable.user5
            });
            lstSource.Add(new NotificationModel()
            {
                sid = 4, name = "Henryy", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM"
            });
            lstSource.Add(new NotificationModel()
            {
                sid = 5, name = "Benjamin", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM", count = 10, image = Resource.Drawable.user5
            });
            lstSource.Add(new NotificationModel()
            {
                sid = 5, name = "Harryyyy", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM"
            });
            lstSource.Add(new NotificationModel()
            {
                sid = 5, name = "Benjamin", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM", count = 10, image = Resource.Drawable.user5
            });
            lstSource.Add(new NotificationModel()
            {
                sid = 5, name = "Harryyyy", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM"
            });
            lstSource.Add(new NotificationModel()
            {
                sid = 5, name = "Benjamin", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM", count = 10, image = Resource.Drawable.user5
            });
            lstSource.Add(new NotificationModel()
            {
                sid = 5, name = "Harryyyy", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM"
            });
            adp             = new NotificationAdapter(this.Activity, lstSource);
            lstview.Adapter = adp;
            return(v);
        }
Beispiel #7
0
 /// <summary>
 /// Constructor of the Class
 /// </summary>
 /// <param name="statusBarNotifications">This list is sent by Catcher, and is used to fill the Adapter
 /// that the RecyclerView will use, it is tighly coupled with that adapter.
 /// </param>
 public CatcherHelper(List <StatusBarNotification> statusBarNotifications)
 {
     StatusBarNotifications = statusBarNotifications;
     notificationAdapter    = new NotificationAdapter(statusBarNotifications);
     if (statusBarNotifications.Count > 0)
     {
         OnNotificationListSizeChanged(new NotificationListSizeChangedEventArgs
         {
             ThereAreNotifications = true
         });
     }
     AwakeHelper awakeHelper = new AwakeHelper(); //Will help us to make certain operations as waking up the screen and such.
 }
Beispiel #8
0
        //So it can grab it from here.

        /// <summary>
        /// Constructor of the Class
        /// </summary>
        /// <param name="statusBarNotifications">This list is sent by Catcher, and is used to fill the Adapter
        /// that the RecyclerView will use, it is tighly coupled with that adapter.
        /// </param>
        public CatcherHelper(List <StatusBarNotification> statusBarNotifications)
        {
            foreach (var sbn in statusBarNotifications)
            {
                StatusBarNotifications.Add(new OpenNotification(sbn));
            }
            notificationAdapter = new NotificationAdapter(StatusBarNotifications);
            if (statusBarNotifications.Count > 0)
            {
                OnNotificationListSizeChanged(new NotificationListSizeChangedEventArgs
                {
                    ThereAreNotifications = true
                });
            }
        }
Beispiel #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Title = "Notificaciones";

            // Create your application here
            SetContentView(Resource.Layout.NotificationLayout);
            createActionBar();

            lvwNotification                = FindViewById <ListView>(Resource.Id.lvwNotification);
            lvwNotification.Adapter        = adapterLvw = new NotificationAdapter(this, getNotificationList());
            lvwNotification.ItemLongClick += LvwNotification_ItemLongClick;
            lvwNotification.ItemClick     += LvwNotification_ItemClick;

            Toast.MakeText(this, "Notifications loaded", ToastLength.Short).Show();
        }
Beispiel #10
0
        async void LoadNotifications()
        {
            _notificationList.Add(new Notifications
            {
                Name    = "Daniel Sarabusing",
                Content = "Aircon not functioning",
                Time    = "08:00AM"
            });

            _notificationList.Add(new Notifications
            {
                Name    = "Daniel Sarabusing",
                Content = "Aircon not functioning",
                Time    = "08:00AM"
            });

            _notificationList.Add(new Notifications
            {
                Name    = "Enber Francisco",
                Content = "Aircon problem",
                Time    = "08:01AM"
            });

            _notificationList.Add(new Notifications
            {
                Name    = "JB Rillo",
                Content = "Mainit po",
                Time    = "08:03AM"
            });

            _notificationList.Add(new Notifications
            {
                Name    = "Rico Arabia",
                Content = "Sira ang aircon",
                Time    = "08:05AM"
            });

            NotificationAdapter adapter = new NotificationAdapter(Activity, _notificationList);

            _notifications.SetAdapter(adapter);
            adapter.NotifyDataSetChanged();
        }
Beispiel #11
0
        public override void OnNotificationPosted(StatusBarNotification sbn)
        {
            //Kitkat Dirty ListenerConnected.
            //No funciona si no hay una notificación nueva
            if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop && isConnected == false)
            {
                catcherInstance     = this;
                listaNotificaciones = GetActiveNotifications().ToList();
                adapter             = new NotificationAdapter(listaNotificaciones);
                isConnected         = true;
                Log.Info("Kitkat Listener connected, list: ", listaNotificaciones.Count.ToString());
            }

            int id     = sbn.Id;
            int indice = listaNotificaciones.IndexOf(listaNotificaciones.FirstOrDefault(o => o.Id == sbn.Id));

            //Condicional debido a que Play Store causa que algun item se pierda #wontfix ?
            if (indice >= 0)
            {
                listaNotificaciones.RemoveAt(indice);
                listaNotificaciones.Add(sbn);
                if (LockScreenActivity.lockScreenInstance != null)
                {
                    LockScreenActivity.lockScreenInstance.RunOnUiThread(() => adapter.NotifyItemChanged(indice));
                }

                Log.Info("Elemento actualizado", "Tamaño lista: " + listaNotificaciones.Count);
            }
            else
            {
                listaNotificaciones.Add(sbn);
                if (LockScreenActivity.lockScreenInstance != null)
                {
                    LockScreenActivity.lockScreenInstance.RunOnUiThread(() => adapter.NotifyItemInserted(listaNotificaciones.Count));
                }
                Log.Info("Elemento insertado", "Tamaño lista: " + listaNotificaciones.Count);
            }
        }
 private void SetRecyclerViewAdapters()
 {
     try
     {
         MAdapter = new NotificationAdapter(Activity)
         {
             NotificationList = new ObservableCollection <NotificationObject>()
         };
         LayoutManager = new LinearLayoutManager(Context);
         MRecycler.SetLayoutManager(LayoutManager);
         MRecycler.HasFixedSize = true;
         MRecycler.SetItemViewCacheSize(10);
         MRecycler.GetLayoutManager().ItemPrefetchEnabled = true;
         var sizeProvider = new FixedPreloadSizeProvider(10, 10);
         var preLoader    = new RecyclerViewPreloader <ArticleObject>(Activity, MAdapter, sizeProvider, 10);
         MRecycler.AddOnScrollListener(preLoader);
         MRecycler.SetAdapter(MAdapter);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Beispiel #13
0
        private void LoadElements()
        {
            if (_notificationList != null && _notificationList.Any())
            {
                _notificationListView = _view.FindViewById <ListView>(Resource.Id.notificationListView);

                var notificationAdapter = new NotificationAdapter(Activity, _notificationList);
                var newsLayout          = _view.FindViewById <LinearLayout>(Resource.Id.newsLayoutId);
                newsLayout.Visibility       = ViewStates.Visible;
                _lottieAnimation.Visibility = ViewStates.Gone;

                _notificationListView.Adapter = notificationAdapter;
                notificationAdapter.NotifyDataSetChanged();
            }
            else
            {
                _emptyState                 = _view.FindViewById <LinearLayout>(Resource.Id.empty_state);
                _emptyState.Visibility      = ViewStates.Visible;
                _lottieAnimation.Visibility = ViewStates.Gone;
            }
            _lottieAnimation.Dispose();
            GarbageCollector();
        }
Beispiel #14
0
 public void Save(NotificationDto notification)
 {
     notification.Id = Guid.NewGuid();
     _notificationRepository.Add(NotificationAdapter.BuildNotification(notification));
 }