public ConversationInfo(List<Guid> users, Dictionary<Guid, MessageInfo> messages)
 {
     this.Users = users;
     this.Messages = messages;
     this.ConversationID = this.GetConversationID ();
     dbm = wowZapp.LaffOutOut.Singleton.dbm;
 }
예제 #2
0
        //public LaffOutOut(IntPtr handle, JniHandleOwnership transfer) : base(handle, transfer)
        public LaffOutOut(Context c)
        {
            context = c;
            AndroidData.SetTeleManager(c);
            LaffOutOut.Singleton = this;
            ContentDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            Version = "0.991";
            Published = "5th Feb 2013";

            this.dbm = new DBManager();
            try
            {
                this.dbm.SetupDB();
            } catch (Exception ex)
            {
                #if(DEBUG)
                System.Diagnostics.Debug.WriteLine("Database failed to be created! {0}--{1}", ex.Message, ex.StackTrace);
                #endif
            }//end try catch
            this.ccm = new ContentCacheManager();
            this.mmg = new MessageManager();

            if (LaffOutOut.Singleton == null)
                LaffOutOut.Singleton = this;

            #if DEBUG
            if (!System.IO.Directory.Exists(Android.OS.Environment.ExternalStorageDirectory + "/wz"))
                System.IO.Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory + "/wz");
            File.Copy(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "LOL.db"), Android.OS.Environment.ExternalStorageDirectory + "/wz/lol.db", true);
            #endif
        }
예제 #3
0
 public MessageManager()
 {
     this.pContentInfoQ = new Queue<ContentInfo>();
     this.contentInfoQLock = new object();
     dbm = wowZapp.LaffOutOut.Singleton.dbm;
     ccm = wowZapp.LaffOutOut.Singleton.ccm;
 }
예제 #4
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     dbm = wowZapp.LaffOutOut.Singleton.dbm;
     Context context = UnknownUser.context;
     imageSize = new float[2];
     imageSize [0] = imageSize [1] = 56f;
     if (wowZapp.LaffOutOut.Singleton.resizeFonts)
         imageSize = ImageHelper.getNewSizes(imageSize, context);
     contacts = new List<ContactDB>();
     newUsers = new List<User>();
     createNewUsers();
 }
예제 #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.EditContact);
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewloginHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);

            context = header.Context;
            Header.headertext = Application.Context.Resources.GetString(Resource.String.editContactTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            TextView name = FindViewById<TextView>(Resource.Id.txtContactName);
            name.Text = EditContactUtil.UserContact.ContactUser.FirstName + " " + EditContactUtil.UserContact.ContactUser.LastName;
            contactpic = FindViewById<ImageView>(Resource.Id.imgContactPic);
            contactpic.Tag = new Java.Lang.String("profilepic_1");
            dbm = wowZapp.LaffOutOut.Singleton.dbm;

            blockcontact = FindViewById<Button>(Resource.Id.btnBlockUser);
            Button deletecontact = FindViewById<Button>(Resource.Id.btnDeleteUser);

            ImageButton uniback = FindViewById<ImageButton>(Resource.Id.btnUniBack);

            LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder);

            uniback.Click += delegate
            {
                Finish();
            };

            blockcontact.Text = Application.Context.Resources.GetString(EditContactUtil.UserContact.Blocked ? Resource.String.editContactUnblock : Resource.String.editContactBlock);

            blockcontact.Click += new EventHandler(blockcontact_Click);
            deletecontact.Click += new EventHandler(deletecontact_Click);
            float size = 100f;
            if (wowZapp.LaffOutOut.Singleton.resizeFonts)
                size *= wowZapp.LaffOutOut.Singleton.bigger;
            xSize = (int)ImageHelper.convertDpToPixel(size, context);
            ySize = xSize;
            if (ContactsUtil.contactFilenames.Contains(EditContactUtil.UserContact.ContactAccountGuid))
            {
                #if DEBUG
                System.Diagnostics.Debug.WriteLine("using cache");
                #endif
                using (Bitmap bm = BitmapFactory.DecodeFile (System.IO.Path.Combine (wowZapp.LaffOutOut.Singleton.ImageDirectory, EditContactUtil.UserContact.ContactAccountGuid)))
                {
                    using (MemoryStream ms = new MemoryStream ())
                    {
                        bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms);
                        byte[] image = ms.ToArray();
                        displayImage(image, contactpic);
                    }
                }
            } else
            {
                if (EditContactUtil.UserContact.ContactUser.Picture.Length > 0)
                {
                    #if DEBUG
                    System.Diagnostics.Debug.WriteLine("grabbing");
                    #endif
                    LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint);
                    service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted;
                    service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, EditContactUtil.UserContact.ContactAccountID, new Guid(AndroidData.ServiceAuthToken));
                } else
                {
                    System.Diagnostics.Debug.WriteLine("no pic");
                    using (Bitmap bm = BitmapFactory.DecodeResource (this.Resources, Resource.Drawable.defaultuserimage))
                    {
                        using (MemoryStream ms = new MemoryStream ())
                        {
                            bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms);
                            byte[] image = ms.ToArray();
                            displayImage(image, contactpic);
                        }
                    }
                }
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ManageContactsMain);
            isBack = base.Intent.GetBooleanExtra("back", false);
            imgAddContact = FindViewById<ImageView>(Resource.Id.btnFindContact);
            imgUniBack = FindViewById<ImageView>(Resource.Id.btnBack);
            listWrapper = FindViewById<LinearLayout>(Resource.Id.linearListWrapper);
            txtSearch = FindViewById<EditText>(Resource.Id.txtContactsSearch);
            context = listWrapper.Context;

            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);

            Header.headertext = Application.Context.Resources.GetString(Resource.String.contactsTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            profilePicsToBeGrabbed = new List<Guid>();

            db = wowZapp.LaffOutOut.Singleton.dbm;
            contactsDB = new List<ContactDB>();
            contacts = new List<Contact>();

            Parent = listWrapper;
            imgAddContact.Click += delegate
            {
                StartActivityForResult(typeof(FindContactActivity), FIND_CONTACT_ACTIVITY);
            };
            imgAddContact.Tag = 1;
            imgUniBack.Click += delegate
            {
                Finish();
            };
            imgUniBack.Tag = 0;

            ImageView[] buttons = new ImageView[2];
            buttons [0] = imgUniBack;
            buttons [1] = imgAddContact;

            float size = 40f;
            if (wowZapp.LaffOutOut.Singleton.resizeFonts)
                size *= wowZapp.LaffOutOut.Singleton.bigger;
            imageSize = new float[2];
            imageSize [0] = imageSize [1] = size;

            LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder);
            ImageHelper.setupButtonsPosition(buttons, bottom, context);

            txtSearch.TextChanged += delegate
            {
                FilterContacts();
            };

            System.Threading.Tasks.Task.Factory.StartNew(() => LoadContactsFromDB());
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.FindContactResults);

            listWrapper = FindViewById<LinearLayout>(Resource.Id.linearResultsWrapper);
            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            Button btnDone = FindViewById<Button>(Resource.Id.btnDone);
            context = listWrapper.Context;

            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);

            Header.headertext = Application.Context.Resources.GetString(Resource.String.findContactbtnSearch);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            db = wowZapp.LaffOutOut.Singleton.dbm;
            contacts = FindContactResultsUtil.contacts;
            profilePicsGrabIndex = 0;
            profilePicsToBeGrabbed = new List<Guid>();
            LinearLayout bottomHolder = FindViewById<LinearLayout>(Resource.Id.bottomHolder);
            //xSize = (int)ImageHelper.convertDpToPixel (40f, context);
            //ySize = xSize;

            btnBack.Click += delegate
            {
                Finish();
            };

            btnDone.Click += delegate
            {
                Finish();
            };

            ImageHelper.setupButtonsPosition(btnBack, btnDone, bottomHolder, context, true);

            newSizes = new float[2];
            newSizes [0] = newSizes [1] = 40f;
            newSizes = ImageHelper.getNewSizes(newSizes, context);

            for (int n = 0; n < contacts.Count; n++)
            {
                LinearLayout layout = new LinearLayout(context);
                layout.Orientation = Android.Widget.Orientation.Horizontal;
                layout.SetGravity(GravityFlags.Center);
                layout.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context),
                                   (int)ImageHelper.convertDpToPixel(10f, context));

                ImageView profilepic = new ImageView(context);
                profilepic.LayoutParameters = new ViewGroup.LayoutParams((int)newSizes [0], (int)newSizes [1]);
                profilepic.Tag = new Java.Lang.String("profilepic_" + contacts [n].ContactAccountID.ToString());
                if (Contacts.ContactsUtil.contactFilenames.Contains(contacts [n].ContactAccountID.ToString()))
                {
                    using (Bitmap bm = BitmapFactory.DecodeFile (System.IO.Path.Combine (wowZapp.LaffOutOut.Singleton.ImageDirectory, contacts [n].ContactAccountID.ToString ())))
                    {
                        using (MemoryStream ms = new MemoryStream ())
                        {
                            bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms);
                            byte[] image = ms.ToArray();
                            displayImage(image, profilepic);
                        }
                    }
                } else
                {
                    if (contacts [n].ContactUser.Picture.Length > 0)
                    {
                        profilePicsToBeGrabbed.Add(contacts [n].ContactAccountID);
                    } else
                    {
                        profilepic.SetImageDrawable(Application.Context.Resources.GetDrawable(Resource.Drawable.defaultuserimage));
                    }
                }

                layout.AddView(profilepic);

                using (TextView text = new TextView (context))
                {
                    text.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(235f, context), (int)ImageHelper.convertDpToPixel(40f, context));
                    text.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context), 0);
                    text.Gravity = GravityFlags.CenterVertical;
                    text.TextSize = 16f;
                    text.SetTextColor(Android.Graphics.Color.White);
                    if (contacts [n].ContactUser.FirstName != "" || contacts [n].ContactUser.LastName != "")
                    {
                        text.Text = contacts [n].ContactUser.FirstName + " " + contacts [n].ContactUser.LastName;
                    } else
                    {
                        text.Text = contacts [n].ContactUser.EmailAddress;
                    }
                    layout.AddView(text);
                }
                ImageView checkbox = new ImageView(context);
                checkbox.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(25f, context), (int)ImageHelper.convertDpToPixel(25f, context));

                if (db.CheckContactExistsForOwner(contacts [n].ContactAccountID.ToString(), AndroidData.CurrentUser.AccountID.ToString()) == true)
                {
                    checkbox.SetImageDrawable(Application.Context.Resources.GetDrawable(Resource.Drawable.@checkedbox));
                    checkbox.ContentDescription = ADD_DISABLED;
                } else
                {
                    checkbox.SetImageDrawable(Application.Context.Resources.GetDrawable(Resource.Drawable.add));
                    checkbox.ContentDescription = ADD_ENABLED;
                }

                int contactId = new int();
                contactId = n;
                layout.Clickable = true;
                layout.Click += delegate
                {
                    AddContact(checkbox, contactId);
                };
                layout.AddView(checkbox);
                this.listWrapper.AddView(layout);
            }

            if (profilePicsToBeGrabbed.Count > 0)
            {
                profilePicsGrabIndex = 0;
                LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint);
                service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted;
                service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, profilePicsToBeGrabbed [0], new Guid(AndroidData.ServiceAuthToken));
            }
        }
