public void CreateRecyclerView(View view) { recyclerView = view.FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.addressRecyclerView); Android.Support.V7.Widget.DividerItemDecoration dividerItemDecoration = new Android.Support.V7.Widget.DividerItemDecoration(recyclerView.Context, Android.Support.V7.Widget.LinearLayoutManager.Vertical); List <AddressBook> addressBookList = new List <AddressBook>(); addressBookAdapter = new AddressBookAdapter(addressBookList); recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(Context)); recyclerView.SetAdapter(addressBookAdapter); recyclerView.AddItemDecoration(dividerItemDecoration); recyclerView.AddOnItemTouchListener(new RecyclerViewOnItemTouchListener(Context, recyclerView, new ClickListener(Context, searchEditView))); addressBookList.Add(new AddressBook("Steven Howchenhowser", "*****@*****.**", "1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L")); addressBookList.Add(new AddressBook("Taun Olson", "*****@*****.**", "1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L")); addressBookList.Add(new AddressBook("Todd Hoffman", "*****@*****.**", "PKM90iag9jJgTHD1VXjvLCEnZuQ3rTCF0Q")); addressBookList.Add(new AddressBook("Todd Swasinger", "*****@*****.**", "20M90iag9jJgTHD1VXjvLCEnZuQ3rTCF0Q")); addressBookList.Add(new AddressBook("Ramin Zahraie", "*****@*****.**", "58M90iag9jJgTHD1VXjvLCEnZuQ3rTCH1X")); addressBookList.Add(new AddressBook("Steve Smith", "*****@*****.**", "58M90iag9jJgTHD1VXjvLCEnZuQ3rTCH2H")); addressBookList.Add(new AddressBook("William Johnson", "*****@*****.**", "58M90iag9jJgTHD1VXjvLCEnZuQ3rTCH27T")); addressBookAdapter.NotifyDataSetChanged(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // Set ActionBar var actionBar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(actionBar); SupportActionBar.Title = GetString(Resource.String.app_name); // Back button /* SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); */ // Get RecyclerView recyMessages = FindViewById<Android.Support.V7.Widget.RecyclerView>(Resource.Id.main_recyMessages); // Get Floating Button btnFloating = FindViewById<Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.main_btnFloating); btnFloating.Click += btnFloating_Click; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); view = inflater.Inflate(Resource.Layout.GalleryFragment, container, false); var capturedImages = GlobalVariables.db.GetAllCapturedImages(); adapter = new GalleryAdapter(capturedImages); adapter.ItemClick += OnItemClick; mRecyclerView = view.FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.GalleryRecyclerView); var emptyTextView = view.FindViewById <TextView>(Resource.Id.EmptyGalleryTextView); var fab = view.FindViewById <CustomFAB>(Resource.Id.GalleryTabFAB); if (capturedImages.Count < 1) { mRecyclerView.Visibility = ViewStates.Gone; emptyTextView.Visibility = ViewStates.Visible; } else { emptyTextView.Visibility = ViewStates.Gone; mRecyclerView.Visibility = ViewStates.Visible; } mRecyclerView.SetAdapter(adapter); mLayoutManager = new Android.Support.V7.Widget.GridLayoutManager(Context, 2, Android.Support.V7.Widget.GridLayoutManager.Vertical, false); mRecyclerView.SetLayoutManager(mLayoutManager); fab.AttachToRecyclerView(mRecyclerView); var rootView = fab.RootView; fab.Click += (sender, args) => { var ImageDirectory = FileAccessHelper.GetImageDirectory(); var imageName = Guid.NewGuid() + ".jpg"; Java.IO.File ImageFile = new Java.IO.File(ImageDirectory, imageName.ToString()); ((MainActivity)Activity).setImageFile(ImageFile); ((MainActivity)Activity).setImageName(imageName.ToString()); ((MainActivity)Activity).setImageDirectory(ImageDirectory.AbsolutePath); var intent = new Intent(MediaStore.ActionImageCapture); intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(ImageFile)); ((MainActivity)Activity).StartActivityForResult(intent, 0); }; return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.layout3); mRecyclerView = FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.recyclerView); // Plug in the linear layout manager: mLayoutManager = new Android.Support.V7.Widget.LinearLayoutManager(this); mRecyclerView.SetLayoutManager(mLayoutManager); // Plug in my adapter: var mAdapter = new RecyclerAdapter(Resource.Mipmap.us); mRecyclerView.SetAdapter(mAdapter); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.LonelyRecycler, container, false); ListView = view.FindViewById <RecyclerView>(Resource.Id.recycler); ListView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(MainActivity.instance)); if (item != null) { CreateHeader(); } #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed PopulateList(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed return(view); }
public override void OnChildViewHolderSelected(Android.Support.V7.Widget.RecyclerView parent, Android.Support.V7.Widget.RecyclerView.ViewHolder child, int position, int subposition) { base.OnChildViewHolderSelected(parent, child, position, subposition); var adapter = parent.GetAdapter() as MvxRecyclerAdapter; var item = adapter?.GetItem(position); if (item == null) { MvxTrace.Error("Could not retrieve item from adapter. Can't pass currently selected item through!"); return; } if (ItemSelection != null && ItemSelection.CanExecute(item)) { ItemSelection.Execute(item); } }
public static void OnAttachedToRecyclerView(Android.Support.V7.Widget.RecyclerView.Adapter innerAdapter, Android.Support.V7.Widget.RecyclerView recyclerView, Com.Zhy.Adapter.Recyclerview.Utils.WrapperUtils.SpanSizeCallback callback) { innerAdapter.OnAttachedToRecyclerView(recyclerView); Android.Support.V7.Widget.RecyclerView.LayoutManager layoutManager = recyclerView .GetLayoutManager(); if (layoutManager is Android.Support.V7.Widget.GridLayoutManager) { Android.Support.V7.Widget.GridLayoutManager gridLayoutManager = (Android.Support.V7.Widget.GridLayoutManager )layoutManager; Android.Support.V7.Widget.GridLayoutManager.SpanSizeLookup spanSizeLookup = gridLayoutManager .GetSpanSizeLookup(); gridLayoutManager.SetSpanSizeLookup(new _SpanSizeLookup_29(callback, gridLayoutManager , spanSizeLookup)); gridLayoutManager.SpanCount = (gridLayoutManager.SpanCount); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); view = inflater.Inflate(Resource.Layout.TranslationHistoryDetail, container, false); translationHistoryDetailAdapter = new TranslationHistoryDetailAdapter(((TranslationHistoryMainActivity)Activity).translationHistoryDetails, GlobalVariables.db.GetAllLanguages()); translationHistoryDetailAdapter.ItemClick += OnItemClick; Android.Support.V7.Widget.RecyclerView mRecyclerView = view.FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.TranslationDetailRecyclerView); mRecyclerView.SetAdapter(translationHistoryDetailAdapter); mLayoutManager = new Android.Support.V7.Widget.LinearLayoutManager(Context, Android.Support.V7.Widget.LinearLayoutManager.Vertical, false); mRecyclerView.SetLayoutManager(mLayoutManager); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); view = inflater.Inflate(Resource.Layout.TranslationHistoryList, container, false); var translationHistory = GlobalVariables.db.GetAllTranslationHistory(); translationHistoryAdapter = new TranslationHistoryAdapter(translationHistory, GlobalVariables.db.GetAllLanguages()); translationHistoryAdapter.ItemClick += OnItemClick; Android.Support.V7.Widget.RecyclerView mRecyclerView = view.FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.TranslationListRecyclerView); var emptyTextView = view.FindViewById <TextView>(Resource.Id.EmptyTextHistoryTextView); var fab = view.FindViewById <CustomFAB>(Resource.Id.TextTabFAB); if (translationHistory.Count < 1) { mRecyclerView.Visibility = ViewStates.Gone; emptyTextView.Visibility = ViewStates.Visible; } else { emptyTextView.Visibility = ViewStates.Gone; mRecyclerView.Visibility = ViewStates.Visible; } mRecyclerView.SetAdapter(translationHistoryAdapter); mLayoutManager = new Android.Support.V7.Widget.GridLayoutManager(Context, 2, Android.Support.V7.Widget.GridLayoutManager.Vertical, false); mRecyclerView.SetLayoutManager(mLayoutManager); fab.AttachToRecyclerView(mRecyclerView); var rootView = fab.RootView; fab.Click += (sender, args) => { var intent2 = new Intent(Context, typeof(TranslatorActivity)); StartActivity(intent2); }; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.LonelyRecycler, container, false); ListView = view.FindViewById <RecyclerView>(Resource.Id.recycler); ListView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(MainActivity.instance)); ListView.SetAdapter(new PlaylistTrackAdapter(new SearchableList <Song>())); ListView.ScrollChange += ListView_ScrollChange; #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed PopulateList(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed if (useHeader && item != null) { CreateHeader(); } //if (item.SyncState == SyncState.Error) // CreateSyncBanner(); return(view); }
public override Java.Lang.Object InstantiateItem(ViewGroup container, int position) { Context context = container.Context; LayoutInflater inflater = LayoutInflater.From(context); View view = null; if (position == 0) { view = inflater.Inflate(Resource.Layout.samples, container, false); } else { view = inflater.Inflate(Resource.Layout.item_font, container, false); RecyclerView recyclerView = view.FindViewById <RecyclerView> (Resource.Id.recyclerView); int nbColumns = AndroidUtils.getScreenSize((Activity)context).width / context.Resources.GetDimensionPixelSize(Resource.Dimension.item_width); recyclerView.SetLayoutManager(new GridLayoutManager(context, nbColumns)); recyclerView.SetAdapter(new IconAdapter(fonts [position - 1].Value.Characters)); } container.AddView(view); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); MobileCenter.Start("e67780b5-ce73-4898-9932-78adc99e961f", typeof(Analytics), typeof(Crashes)); SetContentView(Resource.Layout.list); Android.Support.V7.Widget.RecyclerView recyclerView = FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.recyclerView); // improve performance if you know that changes in content // do not change the size of the RecyclerView recyclerView.HasFixedSize = true; // use a linear layout manager Android.Support.V7.Widget.LinearLayoutManager layoutManager = new Android.Support.V7.Widget.LinearLayoutManager(this); recyclerView.SetLayoutManager(layoutManager); List <RootObject> mytempObjet = MyClass.readDataFromFile(); // specify an adapter RecyclarAdapter adapter = new RecyclarAdapter(this, mytempObjet); recyclerView.SetAdapter(adapter); }
public override void OnAttachedToRecyclerView(Android.Support.V7.Widget.RecyclerView recyclerView) { Com.Zhy.Adapter.Recyclerview.Utils.WrapperUtils.OnAttachedToRecyclerView(mInnerAdapter , recyclerView, new _SpanSizeCallback_90(this)); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.Inflate(Resource.Layout.fragment_weather_now, container, false); // Setup Actionbar HasOptionsMenu = false; refreshLayout = (SwipeRefreshLayout)view; mainView = view.FindViewById <NestedScrollView>(Resource.Id.fragment_weather_now); mainView.ScrollChange += ScrollView_ScrollChange; bgImageView = view.FindViewById <ImageView>(Resource.Id.image_view); // Condition locationName = view.FindViewById <TextView>(Resource.Id.label_location_name); updateTime = view.FindViewById <TextView>(Resource.Id.label_updatetime); weatherIcon = view.FindViewById <TextView>(Resource.Id.weather_icon); weatherCondition = view.FindViewById <TextView>(Resource.Id.weather_condition); weatherTemp = view.FindViewById <TextView>(Resource.Id.weather_temp); // Details detailsPanel = view.FindViewById(Resource.Id.details_panel); humidity = view.FindViewById <TextView>(Resource.Id.humidity); pressureState = view.FindViewById <TextView>(Resource.Id.pressure_state); pressure = view.FindViewById <TextView>(Resource.Id.pressure); visiblity = view.FindViewById <TextView>(Resource.Id.visibility_val); feelslike = view.FindViewById <TextView>(Resource.Id.feelslike); windDirection = view.FindViewById <TextView>(Resource.Id.wind_direction); windSpeed = view.FindViewById <TextView>(Resource.Id.wind_speed); sunrise = view.FindViewById <TextView>(Resource.Id.sunrise_time); sunset = view.FindViewById <TextView>(Resource.Id.sunset_time); // Forecast forecastPanel = view.FindViewById <RelativeLayout>(Resource.Id.forecast_panel); forecastPanel.Visibility = ViewStates.Invisible; forecastView = view.FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.forecast_view); // Additional Details forecastSwitch = view.FindViewById <Switch>(Resource.Id.forecast_switch); forecastSwitch.CheckedChange += ForecastSwitch_CheckedChange; forecastSwitch.Visibility = ViewStates.Gone; txtForecastView = view.FindViewById <ViewPager>(Resource.Id.txt_forecast_viewpgr); txtForecastView.Adapter = new TextForecastPagerAdapter(this.Activity, new List <TextForecastItemViewModel>()); txtForecastView.Visibility = ViewStates.Gone; hrforecastPanel = view.FindViewById <LinearLayout>(Resource.Id.hourly_forecast_panel); hrforecastPanel.Visibility = ViewStates.Gone; hrforecastView = view.FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.hourly_forecast_view); precipitationPanel = view.FindViewById <RelativeLayout>(Resource.Id.precipitation_card); precipitationPanel.Visibility = ViewStates.Gone; chanceLabel = view.FindViewById <TextView>(Resource.Id.chance_label); chance = view.FindViewById <TextView>(Resource.Id.chance_val); cloudinessLabel = view.FindViewById <TextView>(Resource.Id.cloudiness_label); cloudiness = view.FindViewById <TextView>(Resource.Id.cloudiness); qpfRain = view.FindViewById <TextView>(Resource.Id.qpf_rain_val); qpfSnow = view.FindViewById <TextView>(Resource.Id.qpf_snow_val); // Alerts alertButton = view.FindViewById(Resource.Id.alert_button); alertButton.Click += (sender, e) => { // Show Alert Fragment if (weatherView.Extras.Alerts.Count > 0) { AppCompatActivity.SupportFragmentManager.BeginTransaction() .Add(Resource.Id.fragment_container, WeatherAlertsFragment.NewInstance(location, weatherView)) .Hide(this) .AddToBackStack(null) .Commit(); } }; alertButton.Visibility = ViewStates.Invisible; // Cloudiness only supported by OWM cloudinessLabel.Visibility = ViewStates.Gone; cloudiness.Visibility = ViewStates.Gone; forecastView.HasFixedSize = true; forecastAdapter = new ForecastItemAdapter(new List <ForecastItemViewModel>()); forecastView.SetAdapter(forecastAdapter); hrforecastView.HasFixedSize = true; hrforecastAdapter = new HourlyForecastItemAdapter(new List <HourlyForecastItemViewModel>()); hrforecastView.SetAdapter(hrforecastAdapter); // SwipeRefresh refreshLayout.SetColorSchemeColors(ContextCompat.GetColor(Activity, Resource.Color.colorPrimary)); refreshLayout.Refresh += delegate { Task.Run(async() => { if (Settings.FollowGPS && await UpdateLocation()) { // Setup loader from updated location wLoader = new WeatherDataLoader(this.location, this, this); } await RefreshWeather(true); }); }; // Nav Header View navheader = Activity.FindViewById <NavigationView>(Resource.Id.nav_view).GetHeaderView(0); navLocation = navheader.FindViewById <TextView>(Resource.Id.nav_location); navWeatherTemp = navheader.FindViewById <TextView>(Resource.Id.nav_weathertemp); weatherCredit = view.FindViewById <TextView>(Resource.Id.weather_credit); loaded = true; refreshLayout.Refreshing = true; return(view); }
private void ShowSendDialog() { var builder = new Android.Support.V7.App.AlertDialog.Builder(Context); builder.SetTitle("Send"); LayoutInflater layoutInflater = Activity.LayoutInflater; View view = layoutInflater.Inflate(Resource.Layout.sendlayout, null, false); mainLayout = view.FindViewById <LinearLayout>(Resource.Id.mainSendLayout); List <AddressBook> addressBookList = new List <AddressBook>(); btcAddressLayout = view.FindViewById <Android.Support.Design.Widget.TextInputLayout>( Resource.Id.username_layout); labelLayout = view.FindViewById <Android.Support.Design.Widget.TextInputLayout>( Resource.Id.labelLayout); amountLayout = view.FindViewById <Android.Support.Design.Widget.TextInputLayout>( Resource.Id.amountLayout); recyclerView = view.FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.recyclerView); addressBookAdapter = new AddressBookAdapter(addressBookList); bitCoinAddressView = view.FindViewById <AutoCompleteTextView>(Resource.Id.autoComplete); labelTextView = view.FindViewById <TextInputEditText>(Resource.Id.labelEdit); amountTextView = view.FindViewById <TextInputEditText>(Resource.Id.amountEdit); buttonLayout = view.FindViewById <LinearLayout>(Resource.Id.buttonLayout); addressBookButton = view.FindViewById <Button>(Resource.Id.addressBook); qrCodeButton = view.FindViewById <Button>(Resource.Id.qrCode); clearButton = view.FindViewById <Button>(Resource.Id.clear); Android.Support.V7.Widget.DividerItemDecoration dividerItemDecoration = new Android.Support.V7.Widget.DividerItemDecoration(recyclerView.Context, Android.Support.V7.Widget.LinearLayoutManager.Vertical); recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(builder.Context)); recyclerView.SetAdapter(addressBookAdapter); recyclerView.AddItemDecoration(dividerItemDecoration); //recyclerView.AddOnItemTouchListener(new RecyclerViewOnItemTouchListener(Context, recyclerView, new ClickListener(Context))); addressBookList.Add(new AddressBook("Steven Howchenhowser", "*****@*****.**", "1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L")); addressBookList.Add(new AddressBook("Taun Olson", "*****@*****.**", "1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L")); addressBookList.Add(new AddressBook("Todd Hoffman", "*****@*****.**", "PKM90iag9jJgTHD1VXjvLCEnZuQ3rTCF0Q")); addressBookList.Add(new AddressBook("Todd Swasinger", "*****@*****.**", "20M90iag9jJgTHD1VXjvLCEnZuQ3rTCF0Q")); addressBookList.Add(new AddressBook("Ramin Zahraie", "*****@*****.**", "58M90iag9jJgTHD1VXjvLCEnZuQ3rTCH1X")); addressBookList.Add(new AddressBook("Steve Smith", "*****@*****.**", "58M90iag9jJgTHD1VXjvLCEnZuQ3rTCH2H")); addressBookList.Add(new AddressBook("William Johnson", "*****@*****.**", "58M90iag9jJgTHD1VXjvLCEnZuQ3rTCH27T")); addressBookAdapter.NotifyDataSetChanged(); //@@address book addressBookButton.Click += AddressBookButton_Click; clearButton.Click += ClearButton_Click; List <string> addressList = new List <string>() { "1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L", "1NU19iag9jJgTHD1VXjvLCEnZuQ3rKDE9L", "PKM90iag9jJgTHD1VXjvLCEnZuQ3rTCF0Q", "20M90iag9jJgTHD1VXjvLCEnZuQ3rTCF0Q", "58M90iag9jJgTHD1VXjvLCEnZuQ3rTCH1X" }; ArrayAdapter <String> addressListDataAdapters = new ArrayAdapter <String>(Context, Android.Resource.Layout.SimpleListItem1, addressList); //bitCoinAddressView.Adapter = addressListDataAdapters; bitCoinAddressView.FocusChange += BitCoinAddressView_FocusChange; //bitCoinAddressView.AddTextChangedListener(new TextWatcher(ref addressBookAdapter)); bitCoinAddressView.AfterTextChanged += BitCoinAddressView_AfterTextChanged; bitCoinAddressView.TextChanged += BitCoinAddressView_TextChanged; labelTextView.FocusChange += LabelTextView_FocusChange; amountTextView.FocusChange += AmountTextView_FocusChange; builder.SetView(view); builder.SetPositiveButton(Resource.String.send, (senderAlert, args) => { if ((bitCoinAddressView.Text.Length != 0) && (labelTextView.Text.Length != 0) && (amountTextView.Text.Length != 0)) { dataRepository.AddTransactionData(DateTime.Now, bitCoinAddressView.Text, labelTextView.Text, Convert.ToDecimal(amountTextView.Text), GetValue(amountTextView.Text), "Sent to"); Snackbar s = Snackbar.Make(mainView, "Request sent. Add " + bitCoinAddressView.Text + " to address book?", Snackbar.LengthLong).SetAction("Yes", (v) => { ShowAddressBookAddEntry(); }); s.Show(); } }); builder.SetNegativeButton(Resource.String.cancel, (senderAlert, args) => { }); builder.Show(); }