Example #1
1
        /// <summary>
        /// When the activity is created
        /// </summary>
        /// <param name="bundle">Any data passed to the activity</param>
        protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

            //Allow this inbox to be retrieved by other classes
            //This allows the inbox to be updated when a new message arrives
			MainActivity.references.Put ("Inbox", this);

			SetContentView(Resource.Layout.messaging_inbox);

			taskListView = (ListView)FindViewById (Resource.Id.listView);
            
            //Get all the users that this user has had a conversation with
            users = MessageRepository.GetMessagedUsers().ToArray<string>();
            tasks = new List<Message>();

            //Get the most recent message from each user to display in the "main" messaging list
            foreach (string s in users)
            {
                tasks.Add(MessageRepository.GetMostRecentMessageFrom(s));
            }
            
            // create our adapter
            taskList = new MsgListAdapterInbox(this, users.ToList());

			//Hook up our adapter to our ListView
			taskListView.Adapter = taskList;
		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            mListView = FindViewById<ListView>(Resource.Id.listView);
            mContacts = new List<Contact>();

            Action<ImageView> action = PicSelected;

            mAdapter = new ContactListAdapter(this, Resource.Layout.row_contact, mContacts, action);
            mListView.Adapter = mAdapter;
        }
        /**
         * Creates a new AnimationAdapter, wrapping given BaseAdapter.
         *
         * @param baseAdapter the BaseAdapter to wrap.
         */
        protected AnimationAdapter(BaseAdapter baseAdapter)
            : base(baseAdapter)
        {
            //super(baseAdapter);

            mGridViewPossiblyMeasuring = true;
            mGridViewMeasuringPosition = -1;
            mIsRootAdapter = true;

            if (baseAdapter is AnimationAdapter)
            {
                ((AnimationAdapter)baseAdapter).setIsWrapped();
            }
        }
Example #4
0
        /// <summary>
        /// Open the conversation window
        /// </summary>
        /// <param name="position">The position of the user in the list of usernames that the conversation is with</param>
        public void viewConversation(int position)
        {
            //Get the elements on the screen
            SetContentView(Resource.Layout.messaging);
            Button mButton = FindViewById<Button>(Resource.Id.btnSendMsg);
            EditText mText = FindViewById<EditText>(Resource.Id.sendMessageTxt);
            taskListView = (ListView)FindViewById(Resource.Id.listView);

            //Get the messages in the conversation
            msgs = MessageRepository.GetUsersMessage(new string[] { users[position] }).ToList();

            //Set the adapter to use messages
            taskList = new MsgListAdapter(this, msgs);
            taskListView.Adapter = taskList;
            
            //When the send button is clicked
            mButton.Click += async (object sender, EventArgs e) =>
            {
                if (!mText.Text.Equals(""))
                {
                    //If the message is sent successfully, store it and display it in the list
                    if(await MessageSender.SendSingleMessage(mText.Text, users[position], MainActivity.credentials, MainActivity.serverURL + MainActivity.single_message))
                    {
                        //Create a message object
                        Message m = new Message();
                        m.MsgText = mText.Text;
                        m.UserName = users[position];
                        m.Date = DateTime.Now.ToString();
                        m.incoming = false;

                        //Update the message on the screen
                        newMessage(m);

                        //Save the message
                        MessageRepository.SaveMessage(m);

                        //Clear the input box
                        mText.Text = "";
                    }
                    else
                    {
                        Toast.MakeText(this, "Sending message was unsuccessful", ToastLength.Short).Show();
                    }   
                }
            };
        }
        /**
         * Create a new {@code StickyListHeadersAdapterDecorator}, decorating given {@link android.widget.BaseAdapter}.
         *
         * @param baseAdapter the {@code BaseAdapter} to decorate. If this is a {@code BaseAdapterDecorator}, it should wrap an instance of
         *                    {@link se.emilsjolander.stickylistheaders.StickyListHeadersAdapter}.
         */
        public StickyListHeadersAdapterDecorator(BaseAdapter baseAdapter)
            : base(baseAdapter)
        {
            //super(baseAdapter);

            BaseAdapter adapter = baseAdapter;
            while (adapter is BaseAdapterDecorator)
            {
                adapter = ((BaseAdapterDecorator)adapter).getDecoratedBaseAdapter();
            }

            if (!(adapter is IStickyListHeadersAdapter))
            {
                //.getCanonicalName()
                throw new Java.Lang.IllegalArgumentException(adapter.GetType().FullName + " does not implement StickyListHeadersAdapter");
            }

            mStickyListHeadersAdapter = (IStickyListHeadersAdapter)adapter;
        }