예제 #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (MessageConversations.conversationsList == null)
                MessageConversations.conversationsList = new List<LOLMessageConversation>();
            else
                MessageConversations.conversationsList.Clear();

            dbm = wowZapp.LaffOutOut.Singleton.dbm;

            SetContentView(Resource.Layout.MessageLists);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader);
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);
            Header.headertext = Application.Context.Resources.GetString(Resource.String.messageListHeaderViewTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;
            listWrapper = FindViewById<LinearLayout>(Resource.Id.linearListWrapper);
            context = listWrapper.Context;
            //ViewGroup Parent = listWrapper;
            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            btnBack.Tag = 0;
            ImageButton btnHome = FindViewById<ImageButton>(Resource.Id.btnHome);
            btnHome.Tag = 1;
            ImageButton btnAdd = FindViewById<ImageButton>(Resource.Id.btnAdd);
            btnAdd.Tag = 2;
            Messages.MessageReceivedUtil.FromMessagesDone = false;
            Messages.MessageReceivedUtil.FromMessages = true;
            LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder);
            ImageButton[] buttons = new ImageButton[3];
            buttons [0] = btnBack;
            buttons [1] = btnHome;
            buttons [2] = btnAdd;
            ImageHelper.setupButtonsPosition(buttons, bottom, context);
            isRefreshing = true;
            scroller = FindViewById<ScrollView>(Resource.Id.scrollViewContainer);
            btnBack.Click += delegate
            {
                wowZapp.LaffOutOut.Singleton.ReceivedMessages -= AppDelegate_ReceivedConversationMessages;
                if (MessageReceivedUtil.FromMessagesDone)
                {
                    MessageReceivedUtil.FromMessagesDone = false;
                    Intent i = new Intent(this, typeof(Main.HomeActivity));
                    i.SetFlags(ActivityFlags.ClearTop);
                    StartActivity(i);
                } else
                    Finish();
            };
            signal = new AutoResetEvent(false);
            createIt = false;

            if (contacts == null)
                contacts = new List<ContactDB>();
            else
                contacts.Clear();

            btnHome.Click += delegate
            {
                wowZapp.LaffOutOut.Singleton.ReceivedMessages -= AppDelegate_ReceivedConversationMessages;
                Intent i = new Intent(this, typeof(Main.HomeActivity));
                i.SetFlags(ActivityFlags.ClearTop);
                StartActivity(i);
            };

            btnAdd.Click += delegate
            {
                wowZapp.LaffOutOut.Singleton.ReceivedMessages -= AppDelegate_ReceivedConversationMessages;
                Intent i = new Intent(this, typeof(Contacts.SelectContactsActivity));
                StartActivity(i);
            };

            newUsers = new List<User>();
            RunOnUiThread(delegate
            {
                progress = ProgressDialog.Show(context, Application.Context.Resources.GetString(Resource.String.messageRefreshingMessages),
                                                Application.Context.Resources.GetString(Resource.String.commonOneSec));
            });
            ThreadPool.QueueUserWorkItem(delegate
            {
                getConversations();
            });
            wowZapp.LaffOutOut.Singleton.ReceivedMessages += AppDelegate_ReceivedConversationMessages;

            float size = 56f;
            imageSize = new float[2];
            imageSize [0] = imageSize [1] = size;
            if (wowZapp.LaffOutOut.Singleton.resizeFonts)
                imageSize = ImageHelper.getNewSizes(imageSize, context);
            #if DEBUG
            System.Diagnostics.Debug.WriteLine("imagesize = {0}", imageSize [0]);
            #endif
            LaffOutOut.Singleton.mmg.MessageSendConfirmCompleted += MessageManager_MessageSendConfirm;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            db = wowZapp.LaffOutOut.Singleton.dbm;
            SetContentView(Resource.Layout.FindContactWCF);
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewLoginHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);

            context = header.Context;
            Header.headertext = Application.Context.Resources.GetString(Resource.String.findContactTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            int dist = 0;

            Button search = FindViewById<Button>(Resource.Id.btnSearch);
            Button internet = FindViewById<Button>(Resource.Id.btnOnline);
            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            EditText first = FindViewById<EditText>(Resource.Id.editFirstName);
            EditText last = FindViewById<EditText>(Resource.Id.editLastName);
            EditText screenname = FindViewById<EditText>(Resource.Id.editScreenName);
            EditText email = FindViewById<EditText>(Resource.Id.editEmailAddress);
            Spinner spinDist = FindViewById<Spinner>(Resource.Id.spinDistance);

            string[] distances = new string[]
            {
                "0",
                "1",
                "2",
                "5",
                "10",
                "25",
                "50",
                "100"
            };
            ArrayAdapter adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerItem, distances);
            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinDist.Adapter = adapter;

            spinDist.Click += delegate(object sender, EventArgs e)
            {
                Spinner t = (Spinner)sender;
                dist = Convert.ToInt32(distances [t.SelectedItemPosition]);
            };

            search.Click += delegate
            {
                StartContactSearch(email.Text, first.Text, last.Text, screenname.Text, dist);
            };

            internet.Click += delegate
            {
                StartActivity(typeof(GetConnectedInsideActivity));
                Finish();
            };
            btnBack.Click += delegate
            {
                SetResult(Result.Ok);
                Finish();
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SelectContacts);
            listWrapper = FindViewById<LinearLayout>(Resource.Id.linearListWrapper);
            txtSearch = FindViewById<EditText>(Resource.Id.txtContactsSearch);
            btnDone = FindViewById<Button>(Resource.Id.btnDone);
            context = listWrapper.Context;
            float msize = 100f;
            if (wowZapp.LaffOutOut.Singleton.resizeFonts)
                msize *= wowZapp.LaffOutOut.Singleton.bigger;
            xSize = (int)ImageHelper.convertDpToPixel(msize, context);
            ySize = xSize;
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, context);

            Header.headertext = Application.Context.Resources.GetString(Resource.String.contactsSelectContacts);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;
            profilePicsToBeGrabbed = new List<Guid>();

            db = wowZapp.LaffOutOut.Singleton.dbm;
            contactsDB = new List<ContactDB>();
            SelectContactsUtil.selectedContacts = new List<ContactDB>();
            System.Threading.Tasks.Task.Factory.StartNew(() => LoadContactsFromDB());

            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            btnBack.Click += delegate
            {
                Finish();
            };
            bool jump = false;
            LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder);
            ImageHelper.setupButtonsPosition(btnBack, btnDone, bottom, context);

            ViewGroup Parent = listWrapper;
            float size = 40f;
            if (wowZapp.LaffOutOut.Singleton.resizeFonts)
                size *= wowZapp.LaffOutOut.Singleton.bigger;
            imageSizes = new float[2];
            imageSizes [0] = imageSizes [1] = size;
            txtSearch.TextChanged += delegate
            {
                FilterContacts();
            };
            int pack = 0;
            int messType = 0;
            btnDone.Click += delegate
            {
                LOLMessageDelivery.Message msg = new LOLMessageDelivery.Message();
                msg.FromAccountID = AndroidData.CurrentUser.AccountID;
                List<MessageStep> msgSteps = new List<MessageStep>();
                Messages.ComposeMessageMainUtil.msgSteps = msgSteps;
                Messages.ComposeMessageMainUtil.message = msg;
                Messages.ComposeMessageMainUtil.currentPosition [0] = 1;
                if (Messages.MessageReceivedUtil.FromMessages)
                {
                    Intent t = new Intent(this, typeof(Messages.ComposeMessageChooseContent));
                    context.StartActivity(t);
                    Finish();
                } else
                {
                    switch (SelectContactsUtil.messageType)
                    {
                        case TEXT_MESSAGE:
                            Intent i = new Intent(context, typeof(Messages.ComposeTextMessageActivity));
                            i.PutExtra("CurrentStep", base.Intent.GetIntExtra("CurrentStep", 1));
                            context.StartActivity(i);
                            jump = true;
                            Finish();
                            break;
                        case COMIX_MESSAGE:
                            pack = 2;
                            messType = 1;
                            break;

                        case COMICON_MESSAGE:
                            i = new Intent(context, typeof(Messages.ComposeGenericMessage));
                            pack = 1;
                            messType = 2;
                            break;

                        case SFX_MESSAGE:
                            pack = messType = 5;
                            break;

                        case EMOTICON_MESSAGE:
                            pack = 3;
                            messType = 6;
                            break;

                        case VOICE_MESSAGE:
                            messType = 3;
                            break;
                        case POLL_MESSAGE:
                            Intent i7 = new Intent(context, typeof(Messages.ComposePollChoiceActivity));
                            i7.PutExtra("CurrentStep", base.Intent.GetIntExtra("CurrentStep", 1));
                            context.StartActivity(i7);
                            jump = true;
                            Finish();
                            break;
            #if DEBUG
                        case DRAW_MESSAGE:
                            messType = 7;
                            break;
                        case VIDEO_MESSAGE:
                            messType = 4;
                            break;
            #endif
                    }
                    if (!jump)
                    {
                        Intent k = new Intent(context, typeof(Messages.ComposeGenericMessage));
                        k.PutExtra("MessageType", messType);
                        if (pack != 0)
                            k.PutExtra("pack", pack);
                        k.PutExtra("CurrentStep", base.Intent.GetIntExtra("CurrentStep", 1));
                        context.StartActivity(k);
                        Finish();
                    }
                }
            };
            if (SelectContactsUtil.selectedContacts.Count == 0)
                btnDone.Visibility = ViewStates.Invisible;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ContentPack);
            isAnimation = base.Intent.GetBooleanExtra("animated", false);
            fromAnimation = base.Intent.GetBooleanExtra("fromanimated", false);
            listContentPack = FindViewById<LinearLayout>(Resource.Id.listContentPack);
            TextView txtContentPackHeader = FindViewById<TextView>(Resource.Id.txtContentPackHeader);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, txtContentPackHeader, relLayout, txtContentPackHeader.Context);
            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);

            context = listContentPack.Context;

            Header.fontsize = 36f;

            int pack = base.Intent.GetIntExtra("pack", -1);

            string text = "";
            switch (pack)
            {
                case 0:
                    packType = LOLCodeLibrary.GenericEnumsContentPackType.Callout;
                    text = Application.Context.GetString(Resource.String.contentCallout);
                    break;
                case 1:
                    packType = LOLCodeLibrary.GenericEnumsContentPackType.Comicon;
                    text = Application.Context.GetString(Resource.String.contentComicon);
                    break;
                case 2:
                    packType = LOLCodeLibrary.GenericEnumsContentPackType.Comix;
                    text = Application.Context.GetString(Resource.String.contentComix);
                    break;
                case 3:
                    packType = LOLCodeLibrary.GenericEnumsContentPackType.Emoticon;
                    text = Application.Context.GetString(Resource.String.contentEmoticon);
                    break;
                case 4:
                    packType = LOLCodeLibrary.GenericEnumsContentPackType.RubberStamp;
                    text = Application.Context.GetString(Resource.String.contentRubber);
                    break;
                case 5:
                    packType = LOLCodeLibrary.GenericEnumsContentPackType.SoundFX;
                    text = Application.Context.GetString(Resource.String.contentSoundFX
                    );
                    break;
            }
            Header.headertext = text;
            ImageHelper.fontSizeInfo(txtContentPackHeader.Context);
            txtContentPackHeader.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            txtContentPackHeader.Text = Header.headertext;
            dbm = wowZapp.LaffOutOut.Singleton.dbm;
            cPackIsLoaded = false;
            contentPath = wowZapp.LaffOutOut.Singleton.ContentDirectory;
            packID = -1;
            contentPacks = new Dictionary<string, ContentPack>();
            btnBack.Click += delegate
            {
                Finish();
            };
            size = 100f;
            if (wowZapp.LaffOutOut.Singleton.resizeFonts)
                size *= wowZapp.LaffOutOut.Singleton.bigger;
            getContentPack();
        }
