//applies font from XML public static void ApplyCustomFont(TextView view, Context context, IAttributeSet attrs) { TypedArray attributeArray = context.ObtainStyledAttributes (attrs, Resource.Styleable.CustomFont); string fontName = attributeArray.GetString (Resource.Styleable.CustomFont_font); int textStyle = attrs.GetAttributeIntValue (ANDROID_SCHEMA, "textStyle", 0); Typeface customFont = SelectTypeface (context, fontName); switch (textStyle) { case 1: view.SetTypeface (customFont, TypefaceStyle.Bold); break; case 2: view.SetTypeface (customFont, TypefaceStyle.Italic); break; case 3: view.SetTypeface (customFont, TypefaceStyle.BoldItalic); break; default: view.SetTypeface (customFont, TypefaceStyle.Normal); break; } attributeArray.Recycle (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.dashboard_listview_detail); progress = new ProgressDialog (this); lat = 37.09035962; lan = -95.71368456; flag = FindViewById<ImageView> (Resource.Id.ivNew1); flag.Click += Flag_Click; ivListEmpty = FindViewById<LinearLayout> (Resource.Id.ivEmptylist); lvlist = FindViewById<ListView> (Resource.Id.lvListDetail); llMap = FindViewById<RelativeLayout> (Resource.Id.llmap); tvnumber = FindViewById<TextView> (Resource.Id.tvNumber); tvdesc = FindViewById<TextView> (Resource.Id.tvdesc); tvtime = FindViewById<TextView> (Resource.Id.tvTime); tvreply = FindViewById<TextView> (Resource.Id.tvReply); ListSipp = new List<SippReplyModel> (); Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Light.ttf"); Typeface tf1 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Semibold.ttf"); Typeface tf2 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Bold.ttf"); adapter = new CustomListViewDetail (this, ListSipp); lvlist.Adapter = adapter; if (adapter.IsEmpty) { ivListEmpty.Visibility = ViewStates.Visible; } else { ivListEmpty.Visibility = ViewStates.Gone; } mapFrag = (MapFragment)FragmentManager.FindFragmentById (Resource.Id.map); map = mapFrag.Map; map.UiSettings.CompassEnabled = true; map.UiSettings.ZoomControlsEnabled = false; map.MyLocationEnabled = false; LatLng lastLatLng = new LatLng (lat, lan); map.MoveCamera (CameraUpdateFactory.NewLatLngZoom (lastLatLng, 15)); MarkerOptions marker = new MarkerOptions (); marker.SetPosition (new LatLng (lat, lan)); map.AddMarker (marker); llMap.Background.SetAlpha (200); llMap.Click += LlMap_Click; tvnumber.SetTypeface (tf, TypefaceStyle.Normal); tvnumber.SetTypeface (tf2, TypefaceStyle.Normal); tvtime.SetTypeface (tf1, TypefaceStyle.Normal); tvreply.SetTypeface (tf1, TypefaceStyle.Normal); }
//here we only have img and text for each item //create a RelativeLayout and add it to dic //squear image public void AddItem(int imgresource,string text,Action OnCellClick) { RelativeLayout menucell = new RelativeLayout (nn_context); menucell.SetPadding (TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding)); menucell.LayoutParameters = new LinearLayout.LayoutParams (TapUtil.dptodx(cellwidth),TapUtil.dptodx(cellheight)); menucell.Click+= (object sender, EventArgs e) => { if(OnCellClick!=null){ OnCellClick(); } }; ImageView img = new ImageView (nn_context); img.Id = TapUtil.generateViewId (); img.LayoutParameters = new RelativeLayout.LayoutParams (TapUtil.dptodx(imagewidth),TapUtil.dptodx(imagewidth)); // Bitmap.CreateScaledBitmap(imgresource, TapUtil.dptodx(imagewidth), TapUtil.dptodx(imageheight), false); img.SetImageResource (imgresource); img.SetBackgroundColor (Color.White); TextView textview = new TextView (nn_context); RelativeLayout.LayoutParams textviewparam=new RelativeLayout.LayoutParams (TapUtil.dptodx(textwidth),TapUtil.dptodx(textheight)); textviewparam.AddRule(LayoutRules.RightOf,img.Id); textviewparam.LeftMargin = TapUtil.dptodx (space); textview.LayoutParameters =textviewparam; textview.Text = text; textview.SetTypeface (Typeface.Default, TypefaceStyle.Bold); textview.SetTextColor(Color.Black); textview.Gravity = global::Android.Views.GravityFlags.Center; menucell.AddView (img); menucell.AddView (textview); nn_itemlist.Add (menucell); }
public static void StyleUILabel( TextView label, string font, uint size ) { label.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) ); label.SetBackgroundColor( Android.Graphics.Color.Transparent ); label.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( font ), TypefaceStyle.Normal ); label.SetTextSize( Android.Util.ComplexUnitType.Dip, size ); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Main); Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Light.ttf"); _tvDescription = FindViewById<TextView> (Resource.Id.tvDescription); _tvDescription.SetTypeface (tf, TypefaceStyle.Normal); _tvContinue = FindViewById<TextView> (Resource.Id.tvContinue); _tvContinue.Click += Continue_Click; InitializeLocationManager(); }
private void SetLinkView() { _boardGameButton = FindViewById<TextView>(Resource.Id.BoardGame); _boardGameButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal); var webLinkText = @"<a href='http://www.spb.mosigra.ru/Face/Show/ersh'>" + GetString(Resource.String.BoardGameString) + "</a>"; var textFormated = Html.FromHtml(webLinkText); _boardGameButton.TextFormatted = textFormated;//your html goes in responseText _boardGameButton.Clickable = true; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.more_activity); //this.ActionBar.Hide (); Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Regular.ttf"); Typeface tf1 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Semibold.ttf"); Typeface tf2 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Bold.ttf"); tvTopYak = FindViewById<TextView> (Resource.Id.tvtopyak); tvTopYakArea = FindViewById<TextView> (Resource.Id.tvtopyakArea); tvOhterYak = FindViewById<TextView> (Resource.Id.tvOhteryak); tvLoveYak = FindViewById<TextView> (Resource.Id.tvloveyak); tvShare = FindViewById<TextView> (Resource.Id.tvShareYak); tvRate = FindViewById<TextView> (Resource.Id.tvRateYak); tvTwitter = FindViewById<TextView> (Resource.Id.tvTwitter); tvFacebook = FindViewById<TextView> (Resource.Id.tvFacebook); tvInstagram = FindViewById<TextView> (Resource.Id.tvinstagram); tvfind = FindViewById<TextView> (Resource.Id.tvFind); tvImportant = FindViewById<TextView> (Resource.Id.tvImportant); tvTopYak.SetTypeface (tf2, TypefaceStyle.Normal); tvTopYakArea.SetTypeface (tf, TypefaceStyle.Normal); tvOhterYak.SetTypeface (tf, TypefaceStyle.Normal); tvLoveYak.SetTypeface (tf1, TypefaceStyle.Normal); tvShare.SetTypeface (tf, TypefaceStyle.Normal); tvRate.SetTypeface (tf, TypefaceStyle.Normal); tvTwitter.SetTypeface (tf, TypefaceStyle.Normal); tvInstagram.SetTypeface (tf, TypefaceStyle.Normal); tvInstagram.SetTypeface (tf, TypefaceStyle.Normal); tvfind.SetTypeface (tf, TypefaceStyle.Normal); tvImportant.SetTypeface (tf, TypefaceStyle.Normal); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // Get our UI controls from the loaded layout: submitButton = FindViewById<Button>(Resource.Id.Button1); InputText = FindViewById<EditText>(Resource.Id.TextInput1); DisplayText = FindViewById<EditText>(Resource.Id.TextView1); FontinBold = FindViewById<CheckBox> (Resource.Id.BoldChecked); FontinItalic = FindViewById<CheckBox> (Resource.Id.ItalicChecked); InputText.Text = ""; // Get our button from the layout resource, // and attach an event to it submitButton.Click += (object sender, EventArgs e) => { //Set the font type depend on the options selected if ((FontinBold.Checked) && (FontinItalic.Checked)) DisplayText.SetTypeface (null,Android.Graphics.TypefaceStyle.BoldItalic); else if (FontinBold.Checked) DisplayText.SetTypeface (null,Android.Graphics.TypefaceStyle.Bold); else if (FontinItalic.Checked) DisplayText.SetTypeface (null,Android.Graphics.TypefaceStyle.Italic); else DisplayText.SetTypeface (null,Android.Graphics.TypefaceStyle.Normal); //Echo the word into output field if (String.IsNullOrWhiteSpace(InputText.Text)) DisplayText.Text = "Nothing was entered"; else DisplayText.Text = "You entered: " + InputText.Text; }; }
public void InitView(List<BookingDocumentDto> _bookingDocs) { this.RemoveAllViews (); int size = _bookingDocs.Count; for(int i = 0; i < size; i ++) { LinearLayout ll = new LinearLayout (_context); ll.Orientation = Orientation.Horizontal; ll.SetVerticalGravity (GravityFlags.CenterVertical); ImageView imgFile = new ImageView (_context); imgFile.SetImageResource (Resource.Drawable.ic_attach); var tvFileAttach = new TextView (_context) { Text = _bookingDocs[i].OriginalFileName }; tvFileAttach.Id = i; tvFileAttach.SetTextColor (Color.Blue); tvFileAttach.PaintFlags = PaintFlags.UnderlineText; tvFileAttach.SetTypeface (null, TypefaceStyle.Bold); tvFileAttach.SetSingleLine (true); tvFileAttach.Ellipsize = global::Android.Text.TextUtils.TruncateAt.Middle; tvFileAttach.SetPadding (5, 0, 10, 0); LayoutParams param = new TableRow.LayoutParams(0, LayoutParams.WrapContent, 1f); tvFileAttach.LayoutParameters = param; tvFileAttach.Click += (sender, e) => { utilsAndroid.onViewFile(_context, _bookingDocs[tvFileAttach.Id].S3FileName); }; ImageButton imgDelete = new ImageButton (_context); imgDelete.Id = i; imgDelete.SetImageResource (Resource.Drawable.ic_delete); imgDelete.SetMinimumWidth (50); imgDelete.SetMinimumHeight (50); imgDelete.SetBackgroundColor (Color.Transparent); imgDelete.Click += (sender, e) => { _deleteFile.onDeleteFile(_isInConference, _bookingDocs[imgDelete.Id]); }; ll.AddView (imgFile); ll.AddView (tvFileAttach); ll.AddView (imgDelete); ll.SetPadding (0, 5, 0, 5); this.AddView (ll); } }
public override View GetView(int position, View convertView, ViewGroup parent) { TextView button = new TextView(context); button.SetText(chapters[position], TextView.BufferType.Normal); button.TextSize = 32; button.SetTypeface(ThisApp.Font(context, "ionbold"), Android.Graphics.TypefaceStyle.Normal); button.SetHeight(84); button.SetBackgroundResource(Resource.Drawable.metro_button_style); button.Gravity = GravityFlags.Center; //button.SetPadding(0, 0, 0, 0); //button.SetTextColor(Resources.System.GetColorStateList(Resource.Color.metro_button_text_style)); //button.SetTextColor(Resources.System.GetColor(Resource.Color.metro_button_text_style)); button.Id = position; button.Click += button_Click; return button; }
public void ini(){ var textFormat = Android.Util.ComplexUnitType.Px; var textFormatdip = Android.Util.ComplexUnitType.Dip; mainLayout = new RelativeLayout (context); mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1); contenLayout = new LinearLayout (context); contenLayout.LayoutParameters = new LinearLayout.LayoutParams (-2, -2); contenLayout.Orientation = Orientation.Vertical; titleHeader = new TextView (context); content = new TextView (context); titleHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); content.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf"); //titleHeader.Text = "El Perú cuenta con mas de 357000 tipos de aves"; titleHeader.SetTypeface(null,TypefaceStyle.Bold); //titleHeader.SetTextSize (textFormat, Configuration.getHeight (52)); titleHeader.SetTextSize (textFormatdip, 27.0f); titleHeader.SetMaxWidth (Configuration.getWidth (583)); //content.Text = "Los factores geográficos, climáticos y evolutivos convierten al Perú en el mejor lugar para realizar la observacion de aves(birthwaching) Tiene 1830 especies de pájaros(segun la lista oficial del SACC/CRAP), tambien es considerado el"; // content.SetTextSize (textFormat, Configuration.getHeight (26)); content.SetTextSize (textFormatdip, 12.0f); content.SetMaxWidth (Configuration.getWidth(583)); contenLayout.AddView (titleHeader); contenLayout.AddView(content); //contenLayout.SetX (Configuration.getHeight (45)); int padW = Configuration.getWidth(45); int padH = Configuration.getHeight (15); //contenLayout.SetPadding (padW,padH,padW,padH); //contenLayout.SetY (Configuration.getWidth (12)); mainLayout.SetPadding (padW,padH,padW,padH); mainLayout.AddView(contenLayout); }
public override Android.Views.View GetSampleContent(Context context) { sfGrid = new SfDataGrid(context); viewModel = new ExportingViewModel(); sfGrid.AutoGeneratingColumn += GridGenerateColumns; sfGrid.ItemsSource = (viewModel.OrdersInfo); exportPdf = new ImageButton(context); exportPdf.SetMaxHeight(30); exportPdf.SetMaxWidth(30); exportPdf.SetBackgroundColor(Android.Graphics.Color.Transparent); exportPdf.SetImageResource(Resource.Drawable.pdfexport); exportPdf.SetScaleType(ImageView.ScaleType.FitXy); exportPdf.LayoutParameters = new ViewGroup.LayoutParams( 120,120); exportPdf.Click += ExportToPdf; exportExcel = new ImageButton(context); exportExcel.SetMaxHeight(30); exportExcel.SetMaxWidth(30); exportExcel.SetBackgroundColor(Android.Graphics.Color.Transparent); exportExcel.SetImageResource(Resource.Drawable.excelexport); exportExcel.SetScaleType(ImageView.ScaleType.FitXy); exportExcel.LayoutParameters = new ViewGroup.LayoutParams(120, 120); exportExcel.Click += ExportToExcel; LinearLayout option = new LinearLayout(context); option.SetGravity(GravityFlags.Center); option.Orientation = Android.Widget.Orientation.Horizontal; var pdftext = new TextView(context) { Text = "Export to Pdf" }; pdftext.SetTypeface(null, TypefaceStyle.Bold); var exceltext = new TextView(context) { Text = "Export to Excel" }; exceltext.SetTypeface(null, TypefaceStyle.Bold); option.AddView(exportPdf); option.AddView(pdftext); option.AddView(exportExcel); option.AddView(exceltext); LinearLayout mainView = new LinearLayout(context); mainView.Orientation = Android.Widget.Orientation.Vertical; mainView.AddView(option); mainView.AddView(sfGrid); return mainView; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.sendsipper); Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Light.ttf"); // Typeface tf1 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Semibold.ttf"); // Typeface tf2 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Bold.ttf"); // wifiManager = (WifiManager)this.GetSystemService (WifiService); // ip = Convert.ToString (wifiManager.ConnectionInfo.IpAddress); //Console.WriteLine ("ip address : " + ip); tvcancel = FindViewById<TextView> (Resource.Id.tvCancel); tvdata = FindViewById<EditText> (Resource.Id.tvdata); tvsend = FindViewById<TextView> (Resource.Id.tvSend); tvcancel.SetTypeface (tf, TypefaceStyle.Normal); tvdata.SetTypeface (tf, TypefaceStyle.Normal); tvsend.SetTypeface (tf, TypefaceStyle.Normal); tvcancel.Click += (object sender, EventArgs e) => Finish (); tvsend.Click += Tvsend_Click; }
private void Initialize() { try { _redColor = Resources.GetColor(Resource.Color.task_progress_red); _greenColor = Resources.GetColor(Resource.Color.task_progress_green); _playerName = FindViewById<TextView>(Resource.Id.playerInGameName); _playerPosition = FindViewById<TextView>(Resource.Id.playerInGamePostion); _playerScore = FindViewById<TextView>(Resource.Id.playerInGameScore); _makeThisButton = FindViewById<Button>(Resource.Id.makeThisButton); _refuseButton = FindViewById<Button>(Resource.Id.refuseButton); _cardImage = FindViewById<ImageButton>(Resource.Id.taskImageButton); _actionButton = (TextView)CreateActionButton(Resource.Drawable.table_button); _points = FindViewById<TextView>(Resource.Id.points); _x2 = FindViewById<TextView>(Resource.Id.x2); _coninueButton = FindViewById<ImageButton>(Resource.Id.continueButton); _scoreTextView = FindViewById<TextView>(Resource.Id.scoreString); _taskEnumerator = Rep.DatabaseHelper.Tasks.Enumerator; _playerEnumerator = Rep.Instance.Players.Enumerator; _playerName.SetTypeface(Rep.FontManager.Get(Font.Bold), TypefaceStyle.Normal); _playerPosition.SetTypeface(Rep.FontManager.Get(Font.Regular), TypefaceStyle.Normal); _makeThisButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal); _refuseButton.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal); _playerScore.SetTypeface(Rep.FontManager.Get(Font.BoldCondensed), TypefaceStyle.Normal); _points.SetTypeface(Rep.FontManager.Get(Font.Bold), TypefaceStyle.Normal); _x2.SetTypeface(Rep.FontManager.Get(Font.Bold), TypefaceStyle.Normal); _cardImage.SetImageResource(Resource.Drawable.card_backside); ; _scoreTextView.SetTypeface(Rep.FontManager.Get(Font.Condensed), TypefaceStyle.Normal); _taskProgressView = FindViewById<RelativeLayout>(Resource.Id.taskProgressView); } catch (Exception exception) { GaService.TrackAppException(this.Class, "Initialize", exception, true); } }
public void OnCreateView( View parentView ) { Layout = parentView.FindViewById<RelativeLayout>( LayoutId ); Icon = Layout.FindViewById<TextView>( Resource.Id.icon ); Button = Layout.FindViewById<Button>( Resource.Id.button ); Text = Layout.FindViewById<TextView>( Resource.Id.text ); Typeface fontFace = FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Primary ); Icon.SetTypeface( fontFace, TypefaceStyle.Normal ); Icon.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateSpringboardConfig.Element_FontSize ); Icon.SetX( Icon.GetX() - Icon.Width / 2 ); Icon.Text = IconStr; Text.Text = ElementLabel; Text.SetTypeface( FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); Text.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize ); Button.Background = null; // setup the seperator color View seperator = Layout.FindViewById<View>( Resource.Id.seperator ); seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) ); }
private void Initialize() { _navigatedFromGameActivity = this.Intent.GetBooleanExtra("from_game", false); _googleStoreNotActive = FindViewById<TextView>(Resource.Id.googleStoreNotActive); _googleStoreNotActive.SetTypeface(Rep.FontManager.Get(Font.SemiboldCondensed), Android.Graphics.TypefaceStyle.Bold); _googleStoreNotActive.Clickable = true; _googleStoreActive = FindViewById<ScrollView>(Resource.Id.googleStoreActive); _taskHeader = FindViewById<TextView>(Resource.Id.taskHeader); _taskHeader.SetTypeface(Rep.FontManager.Get(Font.SemiboldCondensed), Android.Graphics.TypefaceStyle.Bold); _taskDescription = FindViewById<TextView>(Resource.Id.taskDescription); _taskDescription.SetTypeface(Rep.FontManager.Get(Font.SemiboldCondensed), Android.Graphics.TypefaceStyle.Bold); _bonusHeader = FindViewById<TextView>(Resource.Id.bonusHeader); _bonusHeader.SetTypeface(Rep.FontManager.Get(Font.SemiboldCondensed), Android.Graphics.TypefaceStyle.Bold); _bonusDescription = FindViewById<TextView>(Resource.Id.bonusDescription); _bonusDescription.SetTypeface(Rep.FontManager.Get(Font.SemiboldCondensed), Android.Graphics.TypefaceStyle.Bold); _taskListView = FindViewById<ListView>(Resource.Id.taskListView); _bonusListView = FindViewById<ListView>(Resource.Id.bonusListView); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); //this.ActionBar.Hide (); SetContentView (Resource.Layout.peek_activity); Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Regular.ttf"); Typeface tf1 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Semibold.ttf"); Typeface tf2 = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/OpenSans-Bold.ttf"); tvPeek = FindViewById<TextView> (Resource.Id.tvPeek); tvMyPeek = FindViewById<TextView> (Resource.Id.tvMyPeek); tvFeature = FindViewById<TextView> (Resource.Id.tvfeature); tvPeekNear = FindViewById<TextView> (Resource.Id.tvPeekNear); tvlove = FindViewById<TextView> (Resource.Id.tvlove); tvPool = FindViewById<TextView> (Resource.Id.tvpool); tvmonday = FindViewById<TextView> (Resource.Id.tvmonday); tvLetter = FindViewById<TextView> (Resource.Id.tvletter); tvHair = FindViewById<TextView> (Resource.Id.tvhair); Locattion = FindViewById<TextView> (Resource.Id.tvlocation); tvCollege = FindViewById<TextView> (Resource.Id.tvCollege); tvCollege2 = FindViewById<TextView> (Resource.Id.tvCollege2); tvPeek.SetTypeface (tf2, TypefaceStyle.Normal); tvMyPeek.SetTypeface (tf1, TypefaceStyle.Normal); tvFeature.SetTypeface (tf1, TypefaceStyle.Normal); tvPeekNear.SetTypeface (tf1, TypefaceStyle.Normal); tvlove.SetTypeface (tf, TypefaceStyle.Normal); tvPool.SetTypeface (tf, TypefaceStyle.Normal); tvmonday.SetTypeface (tf, TypefaceStyle.Normal); tvLetter.SetTypeface (tf, TypefaceStyle.Normal); tvHair.SetTypeface (tf, TypefaceStyle.Normal); Locattion.SetTypeface (tf, TypefaceStyle.Normal); tvCollege.SetTypeface (tf, TypefaceStyle.Normal); tvCollege2.SetTypeface (tf, TypefaceStyle.Normal); }
public static void ConvertTextViewToIcon (AssetManager assets, TextView textViewToConvert) { Typeface font = Typeface.CreateFromAsset(assets, ICON_FONT_FILENAME); textViewToConvert.SetTypeface (font, TypefaceStyle.Normal); }
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); }
private void Initialize() { _playerName = FindViewById<TextView> (Resource.Id.playerInGameName); _playerPosition = FindViewById<TextView> (Resource.Id.playerInGamePostion); _playerScore = FindViewById<TextView> (Resource.Id.playerInGameScore); _makeThisButton = FindViewById<Button>(Resource.Id.makeThisButton); _refuseButton = FindViewById<Button>(Resource.Id.refuseButton); _cardImage = FindViewById<ImageButton>(Resource.Id.taskImageButton); _actionButton = (TextView)CreateActionButton (Resource.Drawable.table_button); _points = FindViewById<TextView> (Resource.Id.points); _x2 = FindViewById<TextView> (Resource.Id.x2); _taskEnumerator = (TaskEnumerator)Rep.Instance.Tasks.GetEnumerator (); _playerName.SetTypeface(this.MyriadProFont(MyriadPro.Bold),TypefaceStyle.Normal); _playerPosition.SetTypeface(this.MyriadProFont(MyriadPro.Regular),TypefaceStyle.Normal); _makeThisButton.SetTypeface(this.MyriadProFont(MyriadPro.BoldCondensed), TypefaceStyle.Normal); _refuseButton.SetTypeface(this.MyriadProFont(MyriadPro.BoldCondensed), TypefaceStyle.Normal); _playerScore.SetTypeface(this.MyriadProFont(MyriadPro.BoldCondensed), TypefaceStyle.Normal); _points.SetTypeface (this.MyriadProFont (MyriadPro.Bold), TypefaceStyle.Normal); _x2.SetTypeface (this.MyriadProFont (MyriadPro.Bold), TypefaceStyle.Normal); _cardImage.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.card_backside)); FindViewById<TextView>(Resource.Id.scoreString).SetTypeface(this.MyriadProFont(MyriadPro.Condensed), TypefaceStyle.Normal); }
private void Init(){ this.Orientation = Orientation.Vertical; this.SetBackgroundResource(Resource.Color.bg_color); int iSpecializationSize = specInfos.SpecialistDetail.Specializations.Count; for (int k = 0; k < iSpecializationSize; k++) { var tvSpecialisation = new TextView (this.Context) { Text = specInfos.SpecialistDetail.Specializations [k].ProfessionalOrTrade }; tvSpecialisation.SetTextColor (Color.Black); tvSpecialisation.SetTypeface (null, TypefaceStyle.Bold); tvSpecialisation.SetPadding (padLeft, padTop, 0, 0); this.AddView (tvSpecialisation); var tvSpecialisationMajor = new TextView (this.Context) { Text = specInfos.SpecialistDetail.Specializations [k].Name }; tvSpecialisationMajor.SetTextColor (Color.Black); tvSpecialisationMajor.SetTypeface (null, TypefaceStyle.Bold); tvSpecialisationMajor.SetPadding (padLeft1, padTop, 0, 0); this.AddView (tvSpecialisationMajor); string sTextLicense = " No"; if (specInfos.SpecialistDetail.Specializations [k].LicenceToOperate) { sTextLicense = " Yes"; } var tvLicence = new TextView (this.Context) { Text = context.GetString (Resource.String.licence_title) + sTextLicense }; tvLicence.SetTextColor (Color.Black); tvLicence.SetPadding (padLeft2, padTop, 0, 0); tvLicence.SetTypeface (null, TypefaceStyle.Bold); this.AddView (tvLicence); if (specInfos.SpecialistDetail.Specializations [k].LicenceToOperate) { var tvLicenceNumber = new TextView (this.Context) { Text = "License Number: " + specInfos.SpecialistDetail.Specializations [k].LicenseNumber }; tvLicenceNumber.SetTextColor (Color.Black); tvLicenceNumber.SetPadding (padLeft2, padTop, 0, 0); tvLicenceNumber.SetTypeface (null, TypefaceStyle.Bold); tvLicenceNumber.SetSingleLine (true); tvLicenceNumber.Ellipsize = global::Android.Text.TextUtils.TruncateAt.End; this.AddView (tvLicenceNumber); // ImageView img = new ImageView (context); // if (specInfos.SpecialistDetail.Specializations [k].LicenceToOperate) // img.SetImageResource (Resource.Drawable.ic_check); // else // img.SetImageResource (Resource.Drawable.ic_close_large); // // RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(32 ,32); // param.TopMargin = 15; // img.LayoutParameters = param; // LinearLayout ll = new LinearLayout (context); // ll.Orientation = Orientation.Horizontal; // ll.SetVerticalGravity (GravityFlags.CenterVertical); // ll.AddView (tvLicence); // ll.AddView (img); // // this.AddView (ll); var tvCountryPermittedTitle = new TextView (this.Context) { Text = context.GetString (Resource.String.country_permitted) }; tvCountryPermittedTitle.SetTextColor (Color.Black); tvCountryPermittedTitle.SetPadding (padLeft2, padTop, 0, 0); tvCountryPermittedTitle.SetTypeface (null, TypefaceStyle.Bold); this.AddView (tvCountryPermittedTitle); int size = specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted.Count; for (int n = 0; n < size; n++) { var tvCountry = new TextView (this.Context) { Text = specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].Name }; tvCountry.SetTextColor (Color.Black); tvCountry.SetPadding (padLeft3, padTop, 0, 0); tvCountry.SetTypeface (null, TypefaceStyle.Bold); this.AddView (tvCountry); int size1 = specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].StatesAndRegulatories.Count; for (int i = 0; i < size1; i++) { var tvState = new TextView (this.Context) { Text = "State: " + specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].StatesAndRegulatories [i].State }; tvState.SetTextColor (Color.Black); tvState.SetPadding (padLeft4, padTop1, 0, 0); var tvRegulatory = new TextView (this.Context) { Text = "Regulatory Authority: " + specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].StatesAndRegulatories [i].Regulatory }; tvRegulatory.SetTextColor (Color.Black); tvRegulatory.SetPadding (padLeft4, padTop1, 0, padTop2); this.AddView (tvState); this.AddView (tvRegulatory); } } var tvProof = new TextView (this.Context) { Text = context.GetString (Resource.String.proof_title) }; tvProof.SetTextColor (Color.Black); tvProof.SetPadding (padLeft2, 0, 0, 0); tvProof.SetTypeface (null, TypefaceStyle.Bold); this.AddView (tvProof); for (int i = 0; i < specInfos.SpecialistDetail.Specializations [k].POCs.Count; i++) { listFileName.Add (specInfos.SpecialistDetail.Specializations [k].POCs [i].S3FileName); var tvPOCPath = new TextView (this.Context) { Text = specInfos.SpecialistDetail.Specializations [k].POCs [i].S3FileName }; tvPOCPath.Id = i; tvPOCPath.SetTextColor (Color.Blue); tvPOCPath.SetPadding (padLeft3, 5, 0, 0); tvPOCPath.PaintFlags = PaintFlags.UnderlineText; tvPOCPath.SetTypeface (null, TypefaceStyle.Bold); tvPOCPath.SetSingleLine (true); tvPOCPath.Ellipsize = global::Android.Text.TextUtils.TruncateAt.Middle; tvPOCPath.Click += (sender, e) => { utilsAndroid.onViewFile (context, listFileName [tvPOCPath.Id]); }; this.AddView (tvPOCPath); } } string str = "GST applies: No"; if (specInfos.SpecialistDetail.Specializations [k].GST) str = "GST applies: Yes"; var tvGST = new TextView (this.Context) { Text = str }; tvGST.SetTextColor (Color.Black); tvGST.SetPadding (padLeft2, padTop, 0, 5); tvGST.SetTypeface (null, TypefaceStyle.Bold); this.AddView (tvGST); } }
public SeperatorListItem( Context context ) : base( context ) { SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) ); Orientation = Android.Widget.Orientation.Vertical; Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal ); Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Large_FontSize ); Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) ); Title.Text = ConnectStrings.Main_Connect_Seperator; ( (LinearLayout.LayoutParams)Title.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 ); ( (LinearLayout.LayoutParams)Title.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); ( (LinearLayout.LayoutParams)Title.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 ); AddView( Title ); }
public ListItem( Context context ) : base( context ) { Orientation = Android.Widget.Orientation.Vertical; SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) ); LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); contentLayout.Orientation = Android.Widget.Orientation.Horizontal; contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent ); AddView( contentLayout ); Thumbnail = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Thumbnail.LayoutParameters = new LinearLayout.LayoutParams( (int)Rock.Mobile.Graphics.Util.UnitToPx( PrivateConnectConfig.MainPage_ThumbnailDimension ), (int)Rock.Mobile.Graphics.Util.UnitToPx( PrivateConnectConfig.MainPage_ThumbnailDimension ) ); ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).Gravity = GravityFlags.CenterVertical; Thumbnail.SetScaleType( ImageView.ScaleType.CenterCrop ); contentLayout.AddView( Thumbnail ); TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); TitleLayout.Orientation = Android.Widget.Orientation.Vertical; TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical; ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); contentLayout.AddView( TitleLayout ); Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal ); Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize ); Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) ); Title.SetSingleLine( ); Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End; ( (LinearLayout.LayoutParams)Title.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 ); TitleLayout.AddView( Title ); SubTitle = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); SubTitle.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); SubTitle.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); SubTitle.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); SubTitle.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); ( (LinearLayout.LayoutParams)SubTitle.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 ); ( (LinearLayout.LayoutParams)SubTitle.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 ); TitleLayout.AddView( SubTitle ); // fill the remaining space with a dummy view, and that will align our chevron to the right View dummyView = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context ); dummyView.LayoutParameters = new LinearLayout.LayoutParams( 0, 0 ); ( (LinearLayout.LayoutParams)dummyView.LayoutParameters ).Weight = 1; contentLayout.AddView( dummyView ); Chevron = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Chevron.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)Chevron.LayoutParameters ).Gravity = GravityFlags.CenterVertical | GravityFlags.Right; Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary ); Chevron.SetTypeface( fontFace, TypefaceStyle.Normal ); Chevron.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateConnectConfig.MainPage_Table_IconSize ); Chevron.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); Chevron.Text = PrivateConnectConfig.MainPage_Table_Navigate_Icon; contentLayout.AddView( Chevron ); // add our own custom seperator at the bottom Seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 ); Seperator.LayoutParameters.Height = 2; Seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) ); AddView( Seperator ); }
TextView Heading(SearchRow item) { TextView heading = new TextView(context); heading.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent); heading.Text = item.Title; heading.TextSize = 18f; heading.SetTypeface(null, Android.Graphics.TypefaceStyle.Bold); return heading; }
private void SetFont(TextView textView) { textView.SetTypeface(this.MyriadProFont(MyriadPro.BoldCondensed), TypefaceStyle.Normal); }
protected override async void OnCreate (Bundle bundle) { //RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate (bundle); //CREAMOS EL OBJETO QUE VA A LEER/ESCRIBIR LAS PREFERENCIAS DEL USUARIO var prefs = this.GetSharedPreferences("RunningAssistant.preferences", FileCreationMode.Private); //ASIGNAMOS EL DICCIONARIO valores = new ContentValues (); source = 1; negocioid = Intent.GetStringExtra ("id"); //CREAMOS EL OBJETO DEL OBJETO (lel) que va a editar las preferencias var editor = prefs.Edit (); userid = prefs.GetString("id", null); //SETEAMOS LA VISTA A CONTROLAR SetContentView(Resource.Layout.perfil_premium); imgnegocioprev = FindViewById<GridLayout> (Resource.Id.imgnegocioprev); masimagenesnegocio = FindViewById<TextView> (Resource.Id.masimagenesnegocio); imagennegocio = FindViewById <Button> (Resource.Id.imagennegocio); imagencamaranegocio = FindViewById<Button> (Resource.Id.imagencamaranegocio); enviarimgneg = FindViewById<Button> (Resource.Id.enviarimgneg); LinearLayout containernegocio = FindViewById<LinearLayout> (Resource.Id.containernegocio); LinearLayout waitlayout = FindViewById <LinearLayout> (Resource.Id.waitlayout); ubicacionbtn = FindViewById<Button> (Resource.Id.ubicacionbtn); descripcionbtn = FindViewById<Button> (Resource.Id.descripcionbtn); contactobtn = FindViewById<Button> (Resource.Id.contactobtn); ubicacionlayout = FindViewById<LinearLayout> (Resource.Id.ubicacionlayout); descripcionlayout = FindViewById<LinearLayout> (Resource.Id.descripcionlayout); contactolayout = FindViewById<LinearLayout> (Resource.Id.contactolayout); callnow = FindViewById<Button> (Resource.Id.callnow); mToolbar = FindViewById<SupportToolBar> (Resource.Id.toolbar); mScrollView = FindViewById<ScrollView> (Resource.Id.scrollView); SetSupportActionBar (mToolbar); //ESTA ES LA FLECHA PARA ATRÁS SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_arrow_back); SupportActionBar.SetDisplayHomeAsUpEnabled (true); //SupportActionBar.SetHomeButtonEnabled (true); layoutdejaimagenes = FindViewById<LinearLayout> (Resource.Id.layoutdejaimagenes); Point size = new Point (); Display display = WindowManager.DefaultDisplay; display.GetSize (size); mScreenHeight = size.Y; mScrollView.ViewTreeObserver.AddOnScrollChangedListener (this); //despues del show del action var, vamos a obtener el negocio SupportActionBar.Title = Intent.GetStringExtra("nombre"); portada = FindViewById<ImageView> (Resource.Id.coverneg); TextView abiertocerrado = FindViewById<TextView>(Resource.Id.abiertocerrado); bounce = AnimationUtils.LoadAnimation (Application.Context, Resource.Animation.bounce); flip = AnimationUtils.LoadAnimation (Application.Context, Resource.Animation.flip); floatbounce = AnimationUtils.LoadAnimation (Application.Context, Resource.Animation.floatbounce); idres=Intent.GetStringExtra ("id"); titulores = Intent.GetStringExtra ("nombre"); //BOTONES DE RESEÑA Button enviarrev = FindViewById<Button> (Resource.Id.enviarrev); Button imagenrev = FindViewById<Button> (Resource.Id.imagenrev); Button imagenrev2 = FindViewById<Button> (Resource.Id.imagenrev2); Button imagencamara = FindViewById<Button> (Resource.Id.imagencamara); masimagenes = FindViewById<TextView> (Resource.Id.masimagenes); imgUri = null; apath = ""; revItems = new List<Review>(); //fuente Typeface font = Typeface.CreateFromAsset(Assets, "Fonts/fa.ttf"); //COORDINATOR LAYOUT: var fab = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition); Button addimg = FindViewById<Button> (Resource.Id.addimg); Button addcomment = FindViewById<Button> (Resource.Id.addcomment); Button addtip = FindViewById<Button> (Resource.Id.addtip); Button enviarmensaje = FindViewById<Button> (Resource.Id.enviarmensaje); Button addlike = FindViewById<Button> (Resource.Id.addlike); fossbytes = new List<byte[]>(); deleteimgnegocio = FindViewById<Button> (Resource.Id.deleteimgnegocio); addimg.SetTypeface(font, TypefaceStyle.Normal); addcomment.SetTypeface(font, TypefaceStyle.Normal); addtip.SetTypeface(font, TypefaceStyle.Normal); enviarmensaje.SetTypeface(font, TypefaceStyle.Normal); addlike.SetTypeface(font, TypefaceStyle.Normal); TextView corazonlikes = FindViewById<TextView> (Resource.Id.corazonlikes); TextView alikes = FindViewById<TextView> (Resource.Id.alikes); TextView likes = FindViewById<TextView> (Resource.Id.likes); TextView gustalikes = FindViewById<TextView> (Resource.Id.gustalikes); corazonlikes.SetTypeface(font, TypefaceStyle.Normal); alikes.SetTypeface(font, TypefaceStyle.Normal); likes.SetTypeface(font, TypefaceStyle.Normal); gustalikes.SetTypeface(font, TypefaceStyle.Normal); callnow.SetTypeface(font, TypefaceStyle.Normal); LinearLayout layoutdiascontainer = FindViewById<LinearLayout> (Resource.Id.layoutdiascontainer); //layoutdiascontainer.Animate().TranslationY(0); ScrollView scrollview = FindViewById<ScrollView> (Resource.Id.scrollView); ProgressBar waitpb = FindViewById<ProgressBar> (Resource.Id.waitpb); deleteimgrev = FindViewById<Button> (Resource.Id.deleteimgrev); try{ negocio = await plifserver.FetchWeatherAsync ("http://plif.mx/mobile/get_negocio?id="+Intent.GetStringExtra("id")+"&uid="+userid); objeto = negocio["respuesta"][0]["Data"]; Log.Debug (tag, "La ruta es: "+objeto["ruta"]); if(negocio["respuesta"][0]["0"]["has_like"]=="1"){ haslike=true; }else{ haslike=false; } if (haslike) { addlike.Text = GetString (Resource.String.heart); } else { addlike.Text = GetString (Resource.String.heartempty); } numlikes=objeto["likes"]; if (objeto["ruta"] == null || objeto["ruta"] == "" || objeto["ruta"] == "null") { //pon la imagen por defecto portada.SetImageResource (Resource.Drawable.dcover); Log.Debug (tag, "No hay ruta!"); } else { //TENEMOS QUE VERIFICAR SI LA IMAGEN ES DE GOOGLE O DE NOSOTROS!!! string ruta=objeto["ruta"]; string first=ruta[0].ToString(); if(first=="u" || first=="U"){ //Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show (); ruta=extra+ruta; }else{ //no hagas nada, la imagen es de google } Koush.UrlImageViewHelper.SetUrlDrawable (portada, ruta, Resource.Drawable.dcover); }//TERMINA SI LA IMAGEN NO ES NULL //Ponemos el titulo TextView titulo = FindViewById<TextView> (Resource.Id.titulo); titulo.Text=Intent.GetStringExtra("nombre"); TextView numestrellas = FindViewById<TextView> (Resource.Id.numestrellas); //Ponemos las estrellas ImageView estrellas = FindViewById<ImageView> (Resource.Id.estrellas); switch (Intent.GetStringExtra("calificacion")) { case "0": case "": case "null": case null: numestrellas.Text="0.0"; break; case "1": numestrellas.Text="1.0"; break; case "2": numestrellas.Text="2.0"; break; case "3": numestrellas.Text="3.0"; break; case "4": numestrellas.Text="4.0"; break; case "5": numestrellas.Text="5.0"; break; default: numestrellas.Text="0.0"; break; } //categoria y subcategoria TextView categoria = FindViewById<TextView> (Resource.Id.categoria); TextView subcategoria = FindViewById<TextView> (Resource.Id.subcategoria); TextView guioncat = FindViewById<TextView> (Resource.Id.guioncat); categoria.Text=objeto["categoria"]; if(objeto["propietario"]==null || objeto["propietario"]=="null"){ propietario="0"; }else{ propietario=objeto["propietario"]; } if(objeto["subcategoria"]=="" || objeto["subcategoria"]==null || objeto["subcategoria"]=="null"){ subcategoria.Text=""; guioncat.Text=""; }else{ subcategoria.Text=objeto["subcategoria"]; } //likes likes.Text=objeto["likes"]+" Personas"; //mapa? try{ mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map); map = mapFrag.Map; LatLng location = new LatLng(objeto["geo_lat"], objeto["geo_long"]); CameraPosition.Builder builder = CameraPosition.InvokeBuilder(); builder.Target(location); builder.Zoom(16); //builder.Bearing(155); //builder.Tilt(65); CameraPosition cameraPosition = builder.Build(); CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition); if (map != null) { map.MapType = GoogleMap.MapTypeNormal; MarkerOptions markerOpt1 = new MarkerOptions(); markerOpt1.SetPosition(new LatLng(objeto["geo_lat"], objeto["geo_long"])); markerOpt1.SetTitle(objeto["titulo"]); markerOpt1.SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.pliflocation3)); markerOpt1.Draggable(true); map.AddMarker(markerOpt1); map.MoveCamera(cameraUpdate); } }catch(Exception ex){ Log.Debug (tag, "GMAPS ERROR:"+ex); } //direccion TextView callenum = FindViewById<TextView> (Resource.Id.callenum); callenum.Text=objeto["geo_calle"]+" "+objeto["geo_numero"]; TextView colonia = FindViewById<TextView> (Resource.Id.colonia); colonia.Text=objeto["geo_colonia"]; TextView regpais = FindViewById<TextView> (Resource.Id.regpais); regpais.Text=objeto["geo_estado"]+", "+objeto["geo_pais"]; //acerca de este negocio TextView mapmarker1 = FindViewById<TextView> (Resource.Id.sobreeste); mapmarker1.SetTypeface(font, TypefaceStyle.Normal); TextView descripcion = FindViewById<TextView> (Resource.Id.descripcion); string desc=objeto["descripcion"]; descripcion.Text=System.Net.WebUtility.HtmlDecode(desc); descripcion.Visibility=ViewStates.Gone; WebView descweb = FindViewById<WebView> (Resource.Id.descweb); descweb.Settings.JavaScriptEnabled=true; string div1="<div style=\"color: #FFFFFF\">"; string div2="</div>"; descweb.LoadDataWithBaseURL("", div1+desc+div2, "text/html", "UTF-8", ""); descweb.SetBackgroundColor(Color.ParseColor("#343A41")); //telefono TextView webico =FindViewById<TextView> (Resource.Id.webico); TextView telico =FindViewById<TextView> (Resource.Id.telico); telefono= FindViewById<TextView> (Resource.Id.telefono); telico.SetTypeface(font, TypefaceStyle.Normal); telefono.Text= objeto["telefono"]+" "; //webpage TextView web = FindViewById<TextView> (Resource.Id.pagweb); webico.SetTypeface(font, TypefaceStyle.Normal); web.Text=objeto["website"]+" "; //Horarios TextView horarios=FindViewById<TextView> (Resource.Id.horarios); horarios.SetTypeface(font, TypefaceStyle.Normal); abiertocerrado = FindViewById<TextView>(Resource.Id.abiertocerrado); LinearLayout lunescontainer = FindViewById<LinearLayout> (Resource.Id.lunescontainer); TextView lunes = FindViewById<TextView>(Resource.Id.lunes); TextView luneshora = FindViewById<TextView>(Resource.Id.luneshora); LinearLayout martescontainer = FindViewById<LinearLayout> (Resource.Id.martescontainer); TextView martes = FindViewById<TextView>(Resource.Id.martes); TextView marteshora = FindViewById<TextView>(Resource.Id.marteshora); LinearLayout miercolescontainer = FindViewById<LinearLayout> (Resource.Id.miercolescontainer); TextView miercoles = FindViewById<TextView>(Resource.Id.miercoles); TextView miercoleshora = FindViewById<TextView>(Resource.Id.miercoleshora); LinearLayout juevescontainer = FindViewById<LinearLayout> (Resource.Id.juevescontainer); TextView jueves = FindViewById<TextView>(Resource.Id.jueves); TextView jueveshora = FindViewById<TextView>(Resource.Id.jueveshora); LinearLayout viernescontainer = FindViewById<LinearLayout> (Resource.Id.viernescontainer); TextView viernes = FindViewById<TextView>(Resource.Id.viernes); TextView vierneshora = FindViewById<TextView>(Resource.Id.vierneshora); LinearLayout sabadocontainer = FindViewById<LinearLayout> (Resource.Id.sabadocontainer); TextView sabado = FindViewById<TextView>(Resource.Id.sabado); TextView sabadohora = FindViewById<TextView>(Resource.Id.sabadohora); LinearLayout domingocontainer = FindViewById<LinearLayout> (Resource.Id.domingocontainer); TextView domingo = FindViewById<TextView>(Resource.Id.domingo); TextView domingohora = FindViewById<TextView>(Resource.Id.domingohora); //poner los horarios donde corresponde if(objeto["lunes_a"]=="" || objeto["lunes_c"]==""){ lunescontainer.Visibility=ViewStates.Gone; }else{ if(objeto["lunes_a"]=="Cerrado" || objeto["lunes_c"]=="Cerrado"){ luneshora.Text="Cerrado"; }else{ luneshora.Text=objeto["lunes_a"]+" - "+objeto["lunes_c"]; } } if(objeto["martes_a"]=="" || objeto["martes_c"]==""){ martescontainer.Visibility=ViewStates.Gone; }else{ if(objeto["martes_a"]=="Cerrado" || objeto["martes_c"]=="Cerrado"){ marteshora.Text="Cerrado"; }else{ marteshora.Text=objeto["martes_a"]+" - "+objeto["martes_c"]; } } if(objeto["miercoles_a"]=="" || objeto["miercoles_c"]==""){ miercolescontainer.Visibility=ViewStates.Gone; }else{ if(objeto["miercoles_a"]=="Cerrado" || objeto["miercoles_c"]=="Cerrado"){ miercoleshora.Text="Cerrado"; }else{ miercoleshora.Text=objeto["miercoles_a"]+" - "+objeto["miercoles_c"]; } } if(objeto["jueves_a"]=="" || objeto["jueves_c"]==""){ juevescontainer.Visibility=ViewStates.Gone; }else{ if(objeto["jueves_a"]=="Cerrado" || objeto["jueves_c"]=="Cerrado"){ jueveshora.Text="Cerrado"; }else{ jueveshora.Text=objeto["jueves_a"]+" - "+objeto["jueves_c"]; } } if(objeto["viernes_a"]=="" || objeto["viernes_c"]==""){ viernescontainer.Visibility=ViewStates.Gone; }else{ if(objeto["viernes_a"]=="Cerrado" || objeto["viernes_c"]=="Cerrado"){ vierneshora.Text="Cerrado"; }else{ vierneshora.Text=objeto["viernes_a"]+" - "+objeto["viernes_c"]; } } if(objeto["sabado_a"]=="" || objeto["sabado_c"]==""){ sabadocontainer.Visibility=ViewStates.Gone; }else{ if(objeto["sabado_a"]=="Cerrado" || objeto["sabado_c"]=="Cerrado"){ sabadohora.Text="Cerrado"; }else{ sabadohora.Text=objeto["sabado_a"]+" - "+objeto["sabado_c"]; } } if(objeto["domingo_a"]=="" || objeto["domingo_c"]==""){ domingocontainer.Visibility=ViewStates.Gone; }else{ if(objeto["domingo_a"]=="Cerrado" || objeto["domingo_c"]=="Cerrado"){ domingohora.Text="Cerrado"; }else{ domingohora.Text=objeto["domingo_a"]+" - "+objeto["domingo_c"]; } } //vemos que dia es hoy y lo ponemos en verde DateTime localDate = DateTime.Now; int dia=(int)localDate.DayOfWeek; //1 es lunes, 7 es domingo y así string hoy_abre=""; string hoy_cierra=""; switch(dia){ case 1: lunes.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); luneshora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); hoy_abre = objeto ["lunes_a"]; hoy_cierra = objeto ["lunes_c"]; break; case 2: martes.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); marteshora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); hoy_abre = objeto ["martes_a"]; hoy_cierra = objeto ["martes_c"]; break; case 3: miercoles.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); miercoleshora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); hoy_abre = objeto ["miercoles_a"]; hoy_cierra = objeto ["miercoles_c"]; break; case 4: jueves.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); jueveshora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); hoy_abre = objeto ["jueves_a"]; hoy_cierra = objeto ["jueves_c"]; break; case 5: viernes.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); vierneshora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); hoy_abre = objeto ["viernes_a"]; hoy_cierra = objeto ["viernes_c"]; break; case 6: sabado.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); sabadohora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); hoy_abre = objeto ["sabado_a"]; hoy_cierra = objeto ["sabado_c"]; break; case 7: domingo.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); domingohora.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); hoy_abre = objeto ["domingo_a"]; hoy_cierra = objeto ["domingo_c"]; break; default: hoy_abre = "cerrado"; hoy_cierra = "cerrado"; break; } if(hoy_abre == "Cerrado" || hoy_cierra=="Cerrado"){ abiertocerrado.Text="Cerrado por el dia de hoy."; abiertocerrado.SetTextColor(Android.Graphics.Color.ParseColor("#C41200")); }else{ if(hoy_abre == "" || hoy_cierra==""){ abiertocerrado.Text="No disponemos de los horarios para el dia de hoy."; abiertocerrado.SetTextColor(Android.Graphics.Color.ParseColor("#C41200")); }else{ //TODO AQUI //AQUI HAY QUE VER SI ESTÁ ABIERTO O CERRADO DateTime ahora = DateTime.Now; DateTime abre = Convert.ToDateTime(hoy_abre); DateTime cierra = Convert.ToDateTime(hoy_cierra); DateTime cierra2 = DateTime.Now; int diasig=DateTime.Compare(abre,cierra); //Toast.MakeText (Application.Context, "Cierra primero: "+cierra.ToString(), ToastLength.Long).Show (); if(diasig>0){ //sumale un dia a la hora de cierre //Toast.MakeText (Application.Context, "si es mayor!: "+diasig, ToastLength.Long).Show (); cierra2=cierra.AddDays(1); }else{ cierra2=cierra; //no hagas nada } int f1=DateTime.Compare(abre, ahora); int f2=DateTime.Compare(ahora,cierra2); if(f1<0 && f2<0){ //abierto abiertocerrado.Text="Abierto justo ahora!"; abiertocerrado.SetTextColor(Android.Graphics.Color.ParseColor("#FFFFFF")); }else{ //cerrado abiertocerrado.Text="Cerrado ahora"; abiertocerrado.SetTextColor(Android.Graphics.Color.ParseColor("#C41200")); } } } TextView revs_tit= FindViewById<TextView> (Resource.Id.revs_tit); revs_tit.SetTypeface(font, TypefaceStyle.Normal); containernegocio.Visibility=ViewStates.Visible; waitlayout.Visibility=ViewStates.Gone; ImageView imgface = FindViewById<ImageView> (Resource.Id.imageface); ImageView imgtwitter = FindViewById<ImageView> (Resource.Id.imagetwitter); ImageView imggoogle = FindViewById<ImageView> (Resource.Id.imagegoogle); ImageView imgplif = FindViewById<ImageView> (Resource.Id.imageplif); if (objeto ["facebook"] == "") { imgface.Visibility = ViewStates.Gone; } if (objeto ["twitter"] == "") { imgtwitter.Visibility = ViewStates.Gone; } if (objeto ["google"] == "") { imggoogle.Visibility = ViewStates.Gone; } imgface.Click += (object sender, EventArgs e) => { Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(objeto["facebook"])); StartActivity(intent); }; imgtwitter.Click += (object sender, EventArgs e) => { Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(objeto["twitter"])); StartActivity(intent); }; imggoogle.Click += (object sender, EventArgs e) => { Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(objeto["google"])); StartActivity(intent); }; imgplif.Click += (object sender, EventArgs e) => { Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("http://www.plif.mx/negocio/"+objeto["id"])); StartActivity(intent); }; } catch(Exception ex){ Log.Debug (tag, "ERROR FETCHING DATA: "+ex); Toast.MakeText (Application.Context, "Ocurrió un error al recuperar la información del negocio", ToastLength.Long).Show (); Finish (); } //aqui en un nuevo try catch, cargamos los comentarios ProgressBar waitrv = FindViewById<ProgressBar> (Resource.Id.waitrv); try{ ReviewsObj=await plifserver.FetchWeatherAsync("http://plif.mx/mobile/get_neg_reviews?nid="+Intent.GetStringExtra("id")+"&uid="+userid); //Aqui vamos a cargar los reviews con ayuda del adapter LinearLayout reviewscont = FindViewById<LinearLayout> (Resource.Id.reviewscont); LayoutInflater inflater = LayoutInflater.From(this); /* for(int i=0; i<=5; i++){ View view = inflater.Inflate(Resource.Layout.listview_comentarios, reviewscont, false); TextView revlikes = view.FindViewById<TextView> (Resource.Id.user_corazonlikes); revlikes.SetTypeface(font, TypefaceStyle.Normal); reviewscont.AddView(view); }*/ foreach(JsonObject data in ReviewsObj){ View row = inflater.Inflate(Resource.Layout.listview_comentarios, reviewscont, false); ReviewDetalles holder=null; LinearDetalles preholder=null; /*TextView revlikes = view.FindViewById<TextView> (Resource.Id.user_corazonlikes); revlikes.SetTypeface(font, TypefaceStyle.Normal);*/ LinearLayout fondo_coment = row.FindViewById<LinearLayout> (Resource.Id.fondo_coment); fondo_coment.SetBackgroundResource(Resource.Drawable.fondoinfopremium); //EMPIEZA //ESTE SETEA LA IMAGEN ImageView imagen = row.FindViewById<ImageView> (Resource.Id.user_imagen); if (data["i"]["ruta"] == null || data["i"]["ruta"] == "" || data["i"]["ruta"] == "null") { //pon la imagen por defecto imagen.SetImageResource (Resource.Drawable.noprof); } else { //TENEMOS QUE VERIFICAR SI LA IMAGEN ES DE GOOGLE O DE NOSOTROS!!! string extra="http://plif.mx/"; string ruta=data["i"]["ruta"]; string first=ruta[0].ToString(); if(first=="u" || first=="U"){ ruta=extra+ruta; }else{ //no hagas nada, la imagen es de google } Koush.UrlImageViewHelper.SetUrlDrawable (imagen, ruta, Resource.Drawable.bolaplace); }//TERMINA SI LA IMAGEN NO ES NULA //Ponemos el nombre TextView nombre = row.FindViewById<TextView> (Resource.Id.user_nombre); nombre.Text = data["u"]["nombre"]+" "+data["u"]["apellidos"]; nombre.SetTextColor(Color.ParseColor("#FFFFFF")); //ESTE SETEA LAS ESTRELLAS DE LA CALIFICACION ImageView cali = row.FindViewById<ImageView> (Resource.Id.user_calificacion); string cal = data["cm"]["calificacion"]; switch (cal) { case "0": cali.SetImageResource (Resource.Drawable.e0); break; case "": cali.SetImageResource (Resource.Drawable.e0); break; case "null": cali.SetImageResource (Resource.Drawable.e0); break; case null: cali.SetImageResource (Resource.Drawable.e0); break; case "1": cali.SetImageResource (Resource.Drawable.e1); break; case "2": cali.SetImageResource (Resource.Drawable.e2); break; case "3": cali.SetImageResource (Resource.Drawable.e3); break; case "4": cali.SetImageResource (Resource.Drawable.e4); break; case "5": cali.SetImageResource (Resource.Drawable.e5); break; default: cali.SetImageResource (Resource.Drawable.e0); break; } //Ponemos el comentario TextView comentario = row.FindViewById<TextView> (Resource.Id.user_comentario); comentario.Text = data["cm"]["comentario"]; comentario.SetTextColor(Color.ParseColor("#FFFFFF")); //Ponemos la fecha y la hora TextView fechahora = row.FindViewById<TextView> (Resource.Id.user_fechahora); string fc=data["cm"]["fecha"]; DateTime dt = System.Convert.ToDateTime(fc); fechahora.Text = dt.ToString ("dd/MM/yyyy H:mm"); fechahora.SetTextColor(Color.ParseColor("#FFFFFF")); //ponemos los likes que tiene TextView likescom = row.FindViewById<TextView> (Resource.Id.user_numlikes); likescom.Text = " "+data["cm"]["num_likes"]; likescom.SetTextColor(Color.ParseColor("#FFFFFF")); bool haslike = false; //averiguamos si el usuario le ha dado like try{ string ulk=" "; if(data["user_likes"]["user_likes"]!= null & data["user_likes"]["user_likes"]!= "null"){ ulk=data["user_likes"]["user_likes"]; string[] words; words = ulk.Split(' '); foreach (string word in words) { if (word == userid) { haslike = true; } } }else{ //no hagas nada! Log.Debug("Split","Los likes son nulos"); } }catch(Exception ex){ Log.Debug("Split","Fue null: "+ex); } corazonlike = row.FindViewById<TextView> (Resource.Id.user_corazonlikes); string hl=""; if (haslike) { corazonlike.Text = GetString(Resource.String.heart); hl="si"; } else { corazonlike.Text = GetString (Resource.String.heartempty); hl="no"; } //Typeface font = Typeface.CreateFromAsset(mContext.Assets, "Fonts/fa.ttf"); corazonlike.SetTypeface(font, TypefaceStyle.Normal); holder = new ReviewDetalles(data["cm"]["id"],hl,likescom); corazonlike.SetTag(Resource.String.lel,holder); LinearLayout layoutlike = row.FindViewById<LinearLayout> (Resource.Id.layoutlike); preholder=new LinearDetalles(corazonlike); layoutlike.SetTag(Resource.String.lel,preholder); //TERMINA reviewscont.AddView(row); }; /* * foreach(JsonObject data in ReviewsObj){ revItems.Add( new Review(){ ReviewId=data["cm"]["id"], ReviewnegId=data["cm"]["negocio_id"], ReviewNombre=data["u"]["nombre"]+" "+data["u"]["apellidos"], ReviewEmail=data["u"]["autor_email"], ReviewComentario=data["cm"]["comentario"], ReviewCalificacion=data["cm"]["calificacion"], ReviewFecha=data["cm"]["fecha"], ReviewLikes=data["cm"]["num_likes"], ReviewautorId=data["u"]["id"], ReviewRuta=data["i"]["ruta"], ReviewLikesUsers=data["user_likes"]["user_likes"] } ); Log.Debug("AñadirReviews","Añadida!"); } */ //MyReviewsAdapter rev_adapter = new MyReviewsAdapter(Application.Context, revItems); //ListView revslista = FindViewById<ListView> (Resource.Id.revslista); //revslista.Adapter=rev_adapter; waitrv.Visibility=ViewStates.Gone; //revslista.Visibility=ViewStates.Visible; }catch(Exception ex){ Log.Debug("ErrorTodo", ex.ToString()); waitrv.Visibility=ViewStates.Gone; //var fab = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition); Snackbar .Make (fab, "Ooops! Ocurrió un error al recuperar las reseñas. Inténtalo nuevamente!", Snackbar.LengthLong) .SetAction ("Ok", (view) => { }) .Show (); } try{ //Traemos la galeria de imagenes TextView fotos_tit = FindViewById<TextView> (Resource.Id.fotos_tit); fotos_tit.SetTypeface(font, TypefaceStyle.Normal); Utils utils = new Utils(this); JsonValue contenedorimg = await utils.getFilePaths("http://plif.mx/mobile/get_img_neg?id="+Intent.GetStringExtra("id")+"&prev"); LinearLayout fotosprevcontain = FindViewById<LinearLayout> (Resource.Id.fotosprevcontain); LayoutInflater inflater2 = LayoutInflater.From(this); string extra="http://plif.mx/admin/"; string rutaa=""; string first=""; View rowimg = inflater2.Inflate(Resource.Layout.img_layout, fotosprevcontain, false); int numfotos=0; try{ rutaa=contenedorimg[0]["imagenes"]["ruta"]; first=rutaa[0].ToString(); if(first=="u" || first=="U"){ //Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show (); rutaa=extra+rutaa; }else{ //no hagas nada, la imagen es de google } Log.Debug ("GaleriaAdapter", "Procesando: "+rutaa); ImageView cont = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria1); Koush.UrlImageViewHelper.SetUrlDrawable (cont, rutaa, Resource.Drawable.bola); numfotos++; } catch(Exception ex){ ImageView cont = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria1); cont.Visibility=ViewStates.Gone; Log.Debug("imgscont","no hay imagen uno"); } ////LA QUE SIGUE!!! try{ rutaa=contenedorimg[1]["imagenes"]["ruta"]; first=rutaa[0].ToString(); if(first=="u" || first=="U"){ //Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show (); rutaa=extra+rutaa; }else{ //no hagas nada, la imagen es de google } Log.Debug ("GaleriaAdapter", "Procesando: "+rutaa); ImageView cont2 = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria2); Koush.UrlImageViewHelper.SetUrlDrawable (cont2, rutaa, Resource.Drawable.bola); numfotos++; } catch(Exception ex){ ImageView cont = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria2); cont.Visibility=ViewStates.Gone; Log.Debug("imgscont","no hay imagen dos"); } ////LA ULTIMA!!! try{ rutaa=contenedorimg[2]["imagenes"]["ruta"]; first=rutaa[0].ToString(); if(first=="u" || first=="U"){ //Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show (); rutaa=extra+rutaa; }else{ //no hagas nada, la imagen es de google } Log.Debug ("GaleriaAdapter", "Procesando: "+rutaa); ImageView cont3 = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria3); Koush.UrlImageViewHelper.SetUrlDrawable (cont3, rutaa, Resource.Drawable.bola); numfotos++; } catch(Exception ex){ ImageView cont = rowimg.FindViewById<ImageView> (Resource.Id.img_galeria3); cont.Visibility=ViewStates.Gone; Log.Debug("imgscont","no hay imagen tres"); } fotosprevcontain.AddView(rowimg); fullfotos= FindViewById<TextView> (Resource.Id.fullfotos); if(numfotos>0){ fullfotos.Visibility=ViewStates.Visible; } }catch(Exception ex){ Log.Debug("ErrorLista", ex.ToString()); var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition); Snackbar .Make (fabee, "Ooops! Ocurrió un error al recuperar las imágenes. Inténtalo nuevamente!", Snackbar.LengthLong) .SetAction ("Ok", (view) => { }) .Show (); } EditText nombrerev = FindViewById<EditText> (Resource.Id.nombrerev); EditText emailrev = FindViewById<EditText> (Resource.Id.emailrev); commentrev = FindViewById<EditText> (Resource.Id.commentrev); nombrerev.Text=prefs.GetString("nombre", null); emailrev.Text=prefs.GetString("email", null); //nombrerev.EditableText = false; //emailrev.EditableText = false; nombrerev.Enabled = false; emailrev.Enabled = false; ImageButton e1 = FindViewById<ImageButton> (Resource.Id.estrella1); ImageButton e2 = FindViewById<ImageButton> (Resource.Id.estrella2); ImageButton e3 = FindViewById<ImageButton> (Resource.Id.estrella3); ImageButton e4 = FindViewById<ImageButton> (Resource.Id.estrella4); ImageButton e5 = FindViewById<ImageButton> (Resource.Id.estrella5); TextView califspan = FindViewById<TextView> (Resource.Id.califspan); callnow.Click += (object sender, EventArgs e) => { Intent intent = new Intent(Intent.ActionCall, Android.Net.Uri.Parse("tel:" + telefono.Text)); StartActivity(intent); }; ubicacionbtn.Click += (object sender, EventArgs e) => { ubicacionlayout.Visibility=ViewStates.Visible; descripcionlayout.Visibility=ViewStates.Gone; contactolayout.Visibility=ViewStates.Gone; ubicacionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnpressprem); descripcionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem); contactobtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem); }; descripcionbtn.Click += (object sender, EventArgs e) => { ubicacionlayout.Visibility=ViewStates.Gone; descripcionlayout.Visibility=ViewStates.Visible; contactolayout.Visibility=ViewStates.Gone; ubicacionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem); descripcionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnpressprem); contactobtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem); }; contactobtn.Click += (object sender, EventArgs e) => { ubicacionlayout.Visibility=ViewStates.Gone; descripcionlayout.Visibility=ViewStates.Gone; contactolayout.Visibility=ViewStates.Visible; ubicacionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem); descripcionbtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnprem); contactobtn.SetBackgroundResource(Resource.Drawable.ubicacionbtnpressprem); }; addcomentbtn = FindViewById<Button> (Resource.Id.addcomment); enviarmensaje.Click += (object sender, EventArgs e) => { var enviarmsj = new Intent (this, typeof(EnviarMensaje)); enviarmsj.PutExtra("negocioid",idres); enviarmsj.PutExtra("titulo", titulores); enviarmsj.PutExtra("propietario",propietario); StartActivity (enviarmsj); }; addcomentbtn.Click += (sender, e) => { enviarrev.Focusable=true; enviarrev.FocusableInTouchMode=true; if(enviarrev.RequestFocus()){ Log.Debug("BotonArribaReseña", "It dit it!"); enviarrev.ClearFocus(); enviarrev.FocusableInTouchMode=false; } }; e1.Click += delegate(object sender, EventArgs e) { califspan.StartAnimation(flip); califspan.Text="1.0"; calificacion=1; e1.SetImageResource(Resource.Drawable.estrellafull); e2.SetImageResource(Resource.Drawable.estrellaempty); e3.SetImageResource(Resource.Drawable.estrellaempty); e4.SetImageResource(Resource.Drawable.estrellaempty); e5.SetImageResource(Resource.Drawable.estrellaempty); }; e2.Click += delegate(object sender, EventArgs e) { califspan.StartAnimation(flip); califspan.Text="2.0"; calificacion=2; e1.SetImageResource(Resource.Drawable.estrellafull); e2.SetImageResource(Resource.Drawable.estrellafull); e3.SetImageResource(Resource.Drawable.estrellaempty); e4.SetImageResource(Resource.Drawable.estrellaempty); e5.SetImageResource(Resource.Drawable.estrellaempty); }; e3.Click += delegate(object sender, EventArgs e) { califspan.StartAnimation(flip); califspan.Text="3.0"; calificacion=3; e1.SetImageResource(Resource.Drawable.estrellafull); e2.SetImageResource(Resource.Drawable.estrellafull); e3.SetImageResource(Resource.Drawable.estrellafull); e4.SetImageResource(Resource.Drawable.estrellaempty); e5.SetImageResource(Resource.Drawable.estrellaempty); }; e4.Click += delegate(object sender, EventArgs e) { califspan.StartAnimation(flip); califspan.Text="4.0"; calificacion=4; e1.SetImageResource(Resource.Drawable.estrellafull); e2.SetImageResource(Resource.Drawable.estrellafull); e3.SetImageResource(Resource.Drawable.estrellafull); e4.SetImageResource(Resource.Drawable.estrellafull); e5.SetImageResource(Resource.Drawable.estrellaempty); }; e5.Click += delegate(object sender, EventArgs e) { califspan.StartAnimation(flip); califspan.Text="5.0"; calificacion=5; e1.SetImageResource(Resource.Drawable.estrellafull); e2.SetImageResource(Resource.Drawable.estrellafull); e3.SetImageResource(Resource.Drawable.estrellafull); e4.SetImageResource(Resource.Drawable.estrellafull); e5.SetImageResource(Resource.Drawable.estrellafull); }; e5.PerformClick (); //nenenenenenene addimg.Click += async (object sender, EventArgs e) => { layoutdejaimagenes.Visibility=ViewStates.Visible; }; deleteimgrev.Click += async (sender, e) => { GridLayout imgcomprev = FindViewById<GridLayout> (Resource.Id.imgcomprev); LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev); Log.Debug("DELETEBUTTON","Inician las layouts"); if(imgcomprev.ChildCount>0){ imgcomprev.RemoveAllViews(); } Log.Debug("DELETEBUTTON","vistas removidas"); if(imagencomentario!=null){ imagencomentario.Recycle(); imagencomentario=null; } Log.Debug("DELETEBUTTON","reciclado"); //deleteimgrev.Visibility=ViewStates.Gone; Log.Debug("DELETEBUTTON","se oculta boton borrar (deprecated)"); imgcontainercomprev.Visibility=ViewStates.Gone; Log.Debug("DELETEBUTTON","se oculta el contenedor de subir imagenes"); imagenrev = FindViewById<Button> (Resource.Id.imagenrev); imagenrev.Visibility=ViewStates.Visible; Log.Debug("DELETEBUTTON","se muestra el boton añadir"); fossbytes.Clear(); Log.Debug("DELETEBUTTON","El Arraylist de bytes se resetea"); imgcount=0; Log.Debug("DELETEBUTTON","se resetea el contador de cuantas imagenes se subieron"); masimagenes.Text="Carga 3 imágenes más!"; Log.Debug("DELETEBUTTON","Reseteamos el texto de las imagenes"); }; deleteimgnegocio.Click += async (sender, e) => { //LinearLayout imgcomprev = FindViewById<LinearLayout> (Resource.Id.imgcomprev); //LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev); Log.Debug("DELETEBUTTON","Inician las layouts"); if(imgnegocioprev.ChildCount>0){ imgnegocioprev.RemoveAllViews(); } Log.Debug("DELETEBUTTON","vistas removidas"); if(imagencomentario!=null){ imagencomentario.Recycle(); imagencomentario=null; } Log.Debug("DELETEBUTTON","reciclado"); //deleteimgrev.Visibility=ViewStates.Gone; Log.Debug("DELETEBUTTON","se oculta boton borrar (deprecated)"); layoutdejaimagenes.Visibility=ViewStates.Gone; Log.Debug("DELETEBUTTON","se oculta el contenedor de subir imagenes"); fossbytes.Clear(); Log.Debug("DELETEBUTTON","El Arraylist de bytes se resetea"); imgcount=0; Log.Debug("DELETEBUTTON","se resetea el contador de cuantas imagenes se subieron"); masimagenesnegocio.Text="Carga 10 imágenes más!"; Log.Debug("DELETEBUTTON","Reseteamos el texto de las imagenes"); }; imagenrev.Click += async (object sender, EventArgs e) => { LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev); imgcontainercomprev.Visibility=ViewStates.Visible; imagenrev.Visibility=ViewStates.Gone; }; imagennegocio.Click += async (object sender, EventArgs e) => { source=1; ProcesarImagenes(imgnegocioprev, 10, masimagenesnegocio); }; imagencamaranegocio.Click += async (object sender, EventArgs e) => { source=2; ProcesarImagenes(imgnegocioprev, 10, masimagenesnegocio); }; imagenrev2.Click += async (object sender, EventArgs e) => { source=1; GridLayout imgcomprev = FindViewById<GridLayout> (Resource.Id.imgcomprev); ProcesarImagenes(imgcomprev,3,masimagenes); };//imagenrev click imagencamara.Click += async (sender, e) => { source=2; GridLayout imgcomprev = FindViewById<GridLayout> (Resource.Id.imgcomprev); ProcesarImagenes(imgcomprev,3,masimagenes); }; enviarimgneg.Click += async (object sender, EventArgs e) => { if(imgcount>0){ diccionario = new Dictionary<string, string>(); diccionario.Add("negocio", idres); diccionario.Add("description", "Foto en "+titulores); diccionario.Add("autor", prefs.GetString("id", null)); //LIMPIAMOS LA PANTALLA Y DESHABILITAMOS LOS BOTONES ProgressBar waitnegociors=FindViewById<ProgressBar>(Resource.Id.waitnegociors); waitnegociors.Visibility=ViewStates.Visible; TextView subiendofotos = FindViewById<TextView> (Resource.Id.subiendofotos); subiendofotos.Visibility=ViewStates.Visible; //deleteimgrev.PerformClick(); //se deshabilitan ambos botones //enviarrev.Enabled=false; //imagenrev.Enabled=false; //LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev); layoutdejaimagenes.Visibility=ViewStates.Gone; Log.Debug("EnviarImagen","se oculta el contenedor de subir imagenes"); imagenrev = FindViewById<Button> (Resource.Id.imagenrev); imagenrev.Visibility=ViewStates.Visible; Log.Debug("EnviarImagenes","se muestra el boton añadir"); masimagenesnegocio.Text="Carga 10 imágenes más!"; Log.Debug("EnviarImagenes","Reseteamos el texto de las imagenes"); int countbytes=fossbytes.Count; if(fossbytes!=null && countbytes>0){ Log.Debug ("EnviarImagenes", "Si hay imágenes byte en el array!"); Log.Debug("CONVERTIR","Elementos convertidos a Byte: "+countbytes); } string resp = await plifserver.PostMultiPartForm ("http://plif.mx/pages/UploadImg/0", fossbytes, "nada", "file[]", "image/jpeg", diccionario, false); Log.Debug("SUBIRIMAGENES",resp); waitnegociors.Visibility=ViewStates.Gone; subiendofotos.Visibility=ViewStates.Gone; deleteimgnegocio.PerformClick(); var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition); Snackbar .Make (fabee, "Hemos recibido tus fotos. Gracias por ser parte de Plif!", Snackbar.LengthLong) .SetAction ("Ok", (view) => { }) .Show (); }else{ var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition); Snackbar .Make (fabee, "Selecciona al menos una imágen!", Snackbar.LengthLong) .SetAction ("Ok", (view) => { }) .Show (); } }; enviarrev.Click += async (object sender, EventArgs e) => { if(calificacion==0){ var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition); Snackbar .Make (fabee, "Por favor califica al negocio!", Snackbar.LengthLong) .SetAction ("Ok", (view) => { }) .Show (); }else{ if(commentrev.Text==""){ var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition); Snackbar .Make (fabee, "Por favor escribe un comentario!", Snackbar.LengthLong) .SetAction ("Ok", (view) => { }) .Show (); }else{ //Aqui mero!!!! diccionario = new Dictionary<string, string>(); diccionario.Add("comentario", commentrev.Text); diccionario.Add("autor", prefs.GetString("id", null)); diccionario.Add("calificacion", calificacion.ToString()); diccionario.Add("negocio", idres); diccionario.Add("titulo", titulores); Log.Debug("EnviarComentario","Clickeo"); //LIMPIAMOS LA PANTALLA Y DESHABILITAMOS LOS BOTONES ProgressBar waitrs=FindViewById<ProgressBar>(Resource.Id.waitrs); waitrs.Visibility=ViewStates.Visible; //deleteimgrev.PerformClick(); //se deshabilitan ambos botones enviarrev.Enabled=false; imagenrev.Enabled=false; LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev); imgcontainercomprev.Visibility=ViewStates.Gone; Log.Debug("EnviarComentario","se oculta el contenedor de subir imagenes"); imagenrev = FindViewById<Button> (Resource.Id.imagenrev); imagenrev.Visibility=ViewStates.Visible; Log.Debug("EnviarComentario","se muestra el boton añadir"); masimagenes.Text="Carga 3 imágenes más!"; Log.Debug("EnviarComentario","Reseteamos el texto de las imagenes"); string filename=""; int countbytes=fossbytes.Count; if(fossbytes!=null && countbytes>0){ Log.Debug ("EnviarComentario", "Si hay imágenes byte en el array!"); Log.Debug("CONVERTIR","Elementos convertidos a Byte: "+countbytes); } //AQUI LO ENVIAMOS, EL PRIMER PARAMETRO ES LA PÁGINA, EL SEGUNDO ES LA IMAGEN CODIFICADA EN BITS, EL TERCERO ES EL NOMBRE DEL PARÁMETRO QUE RECIBE PHP, EL CUARTO ES EL MIMETYPE DE LA IMAGEN, Y EL ULTIMO ES EL DICCTIONARY CON TODOS LOS DEMÁS VALORES STRING string resp = await plifserver.PostMultiPartForm ("http://plif.mx/comentario_negocio", fossbytes, filename, "file[]", "image/jpeg", diccionario, false); //deleteimgrev.PerformClick(); enviarrev.Enabled=true; imagenrev.Enabled=true; waitrs.Visibility=ViewStates.Gone; calificacion=0; commentrev.Text=""; califspan.StartAnimation(flip); califspan.Text="0.0"; calificacion=0; e1.SetImageResource(Resource.Drawable.estrellaempty); e2.SetImageResource(Resource.Drawable.estrellaempty); e3.SetImageResource(Resource.Drawable.estrellaempty); e4.SetImageResource(Resource.Drawable.estrellaempty); e5.SetImageResource(Resource.Drawable.estrellaempty); Log.Debug("MULTIPARTRESPONSE",resp); deleteimgrev.PerformClick(); var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition); Snackbar .Make (fabee, "Tu reseña ha sido enviada. ¡Gracias por ser parte de Plif!", Snackbar.LengthLong) .SetAction ("Ok", (view) => { }) .Show (); } } }; fullfotos.Click += delegate(object sender, EventArgs e) { var galeriaimg = new Intent (this, typeof(GaleriaImagenes)); galeriaimg.PutExtra("negocioid",idres); /*negocio.PutExtra("id",negItems [e.Position].NegocioId); negocio.PutExtra("nombre",negItems [e.Position].NegocioName); negocio.PutExtra("direccion",negItems [e.Position].NegocioDir); negocio.PutExtra("categoria",negItems [e.Position].NegocioCat); negocio.PutExtra("calificacion",negItems [e.Position].NegocioCal);*/ StartActivity (galeriaimg); //StartActivity(typeof(GaleriaImagenes)); /* var fabee = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition); Snackbar .Make (fabee, "El lunes se lo pongo!", Snackbar.LengthLong) .SetAction ("Ok", (view) => { }) .Show (); */ }; abiertocerrado.Click += delegate { if(!horariovisible){ //layoutdiascontainer.Animate().TranslationY(300); layoutdiascontainer.Visibility=ViewStates.Visible; //int val=GetX(layoutdiascontainer); //scrollview.ScrollTo(0,val); horariovisible=true; }else{ //layoutdiascontainer.Animate().TranslationY(0); layoutdiascontainer.Visibility=ViewStates.Gone; horariovisible=false; } }; addlike.Click += async (sender, e) => { if(!dandolike){ dandolike=true; try{ if(!haslike){ haslike=true; addlike.StartAnimation(bounce); addlike.Text = GetString (Resource.String.heart); numlikes++; likes.Text=numlikes+" Personas"; //JsonValue likeans=await plifserver.FetchWeatherAsync("http://plif.mx/mobile/like_neg_asset?nid="+Intent.GetStringExtra("id")+"&uid="+userid+"&case=1"); string likestring="http://plif.mx/pages/LikeNegocio/"+negocioid+"/1?uid="+userid; Log.Debug("Like","La URL Es: "+likestring); JsonValue likeans=await plifserver.FetchWeatherAsync("http://plif.mx/pages/LikeNegocio/"+negocioid+"/1?uid="+userid); dandolike=false; }else{ haslike=false; addlike.StartAnimation(bounce); addlike.Text = GetString (Resource.String.heartempty); numlikes--; likes.Text=numlikes+" Personas"; //JsonValue likeans=await plifserver.FetchWeatherAsync("http://plif.mx/mobile/like_neg_asset?nid="+Intent.GetStringExtra("id")+"&uid="+userid+"&case=2"); string likestring="http://plif.mx/pages/LikeNegocio/"+negocioid+"/2?uid="+userid; Log.Debug("Like","La URL Es: "+likestring); JsonValue likeans=await plifserver.FetchWeatherAsync(likestring); dandolike=false; } }catch(Exception ex){ waitpb.Visibility=ViewStates.Gone; //var fab = FindViewById<CoordinatorLayout> (Resource.Id.snackbarPosition); Snackbar .Make (fab, "Ooops! Ocurrió un error al intentar procesar tu solicitud. Inténtalo nuevamente!", Snackbar.LengthLong) .SetAction ("Ok", (view) => { }) .Show (); } }else{ Log.Debug("AddLike","Like en proceso! Por favor espera!!"); } }; //REDES SOCIALES }
TextView MakeHeaderView () { var result = new TextView (context) { Gravity = GravityFlags.Center, TextSize = 10, }; result.SetPadding (4, 4, 4, 4); result.SetBackgroundColor (Color.Rgb (0x22, 0x22, 0x22)); result.SetAllCaps (true); result.SetTypeface (Typeface.DefaultBold, TypefaceStyle.Bold); result.SetTextColor (Color.White); return result; }
public CardboardOverlayEyeView(Context context) : base(context) { imageView = new ImageView(context); imageView.SetScaleType (ImageView.ScaleType.CenterInside); imageView.SetAdjustViewBounds (true); // Preserve aspect ratio. AddView(imageView); textView = new TextView(context); textView.SetTextSize (ComplexUnitType.Dip, 14f); textView.SetTypeface (textView.Typeface, TypefaceStyle.Bold); textView.Gravity = GravityFlags.Center; textView.SetShadowLayer(3.0f, 0.0f, 0.0f, Color.DarkGray); AddView(textView); }
void Initialize () { BackgroundColor = Color.Black; strokeColor = Color.White; StrokeWidth = 2f; canvasView = new SignatureCanvasView (this.context); canvasView.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent); //Set the attributes for painting the lines on the screen. paint = new Paint (); paint.Color = strokeColor; paint.StrokeWidth = StrokeWidth; paint.SetStyle (Paint.Style.Stroke); paint.StrokeJoin = Paint.Join.Round; paint.StrokeCap = Paint.Cap.Round; paint.AntiAlias = true; #region Add Subviews RelativeLayout.LayoutParams layout; BackgroundImageView = new ImageView (this.context); BackgroundImageView.Id = generateId (); AddView (BackgroundImageView); //Add an image that covers the entire signature view, used to display already drawn //elements instead of having to redraw them every time the user touches the screen. imageView = new ClearingImageView (context); imageView.SetBackgroundColor (Color.Transparent); imageView.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.FillParent, RelativeLayout.LayoutParams.FillParent); AddView (imageView); lblSign = new TextView (context); lblSign.Id = generateId (); lblSign.SetIncludeFontPadding (true); lblSign.Text = "Sign Here"; layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent); layout.AlignWithParent = true; layout.BottomMargin = 6; layout.AddRule (LayoutRules.AlignBottom); layout.AddRule (LayoutRules.CenterHorizontal); lblSign.LayoutParameters = layout; lblSign.SetPadding (0, 0, 0, 6); AddView (lblSign); //Display the base line for the user to sign on. signatureLine = new View (context); signatureLine.Id = generateId (); signatureLine.SetBackgroundColor (Color.Gray); layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, 1); layout.SetMargins (10, 0, 10, 5); layout.AddRule (LayoutRules.Above, lblSign.Id); signatureLine.LayoutParameters = layout; AddView (signatureLine); //Display the X on the left hand side of the line where the user signs. xLabel = new TextView (context); xLabel.Id = generateId (); xLabel.Text = "X"; xLabel.SetTypeface (null, TypefaceStyle.Bold); layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent); layout.LeftMargin = 11; layout.AddRule (LayoutRules.Above, signatureLine.Id); xLabel.LayoutParameters = layout; AddView (xLabel); AddView (canvasView); lblClear = new TextView (context); lblClear.Id = generateId (); lblClear.Text = "Clear"; layout = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent); layout.SetMargins (0, 10, 22, 0); layout.AlignWithParent = true; layout.AddRule (LayoutRules.AlignRight); layout.AddRule (LayoutRules.AlignTop); lblClear.LayoutParameters = layout; lblClear.Visibility = ViewStates.Invisible; lblClear.Click += (object sender, EventArgs e) => { Clear (); }; AddView (lblClear); #endregion paths = new List<Path> (); points = new List<System.Drawing.PointF[]> (); currentPoints = new List<System.Drawing.PointF> (); dirtyRect = new RectF (); }
public MessageListItem( Context context ) : base( context ) { SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) ); LayoutParameters = new AbsListView.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent ); Orientation = Orientation.Vertical; LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent ); contentLayout.Orientation = Orientation.Horizontal; AddView( contentLayout ); TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.WrapContent ); TitleLayout.Orientation = Orientation.Vertical; ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Weight = 1; ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical; ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); contentLayout.AddView( TitleLayout ); Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal ); Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize ); Title.SetSingleLine( ); Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End; Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) ); TitleLayout.AddView( Title ); Date = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Date.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Date.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); Date.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); Date.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); ( (LinearLayout.LayoutParams)Date.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 ); TitleLayout.AddView( Date ); Speaker = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Speaker.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Speaker.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); Speaker.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); Speaker.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); ( (LinearLayout.LayoutParams)Speaker.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 ); Speaker.SetMaxLines( 1 ); TitleLayout.AddView( Speaker ); // add our own custom seperator at the bottom View seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context ); seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 ); seperator.LayoutParameters.Height = 2; seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) ); AddView( seperator ); // setup the buttons LinearLayout buttonLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); buttonLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent ); ( (LinearLayout.LayoutParams)buttonLayout.LayoutParameters ).Weight = 1; buttonLayout.Orientation = Orientation.Horizontal; contentLayout.AddView( buttonLayout ); Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary ); ListenButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context ); ListenButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Weight = 1; ( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical; ListenButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal ); ListenButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize ); ListenButton.Text = PrivateNoteConfig.Series_Table_Listen_Icon; ListenButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) ); ListenButton.Background = null; buttonLayout.AddView( ListenButton ); WatchButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context ); WatchButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Weight = 1; ( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical; WatchButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal ); WatchButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize ); WatchButton.Text = PrivateNoteConfig.Series_Table_Watch_Icon; WatchButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) ); WatchButton.Background = null; buttonLayout.AddView( WatchButton ); TakeNotesButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context ); TakeNotesButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Weight = 1; ( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical; TakeNotesButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal ); TakeNotesButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize ); TakeNotesButton.Text = PrivateNoteConfig.Series_Table_TakeNotes_Icon; TakeNotesButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) ); TakeNotesButton.Background = null; buttonLayout.AddView( TakeNotesButton ); ListenButton.Click += (object sender, EventArgs e ) => { ParentAdapter.OnClick( Position, 0 ); }; WatchButton.Click += (object sender, EventArgs e ) => { ParentAdapter.OnClick( Position, 1 ); }; TakeNotesButton.Click += (object sender, EventArgs e ) => { ParentAdapter.OnClick( Position, 2 ); }; }