Example #6
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     persistentData = Intent.GetStringArrayListExtra("persistent data");
     repliesList = Intent.GetStringArrayListExtra("replies list");
     postID = Intent.GetStringArrayListExtra("post id");
     query = Intent.GetStringArrayListExtra("query text");
     SetContentView(Resource.Layout.ViewPostDetail);
     TextView postText = FindViewById<TextView>(Resource.Id.PostText);
     Button addReply = FindViewById<Button>(Resource.Id.addReplyButton);
     postText.Text = (query[0]);
     string[] myArray;
     for (int i = 1; i < repliesList.Count; i++)
     {
         myArray = repliesList[i].Split(',');
         string date = myArray[2].Split(' ').First();
         nameDate.Add(myArray[0] + ", " + date);
         content.Add(myArray[1]);
     }
     addReply.Click += AddReply_Click;
     adapt = new ViewApptsAdapter(this, content, nameDate);
     listview = FindViewById<ListView>(Resource.Id.postDetailView);
     listview.Adapter = adapt;
 }
Example #7
0
 //ImageView image;
 public ListSection( String columnHeader1, BaseAdapter adapter)
 {
     _columnHeader1 = columnHeader1;
     //this.image = image;
     _adapter = adapter;
 }
 protected SingleAnimationAdapter(BaseAdapter baseAdapter)
     : base(baseAdapter)
 {
     //super(baseAdapter);
 }
Example #9
0
        /// <summary>
        /// Executed if the activity is resumed after it is paused
        /// </summary>
		protected override void OnResume ()
		{
			base.OnResume ();

            // create our adapter
            taskList = new MsgListAdapterInbox(this, users);

			//Hook up our adapter to our ListView
			taskListView.Adapter = taskList;
		}
 public AlphaInAnimationAdapter(BaseAdapter baseAdapter)
     : base(baseAdapter)
 {
     //super(baseAdapter);
 }
 public ScaleInAnimationAdapter(BaseAdapter baseAdapter, float scaleFrom)
     : base(baseAdapter)
 {
     //super(baseAdapter);
     mScaleFrom = scaleFrom;
 }
 public ScaleInAnimationAdapter(BaseAdapter baseAdapter)
     : this(baseAdapter, DEFAULT_SCALE_FROM)
 {
     //this(baseAdapter, DEFAULT_SCALE_FROM);
 }
 /**
  * Create a new SwipeDismissAdapter.
  *
  * @param baseAdapter       the {@link android.widget.BaseAdapter to use}
  * @param onDismissCallback the {@link OnDismissCallback} to be notified of dismissed items.
  */
 public SwipeDismissAdapter(BaseAdapter baseAdapter, IOnDismissCallback onDismissCallback)
     : base(baseAdapter)
 {
     //    super(baseAdapter);
     mOnDismissCallback = onDismissCallback;
 }
Example #14
0
 internal DatabaseHook(BaseAdapter adapter) : base(adapter)
 {
 }
Example #15
0
        /// <summary>
        /// Sets teh drop down list with a customer adapter and callback when items change
        /// if adapter.Count == 0 then the spinner will NOT be shown and you will have to call this method again.
        /// </summary>
        /// <param name="adapter">Adapter to display</param>
        /// <param name="eventHandler">Event handler to callback. (can be null)</param>
         public void SetDropDown(BaseAdapter adapter, EventHandler<AdapterView.ItemSelectedEventArgs> eventHandler)
         {
             if (adapter == null)
                 return;

             

             if (adapter.Count == 0)
             {
                 _titleView.Visibility = ViewStates.Visible;
                 _titleDropdown.Visibility = ViewStates.Gone;
             }
             else
             {
                 var previousSelected = _titleDropdown.SelectedItemPosition;
                 _titleView.Visibility = ViewStates.Gone;

                 _titleDropdown.Visibility = ViewStates.Visible;
                 _titleDropdown.Adapter = adapter;
                 if (eventHandler != null)
                     _titleDropdown.ItemSelected += eventHandler;

                 if (previousSelected >= 0 && previousSelected < adapter.Count)
                     _titleDropdown.SetSelection(previousSelected);
             }
        }
 //@SuppressWarnings("UnusedDeclaration")
 protected ResourceAnimationAdapter(BaseAdapter baseAdapter, Context context)
     : base(baseAdapter)
 {
     //super(baseAdapter);
     mContext = context;
 }
 public SwingBottomInAnimationAdapter(BaseAdapter baseAdapter)
     : base(baseAdapter)
 {
     //super(baseAdapter);
 }
        /**
         * Create a new {@code SwipeUndoAdapter}, decorating given {@link android.widget.BaseAdapter}.
         *
         * @param baseAdapter  the {@link android.widget.BaseAdapter} to decorate.
         * @param undoCallback the {@link UndoCallback} that is used.
         */
        protected SwipeUndoAdapter(BaseAdapter baseAdapter, IUndoCallback undoCallback)
            : base(baseAdapter)
        {

            mUndoCallback = undoCallback;
        }
 /**
  * Create a new {@code BaseAdapterDecorator}, decorating given {@link android.widget.BaseAdapter}.
  *
  * @param baseAdapter the {@code} BaseAdapter to decorate.
  */
 protected BaseAdapterDecorator(BaseAdapter baseAdapter)
 {
     mDecoratedBaseAdapter = baseAdapter;
 }
 public SwingLeftInAnimationAdapter(BaseAdapter baseAdapter)
     : base(baseAdapter)
 {
     //super(baseAdapter);
 }