예제 #12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.HomeScreenscrollview);
            checkForImages();
            messageBar = FindViewById<LinearLayout>(Resource.Id.linmessageBlock);
            parent = messageBar;
            MessageItems = new Dictionary<Guid, Messages.MessageInfo>();
            context = messageBar.Context;

            if (unknownContacts == null)
                unknownContacts = new List<Guid>();
            else
                unknownContacts.Clear();

            if (Messages.ComposeMessageMainUtil.currentPosition == null)
            {
                Messages.ComposeMessageMainUtil.currentPosition = new int[6];
                for (int n = 0; n < 6; ++n)
                    Messages.ComposeMessageMainUtil.currentPosition [n] = 0;
            } else
                for (int n = 0; n < 6; ++n)
                    Messages.ComposeMessageMainUtil.currentPosition [n] = 0;

            if (Messages.ComposeMessageMainUtil.msgSteps != null)
                Messages.ComposeMessageMainUtil.msgSteps.Clear();

            if (Messages.MessageConversations.storedMessages == null)
                Messages.MessageConversations.storedMessages = new List<MessageDB>();

            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewloginHeader);
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, context);

            Header.headertext = Application.Context.Resources.GetString(Resource.String.mainTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;
            killed = false;
            newX = (int)wowZapp.LaffOutOut.Singleton.ScreenXWidth;
            //string filename = base.Intent.GetStringExtra ("playname");
            //string toplay = filename == "" ? String.Empty : filename;
            bool[] checkCameraRecord = new bool[3];
            AndroidData.IsAppActive = true;
            wowZapp.LaffOutOut.Singleton.ScreenXWidth = WindowManager.DefaultDisplay.Width;
            if (AndroidData.GeoLocationEnabled)
                wowZapp.LaffOutOut.Singleton.EnableLocationTimer();

            ImageButton btnAddressBook = FindViewById<ImageButton>(Resource.Id.btnAddressBook);
            btnAddressBook.Tag = 0;
            btnAddressBook.Click += delegate
            {
                StartActivityForResult(typeof(Contacts.ManageContactsActivity), CONTACTS);
            };
            ImageButton btnMessageList = FindViewById<ImageButton>(Resource.Id.btnMessageList);
            btnMessageList.Click += delegate
            {
                wowZapp.LaffOutOut.Singleton.ReceivedMessages -= AppDelegate_ReceivedMessages;
                if (scroller != null)
                {
                    scroller.Stop();
                }
                Intent i = new Intent(this, typeof(Messages.Conversations));
                i.PutExtra("list", true);
                StartActivityForResult(i, MESSAGE_LIST);
            };
            btnMessageList.Tag = 1;
            ImageButton btnLogout = FindViewById<ImageButton>(Resource.Id.btnLogout);
            btnLogout.Click += new EventHandler(btnLogout_Click);
            btnLogout.Tag = 2;

            if (Contacts.SelectContactsUtil.selectedContacts == null)
                Contacts.SelectContactsUtil.selectedContacts = new List<ContactDB>();

            ImageButton[] buttons = new ImageButton[3];
            buttons [0] = btnAddressBook;
            buttons [1] = btnMessageList;
            buttons [2] = btnLogout;
            Messages.MessageReceivedUtil.FromMessages = false;
            ImageButton startTextMessage = FindViewById<ImageButton>(Resource.Id.btnTextMessage);
            startTextMessage.Click += delegate
            {
                if (scroller != null)
                {
                    scroller.Stop();
                }
                Contacts.SelectContactsUtil.messageType = TEXT_MESSAGE;
                StartActivity(typeof(Contacts.SelectContactsActivity));
            };

            ImageButton startDrawMessage = FindViewById<ImageButton>(Resource.Id.btnDrawMessage);
            #if DEBUG
            startDrawMessage.Click += delegate
            {
                if (scroller != null)
                {
                    scroller.Stop();
                }
                Contacts.SelectContactsUtil.messageType = DRAW_MESSAGE;
                StartActivity(typeof(Contacts.SelectContactsActivity));
            };
            #endif

            ImageButton startComixMessage = FindViewById<ImageButton>(Resource.Id.btnComixMessage);
            startComixMessage.Click += delegate
            {
                if (scroller != null)
                {
                    scroller.Stop();
                }
                Contacts.SelectContactsUtil.messageType = COMIX_MESSAGE;
                StartActivity(typeof(Contacts.SelectContactsActivity));
            };

            ImageButton startComiconMessage = FindViewById<ImageButton>(Resource.Id.btnComiconMessage);
            startComiconMessage.Click += delegate
            {
                if (scroller != null)
                {
                    scroller.Stop();
                }
                Contacts.SelectContactsUtil.messageType = COMICON_MESSAGE;
                StartActivity(typeof(Contacts.SelectContactsActivity));
            };

            ImageButton startPollMessage = FindViewById<ImageButton>(Resource.Id.btnPollMessage);
            startPollMessage.Click += delegate
            {
                if (scroller != null)
                {
                    scroller.Stop();
                }
                Contacts.SelectContactsUtil.messageType = POLL_MESSAGE;
                StartActivity(typeof(Contacts.SelectContactsActivity));
            };

            ImageButton startSFXMessage = FindViewById<ImageButton>(Resource.Id.btnSFXMessage);
            startSFXMessage.Click += delegate
            {
                if (scroller != null)
                {
                    scroller.Stop();
                }
                Contacts.SelectContactsUtil.messageType = SFX_MESSAGE;
                StartActivity(typeof(Contacts.SelectContactsActivity));
            };

            ImageButton startEmoticonMessage = FindViewById<ImageButton>(Resource.Id.btnEmotMessage);
            startEmoticonMessage.Click += delegate
            {
                if (scroller != null)
                {
                    scroller.Stop();
                }
                Contacts.SelectContactsUtil.messageType = EMOTICON_MESSAGE;
                StartActivity(typeof(Contacts.SelectContactsActivity));
            };

            ImageButton startVideoMessage = FindViewById<ImageButton>(Resource.Id.btnVideoMessage);
            ImageButton startVoiceMessage = FindViewById<ImageButton>(Resource.Id.btnVoiceMessage);

            hsv = FindViewById<HorizontalScrollView>(Resource.Id.horizontalScrollView1);
            hsv.SmoothScrollingEnabled = true;
            LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder);
            ImageHelper.setupButtonsPosition(buttons, bottom, context);

            dbm = wowZapp.LaffOutOut.Singleton.dbm;
            checkCameraRecord = GeneralUtils.CamRecLong();

            if (checkCameraRecord [1] == false)
                startVoiceMessage.SetBackgroundResource(Resource.Drawable.nomicrophone2);
            else
                startVoiceMessage.Click += delegate
                {
                    if (scroller != null)
                    {
                        scroller.Stop();
                    }
                    Contacts.SelectContactsUtil.messageType = VOICE_MESSAGE;
                    StartActivity(typeof(Contacts.SelectContactsActivity));
                };

            if (checkCameraRecord [0] == false || checkCameraRecord [2] == false)
                startVideoMessage.SetBackgroundResource(Resource.Drawable.novideo2);
            #if DEBUG
            else
                startVideoMessage.Click += delegate
                {
                    if (scroller != null)
                    {
                        scroller.Stop();
                    }
                    Contacts.SelectContactsUtil.messageType = VIDEO_MESSAGE;
                    StartActivity(typeof(Contacts.SelectContactsActivity));
                };
            #endif

            float picXSize = 100f;
            if (wowZapp.LaffOutOut.Singleton.resizeFonts)
                picXSize = (25 * (float)wowZapp.LaffOutOut.Singleton.ScreenXWidth) / 100;
            picSize = (int)ImageHelper.convertDpToPixel(picXSize, context);

            if (Messages.ComposeMessageMainUtil.msgSteps == null)
                Messages.ComposeMessageMainUtil.msgSteps = new List<LOLMessageDelivery.MessageStep>();
            if (Messages.ComposeMessageMainUtil.messageDB == null)
                Messages.ComposeMessageMainUtil.messageDB = new MessageDB();
            wowZapp.LaffOutOut.Singleton.ReceivedMessages += AppDelegate_ReceivedMessages;
            //RunOnUiThread (delegate {
            wowZapp.LaffOutOut.Singleton.EnableMessageTimer();
            wowZapp.LaffOutOut.Singleton.CheckForUnsentMessages(context);
            getcontacts();
            //});
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.CreateAnimation);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewLoginHeader);
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);
            Header.headertext = Application.Context.Resources.GetString(Resource.String.animationTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            ImageButton imgUndo = FindViewById<ImageButton>(Resource.Id.imgUndo);
            ImageButton imgStamp = FindViewById<ImageButton>(Resource.Id.imgStamp);
            ImageButton imgPaint = FindViewById<ImageButton>(Resource.Id.imgPaint);
            ImageButton imgColour = FindViewById<ImageButton>(Resource.Id.imgColour);
            ImageButton imgText = FindViewById<ImageButton>(Resource.Id.imgText);
            ImageButton imgComix = FindViewById<ImageButton>(Resource.Id.imgComix);
            ImageButton imgSound = FindViewById<ImageButton>(Resource.Id.imgSound);
            ImageButton imgPicture = FindViewById<ImageButton>(Resource.Id.imgPicture);
            ImageButton imgConfig = FindViewById<ImageButton>(Resource.Id.imgConfig);
            ImageButton imgPlayAnimation = FindViewById<ImageButton>(Resource.Id.imgPlayAnimation);
            ImageButton btnHome = FindViewById<ImageButton>(Resource.Id.btnHome);
            drawer = FindViewById<SlidingDrawer>(Resource.Id.slidingDrawer1);
            sliderToggle = FindViewById<Button>(Resource.Id.handle);
            context = header.Context;

            brushImage = null;

            relLay = FindViewById<RelativeLayout>(Resource.Id.relativeLayout2);
            relLay.LayoutParameters = new LinearLayout.LayoutParams((int)wowZapp.LaffOutOut.Singleton.ScreenXWidth,
                (int)wowZapp.LaffOutOut.Singleton.ScreenXWidth);

            if (AnimationUtil.imagesForCanvas == null)
                AnimationUtil.imagesForCanvas = new List<Bitmap>();

            if (currentColor == null)
            {

                currentColor = new WZColor(ImageHelper.convColToByteArray(Color.Black));
                inactiveColor = new WZColor(ImageHelper.convColToByteArray(Color.Gray));
                colorUtil.color = ImageHelper.convWZColorToColor(currentColor);
            }

            if (currentBrush == null)
            {
                using (Bitmap myBrush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.HardBrush1))
                {
                    MemoryStream stream = new MemoryStream();
                    myBrush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                    brushImage = stream.ToArray();
                    currentBrush = new BrushItem(4f, AnimationTypesBrushType.Normal, currentColor, inactiveColor, brushImage);
                }
            }

            myBitmap = Bitmap.CreateBitmap((int)wowZapp.LaffOutOut.Singleton.ScreenXWidth,
                                            (int)wowZapp.LaffOutOut.Singleton.ScreenYHeight / 2 /*- (int)ImageHelper.convertDpToPixel (320f, context)*/, Bitmap.Config.Argb8888);
            AnimationUtil.imagesForCanvas.Add(myBitmap);
            canvas = new Canvas(myBitmap);

            if (AnimationUtil.theImage == null)
                AnimationUtil.theImage = new Dictionary<int, List<ImageAttr>>();
            if (AnimationUtil.imgAttr == null)
                AnimationUtil.imgAttr = new List<ImageAttr>();
            AnimationUtil.imgAttr.Add(new ImageAttr());
            AnimationUtil.currentImage = 0;

            relLay.AddView(new CreateAnimationDrawer(context, currentBrush, canvas, myBitmap));

            if (AudioItems == null || AudioItems.Count == 0)
                AudioItems = new Dictionary<int, AnimationAudioInfo>();

            CurrentLayer = new FrameLayerPair(1, 1);

            dbm = LaffOutOut.Singleton.dbm;

            drawerState = false;

            btnBack.Click += delegate
            {
                SaveAnimation();
                Finish();
            };

            btnHome.Click += delegate
            {
                Intent i = new Intent(this, typeof(Main.HomeActivity));
                i.SetFlags(ActivityFlags.ClearTop);
                StartActivity(i);
            };

            imgUndo.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgStamp.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgPaint.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgColour.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgText.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgComix.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgSound.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgPicture.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgConfig.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};

            imgPlayAnimation.Click += delegate
            {
                Intent m = new Intent(this, typeof(PlayAnimation));
                StartActivity(m);
            };
            modalPicture = new ImageView(context);
            percents = new TextView[4];
            colours = new ImageView[2];
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.ComposeTextMessageScreen);
            string passedIn = base.Intent.GetStringExtra ("text");

            ImageView btns = FindViewById<ImageView> (Resource.Id.imgNewloginHeader);
            TextView header = FindViewById<TextView> (Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout> (Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel (btns, header, relLayout, header.Context);
            context = header.Context;
            Header.headertext = Application.Context.Resources.GetString (Resource.String.sendMessageTextTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo (header.Context);
            header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            dbm = wowZapp.LaffOutOut.Singleton.dbm;
            mmg = wowZapp.LaffOutOut.Singleton.mmg;
            CurrentStepInc = base.Intent.GetIntExtra ("CurrentStep", 0);

            Button addContent = FindViewById<Button> (Resource.Id.btnAddContent);
            Button sendMessage = FindViewById<Button> (Resource.Id.btnMessageSend);
            ImageView useVoice = FindViewById<ImageView> (Resource.Id.imgVoice);
            text = FindViewById<EditText> (Resource.Id.editTextMessage);

            if (wowZapp.LaffOutOut.Singleton.resizeFonts) {
                float fSize = text.TextSize;
                text.SetTextSize (Android.Util.ComplexUnitType.Dip, ImageHelper.getNewFontSize (fSize, context));
            }

            if (!string.IsNullOrEmpty (passedIn))
                text.Text = passedIn;

            string rec = Android.Content.PM.PackageManager.FeatureMicrophone;
            if (rec != "android.hardware.microphone")
                useVoice.SetBackgroundResource (Resource.Drawable.nomicrophone2);
            else
                useVoice.Click += new EventHandler (recordVoice);

            text.TextChanged += delegate {
                if (text.Text.Length > 500)
                    text.Text = text.Text.Substring (0, 500);
            };

            sendMessage.Click += delegate {
                SendTextMessage ();
            };

            ImageButton btnBack = FindViewById<ImageButton> (Resource.Id.btnBack);
            btnBack.Click += delegate {
                Finish ();
            };

            addContent.Click += delegate {
                if (!string.IsNullOrEmpty (text.Text)) {
                    MessageStep msgStep = new MessageStep ();
                    msgStep.MessageText = text.Text;
                    msgStep.StepType = MessageStep.StepTypes.Text;

                    if (CurrentStepInc > ComposeMessageMainUtil.msgSteps.Count) {
                        msgStep.StepNumber = ComposeMessageMainUtil.msgSteps.Count + 1;
                        ComposeMessageMainUtil.msgSteps.Add (msgStep);
                    } else {
                        msgStep.StepNumber = CurrentStepInc;
                        ComposeMessageMainUtil.msgSteps [CurrentStepInc - 1] = msgStep;
                    }

                    if (CurrentStepInc == 1) {
                        StartActivity (typeof(ComposeMessageMainActivity));
                        Finish ();
                    } else {
                        Finish ();
                    }
                    ComposeGenericResults.success = true;
                } else
                    Finish ();
            };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ComposeMessageMain);
            readOnly = base.Intent.GetBooleanExtra("readonly", false);

            dbm = wowZapp.LaffOutOut.Singleton.dbm;
            mmg = wowZapp.LaffOutOut.Singleton.mmg;
            Guid profPic = Guid.Empty;
            UserDB user = null;
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewLoginHeader);
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);
            context = header.Context;

            Header.headertext = Application.Context.Resources.GetString(Resource.String.messageCreateMessageTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            imgProfilePic = FindViewById<ImageView>(Resource.Id.imgProfilePic);
            imgProfilePic.SetBackgroundResource(Resource.Drawable.emptybackground);
            hasMoved = regenerate = false;

            this.thumbImageWidth = (int)ImageHelper.convertDpToPixel(80f, context);
            this.thumbImageHeight = (int)ImageHelper.convertDpToPixel(100f, context);

            btnSend = FindViewById<Button>(Resource.Id.btnSend);
            btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            btnBack.Tag = 0;
            btnHome = FindViewById<ImageButton>(Resource.Id.btnHome);
            btnHome.Tag = 1;
            btnPlay = FindViewById<ImageView>(Resource.Id.imgPlay);
            btnPlay.Click += new EventHandler(btnPlay_Click);
            txtFullname = FindViewById<TextView>(Resource.Id.txtAuthorName);
            txtMessage = FindViewById<TextView>(Resource.Id.txtMainMessage);
            LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder);

            ImageButton[] buttons = new ImageButton[2];
            buttons [0] = btnBack;
            buttons [1] = btnHome;
            ImageHelper.setupButtonsPosition(buttons, bottom, context);

            if (ComposeMessageMainUtil.contentPackID == null)
                ComposeMessageMainUtil.contentPackID = new int[7];

            for (int i = 0; i < 6; ++i)
                ComposeMessageMainUtil.contentPackID [i] = -1;

            txtMessage.Click += delegate
            {
                int n = 0, t = -1;
                for (n = 0; n < ComposeMessageMainUtil.currentPosition.Length; ++n)
                {
                    if (ComposeMessageMainUtil.currentPosition [n] == 0)
                    {
                        t = n;
                        break;
                    }
                }
                if (n == ComposeMessageMainUtil.currentPosition.Length)
                {
                    for (n = 0; n < ComposeMessageMainUtil.currentPosition.Length; ++n)
                    {
                        if (ComposeMessageMainUtil.msgSteps [n].StepType == MessageStep.StepTypes.Text)
                        {
                            if (ComposeMessageMainUtil.msgSteps [n].MessageText == txtMessage.Text)
                            {
                                t = n;
                                break;
                            }
                        }
                    }
                    if (t == -1)
                        RunOnUiThread(() => Toast.MakeText(context, Application.Context.GetString(Resource.String.errorNoSpaceForText), ToastLength.Short).Show());
                } else
                {
                    RunOnUiThread(delegate
                    {
                        Intent it = new Intent(this, typeof(ComposeTextMessageActivity));
                        it.PutExtra("text", txtMessage.Text != Application.Context.Resources.GetString(Resource.String.composeTextMessagelblMessage) ?
                                     ComposeMessageMainUtil.msgSteps [t].MessageText : string.Empty);
                        it.PutExtra("CurrentStep", base.Intent.GetIntExtra("CurrentStep", 1));
                        StartActivity(it);
                    });
                }
            };

            imgSteps = new ImageView[6];
            imgSets = new bool[6];
            imgSteps [0] = FindViewById<ImageView>(Resource.Id.imgStep1);
            imgSteps [0].Tag = 0;
            imgSteps [1] = FindViewById<ImageView>(Resource.Id.imgStep2);
            imgSteps [1].Tag = 1;
            imgSteps [2] = FindViewById<ImageView>(Resource.Id.imgStep3);
            imgSteps [2].Tag = 2;
            imgSteps [3] = FindViewById<ImageView>(Resource.Id.imgStep4);
            imgSteps [3].Tag = 3;
            imgSteps [4] = FindViewById<ImageView>(Resource.Id.imgStep5);
            imgSteps [4].Tag = 4;
            imgSteps [5] = FindViewById<ImageView>(Resource.Id.imgStep6);
            imgSteps [5].Tag = 5;
            for (int z = 0; z < 6; ++z)
                imgSets [z] = true;
            bool multi = false;

            if (ComposeMessageMainUtil.messageDB != null)
            {
                if (ComposeMessageMainUtil.messageDB.MessageRecipientDBList != null)
                {
                    int n = 0;
                    for (int j = 0; j < ComposeMessageMainUtil.currentPosition.Length; ++j)
                        ComposeMessageMainUtil.currentPosition [j] = 0;
                    regenerateIcons();
                    foreach (MessageStepDB mesg in ComposeMessageMainUtil.messageDB.MessageStepDBList)
                    {
                        #if DEBUG
                        Console.WriteLine("MessageStepDB item = {0}", mesg);
                        #endif
                        MessageStep mSt = MessageStepDB.ConvertFromMessageStepDB(mesg);
                        ComposeMessageMainUtil.msgSteps.Add(mSt);
                        ComposeMessageMainUtil.currentPosition [n] = 1;
                    }
                }
            }

            if (readOnly)
            {
                user = dbm.GetUserWithAccountID(ComposeMessageMainUtil.messageDB.FromAccountID.ToString());
                if (ComposeMessageMainUtil.messageDB.MessageRecipientDBList.Count > 1)
                    multi = true;
                if (user.Picture.Length == 0)
                    profPic = user.AccountID;
                else
                    loadProfilePicture(user, imgProfilePic);
            } else
            {
                user = UserDB.ConvertFromUser(AndroidData.CurrentUser);
                if (AndroidData.CurrentUser.Picture.Length == 0)
                    profPic = AndroidData.CurrentUser.AccountID;
                else
                    loadProfilePicture(user, imgProfilePic);
            }

            imgProfilePic.Tag = new Java.Lang.String("profilepic_" + user.AccountID);
            string name = user.FirstName + " " + user.LastName;
            if (multi == true)
            {
                if (ComposeMessageMainUtil.messageDB == null)
                    name += " and " + (Contacts.SelectContactsUtil.selectedContacts.Count - 1).ToString() +
                        (Contacts.SelectContactsUtil.selectedContacts.Count - 1 > 1 ? " others" : "other");
                else
                    name += " and " + (ComposeMessageMainUtil.messageDB.MessageRecipientDBList.Count - 1).ToString() +
                        (ComposeMessageMainUtil.messageDB.MessageRecipientDBList.Count - 1 > 1 ? " others" : "other");
            }
            float fontSize = txtFullname.TextSize;
            txtFullname.SetTextSize(Android.Util.ComplexUnitType.Dip, ImageHelper.getNewFontSize(fontSize, context));
            txtFullname.Text = name;
            fontSize = txtMessage.TextSize;
            txtMessage.SetTextSize(Android.Util.ComplexUnitType.Dip, ImageHelper.getNewFontSize(fontSize, context));
            if (readOnly == false)
            {
                for (int n = 0; n < 6; ++n)
                {

                    if (imgSets [n])
                    {
                        int step = new int();
                        step = n;
                        imgSteps [step].Click -= (object s, EventArgs e) => {
                            imgClickEvent(s, e, 9, step);};
                        imgSteps [step].Click += (object s, EventArgs e) => {
                            imgClickEvent(s, e, 9, step);};
                    }
                    imgSteps [n].SetOnLongClickListener(this);
                }

                ReloadMessageSteps();
            } else
            {
                this.SetButtonImagesForMessageSteps();
                header.Text = Application.Context.Resources.GetString(Resource.String.messageReadMessage);
                btnSend.Visibility = ViewStates.Invisible;
                ImageView a1 = FindViewById<ImageView>(Resource.Id.arrow1);
                ImageView a2 = FindViewById<ImageView>(Resource.Id.arrow2);
                ImageView a3 = FindViewById<ImageView>(Resource.Id.arrow3);
                ImageView a4 = FindViewById<ImageView>(Resource.Id.arrow4);
                a1.Visibility = a2.Visibility = a3.Visibility = a4.Visibility = ViewStates.Invisible;
            }

            co = 0;

            btnBack.Click += delegate
            {
                for (int i = 0; i < 6; ++i)
                    ComposeMessageMainUtil.currentPosition [i] = 0;
                for (int i = 0; i < 7; ++i)
                    ComposeMessageMainUtil.contentPackID [i] = -1;
                ComposeMessageMainUtil.message = null;
                ComposeMessageMainUtil.messageDB = null;
                ComposeMessageMainUtil.msgSteps = null;
                ComposeMessageMainUtil.pollSteps = null;
                Finish();
            };
            btnHome.Click += delegate
            {
                Intent i = new Intent(this, typeof(Main.HomeActivity));
                i.AddFlags(ActivityFlags.ClearTop);
                StartActivity(i);
            };

            btnSend.Click += delegate
            {
                SendMessage();
                Finish();
            };

            if (profPic != Guid.Empty)
            {
                Guid finder = profPic != Guid.Empty ? profPic : AndroidData.CurrentUser.AccountID;
                LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint);
                service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted;
                service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, finder, new Guid(AndroidData.ServiceAuthToken));
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.CreateAudioMessage);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewLoginHeader);
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);
            Header.headertext = Application.Context.Resources.GetString(Resource.String.audioTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;
            CurrentStepInc = base.Intent.GetIntExtra("CurrentStep", 1);
            isPlayback = base.Intent.GetBooleanExtra("playback", false);
            filename = base.Intent.GetStringExtra("filename");
            time = 15;
            up = 0;
            btnRecord = FindViewById<ImageButton>(Resource.Id.btnRecord);
            btnPlay = FindViewById<ImageButton>(Resource.Id.btnPlay);
            Button btnSend = FindViewById<Button>(Resource.Id.btnSend);
            Button btnAdd = FindViewById<Button>(Resource.Id.btnAdd);

            progress = FindViewById<ProgressBar>(Resource.Id.progressBar1);
            context = progress.Context;
            mmg = wowZapp.LaffOutOut.Singleton.mmg;
            timer = new System.Timers.Timer();
            timer.Interval = 1000;
            timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
            isRecording = false;

            string filename2 = Path.Combine(wowZapp.LaffOutOut.Singleton.ContentDirectory, "voice_msg_");
            filename2 += CurrentStepInc.ToString() + ".3gp";
            path = string.Format(filename2, CurrentStepInc);

            if (string.IsNullOrEmpty(filename))
                filename = path;

            if (File.Exists(filename))
                File.Delete(filename);

            ar = new AudioRecorder(filename);
            ap = new AudioPlayer(context);

            #if DEBUG
            System.Diagnostics.Debug.WriteLine("Filename audio being saved as = {0}", filename);
            #endif

            btnRecord.Click += new EventHandler(btnRecord_Click);

            btnSend.Click += delegate
            {
                SendAudioMessage();
            };

            btnAdd.Click += delegate
            {
                AddToMessages();
            };

            dbm = wowZapp.LaffOutOut.Singleton.dbm;

            if (isPlayback == true)
            {
                btnRecord.Visibility = ViewStates.Gone;
                btnPlay.Click += new EventHandler(btnPlay_Click);
            } else
            {
                btnPlay.Click += new EventHandler(btnStop_Click);
                btnPlay.SetBackgroundResource(Resource.Drawable.stopbutton);
            }

            rectime = 16;

            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            btnBack.Tag = 0;
            ImageButton btnHome = FindViewById<ImageButton>(Resource.Id.btnHome);
            btnHome.Tag = 1;

            btnBack.Click += delegate
            {
                ar.cancelOut();
                Finish();
            };
            btnHome.Click += delegate
            {
                ar.cancelOut();
                Intent i = new Intent(this, typeof(Main.HomeActivity));
                i.AddFlags(ActivityFlags.ClearTop);
                StartActivity(i);
            };

            ImageButton[] buttons = new ImageButton[2];
            LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder);
            buttons [0] = btnBack;
            buttons [1] = btnHome;
            ImageHelper.setupButtonsPosition(buttons, bottom, context);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            Window.AddFlags (WindowManagerFlags.KeepScreenOn);
            SetContentView (Resource.Layout.previewSoundFX);

            if (MessageReceivedUtil.userFrom != null) {
                UserDB user = UserDB.ConvertFromUser (MessageReceivedUtil.userFrom);
                Header.headertext = user.FirstName + " " + user.LastName;
                MessageReceivedUtil.userFrom = null;
            } else {
                if (MessagePlaybackUtil.recipients != null) {
                    for (int i = 0; i < MessagePlaybackUtil.recipients.Count; ++i) {
                        if (MessagePlaybackUtil.recipients [i] != null) {
                            Header.headertext = MessagePlaybackUtil.recipients [i].FirstName + " " + MessagePlaybackUtil.recipients [i].LastName;
                            break;
                        }
                    }
                    //}
                } else
                    Header.headertext = "Ann Onymouse";
            }
            linView = FindViewById<LinearLayout> (Resource.Id.linearHolder);
            context = linView.Context;

            ImageView btns = FindViewById<ImageView> (Resource.Id.imgNewUserHeader);
            TextView header = FindViewById<TextView> (Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout> (Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel (btns, header, relLayout, header.Context);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo (header.Context);
            header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            parent = linView;
            //preview = FindViewById<ImageView> (Resource.Id.imgComicon);
            progress = FindViewById<ProgressBar> (Resource.Id.prgPreview);
            co = base.Intent.GetIntExtra ("position", 0);
            counter = MessagePlaybackUtil.messageSteps.Count;
            dbm = wowZapp.LaffOutOut.Singleton.dbm;
            isPlaying = false;

            stepID = Guid.Empty;

            #if DEBUG
            System.Diagnostics.Debug.WriteLine ("number of steps = {0}", counter);
            #endif
            linView.RemoveAllViewsInLayout ();
            t = new System.Timers.Timer ();
            t.Interval = 2500;
            t.Elapsed += new System.Timers.ElapsedEventHandler (t_Elapsed);

            increments = 100 / (counter + 1);

            if (co != 0) {
                RunOnUiThread (() => progress.Progress = co * increments);
                increments *= co + co;
            }

            if (MessagePlaybackUtil.markAsRead) {
                ThreadPool.QueueUserWorkItem (delegate {
                    Guid messageID = MessagePlaybackUtil.messageSteps [0].MessageID;

                    LOLMessageClient service = new LOLMessageClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint);
                    service.MessageMarkReadCompleted += Service_MessageMarkReadCompleted;
                    service.MessageMarkReadAsync (messageID, AndroidData.CurrentUser.AccountID, AndroidData.NewDeviceID, new Guid (AndroidData.ServiceAuthToken), messageID);
                });
            }

            ImageButton btnPreAdd = FindViewById<ImageButton> (Resource.Id.imgAdd);
            btnPreAdd.Tag = 1;
            ImageButton btnBack = FindViewById<ImageButton> (Resource.Id.btnBack);
            btnBack.Tag = 0;
            btnBack.Click += delegate {
                Window.ClearFlags (WindowManagerFlags.KeepScreenOn);
                Finish ();
            };
            LinearLayout bottom = FindViewById<LinearLayout> (Resource.Id.bottomHolder);
            ImageButton[] buttons = new ImageButton[2];
            buttons [0] = btnBack;
            buttons [1] = btnPreAdd;
            ImageHelper.setupButtonsPosition (buttons, bottom, context);

            if (MessageReceivedUtil.readOnly)
                btnPreAdd.Visibility = ViewStates.Invisible;
            else
                btnPreAdd.Click += delegate {
                    StartActivity (typeof(ComposeMessageChooseContent));
                };
            #if DEBUG
            int m = 0;
            foreach (MessageStep eachMessageStep in MessagePlaybackUtil.messageSteps)
                System.Diagnostics.Debug.WriteLine ("step {0} = {1}", m++, eachMessageStep.StepType.ToString ());
            #endif

            RunOnUiThread (delegate {
                PrepareViews (co);
            });
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ContentPackItem);
            fromAnimation = base.Intent.GetBooleanExtra("fromanimation", false);
            listContentPack = FindViewById<LinearLayout>(Resource.Id.listContentPack);
            TextView txtContentPackHeader = FindViewById<TextView>(Resource.Id.txtContentPackHeader);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, txtContentPackHeader, relLayout, txtContentPackHeader.Context);
            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            isAnimation = base.Intent.GetBooleanExtra("animated", false); // false = not from animation
            Header.headertext = base.Intent.GetStringExtra("ContentPackTitle").ToUpper();
            currentStep = base.Intent.GetIntExtra("CurrentStep", 1);
            context = listContentPack.Context;

            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(txtContentPackHeader.Context);
            txtContentPackHeader.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            txtContentPackHeader.Text = Header.headertext;
            isSet = false;
            contentPackID = base.Intent.GetIntExtra("packid", -1);
            iconFile = "";
            packType = ContentPackActivity.packType;
            ContentPath = wowZapp.LaffOutOut.Singleton.ContentDirectory;
            dbm = wowZapp.LaffOutOut.Singleton.dbm;
            packItems = new List<ContentPackItemDB>();
            contentPackItems = new Dictionary<string, ContentPackItem>();
            btnBack.Click += delegate
            {
                sendBack(true);
            };
            Button btnDone = FindViewById<Button>(Resource.Id.btnDone);
            btnDone.Click += delegate
            {
                sendBack(!isSet);
            };
            isPreview = false;
            LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder);
            ImageHelper.setupButtonsPosition(btnBack, btnDone, bottom, context);
            layouts = new LinearLayout[4];
            size = 100f;
            if (wowZapp.LaffOutOut.Singleton.resizeFonts)
                size *= wowZapp.LaffOutOut.Singleton.bigger;
            getContentPackItems();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.GetConnectedContacts);

            db = wowZapp.LaffOutOut.Singleton.dbm;

            isFind = base.Intent.GetBooleanExtra("isfind", true);
            selectedContacts = new List<Contact>();
            searchResults = new List<Contact>();
            contacts = new List<Contact>();

            if (ContactsUtil.contacts == null)
                ContactsUtil.contacts = new List<ContactDB>();

            search = FindViewById<EditText>(Resource.Id.editSearch);
            Button cont = FindViewById<Button>(Resource.Id.btnGetConnectedContinue);
            scroller = FindViewById<ScrollView>(Resource.Id.scrollViewContainer);
            listContainer = FindViewById<LinearLayout>(Resource.Id.linearListContainer);

            context = scroller.Context;

            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);

            Header.headertext = Application.Context.Resources.GetString(Resource.String.getconnectedTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            int netType = base.Intent.GetIntExtra("type", 0);
            switch (netType)
            {
                case 1:
                    this.networkType = AccountOAuth.OAuthTypes.Google;
                    if (string.IsNullOrEmpty(AndroidData.GooglePlusAccessToken))
                    {
                        this.Provider = new LGooglePlusManager(LOLConstants.GooglePlusConsumerKey, LOLConstants.GooglePlusConsumerSecret, new HttpHelper());
                        gg = false;
                    } else
                    {
                        this.Provider = new LGooglePlusManager(LOLConstants.GooglePlusConsumerKey, LOLConstants.GooglePlusConsumerSecret, AndroidData.GooglePlusAccessToken, AndroidData.GooglePlusRefreshToken,
                            AndroidData.GoogleAccessTokenExpiration, new HttpHelper());
                        gg = true;
                    }
                    break;

                case 2:
                    this.networkType = AccountOAuth.OAuthTypes.LinkedIn;
                    if (string.IsNullOrEmpty(AndroidData.LinkedInAccessToken))
                    {
                        this.Provider = new LLinkedInManager(LOLConstants.LinkedInConsumerKey, LOLConstants.LinkedInConsumerSecret, string.Empty, string.Empty);
                        gl = false;
                    } else
                    {
                        this.Provider = new LLinkedInManager(LOLConstants.LinkedInConsumerKey, LOLConstants.LinkedInConsumerSecret, AndroidData.LinkedInAccessToken, AndroidData.LinkedInAccessTokenSecret);
                        gl = true;
                    }
                    break;

                case 3:
                    this.networkType = AccountOAuth.OAuthTypes.FaceBook;
                    if (string.IsNullOrEmpty(AndroidData.FacebookAccessToken))
                    {
                        gf = false;
                        this.Provider = new LFacebookManager(LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret);
                    } else
                    {
                        this.Provider = new LFacebookManager(LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret, AndroidData.FacebookAccessToken, AndroidData.FacebookAccessTokenExpiration);
                        gf = true;
                    }
                    break;
            }

            System.Threading.Tasks.Task.Factory.StartNew(() => SetDataSources());

            cont.Click += (object s, EventArgs e) => {
                cont_Click(); };
            search.Clickable = true;
            search.TextChanged += delegate
            {
                #if DEBUG
                System.Diagnostics.Debug.WriteLine("Text changed - now is {0}", search.Text);
                #endif
                FilterContacts();
            };
        }
