private void iniMenu(){ mainLayout = new RelativeLayout (this); _foro = new LOContainerView (this); _dialogDownload = new ProgressDialog (this); _dialogDownload.SetCancelable (false); _dialogDownload.SetMessage ("Downloading..."); txtUserName = new TextView (this); txtCurse = new TextView (this); txtSchoolName = new TextView (this); txtUserRol = new TextView (this); txtPorcentaje = new TextView (this); txtCurseTitle = new TextView (this); txtTaskTitle = new TextView (this); txtPendiente = new TextView (this); txtValorBarra = new TextView (this); imgChat = new ImageView (this); imgUser = new ImageView (this); imgSchool = new ImageView (this); imgNotificacion = new ImageView (this); imgCurse = new ImageView (this); imgTask = new ImageView (this); linearBarraCurso = new LinearLayout (this); linearCurse= new LinearLayout (this); linearSchool= new LinearLayout (this); linearTask= new LinearLayout (this); linearUserData= new LinearLayout (this); linearUser = new LinearLayout (this); linearListCurso = new LinearLayout (this); linearListTask = new LinearLayout (this); linearList = new LinearLayout (this); linearPendiente = new LinearLayout (this); linearTxtValorBarra = new LinearLayout (this); listCursos = new ListView (this); listTasks = new ListView (this); mItemsChat = new List<ChatDataRow> (); mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1); Drawable d = new BitmapDrawable (getBitmapFromAsset ("icons/fondo.png")); mainLayout.SetBackgroundDrawable (d); d = null; linearBarraCurso.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent); linearCurse.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(50)); linearTask.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(50)); linearSchool.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent); linearUserData.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent); linearUser.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent); linearListCurso.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(250)); linearListTask.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent); linearList.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent); linearPendiente.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (30), Configuration.getWidth (30)); linearTxtValorBarra.LayoutParameters = new LinearLayout.LayoutParams (-1, -2); linearBarraCurso.Orientation = Orientation.Vertical; linearBarraCurso.SetGravity (GravityFlags.Center); linearTxtValorBarra.Orientation = Orientation.Vertical; linearTxtValorBarra.SetGravity (GravityFlags.Center); txtValorBarra.Gravity = GravityFlags.Center; linearCurse.Orientation = Orientation.Horizontal; linearCurse.SetGravity (GravityFlags.CenterVertical); linearTask.Orientation = Orientation.Horizontal; linearTask.SetGravity (GravityFlags.CenterVertical); linearSchool.Orientation = Orientation.Horizontal; //linearSchool.SetGravity (GravityFlags.CenterVer); linearUserData.Orientation = Orientation.Vertical; linearUserData.SetGravity (GravityFlags.Center); linearUser.Orientation = Orientation.Vertical; linearUser.SetGravity (GravityFlags.CenterHorizontal); linearListCurso.Orientation = Orientation.Vertical; linearListTask.Orientation = Orientation.Vertical; linearList.Orientation = Orientation.Vertical; linearPendiente.Orientation = Orientation.Horizontal; linearPendiente.SetGravity (GravityFlags.Center); //linearList.SetGravity (GravityFlags.CenterVertical); progressBar = new ProgressBar (this,null,Android.Resource.Attribute.ProgressBarStyleHorizontal); progressBar.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (274), Configuration.getHeight (32)); progressBar.ProgressDrawable = Resources.GetDrawable (Resource.Drawable.progressBackground); progressBar.Progress = 60; txtValorBarra.Text = "60%"; //progressBar.text txtValorBarra.SetY(13); txtCurse.Text = "Cursos del 2015"; txtCurse.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); // txtUserName.Text ="David Spencer"; txtUserName.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); txtUserRol.Text ="Alumno"; txtUserRol.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); txtSchoolName.Text ="Colegio Sagrados Corazones"; txtSchoolName.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); txtPorcentaje.Text = "60%"; txtPorcentaje.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); txtCurseTitle.Text = "CURSOS"; txtCurseTitle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); txtTaskTitle.Text = "TAREAS"; txtTaskTitle.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); txtPendiente.Text = "1"; txtPendiente.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); txtPendiente.SetY (-10); txtPendiente.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (30)); txtUserName.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (35)); txtUserRol.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (30)); txtCurseTitle.SetPadding (Configuration.getWidth (48), 0, 0, 0); txtTaskTitle.SetPadding (Configuration.getWidth (48), 0, 0, 0); txtCurse.SetTextColor (Color.ParseColor ("#ffffff")); txtUserName.SetTextColor (Color.ParseColor ("#ffffff")); txtUserRol.SetTextColor (Color.ParseColor ("#999999")); txtSchoolName.SetTextColor (Color.ParseColor ("#ffffff")); txtPorcentaje.SetTextColor (Color.ParseColor ("#ffffff")); txtPendiente.SetTextColor (Color.ParseColor ("#ffffff")); txtTaskTitle.SetTextColor (Color.ParseColor ("#ffffff")); txtCurseTitle.SetTextColor (Color.ParseColor ("#ffffff")); txtValorBarra.SetTextColor (Color.ParseColor ("#ffffff")); txtUserName.Gravity = GravityFlags.CenterHorizontal; txtUserRol.Gravity = GravityFlags.CenterHorizontal; txtCurse.Gravity = GravityFlags.CenterHorizontal; imgChat.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/chat.png"),Configuration.getWidth (45), Configuration.getWidth (40),true)); imgUser.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/user.png"),Configuration.getWidth (154), Configuration.getHeight (154),true)); imgSchool.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/colegio.png"),Configuration.getWidth (29), Configuration.getHeight (29),true)); imgNotificacion.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/notif.png"),Configuration.getWidth (35), Configuration.getWidth (40),true)); imgCurse.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/curso.png"),Configuration.getWidth (23), Configuration.getHeight (28),true)); imgTask.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/vertareas.png"),Configuration.getWidth (23), Configuration.getHeight (28),true)); Drawable drPendiente = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/pendiente.png"), Configuration.getWidth(30), Configuration.getWidth(30), true)); linearPendiente.SetBackgroundDrawable (drPendiente); drPendiente = null; imgCurse.SetPadding (Configuration.getWidth (68), 0, 0, 0); imgTask.SetPadding(Configuration.getWidth(68),0,0,0); linearCurse.SetBackgroundColor(Color.ParseColor("#0d1216")); linearTask.SetBackgroundColor (Color.ParseColor ("#0d1216")); linearBarraCurso.AddView (txtCurse); linearBarraCurso.AddView (progressBar); linearTxtValorBarra.AddView (txtValorBarra); linearCurse.AddView (imgCurse); linearCurse.AddView (txtCurseTitle); linearTask.AddView (imgTask); linearTask.AddView (txtTaskTitle); linearPendiente.AddView (txtPendiente); imgSchool.SetPadding (Configuration.getWidth(68),0,0,0); txtSchoolName.SetPadding (Configuration.getWidth(40),0,0,0); linearSchool.AddView (imgSchool); linearSchool.AddView (txtSchoolName); linearUser.AddView (txtUserName); linearUser.AddView (txtUserRol); linearUserData.AddView (imgUser); linearUserData.AddView (linearUser); linearListCurso.AddView (listCursos); linearListTask.AddView (listTasks); linearList.AddView (linearCurse); linearList.AddView (linearListCurso); linearList.AddView (linearTask); linearList.AddView (linearListTask); imgChat.SetX (Configuration.getWidth(59)); imgChat.SetY (Configuration.getHeight(145)); imgChat.Click += delegate { mDrawerLayout.CloseDrawer (mLeftDrawer); mDrawerLayout.OpenDrawer (mRightDrawer); }; imgNotificacion.SetX (Configuration.getWidth(59)); imgNotificacion.SetY (Configuration.getHeight(233)); imgNotificacion.Click += delegate { mDrawerLayout.CloseDrawer (mLeftDrawer); main_ContentView.RemoveAllViews (); main_ContentView.AddView(new NotificationView(this)); }; linearPendiente.SetX (Configuration.getWidth(94)); linearPendiente.SetY (Configuration.getHeight(217)); linearUserData.SetX (0); linearUserData.SetY (Configuration.getHeight(130)); linearBarraCurso.SetX (0); linearBarraCurso.SetY (Configuration.getHeight(412)); linearTxtValorBarra.SetX (0); linearTxtValorBarra.SetY (Configuration.getHeight(443)); linearSchool.SetX (0); linearSchool.SetY (Configuration.getHeight(532)); linearList.SetX (0); linearList.SetY (Configuration.getHeight(583)); Bitmap bm; txtUserName.Text = vm.UserFirstName + " "+ vm.UserLastName; if (vm.UserImage != null) { bm = BitmapFactory.DecodeByteArray (vm.UserImage, 0, vm.UserImage.Length); Bitmap newbm = Configuration.GetRoundedCornerBitmap (Bitmap.CreateScaledBitmap (bm,Configuration.getWidth (154), Configuration.getHeight (154),true)); imgUser.SetImageBitmap (newbm); newbm = null; } bm = null; mainLayout.AddView (imgChat); mainLayout.AddView (imgNotificacion); mainLayout.AddView (linearPendiente); mainLayout.AddView (linearUserData); mainLayout.AddView (linearBarraCurso); mainLayout.AddView (linearTxtValorBarra); mainLayout.AddView (linearSchool); mainLayout.AddView (linearList); imgChat = null; imgNotificacion = null; imgCurse = null; imgTask = null; imgSchool = null; imgUser = null; }
protected override void OnCreate(Bundle bundle) { this.Window.AddFlags(WindowManagerFlags.Fullscreen); base.OnCreate(bundle); SetContentView(Resource.Layout.MainView); vm = this.ViewModel as MainViewModel; vm.PropertyChanged += Vm_PropertyChanged; loWallView = new WallView(this); currentIndexLO = 0; LinearLayout linearMainLayout = FindViewById<LinearLayout>(Resource.Id.left_drawer); /*scrollIndice = new ScrollView (this); scrollIndice.LayoutParameters = new ScrollView.LayoutParams (-1,400); linearContentIndice = new LinearLayout (this); linearContentIndice.LayoutParameters = new LinearLayout.LayoutParams (-1, 800); linearContentIndice.Orientation = Orientation.Vertical; linearContentIndice.SetBackgroundColor (Color.Red); scrollIndice.AddView (linearContentIndice); */ var metrics = Resources.DisplayMetrics; widthInDp = ((int)metrics.WidthPixels); heightInDp = ((int)metrics.HeightPixels); Configuration.setWidthPixel (widthInDp); Configuration.setHeigthPixel (heightInDp); task = new TaskView (this); iniMenu (); mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar); SetSupportActionBar(mToolbar); mToolbar.SetNavigationIcon (Resource.Drawable.hamburger); mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); mLeftDrawer = FindViewById<LinearLayout>(Resource.Id.left_drawer); mRightDrawer = FindViewById<LinearLayout>(Resource.Id.right_drawer); mLeftDrawer.Tag = 0; mRightDrawer.Tag = 1; frameLayout = FindViewById<FrameLayout> (Resource.Id.content_frame); main_ContentView = new RelativeLayout (this); main_ContentView.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1); // main_ContentView.AddView (scrollIndice); //main_ContentView.AddView(linearContentIndice); LOContainerView LOContainer = new LOContainerView (this); //main_ContentView.AddView (LOContainer); //WallView wallview = new WallView(this); //wallview.OpenLO.Click += Lo_ImagenLO_Click; //lo.OpenTasks.Click += ListTasks_ItemClick; //wallview.OpenChat.Click += imBtn_Chat_Click; //wallview.OpenUnits.Click += imBtn_Units_Click; loWallView.OpenChat.Click += imBtn_Chat_Click; loWallView.OpenUnits.Click += imBtn_Units_Click; main_ContentView.AddView (loWallView); frameLayout.AddView (main_ContentView); RelativeLayout RL = FindViewById<RelativeLayout> (Resource.Id.main_view_relativeLayoutCL); Drawable dr = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/nubeactivity.png"), 768, 1024, true)); RL.SetBackgroundDrawable (dr); dr = null; //seting up chat view content title_view = FindViewById<TextView> (Resource.Id.chat_view_title); info1= FindViewById<TextView> (Resource.Id.chat_view_info1); info2 = FindViewById<TextView> (Resource.Id.chat_view_info2); title_list = FindViewById<TextView> (Resource.Id.chat_list_title); mListViewChat = FindViewById<ListView> (Resource.Id.chat_list_view); title_view.SetX (Configuration.getWidth(74)); title_view.SetY (Configuration.getHeight (202)); title_view.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); title_view.SetTypeface (null, TypefaceStyle.Bold); info1.SetX (Configuration.getWidth (76)); info1.SetY (Configuration.getHeight (250)); info1.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); info2.SetX (Configuration.getWidth (76)); info2.SetY (Configuration.getHeight (285)); info2.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); title_list.SetX (Configuration.getWidth (76)); title_list.SetY (Configuration.getHeight (391)); title_list.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); title_list.SetTypeface (null, TypefaceStyle.Bold); mListViewChat.SetX (0); mListViewChat.SetY (Configuration.getHeight (440)); //end setting linearMainLayout.AddView (mainLayout); vm.PropertyChanged += new PropertyChangedEventHandler(logout_propertyChanged); RegisterWithGCM(); mDrawerToggle = new MyActionBarDrawerToggle( this, //Host Activity mDrawerLayout, //DrawerLayout Resource.String.openDrawer, //Opened Message Resource.String.closeDrawer //Closed Message ); mDrawerLayout.SetDrawerListener(mDrawerToggle); SupportActionBar.SetHomeButtonEnabled (true); SupportActionBar.SetDisplayShowTitleEnabled(false); mDrawerToggle.SyncState(); if (bundle != null) { if (bundle.GetString("DrawerState") == "Opened") { SupportActionBar.SetTitle(Resource.String.openDrawer); } else { SupportActionBar.SetTitle(Resource.String.closeDrawer); } } else { SupportActionBar.SetTitle(Resource.String.closeDrawer); } initListCursos (); iniPeoples (); initListTasks (); //main_ContentView.AddView (scrollIndice); }