public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // all the splicing is optional as we are going to populate // the members/events from three different views (fragment/header/footer) var rootView = inflater.Inflate(Resource.Layout.fragment_tiles, container, false); Geneticist.Splice(this, rootView); var header = inflater.Inflate(Resource.Layout.fragment_tiles_header, null); Geneticist.Splice(this, header); var footer = inflater.Inflate(Resource.Layout.fragment_tiles_footer, null); Geneticist.Splice(this, footer); mListTiles.AddHeaderView(header); mListTiles.AddFooterView(footer); mTileListAdapter = new TileListAdapter(this); mListTiles.Adapter = mTileListAdapter; mListTiles.ItemClick += (sender, e) => { var position = e.Position - 1; // ignore the header if (position >= 0 && position < mTileListAdapter.Count) { mSelectedTile = (BandTile)mTileListAdapter.GetItem(position); RefreshControls(); } }; return(rootView); }
private void Init() { var inflater = LayoutInflater.From(Context); inflater.Inflate(Resource.Layout.view_bandtheme, this); Geneticist.Splice(this); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var rootView = inflater.Inflate(Resource.Layout.fragment_theme, container, false); Geneticist.Splice(this, rootView); return(rootView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.MainLayout); // inject views Geneticist.Splice(this); // set up chrome drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, Resource.String.drawer_open, Resource.String.drawer_close); drawerLayout.SetDrawerListener(drawerToggle); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); //var styledAttributes = Theme.ObtainStyledAttributes(new[] { Android.Resource.Attribute.ActionBarSize }); //var actionBarSize = (int)styledAttributes.GetDimension(0, 0); //styledAttributes.Recycle(); // set up list view stickyList.EmptyView = FindViewById(Resource.Id.empty); stickyList.DrawingListUnderStickyHeader = true; stickyList.AreHeadersSticky = true; stickyList.StickyHeaderTopOffset = 0;// -20; stickyList.AddHeaderView(LayoutInflater.Inflate(Resource.Layout.ListHeader, null)); stickyList.AddFooterView(LayoutInflater.Inflate(Resource.Layout.ListFooter, null)); stickyList.ItemClick += (sender, e) => Toast.MakeText(this, "Item " + e.Position + " clicked!", ToastLength.Short).Show(); stickyList.HeaderClick += (sender, e) => Toast.MakeText(this, "Header " + e.HeaderId + " currentlySticky ? " + e.CurrentlySticky, ToastLength.Short).Show(); stickyList.StickyHeaderChanged += (sender, e) => ViewHelper.SetAlpha(e.Header, 1); stickyList.StickyHeaderOffsetChanged += (sender, e) => { if (fadeHeader) { ViewHelper.SetAlpha(e.Header, 1 - (e.Offset / (float)e.Header.MeasuredHeight)); } }; // set up data adapter = new StickyAdapter(this); stickyList.Adapter = adapter; // actions openExpandableListButton.Click += (sender, e) => StartActivity(new Intent(this, typeof(ExpandableListActivity))); restoreButton.Click += (sender, e) => adapter.Restore(); updateButton.Click += (sender, e) => adapter.NotifyDataSetChanged(); clearButton.Click += (sender, e) => adapter.Clear(); stickyCheckBox.CheckedChange += (sender, e) => stickyList.AreHeadersSticky = e.IsChecked; fadeCheckBox.CheckedChange += (sender, e) => fadeHeader = e.IsChecked; drawBehindCheckBox.CheckedChange += (sender, e) => stickyList.DrawingListUnderStickyHeader = e.IsChecked; fastScrollCheckBox.CheckedChange += (sender, e) => { stickyList.SetFastScrollEnabled(e.IsChecked); stickyList.FastScrollAlwaysVisible = e.IsChecked; }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); Geneticist.Splice(this); // load the image using the traditional method cropView.SetImageResource(Resource.Drawable.AfricanLion); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_basics, container, false); Geneticist.Splice(this, rootView); mButtonVibratePattern.Text = mSelectedVibrationType.ToString(); return(rootView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); Geneticist.Splice(this); Timber.Tag("LifeCycles"); Timber.D("Activity Created"); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); _recorder = new Recorder(); Geneticist.Splice(this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_crop_result); Geneticist.Splice(this); var filePath = Intent.GetStringExtra(ExtraFilePath); Picasso.With(this) .Load(new File(filePath)) .MemoryPolicy(MemoryPolicy.NoCache, MemoryPolicy.NoStore) .Into(resultView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _activity = this; SetContentView(Resource.Layout.PixabayImageGrid); Geneticist.Splice(this); gallery = FindViewById <GridView>(Resource.Id.gridImages); searchText = FindViewById <EditText>(Resource.Id.pixabaySearchText); pixabayService = new PixabayService(); Init(_activity); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ImagePreview); Geneticist.Splice(this); var helpRelaLayout = FindViewById <RelativeLayout>(Resource.Id.helpRelaLayout); helpRelaLayout.Click += (sender, e) => { helpRelaLayout.Visibility = ViewStates.Gone; }; _scaleImageView = FindViewById <ScaleImageView>(Resource.Id.scaleImageView); if (!string.IsNullOrEmpty(Constants.ImageBtmUri)) { var options = new DisplayImageOptions.Builder() .ShowImageOnLoading(Resource.Drawable.ic_stub) .ShowImageForEmptyUri(Resource.Drawable.ic_empty) .ShowImageOnFail(Resource.Drawable.ic_error) .CacheInMemory(false) .CacheOnDisk(false) .BitmapConfig(Bitmap.Config.Rgb565) .Build(); ImageLoader.Instance.DisplayImage( Constants.ImageBtmUri, _scaleImageView, options, new ImageLoadingListener( loadingStarted: delegate { //spinner.Visibility = ViewStates.Visible; }, loadingComplete: delegate { //spinner.Visibility = ViewStates.Gone; }, loadingFailed: (imageUri, _view, failReason) => { string message = null; if (failReason.Type == FailReason.FailType.IoError) { message = "Input/Output error"; } else if (failReason.Type == FailReason.FailType.DecodingError) { message = "Image can't be decoded"; } else if (failReason.Type == FailReason.FailType.NetworkDenied) { message = "Downloads are denied"; } else if (failReason.Type == FailReason.FailType.OutOfMemory) { message = "Out Of Memory error"; } else { message = "Unknown error"; } AlertDialog.Builder builder; builder = new AlertDialog.Builder(this); builder.SetTitle("Error CodeBloc №102/1"); builder.SetMessage("message"); builder.SetCancelable(false); builder.SetPositiveButton("OK", delegate { Finish(); }); builder.Show(); //spinner.Visibility = ViewStates.Gone; })); } else { AlertDialog.Builder builder; builder = new AlertDialog.Builder(this); builder.SetTitle("Error CodeBlock №102/2"); builder.SetMessage("File not support"); builder.SetCancelable(false); builder.SetPositiveButton("OK", delegate { Finish(); }); builder.Show(); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_sensors, container, false); Geneticist.Splice(this, rootView); mSensorMap = new Dictionary <Switch, TableLayout>(); // Accelerometer setup mSensorMap[mSwitchAccelerometer] = mTableAccelerometer; mTableAccelerometer.Visibility = ViewStates.Gone; // Gyro setup mSensorMap[mSwitchGyro] = mTableGyro; mTableGyro.Visibility = ViewStates.Gone; // Distance setup mSensorMap[mSwitchDistance] = mTableDistance; mTableDistance.Visibility = ViewStates.Gone; // Heart rate setup mSensorMap[mSwitchHeartRate] = mTableHeartRate; mTableHeartRate.Visibility = ViewStates.Gone; // Contact setup mSensorMap[mSwitchContact] = mTableContact; mTableContact.Visibility = ViewStates.Gone; // Skin temperature setup mSensorMap[mSwitchSkinTemperature] = mTableSkinTemperature; mTableSkinTemperature.Visibility = ViewStates.Gone; // Ultraviolet setup mSensorMap[mSwitchUltraviolet] = mTableUltraviolet; mTableUltraviolet.Visibility = ViewStates.Gone; // Pedometer setup mSensorMap[mSwitchPedometer] = mTablePedometer; mTablePedometer.Visibility = ViewStates.Gone; // Altimeter setup mSensorMap[mSwitchAltimeter] = mTableAltimeter; mTableAltimeter.Visibility = ViewStates.Gone; // Ambient light rate setup mSensorMap[mSwitchAmbientLight] = mTableAmbientLight; mTableAmbientLight.Visibility = ViewStates.Gone; // Barometer setup mSensorMap[mSwitchBarometer] = mTableBarometer; mTableBarometer.Visibility = ViewStates.Gone; // Calories setup mSensorMap[mSwitchCalories] = mTableCalories; mTableCalories.Visibility = ViewStates.Gone; // Gsr setup mSensorMap[mSwitchGsr] = mTableGsr; mTableGsr.Visibility = ViewStates.Gone; // Rr interval setup mSensorMap[mSwitchRRInterval] = mTableRRInterval; mTableRRInterval.Visibility = ViewStates.Gone; return(rootView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); Geneticist.Splice(this); var nextYear = DateTime.Now.AddYears(1); var lastYear = DateTime.Now.AddYears(-1); calendar .Init(lastYear, nextYear) .InMode(CalendarPickerView.SelectionMode.Single) .WithSelectedDate(DateTime.Now); modeButtons.AddRange(new[] { single, multi, range, displayOnly, weekdaysOnly, decorator }); single.Click += delegate { SetButtonsEnabled(single); calendar.Decorators = new ICalendarCellDecorator[0]; calendar .Init(lastYear, nextYear) .InMode(CalendarPickerView.SelectionMode.Single) .WithSelectedDate(DateTime.Now); }; multi.Click += delegate { SetButtonsEnabled(multi); var today = DateTime.Now; var dates = new List <DateTime>(); for (int i = 0; i < 5; i++) { today = today.AddDays(3); dates.Add(today); } calendar.Decorators = new ICalendarCellDecorator[0]; calendar .Init(DateTime.Now, nextYear) .InMode(CalendarPickerView.SelectionMode.Multiple) .WithSelectedDates(dates); }; range.Click += delegate { SetButtonsEnabled(range); var today = DateTime.Now; var dates = new List <DateTime>(); today = today.AddDays(3); dates.Add(today); today = today.AddDays(5); dates.Add(today); calendar.Decorators = new ICalendarCellDecorator[0]; calendar .Init(DateTime.Now, nextYear) .InMode(CalendarPickerView.SelectionMode.Range) .WithSelectedDates(dates); }; displayOnly.Click += delegate { SetButtonsEnabled(displayOnly); calendar.Decorators = new ICalendarCellDecorator[0]; calendar .Init(DateTime.Now, nextYear) .InMode(CalendarPickerView.SelectionMode.Single) .WithSelectedDate(DateTime.Now) .DisplayOnly(); }; weekdaysOnly.Click += delegate { SetButtonsEnabled(weekdaysOnly); calendar.Decorators = new ICalendarCellDecorator[0]; calendar .Init(DateTime.Now, nextYear) .InMode(CalendarPickerView.SelectionMode.Single) .WithSelectedDate(DateTime.Now); }; decorator.Click += delegate { SetButtonsEnabled(decorator); calendar.Decorators = new[] { new SampleDecorator() }; calendar .Init(lastYear, nextYear) .InMode(CalendarPickerView.SelectionMode.Single) .WithSelectedDate(DateTime.Now); }; dialog.Click += delegate { ShowCalendarInDialog("I'm a dialog!", Resource.Layout.Dialog); dialogView .Init(lastYear, nextYear) .WithSelectedDate(DateTime.Now); }; customized.Click += delegate { ShowCalendarInDialog("Pimp my calendar!", Resource.Layout.DialogCustomized); dialogView .Init(lastYear, nextYear) .WithSelectedDate(DateTime.Now); }; rtl.Click += delegate { ShowCalendarInDialog("I'm right-to-left!", Resource.Layout.Dialog); dialogView .Init(lastYear, nextYear, "iw", "IL") .WithSelectedDate(DateTime.Now); }; done.Click += delegate { var dates = calendar.SelectedDates.Select(d => d.ToString("d MMM yyyy")).ToArray(); var toast = "Selected: " + string.Join(", ", dates); Toast.MakeText(this, toast, ToastLength.Short).Show(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ExpandableLayout); // inject views Geneticist.Splice(this); // handle header clicks listView.HeaderClick += (sender, e) => { if (listView.IsHeaderCollapsed(e.HeaderId)) { listView.Expand(e.HeaderId); } else { listView.Collapse(e.HeaderId); } }; //custom expand/collapse animation listView.SetAnimExecutor((target, animType) => { if (ExpandableStickyListHeadersListView.AnimationExpand == animType && target.Visibility == ViewStates.Visible) { return; } if (ExpandableStickyListHeadersListView.AnimationCollapse == animType && target.Visibility != ViewStates.Visible) { return; } if (!originalHeightPool.ContainsKey(target.Handle)) { originalHeightPool.Add(target.Handle, target.Height); } var viewHeight = originalHeightPool[target.Handle]; var animStartY = animType == ExpandableStickyListHeadersListView.AnimationExpand ? 0f : viewHeight; var animEndY = animType == ExpandableStickyListHeadersListView.AnimationExpand ? viewHeight : 0f; target.Visibility = ViewStates.Visible; var lp = target.LayoutParameters; var animator = ValueAnimator.OfFloat(animStartY, animEndY); animator.SetDuration(200); animator.AnimationEnd += delegate { if (animType == ExpandableStickyListHeadersListView.AnimationExpand) { target.Visibility = ViewStates.Visible; } else { target.Visibility = ViewStates.Gone; } target.LayoutParameters.Height = viewHeight; }; animator.Update += delegate { lp.Height = (int)animator.AnimatedValue; target.LayoutParameters = lp; target.RequestLayout(); }; animator.Start(); }); // set up data adapter = new StickyAdapter(this); listView.Adapter = adapter; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.NewBigDays); Geneticist.Splice(this); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetActionBar(toolbar); ActionBar.Title = "Edit Big Days"; _cameraHelpers = new CameraHelpers(this); MainActivity._BDDB.CheckRepeats(); _Edit = Intent.GetBooleanExtra("Edit", false); _ImageArea = FindViewById <ImageView>(Resource.Id.imageArea); _ImageArea.SetScaleType(ImageView.ScaleType.CenterCrop); _UiTimeEdit = FindViewById <EditText>(Resource.Id.timeEdit); _UiTimeEdit.Click += (o, e) => ShowDialog(TIME_DIALOG_ID); _UiDateEdit = FindViewById <EditText>(Resource.Id.dateEdit); _UiDateEdit.Click += (o, e) => { ShowDialog(DATE_DIALOG_ID); }; _UiEditRepeat = FindViewById <EditText>(Resource.Id.editRepeat); _UiEditRepeat.Click += (sender, e) => { var IntentRepeatSelect = new Intent(this, typeof(RepeatSelect)); IntentRepeatSelect.PutExtra("Num", _RepeatNum); StartActivityForResult(IntentRepeatSelect, (int)RequestCode.Repeat); }; _ImgPath = "img17.jpg"; _ImageStorageNum = LocationPicture.ResourcesImage; // Get the current time DateTime now = DateTime.Now; now = now.AddHours(1); hour = now.Hour; minute = DateTime.Now.Minute; seconds = DateTime.Now.Second; // get the current date date = DateTime.Today; _UiName = FindViewById <EditText>(Resource.Id.BigDayName); if (_Edit) { _ID = Intent.GetIntExtra("ID", 0); if (_ID != 0) { _Item = MainActivity._BDDB.SelectItem(_ID); _UiName.Text = _Item._Name; // Get the current time hour = _Item._EndDate.Hour; minute = _Item._EndDate.Minute; // get the current date date = _Item._EndDate; _RepeatNum = _Item._Repeat; _Notification = _Item._Notification; _UiEditRepeat.Text = _RepeatStrs[_RepeatNum].ToString(); _AlertStr = _AlertStrOld = _Item._Alerts; _ImageStorageNum = (LocationPicture)_Item._ImageStorage; _ImgPath = _Item._Image; _ImageBase64 = _Item.ImageBase64; foreach (var i in MainActivity._BDitems) { if (i._ID == _ID) { _ImageArea.SetImageBitmap(i._BigImg); } } } } else { Resources res = Resources; int imageID = res.GetIdentifier(_ImgPath.Replace(".jpg", ""), "drawable", PackageName); Drawable def = new BitmapDrawable(BitmapHelpers.DecodeSampledBitmapFromResource(res, imageID, (int)MainActivity._DisplayWidth, (int)MainActivity._DisplayWidth, this)); _ImageArea.SetImageDrawable(def); } _NM = (NotificationManager)GetSystemService(NotificationService); _UiAlerts = FindViewById <Button>(Resource.Id.Alerts); _UiAlerts.Click += (sender, e) => { string[] alerts = _AlertStr.Split('#'); int i = 0; foreach (var a in alerts) { string[] alertStr = a.Split(';'); garbage[i] = 0; if (alertStr[1] == "1") { garbage[i] = Convert.ToInt32(alertStr[2]); } i++; } var IntentAlerts = new Intent(this, typeof(Alerts)); IntentAlerts.PutExtra("Alert", _AlertStr); StartActivityForResult(IntentAlerts, (int)RequestCode.Alerts); }; // Display the current date UpdateDisplayTime(); // display the current date (this method is below) UpdateDisplayDate(); _UiSeveOrEdit = FindViewById <ImageButton>(Resource.Id.SeveOrEdit); _UiSeveOrEdit.Click += (sender, e) => { if (_Edit) { _Item._ID = _ID; _Item._Name = _UiName.Text.ToString(); DateTime d = Convert.ToDateTime(_UiDateEdit.Text.ToString()); DateTime t = Convert.ToDateTime(_UiTimeEdit.Text.ToString()); _Item._EndDate = new DateTime(d.Year, d.Month, d.Day, t.Hour, t.Minute, t.Second); _Item._Image = _ImgPath; _Item._ImageStorage = (int)_ImageStorageNum; _Item._Repeat = _RepeatNum; _Item.ImageBase64 = _ImageBase64; int garbageMain = _Notification; _Item._Notification = new System.Random().Next(0, 999999); AlarmHelpers.UpdateAlarm(this, _Item, garbageMain); _Item._Alerts = _AlertStr; string[] alertOld = _AlertStrOld.Split('#'); NotificationManager NM = (NotificationManager)GetSystemService(Context.NotificationService); foreach (var ao in alertOld) { string[] ao2 = ao.Split(';'); if (ao2[1] == "1") { int ID = Convert.ToInt32(ao2[2]); NM.Cancel(ID); } } string[] alerts = _AlertStr.Split('#'); int i = 0; foreach (var a in alerts) { string[] alertStr = a.Split(';'); if (alertStr[1] == "1") { int ID = Convert.ToInt32(alertStr[2]); AlarmHelpers.UpdateAlertsAlarm(this, _Item, ID, alertStr, garbage[i]); } i++; } MainActivity._BDDB.Update(_Item); Intent ParentIntent = new Intent(this, typeof(MainActivity)); SetResult(Result.Ok, ParentIntent); Finish(); } else { _Item = new BigDaysItemModel(); _Item._Name = _UiName.Text.ToString(); DateTime d = Convert.ToDateTime(_UiDateEdit.Text.ToString()); DateTime t = Convert.ToDateTime(_UiTimeEdit.Text.ToString()); _Item._EndDate = new DateTime(d.Year, d.Month, d.Day, t.Hour, t.Minute, t.Second); _Item._Image = _ImgPath; _Item._ImageStorage = (int)_ImageStorageNum; _Item._Repeat = _RepeatNum; _Item.ImageBase64 = _ImageBase64; _Item._Notification = new System.Random().Next(0, 999999); _Item._ID = MainActivity._BDDB.GetLastID() + 1; AlarmHelpers.SetAlarm(this, _Item); _Item._Alerts = _AlertStr; string[] alerts = _AlertStr.Split('#'); foreach (var a in alerts) { string[] alertStr = a.Split(';'); if (alertStr[1] == "1") { int ID = Convert.ToInt32(alertStr[2]); _Item._ID = MainActivity._BDDB.GetLastID() + 1; AlarmHelpers.SetAlertsAlarm(this, _Item, ID, alertStr); } } MainActivity._BDDB.Insert(_Item); List <BigDaysItemModel> items = MainActivity._BDDB.SelectBDItems(); if (items.Count == 1) { MainActivity._BDDB.SetActive(items[0]._ID); } Intent ParentIntent = new Intent(this, typeof(ListActivity)); SetResult(Result.Ok, ParentIntent); Finish(); } }; _UiCancelOrDelete = FindViewById <ImageButton>(Resource.Id.CancelOrDelete); if (_Edit) { _UiCancelOrDelete.SetImageResource(Resource.Drawable.ic_action_discard); } _UiCancelOrDelete.Click += (sender, e) => { if (_Edit) { AlarmHelpers.RemoveAlarm(this, _Notification); foreach (var g in garbage) { if (g != 0) { Intent IntentNot = new Intent(this, typeof(NotificationView)); PendingIntent mAlarmSenderCansel = PendingIntent.GetBroadcast(this, g, IntentNot, PendingIntentFlags.UpdateCurrent); AlarmManager am = (AlarmManager)GetSystemService(Context.AlarmService); am.Cancel(mAlarmSenderCansel); } } if (_ID != 0) { MainActivity._BDDB.Delete(_ID); } for (int i = 0; i < MainActivity._BDitems.Count; i++) { if (MainActivity._BDitems[i]._ID == _ID) { MainActivity._BDitems.RemoveAt(i); } } List <BigDaysItemModel> items = MainActivity._BDDB.SelectBDItems(); if (items.Count > 0) { MainActivity._BDDB.SetActive(items[0]._ID); } Intent ParentIntent = new Intent(this, typeof(ListActivity)); SetResult(Result.Ok, ParentIntent); Finish(); } else { Intent ParentIntent = new Intent(this, typeof(ListActivity)); SetResult(Result.Canceled, ParentIntent); Finish(); } }; }
protected override void OnDestroy() { Geneticist.Sever(this); _recorder.Dispose(); base.OnDestroy(); }