예제 #20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            dbm = wowZapp.LaffOutOut.Singleton.dbm;
            SetContentView(Resource.Layout.MessageLists);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader);
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);

            Header.headertext = MessageConversations.firstUserName;
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;
            clearView = false;
            listWrapper = FindViewById<LinearLayout>(Resource.Id.linearListWrapper);
            context = listWrapper.Context;
            //ViewGroup Parent = listWrapper;
            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            btnBack.Tag = 0;
            ImageButton btnHome = FindViewById<ImageButton>(Resource.Id.btnHome);
            btnHome.Tag = 1;
            ImageButton btnAdd = FindViewById<ImageButton>(Resource.Id.btnAdd);
            btnAdd.Tag = 2;
            Messages.MessageReceivedUtil.FromMessagesDone = false;
            Messages.MessageReceivedUtil.FromMessages = true;

            if (messageUsers == null)
                messageUsers = new List<UserDB>();
            else
                messageUsers.Clear();

            if (getGuid == null)
                getGuid = new List<Guid>();
            else
                getGuid.Clear();

            LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder);
            ImageButton[] buttons = new ImageButton[3];
            buttons [0] = btnBack;
            buttons [1] = btnHome;
            buttons [2] = btnAdd;
            ImageHelper.setupButtonsPosition(buttons, bottom, context);
            ContentPath = wowZapp.LaffOutOut.Singleton.ContentDirectory;
            scroller = FindViewById<ScrollView>(Resource.Id.scrollViewContainer);
            btnBack.Click += delegate
            {
                wowZapp.LaffOutOut.Singleton.ReceivedMessages -= AppDelegate_ReceivedMessages;
                Intent resultData = new Intent();
                SetResult(Result.Ok, resultData);
                Finish();
            };
            //

            btnHome.Click += delegate
            {
                wowZapp.LaffOutOut.Singleton.ReceivedMessages -= AppDelegate_ReceivedMessages;
                Intent i = new Intent(this, typeof(Main.HomeActivity));
                i.SetFlags(ActivityFlags.ClearTop);
                StartActivity(i);
            };

            btnAdd.Click += delegate
            {
                wowZapp.LaffOutOut.Singleton.ReceivedMessages -= AppDelegate_ReceivedMessages;
                Intent i = new Intent(this, typeof(ComposeMessageChooseContent));
                ComposeMessageMainUtil.returnTo = true;
                StartActivity(i);
            };

            RunOnUiThread(delegate
            {
                progress = ProgressDialog.Show(context, Application.Context.Resources.GetString(Resource.String.messageRefreshingMessages),
                                                Application.Context.Resources.GetString(Resource.String.commonOneSec));
            });

            wowZapp.LaffOutOut.Singleton.ReceivedMessages += AppDelegate_ReceivedMessages;

            float tSize = ImageHelper.convertDpToPixel(56f, context);
            imageSize = new float[2];
            imageSize [0] = imageSize [1] = tSize;
            if (wowZapp.LaffOutOut.Singleton.resizeFonts)
                imageSize = ImageHelper.getNewSizes(imageSize, context);
            RunOnUiThread(() => CreateMessagesUI());
            LaffOutOut.Singleton.mmg.MessageSendConfirmCompleted += MessageManager_MessageSendConfirmCompleted;
        }
 public ContentCacheManager()
 {
     this.cacheLock = new object ();
     dbm = wowZapp.LaffOutOut.Singleton.dbm;
     ContentPath = wowZapp.LaffOutOut.Singleton.ContentDirectory;
 }
예제 #22
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     dbm = wowZapp.LaffOutOut.Singleton.dbm;
     mmg = wowZapp.LaffOutOut.Singleton.mmg;
     MessageItems = new Dictionary<Guid, MessageInfo>();
     contentPackItems = new Dictionary<int, ContentPackItem>();
     this.voiceFiles = new Dictionary<int, string>();
     this.contacts = new Dictionary<Guid, ContactDB>();
     this.pollSteps = new Dictionary<int, PollingStep>();
     this.conversationItems = new Dictionary<string, ConversationInfo>();
     this.animationStep = new Dictionary<int, AnimationInfo>();
     ContentPath = wowZapp.LaffOutOut.Singleton.ContentDirectory;
     isMe = AndroidData.CurrentUser.FirstName + " " + AndroidData.CurrentUser.LastName;
     SetContentView(Resource.Layout.previewSoundFX);
     context = MessageReceivedUtil.context;
     btns = FindViewById<ImageView>(Resource.Id.imgNewUserHeader);
     TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
     RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
     ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);
     UserDB user = dbm.GetUserWithAccountID(MessageReceivedUtil.message.FromAccountGuid);
     if (user == null)
         user = UserDB.ConvertFromUser(AndroidData.CurrentUser);
     MessageReceivedUtil.userFrom = UserDB.ConvertFromUserDB(user);
     Header.headertext = user.FirstName + " " + user.LastName;
     Header.fontsize = 36f;
     ImageHelper.fontSizeInfo(header.Context);
     header.SetTextSize(Android.Util.ComplexUnitType.Pt, Header.fontsize);
     header.Text = Header.headertext;
     RunOnUiThread(delegate
     {
         progress = ProgressDialog.Show(context, Application.Context.Resources.GetString(Resource.String.messageViewingMessage),
                                                 Application.Context.Resources.GetString(Resource.String.messageViewingPleaseWait));
     });
     processMessages(MessageReceivedUtil.message);
     PlayMessage(MessageReceivedUtil.message);
     markAsRead = true;
     Finish();
 }