public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.StudyCardLayout, container, false); mRecyclerView = view.FindViewById<RecyclerView> (Resource.Id.recyclerView); //mListView = view.FindViewById<ListView> (Resource.Id.lvToDoList); mFab = view.FindViewById<FloatingActionButton> (Resource.Id.fab); mFab.Click += (sender, e) => { createFragment(null,true); }; mStudyGroup = new List<StudyGroup> (); StudyRequest asyncStudyRquest = new StudyRequest (); Task<StudyResponse> data = asyncStudyRquest.StudyRequestAsync (LoginInfo.username, LoginInfo.KEY); StudyResponse results = data.Result; List<StudyGroup> resultsList = new List<StudyGroup> (results.studyGroups); for (int i = 0; i <resultsList.Count; i++) { mStudyGroup.Add (resultsList[i]); } mLayoutManager = new LinearLayoutManager (view.Context); mRecyclerView.SetLayoutManager (mLayoutManager); mAdapter = new RecyclerAdapter (mStudyGroup,mRecyclerView,this); mRecyclerView.SetAdapter (mAdapter); return view; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Instantiate the photo album: mPhotoAlbum = new PhotoAlbum(); // Set our view from the "main" layout resource: SetContentView (Resource.Layout.Main); // Get our RecyclerView layout: mRecyclerView = FindViewById<RecyclerView> (Resource.Id.recyclerView); //............................................................ // Layout Manager Setup: // Use the built-in linear layout manager: mLayoutManager = new LinearLayoutManager (this); // Or use the built-in grid layout manager (two horizontal rows): // mLayoutManager = new GridLayoutManager // (this, 2, GridLayoutManager.Horizontal, false); // Plug the layout manager into the RecyclerView: mRecyclerView.SetLayoutManager (mLayoutManager); //............................................................ // Adapter Setup: // Create an adapter for the RecyclerView, and pass it the // data set (the photo album) to manage: mAdapter = new PhotoAlbumAdapter (mPhotoAlbum); // Register the item click handler (below) with the adapter: mAdapter.ItemClick += OnItemClick; // Plug the adapter into the RecyclerView: mRecyclerView.SetAdapter (mAdapter); //............................................................ // Random Pick Button: // Get the button for randomly swapping a photo: Button randomPickBtn = FindViewById<Button>(Resource.Id.randPickButton); // Handler for the Random Pick Button: randomPickBtn.Click += delegate { if (mPhotoAlbum != null) { // Randomly swap a photo with the top: int idx = mPhotoAlbum.RandomSwap(); // Update the RecyclerView by notifying the adapter: // Notify that the top and a randomly-chosen photo has changed (swapped): mAdapter.NotifyItemChanged(0); mAdapter.NotifyItemChanged(idx); } }; }
public override void OnViewCreated (View view, Bundle savedInstanceState) { base.OnViewCreated (view, savedInstanceState); //createGroupList (); //myList = view.FindViewById<ExpandableListView> (Resource.Id.expView); //mExpandAdapter = new ExpandableListAdapter (Activity, groupList, Child_Data.childData()); //myList.SetAdapter (mExpandAdapter); //SetGroupIndicatorToRight (); listData = new MySkool_ListTakwimDataHolder (); mLayoutManager = new LinearLayoutManager (Activity); recyclerView.SetLayoutManager (mLayoutManager); takwimRecyclerAdapter = new MySkool_Takwim_RecyclerViewAdapter (Activity, listData); recyclerView.SetAdapter (takwimRecyclerAdapter); //Takwim_NestedRecyclerViewAdapter mRViewAdapter = new Takwim_NestedRecyclerViewAdapter (Activity); //recyclerView.SetAdapter(mRViewAdapter); //listViewAdapter = new Takwim_ListViewAdapter (Activity, Child_Data.childData()); //mListView.Adapter = listViewAdapter; }
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); base.OnCreateView (inflater, container, savedInstanceState); View View = inflater.Inflate (Resource.Layout.StatsPopUp, container, false); StatsView = View.FindViewById<RecyclerView> (Resource.Id.statsContainer); StatsLayoutManager = new LinearLayoutManager (Activity); StatsView.SetLayoutManager (StatsLayoutManager); StatsList = new List<Statistic> (); StatsList.Add (new Statistic () { Name = "Leben", Description = "Leben des Helden", Value = 2, Image = Resource.Drawable.heart }); StatsList.Add (new Statistic () { Name = "Mana", Value = 20000000, Image = Resource.Drawable.heart }); StatsList.Add (new Statistic () { Name = "Stärke", Value = 552, Image = Resource.Drawable.heart }); StatsList.Add (new Statistic () { Name = "Schnelligkeit", Value = 23, Image = Resource.Drawable.heart }); StatsList.Add (new Statistic () { Name = "Intelligenz", Value = 42, Image = Resource.Drawable.heart }); StatsList.Add (new Statistic () { Name = "Ansehen", Value = 12, Image = Resource.Drawable.heart }); StatsList.Add (new Statistic ()); StatsView.SetAdapter (new StatisticRecyclerAdapter (StatsList)); return View; }
public override void OnViewCreated (View view, Bundle savedInstanceState) { base.OnViewCreated (view, savedInstanceState); //createGroupList (); //myList = view.FindViewById<ExpandableListView> (Resource.Id.expView); //mExpandAdapter = new ExpandableListAdapter (Activity, groupList, Child_Data.childData()); //myList.SetAdapter (mExpandAdapter); //SetGroupIndicatorToRight (); listDataRA = new MySoal_MesejDihantar_ListDataHolderList (mySoalSIListData); mLayoutManager = new LinearLayoutManager (Activity); recyclerView.SetLayoutManager (mLayoutManager); mesejDihantarRA = new MySoal_MesejDihantar_RecyclerViewAdapter (Activity, listDataRA); recyclerView.SetAdapter (mesejDihantarRA); mesejDihantarRA.ItemClick += ItemClicked; //Takwim_NestedRecyclerViewAdapter mRViewAdapter = new Takwim_NestedRecyclerViewAdapter (Activity); //recyclerView.SetAdapter(mRViewAdapter); //listViewAdapter = new Takwim_ListViewAdapter (Activity, Child_Data.childData()); //mListView.Adapter = listViewAdapter; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.PhotoLayout1); _RecyclerView = FindViewById<RecyclerView> (Resource.Id.recyclerView); var getRequest = new GetRequest (); var getResponse = new GetResponse (); getRequest.apiKey = "7gXV0uUd54z3ksYKMAG4co595dDPMaTB"; getRequest.accessToken = "W88EaRR8PiKZXzoDe16eqlnt96CRSj0WFeEfy9ie9N565frGPqM4OVMKVOEdo9qGrYuT4ifeS2eNqrx3P6cBG6hTB3uTFfZawyOh"; getRequest.langCode = "en-GB"; String url = String.Format ("http://api.powhealth.com/LabTestService.svc/api/labtests/byuser/list/{0}/{1}/{2}", getRequest.apiKey, getRequest.accessToken, getRequest.langCode); WebRequest request = WebRequest.Create (url); WebResponse response = request.GetResponse (); var dataStream = response.GetResponseStream (); StreamReader reader = new StreamReader (dataStream); string responseFromServer = reader.ReadToEnd (); reader.Close (); response.Close (); var jsonObject = JsonConvert.DeserializeObject <GetResponse> (responseFromServer); //_LayoutManager = new LinearLayoutManager (this); _LayoutManager = new GridLayoutManager (this, 2, GridLayoutManager.Vertical, false); _RecyclerView.SetLayoutManager (_LayoutManager); _Adapter = new RecyclerAdapter (jsonObject.LabTestsUserOnlyResult, _RecyclerView); _RecyclerView.SetAdapter (_Adapter); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.activity_recycler_view_add_remove); ActionBar.SetDisplayHomeAsUpEnabled (true); ActionBar.SetDisplayShowHomeEnabled (true); ActionBar.SetIcon (Android.Resource.Color.Transparent); recyclerView = FindViewById<RecyclerView> (Resource.Id.recycler_view); recyclerView.HasFixedSize = true; layoutManager = new LinearLayoutManager (this); recyclerView.SetLayoutManager (layoutManager); adapter = new RecyclerAdapter (new List<RecyclerItem>()); recyclerView.SetAdapter (adapter); recyclerView.SetItemAnimator (new DefaultItemAnimator ()); FindViewById<Button>(Resource.Id.add).Click += (sender, e) => { adapter.Add(new RecyclerItem { Title = "New Item: " + adapter.ItemCount }); }; adapter.OnItemClick = (view, item) => { adapter.Remove(adapter.Items.IndexOf(item)); }; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = (View) inflater.Inflate(Resource.Layout.cardView_layout,container, false); //CardView mRecyclerView = view.FindViewById<RecyclerView>(Resource.Id.recyclerView); mCardViewHuoJing = new List<CardViewHuoJing>(); FragmentManager fragmentManager1 = this.FragmentManager; string strURL= this.Resources.GetString(Resource.String.HttpUri)+ String.Format("andriod/bjxx_intime_andriod.jsp?") + String.Format("userId={0}&userType={1}",LogInfoCardView.userId,LogInfoCardView.userType); Console.WriteLine (strURL); mHttpRequestCardView.HttpRequestFunc (strURL); doc.LoadXml(mHttpRequestCardView.HttpRecv); foreach (XmlNode node in doc.SelectNodes("FireIntime/Info/Fire")) { mCardViewHuoJing.Add (new CardViewHuoJing (){ bjxxbh=node.Attributes["bjxxbh"].Value, dwmc=node.Attributes["dwmc"].Value, lxdz=node.Attributes["lxdz"].Value, lxr=node.Attributes["lxr"].Value, khlb=node.Attributes["khlb"].Value, gddh=node.Attributes["gddh"].Value, bjdz=node.Attributes["bjdz"].Value, asebh=node.Attributes["asebh"].Value, ipphone=node.Attributes["ipphone"].Value, quhao=node.Attributes["quhao"].Value, bjsj=node.Attributes["bjsj"].Value, bjjb=node.Attributes["bjjb"].Value, flag=node.Attributes["flag"].Value, bn=node.Attributes["bn"].Value }); } //mCardViewHuoJing.Add(new Email() { Name = "tom", Subject = "Wanna hang out?", Message = "I'll be around tomorrow!!" }); mLayoutManager = new LinearLayoutManager(Application.Context); mRecyclerView.SetLayoutManager(mLayoutManager); mAdapter = new RecyclerAdapter(mCardViewHuoJing, mRecyclerView,1,Application.Context,fragmentManager1); mRecyclerView.SetAdapter(mAdapter); //swipeRefresh mSwipeRefreshLayout = view.FindViewById<SwipeRefreshLayout> (Resource.Id.swipeLayout); mSwipeRefreshLayout.SetColorScheme (Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloRedLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloPurple); mSwipeRefreshLayout.Refresh += mSwipeRefreshLayout_Refresh; //mRecyclerView.Click += mRecyclerView_Click; return view ; }
public override Android.Views.View OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState) { var ignored = base.OnCreateView (inflater,container,savedInstanceState); var view = (ViewGroup)inflater.Inflate (Resource.Layout.layout_news, null); var viewGroup = (ViewGroup)inflater.Inflate (Resource.Layout.layout_group, null); string string_key = "41f579fc-1445-4065-ab10-c06d50e724d3"; //NewsDetail = new NewsFragmentDetail (); //var mFragmentItemContainer = viewGroup.FindViewById<FrameLayout> (Resource.Id.fragment4Container); Button button = viewGroup.FindViewById<Button> (Resource.Id.btnDetalle); mFrameLayoutContainer = view.FindViewById<FrameLayout> (Resource.Id.RelativeLay); var trans = Activity.SupportFragmentManager.BeginTransaction (); //trans.Add (mFragmentItemContainer.Id, new NewsFragmentDetail (), "Detail"); //trans.Add (Resource.Id.layout_content, NewsDetail); //trans.Hide (NewsDetail); mCurrentFragment = this; trans.Commit (); mRecyclerView = view.FindViewById<RecyclerView> (Resource.Id.RecyclerViewer); //Pruebas //cocoservices.tinnova.mx.COCOService cliente = new Navigation_View.cocoservices.tinnova.mx.COCOService (); //Navigation_View.cocoservices.tinnova.mx.PublicationDTO[] mPublicacion = new Navigation_View.cocoservices.tinnova.mx.PublicationDTO[5]; //Produccion services_911consumidor_com.COCOService cliente = new Navigation_View.services_911consumidor_com.COCOService(); Navigation_View.services_911consumidor_com.PublicationDTO[] mPublicacion = new Navigation_View.services_911consumidor_com.PublicationDTO[5]; mPublicacion = cliente.GetActivePublications (string_key); mPublicaciones = new List<Publicaciones> (); foreach (PublicationDTO value in mPublicacion) { mPublicaciones.Add (new Publicaciones { Titulo = value.Tittle, FechaPublicacion = value.PublicationDate, Subtitulo = value.SubTittle, Imagen = value.ImageUrl, IdPublicacion = value.Id, Contenido = value.Content }); } mLayoutManager = new LinearLayoutManager (view.Context); mRecyclerView.SetLayoutManager (mLayoutManager); mAdapter = new adapter_listview (mPublicaciones, mRecyclerView, view.Context); mRecyclerView.SetAdapter (mAdapter); return view; // Create your fragment here }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.main); var refreshbattery = FindViewById<Button> (Resource.Id.refresh_battery); var batterystatus = FindViewById<TextView> (Resource.Id.battery_status); var batterylevel = FindViewById<TextView> (Resource.Id.battery_level); refreshbattery.Click += (sender, e) => { var filter = new IntentFilter(Intent.ActionBatteryChanged); var battery = RegisterReceiver(null, filter); int level = battery.GetIntExtra(BatteryManager.ExtraLevel, -1); int scale = battery.GetIntExtra(BatteryManager.ExtraScale, -1); batterylevel.Text = string.Format("Current Charge: {0}%", Math.Floor (level * 100D / scale)); // Are we charging / charged? works on phones, not emulators must check how. int status = battery.GetIntExtra(BatteryManager.ExtraStatus, -1); var isCharging = status == (int)BatteryStatus.Charging || status == (int)BatteryStatus.Full; // How are we charging? var chargePlug = battery.GetIntExtra(BatteryManager.ExtraPlugged, -1); var usbCharge = chargePlug == (int)BatteryPlugged.Usb; var acCharge = chargePlug == (int)BatteryPlugged.Ac; var wirelessCharge = chargePlug == (int)BatteryPlugged.Wireless; isCharging = (usbCharge || acCharge || wirelessCharge); if(!isCharging){ batterystatus.Text = "Status: discharging"; } else if(usbCharge){ batterystatus.Text = "Status: charging via usb"; } else if(acCharge){ batterystatus.Text = "Status: charging via ac"; } else if(wirelessCharge){ batterystatus.Text = "Status: charging via wireless"; } }; recyclerView = FindViewById<RecyclerView> (Resource.Id.recycler_view); recyclerView.HasFixedSize = true; layoutManager = new LinearLayoutManager (this); recyclerView.SetLayoutManager (layoutManager); var items = new List<RecyclerItem> (100); for(int i = 0; i < 100; i++) items.Add(new RecyclerItem{Title = "Item: " + i}); adapter = new RecyclerAdapter (items); recyclerView.SetAdapter (adapter); }
private void Initialize () { var inflater = (LayoutInflater)Context.GetSystemService (Context.LayoutInflaterService); inflater.Inflate (Resource.Layout.ColorPicker, this); Recycler = FindViewById<RecyclerView> (Resource.Id.ColorPickerRecyclerView); LayoutManager = new GridLayoutManager (Context, ColumnsCount); Recycler.SetLayoutManager (LayoutManager); Adapter = new ColorPickerAdapter (); Recycler.SetAdapter (Adapter); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); vegeList = new List<Vegetable> () { new Vegetable (1,"Onion",0,false,10, Resource.Drawable.rsz_onion_images), new Vegetable (2,"Cucumber",0,false,10, Resource.Drawable.rsz_cucumber), new Vegetable (3,"Carrot",0,false,10, Resource.Drawable.rsz_carrot), }; // Get our button from the layout resource, // and attach an event to it Button btnReset = FindViewById<Button> (Resource.Id.myButton); // Get our RecyclerView layout: mRecyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView); // Use the built-in linear layout manager: mLayoutManager = new LinearLayoutManager(this); // Plug the layout manager into the RecyclerView: mRecyclerView.SetLayoutManager(mLayoutManager); // Create an adapter for the RecyclerView, and pass it the // data set (the photo album) to manage: mAdapter = new RecycleAdapter(this,vegeList); // Register the item click handler (below) with the adapter: mAdapter.ItemClick += OnItemClick; mAdapter.SpinnerItemSelectionChanged += SpinnerItemSelectionChangedEvent; // Plug the adapter into the RecyclerView: mRecyclerView.SetAdapter(mAdapter); //Reset the complete view; btnReset.Click += delegate { if(vegeList!=null) { for(int i=0;i<vegeList.Count;i++) { vegeList[i].Quantity = 0; } mAdapter.NotifyDataSetChanged(); } }; }
public override void OnBindViewHolder (RecyclerView.ViewHolder holder, int position) { //int item = mData[position]; //IWindowManager windowManager = context.GetSystemService(Context.WindowService).JavaCast<IWindowManager>(); MyHealth_TakwimViewHolder vh = holder as MyHealth_TakwimViewHolder; string tempData = mData[position].title; vh.tvTitle.Text = tempData; mLayoutManager = new MyHealth_MyLinearLayoutManager (context); vh.mRViewList.SetLayoutManager (mLayoutManager); mRViewAdapter = new MyHealth_Takwim_NestedRecyclerViewAdapter (context, MyHealth_Child_Data.childData(), tempData); vh.mRViewList.SetAdapter(mRViewAdapter); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.CardViewLayout); InitComponents(); _layoutManager = new LinearLayoutManager(this); _recyclerView.SetLayoutManager(_layoutManager); _album = new PhotoAlbum(); _albumAdapter = new PhotoAlbumAdapter(_album); _albumAdapter.ItemClick += albumAdapter_ItemClick; _recyclerView.SetAdapter(_albumAdapter); }
public override void OnViewCreated (View rootView, Bundle savedInstanceState) { base.OnViewCreated (rootView, savedInstanceState); mLayoutManager = new LinearLayoutManager (Activity); mUsageListAdapter = new UsageListAdapter (); mRecyclerView = rootView.FindViewById<RecyclerView> (Resource.Id.recyclerview_app_usage); mRecyclerView.SetLayoutManager (mLayoutManager); mRecyclerView.ScrollToPosition (0); mRecyclerView.SetAdapter (mUsageListAdapter); mOpenUsageSettingButton = rootView.FindViewById<Button> (Resource.Id.button_open_usage_setting); mSpinner = rootView.FindViewById<Spinner> (Resource.Id.spinner_time_span); var spinnerAdapter = ArrayAdapter.CreateFromResource (Activity, Resource.Array.action_list, Android.Resource.Layout.SimpleSpinnerDropDownItem); mSpinner.Adapter = spinnerAdapter; mSpinner.OnItemSelectedListener = new MyOnItemSelectedListener (this); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Main); mItemAdapter = new ItemAdapter (); mLayoutManager = new LinearLayoutManager (this); mRecyclerView = FindViewById<RecyclerView> (Resource.Id.recyclerView); mRecyclerView.SetLayoutManager (mLayoutManager); mRecyclerView.SetAdapter (mItemAdapter); FetchItems (); // LoaderManager.InitLoader (0, null, this); }
private async void create (Bundle savedInstanceState) { // Set our view from the "main" layout resource this.SetContentView (Resource.Layout.movie_browse); this.categoryList = FindViewById<RecyclerView>(Resource.Id.movie_category_recyclerView); this.configuration = await Data.Current.GetConfigurationAsync (); this.categories = await Data.Current.GetMoviesByCategoryAsync (); this.categoryLayoutManager = new LinearLayoutManager (this, LinearLayoutManager.Vertical, false); this.categoryList.SetLayoutManager (this.categoryLayoutManager); if (this.categoryList.GetAdapter () == null) { this.categoryAdapter = new MovieCategoryRecyclerViewAdapter (this, this.categories, this.configuration); this.categoryList.SetAdapter (this.categoryAdapter); } else { this.categoryAdapter.Reload (this.categories); } }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var rootView = inflater.Inflate (Resource.Layout.recycler_view_frag, container, false); rootView.SetTag (rootView.Id,TAG); recyclerView = rootView.FindViewById<RecyclerView>(Resource.Id.recyclerView); // A LinearLayoutManager is used here, this will layout the elements in a similar fashion // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how the // elements are laid out. layoutManager = new LinearLayoutManager (Activity); recyclerView.SetLayoutManager (layoutManager); adapter = new CustomAdapter (dataSet); // Set CustomAdapter as the adapter for RecycleView recyclerView.SetAdapter (adapter); return rootView; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); viewModel = new ImageSearchViewModel(); //Setup RecyclerView adapter = new ImageAdapter(this, viewModel); recyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView); recyclerView.SetAdapter(adapter); layoutManager = new GridLayoutManager(this, 2); recyclerView.SetLayoutManager(layoutManager); progressBar = FindViewById<ProgressBar>(Resource.Id.my_progress); progressBar.Visibility = ViewStates.Gone; var query = FindViewById<EditText>(Resource.Id.my_query); // Get our button from the layout resource, // and attach an event to it var clickButton = FindViewById<Button>(Resource.Id.my_button); //Button Click event to get images clickButton.Click += async (sender, args) => { clickButton.Enabled = false; progressBar.Visibility = ViewStates.Visible; await viewModel.SearchForImagesAsync(query.Text.Trim()); progressBar.Visibility = ViewStates.Gone; clickButton.Enabled = true; }; UserDialogs.Init(this); SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetHomeButtonEnabled(false); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); recyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView); layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); var moviesAdapter = new MovieAdapter(MoviesRepository.Movies); recyclerView.SetAdapter(moviesAdapter); moviesAdapter.ItemClick += MoviesAdapter_ItemClick; SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetHomeButtonEnabled(false); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); string menuURL = "http://54.191.98.63/menu.php"; JsonValue json = await JsonParsing<Task<JsonValue>>.FetchDataAsync(menuURL); List<EMItemList> parsedData = JsonParsing<EMItemList>.ParseAndDisplay(json); AP_EM_ItemList.mBuiltInCards = parsedData.ToArray(); //Create Menu List mItemList = new AP_EM_ItemList(); //Set View SetContentView(Resource.Layout.APEditMenu); Button logout = FindViewById<Button>(Resource.Id.LogOut_Edit_Menu_Button); logout.Click += delegate { Android.Widget.Toast.MakeText(this, "Logged Out Successfully", Android.Widget.ToastLength.Short).Show(); StartActivity(typeof(LoginScreen)); }; //Set up layout manager to view all cards on recycler view mRecyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView); mLayoutManager = new LinearLayoutManager(this); mRecyclerView.SetLayoutManager(mLayoutManager); //Menu List Adapter mAdapter = new CVBFItemListAdapter(mItemList); //Put adapter into RecyclerView mRecyclerView.SetAdapter(mAdapter); //Item Click mAdapter.ItemClick += OnItemClick; mView = FindViewById(Resource.Id.fullAPEMAdd); //FAB var fab = FindViewById<FloatingActionButton>(Resource.Id.APEMfab); fab.AttachToRecyclerView(mRecyclerView); FindViewById<FloatingActionButton>(Resource.Id.APEMfab).Click += (sender, e) => { StartActivity(typeof(AP_EM_Add)); OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.right_out); }; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); recyclerView = FindViewById<RecyclerView> (Resource.Id.my_recycler_view); // 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 layoutManager = new LinearLayoutManager (this); recyclerView.SetLayoutManager (layoutManager); // specify an adapter adapter = new MyAdapter (new [] { "Brasil", "Mexico", "United States", "Canada" }); recyclerView.SetAdapter (adapter); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); try { SetContentView(Resource.Layout.YourSpecializationCheckBox); inputMethodManager = Application.GetSystemService(Context.InputMethodService) as InputMethodManager; InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); searchET = FindViewById <EditText>(Resource.Id.searchET); backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout); back_button = FindViewById <ImageButton>(Resource.Id.back_button); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); activityIndicatorSearch = FindViewById <ProgressBar>(Resource.Id.activityIndicatorSearch); searchLL = FindViewById <LinearLayout>(Resource.Id.searchLL); search_recyclerView = FindViewById <RecyclerView>(Resource.Id.search_recyclerView); nothingTV = FindViewById <TextView>(Resource.Id.nothingTV); nothingIV = FindViewById <ImageView>(Resource.Id.nothingIV); headerTV = FindViewById <TextView>(Resource.Id.headerTV); searchBn = FindViewById <Button>(Resource.Id.searchBn); applyBn = FindViewById <Button>(Resource.Id.applyBn); close_searchBn = FindViewById <ImageButton>(Resource.Id.close_searchBn); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); activityIndicatorSearch.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); search_layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); search_recyclerView.SetLayoutManager(search_layoutManager); recyclerView.SetLayoutManager(layoutManager); SubCategoryAdapter.checked_positions.Clear(); Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf"); headerTV.SetTypeface(tf, TypefaceStyle.Bold); searchET.SetTypeface(tf, TypefaceStyle.Normal); searchBn.SetTypeface(tf, TypefaceStyle.Normal); nothingTV.SetTypeface(tf, TypefaceStyle.Normal); applyBn.SetTypeface(tf, TypefaceStyle.Normal); SpecializationMethods specializationMethods = new SpecializationMethods(); searchET.Visibility = ViewStates.Gone; searchBn.Click += (s, e) => { close_searchBn.Visibility = ViewStates.Visible; searchET.Visibility = ViewStates.Visible; searchBn.Visibility = ViewStates.Gone; headerTV.Visibility = ViewStates.Gone; searchET.RequestFocus(); showKeyboard(); }; searchET.EditorAction += (object sender, EditText.EditorActionEventArgs e) => { imm.HideSoftInputFromWindow(searchET.WindowToken, 0); }; close_searchBn.Click += (s, e) => { searchET.Text = null; imm.HideSoftInputFromWindow(searchET.WindowToken, 0); searchLL.Visibility = ViewStates.Gone; headerTV.Visibility = ViewStates.Visible; searchET.Visibility = ViewStates.Gone; close_searchBn.Visibility = ViewStates.Gone; searchBn.Visibility = ViewStates.Visible; }; searchET.TextChanged += async(s, e) => { if (!String.IsNullOrEmpty(searchET.Text)) { nothingIV.Visibility = ViewStates.Gone; nothingTV.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Visible; close_searchBn.Visibility = ViewStates.Visible; activityIndicatorSearch.Visibility = ViewStates.Visible; search_recyclerView.Visibility = ViewStates.Gone; activityIndicatorSearch.Visibility = ViewStates.Visible; var search_content = await specializationMethods.SearchCategory(searchET.Text); if (!search_content.ToLower().Contains("пошло не так".ToLower()) && !search_content.Contains("null")) { search_recyclerView.Visibility = ViewStates.Visible; deserialized_search = JsonConvert.DeserializeObject <List <SearchCategory> >(search_content.ToString()); List <SearchDisplaying> searchDisplayings = new List <SearchDisplaying>(); foreach (var item in deserialized_search) { if (item.hasSubcategory) { searchDisplayings.Add(new SearchDisplaying { id = item.id, name = item.name, iconUrl = item.iconUrl, isRoot = true, hasSubcategory = true, rootId = item.id }); if (item.subcategories != null) { foreach (var item1 in item.subcategories) { if (item1.hasSubcategory) { searchDisplayings.Add(new SearchDisplaying { id = item1.id, name = item1.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id }); if (item1.subcategories != null) { foreach (var item2 in item1.subcategories) { if (item2.hasSubcategory) { searchDisplayings.Add(new SearchDisplaying { id = item2.id, name = item2.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id }); if (item2.subcategories != null) { foreach (var item3 in item2.subcategories) { if (item3.subcategories != null) { searchDisplayings.Add(new SearchDisplaying { id = item3.id, name = item3.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id }); foreach (var item4 in item3.subcategories) { searchDisplayings.Add(new SearchDisplaying { id = item4.id, name = item4.name, iconUrl = null, isRoot = false, hasSubcategory = true, rootId = item.id }); } } else { searchDisplayings.Add(new SearchDisplaying { id = item3.id, name = item3.name, iconUrl = null, isRoot = false, hasSubcategory = false, rootId = item.id }); } } } } else { searchDisplayings.Add(new SearchDisplaying { id = item2.id, name = item2.name, iconUrl = null, isRoot = false, hasSubcategory = false, rootId = item.id }); } } } } else { searchDisplayings.Add(new SearchDisplaying { id = item1.id, name = item1.name, iconUrl = null, isRoot = false, hasSubcategory = false, rootId = item.id }); } } } } else { searchDisplayings.Add(new SearchDisplaying { id = item.id, name = item.name, iconUrl = item.iconUrl, isRoot = true, hasSubcategory = false, rootId = item.id }); } } subCategorySearchAdapter = new SubCategorySearchAdapter(searchDisplayings, this, tf); subCategorySearchAdapter.NotifyDataSetChanged(); search_recyclerView.SetAdapter(subCategorySearchAdapter); subCategorySearchAdapter.NotifyDataSetChanged(); } else { search_recyclerView.Visibility = ViewStates.Gone; nothingIV.Visibility = ViewStates.Visible; nothingTV.Visibility = ViewStates.Visible; } activityIndicatorSearch.Visibility = ViewStates.Gone; } else { close_searchBn.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Visible; } }; backRelativeLayout.Click += (s, e) => { OnBackPressed(); }; back_button.Click += (s, e) => { OnBackPressed(); }; headerTV.Text = pref.GetString("spec_name", String.Empty); var sub_categs = await specializationMethods.GetSubCategories(pref.GetString("spec_id", String.Empty)); activityIndicator.Visibility = ViewStates.Gone; if (sub_categs != "null") { var deserObj = JsonConvert.DeserializeObject <SubCategoryRootObject>(sub_categs.ToString()); deserialized_sub_categs = deserObj.subcategories; deserialized_sub_categs.Add(new SubCategory { id = "-1", name = GetString(Resource.String.other) }); var subCategoryAdapter = new SubCategoryAdapter(deserialized_sub_categs, this, tf); recyclerView.SetAdapter(subCategoryAdapter); } applyBn.Click += async(s, e) => { foreach (var index in SubCategoryAdapter.checked_positions) { var kjg = deserialized_sub_categs[index]; } if (!userMethods.UserExists()) { foreach (var index in SubCategoryAdapter.checked_positions) { if (!SubCategoryAdapter.my_specializations_static.Contains(deserialized_sub_categs[index])) { SubCategoryAdapter.my_specializations_static.Add(deserialized_sub_categs[index]); } } StartActivity(new Intent(this, typeof(AddSpecializationActivity))); } else { foreach (var index in SubCategoryAdapter.checked_positions) { var res = await SubCategoryActivity.show_activity(deserialized_sub_categs[index].id, userMethods.GetUsersAuthToken()); } StartActivity(new Intent(this, typeof(UserProfileActivity))); } }; } catch { StartActivity(typeof(MainActivity)); } }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.My_BackgroundReports); _progressDialog = new ProgressDialog(this); _progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); _progressDialog.SetMessage("Loading Team . . ."); _progressDialog.Show(); //If the device is portrait, then show the RecyclerView in a vertical list, //else show it in horizontal list. _layoutManager = Resources.Configuration.Orientation == Android.Content.Res.Orientation.Portrait ? new LinearLayoutManager(this, LinearLayoutManager.Vertical, false) : new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false); //Experiement with a GridLayoutManger! You can create some cool looking UI! //This create a gridview with 2 rows that scrolls horizontally. // _layoutManager = new GridLayoutManager(this, 2, GridLayoutManager.Horizontal, false); //Create a reference to our RecyclerView and set the layout manager; _recyclerView = FindViewById<RecyclerView>(Resource.Id.mainActivity_recyclerView); _recyclerView.SetLayoutManager(_layoutManager); //Get our crew member data. This could be a web service. SharedData.CrewManifest = await BackgroundCheck_List_Data.GetAllCrewAsync(); //Create the adapter for the RecyclerView with our crew data, and set //the adapter. Also, wire an event handler for when the user taps on each //individual item. _adapter = new BackgroundCheckRecyclerViewAdapter(SharedData.CrewManifest, this.Resources); _adapter.ItemClick += OnItemClick; _recyclerView.SetAdapter(_adapter); _progressDialog.Dismiss(); mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar); mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); mLeftDrawer = FindViewById<ListView>(Resource.Id.left_drawer); mRightDrawer = FindViewById<ListView>(Resource.Id.right_drawer); mLeftDrawer.Tag = 0; mRightDrawer.Tag = 1; SetSupportActionBar(mToolbar); mLeftDataSet = new List<string>(); mLeftDataSet.Add(GetString(Resource.String.my_profile)); mLeftDataSet.Add(GetString(Resource.String.log_out)); mLeftAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet); mLeftDrawer.Adapter = mLeftAdapter; //this.mLeftDrawer.ItemClick += mLeftDrawer_ItemClick; //this.mRightDrawer.ItemClick += mRightDrawer_ItemClick; mRightDataSet = new List<string>(); mRightDataSet.Add(GetString(Resource.String.drawer_faq)); mRightDataSet.Add(GetString (Resource.String.support)); mRightDataSet.Add(GetString(Resource.String.rentproof_summary)); mRightAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, mRightDataSet); mRightDrawer.Adapter = mRightAdapter; mDrawerToggle = new NavigationBar( this, //Host Activity mDrawerLayout, //DrawerLayout Resource.String.openDrawer, //Opened Message Resource.String.closeDrawer //Closed Message ); mDrawerLayout.SetDrawerListener(mDrawerToggle); SupportActionBar.SetDisplayHomeAsUpEnabled (true); SupportActionBar.SetDisplayShowTitleEnabled(true); mDrawerToggle.SyncState(); if (bundle != null){ if (bundle.GetString("DrawerState") == "Opened"){ SupportActionBar.SetTitle(Resource.String.openDrawer); } else{ SupportActionBar.SetTitle(Resource.String.closeDrawer); } } else{ //This is the first the time the activity is ran SupportActionBar.SetTitle(Resource.String.closeDrawer); } }
public void DoStartup() { SetContentView(Resource.Layout.activity_main); db = new DataBaseClass(); Product newProduct = new Product(); Magazin newMagazin = new Magazin(); mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); mProducts = db.getAllProducts(); mProductsCopy = new List <Product>(); //lista copie pt filtrare mProductsCopy.AddRange(mProducts); mProductsCD = new List <Product>(); //lista copie pt stergere multipla mProductsCD.AddRange(mProducts); mMagazin = db.getAllMagazin(); //create our layout manager mLayoutManager = new LinearLayoutManager(this); mRecyclerView.SetLayoutManager(mLayoutManager); mAdapter = new RecyclerAdapter(mProducts, mRecyclerView, db, this); mAdapter.CellClick_ButtonDelete += MAdapter_CellClick_ButtonDelete; mAdapter.CellClick_ButtonEdit += MAdapter_CellClick_ButtonEdit; // mAdapter = new RecyclerAdapter(mMagazin); mRecyclerView.SetAdapter(mAdapter); // MenuInflater.Inflate(Resource.Menu.menu_pop, menu); // base.OnCreateOptionsMenu(menu); Button btnInsertData = FindViewById <Button>(Resource.Id.btnInsertData); btnInsertData.Click += BtnInsertData_Click; database = new DataBaseClass(); spinnerMagazine = FindViewById <Spinner>(Resource.Id.spinnerMagazine); arrayAdapter = new ArrayAdapter <Magazin>(this, Resource.Layout.support_simple_spinner_dropdown_item); List <Magazin> magazine = MainActivity.database.GetMagazins(); Magazin magazin = new Magazin(); magazin.Name = "Magazine"; arrayAdapter.Add(magazin); arrayAdapter.AddAll(magazine); arrayAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerMagazine.Adapter = arrayAdapter; spinnerMagazine.ItemSelected += SpinnerMagazine_ItemSelected; Button mMultipleDelete = FindViewById <Button>(Resource.Id.btnMultipleDelete); mMultipleDelete.Click += MMultipleDelete_Click; //Galerie-buton Button btnGallery = FindViewById <Button>(Resource.Id.btnGallery); btnGallery.Click += BtnGallery_Click; //Map-button Button btnMap = FindViewById <Button>(Resource.Id.btnMap); btnMap.Click += BtnMap_Click; Depozit newDepozit = new Depozit(); mDepozit = db.getAllDepozite(); Button btnDepozit = FindViewById <Button>(Resource.Id.btnDepozit); btnDepozit.Click += BtnDepozit_Click; Button btnValutaEur = FindViewById <Button>(Resource.Id.btnValutaEur); Button btnValutaUsd = FindViewById <Button>(Resource.Id.btnValutaUsd); try { ro.infovalutar.www.Curs curs = new ro.infovalutar.www.Curs(); double valE = curs.GetValue(DateTime.Now, "EUR"); double valU = curs.GetValue(DateTime.Now, "USD"); btnValutaEur.Text = "1 Euro=" + valE.ToString() + "Lei"; btnValutaUsd.Text = "1 USD=" + valU.ToString() + "Lei"; btnValutaEur.Click += BtnValutaEur_Click; btnValutaUsd.Click += BtnValutaUsd_Click; } catch (System.Net.WebException) { btnValutaEur.Text = "Please ensure you are connected to the internet"; btnValutaUsd.Text = "Please ensure you are connected to the internet"; } catch (Exception ex) { btnValutaEur.Text = ex.Message; btnValutaUsd.Text = ex.Message; } Button btnMail = FindViewById <Button>(Resource.Id.btnMail); btnMail.Click += BtnMail_Click; Button btnMail2 = FindViewById <Button>(Resource.Id.btnMail2); btnMail2.Click += BtnMail2_Click; }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.MyBookings); //clearing list myExpListClassForRecycler.Clear(); ProgressBar activityIndicatorMyBookings = FindViewById <ProgressBar>(Resource.Id.activityIndicatorMyBookings); TextView messageTV = FindViewById <TextView>(Resource.Id.messageTV); TextView MyExp_title_TV = FindViewById <TextView>(Resource.Id.MyExp_title_TV); string path = "fonts/HelveticaNeueLight.ttf"; Typeface tf = Typeface.CreateFromAsset(Assets, path); messageTV.Typeface = tf; MyExp_title_TV.Typeface = tf; await getMyExperiences.GettingMyExperiences(Login.token); try { var responseData = JsonConvert.DeserializeObject <RootObjectMyExperiences>(GetMyExperiences.content); //THIS CONSTRUCTION IS TO DISPLAY ITEMS FROM REVERSE for (int i = responseData.experiences.Count - 1; i >= 0; i--) { if (responseData.experiences[i].cover_image == null) { myExpListClassForRecycler.Add( new MyExperiencesClassForRecycler { _id = responseData.experiences[i].id.ToString(), _name = responseData.experiences[i].title, _price = responseData.experiences[i].price, _description = responseData.experiences[i].description, _location = responseData.experiences[i].location, _duration = responseData.experiences[i].duration, _min_capacity = responseData.experiences[i].min_capacity, _max_capacity = responseData.experiences[i].max_capacity, _lat = responseData.experiences[i].lat, _lng = responseData.experiences[i].lng, _status = responseData.experiences[i].status }); } else if (responseData.experiences[i].cover_image.url != null) { myExpListClassForRecycler.Add( new MyExperiencesClassForRecycler { _id = responseData.experiences[i].id.ToString(), _name = responseData.experiences[i].title, _price = responseData.experiences[i].price, _description = responseData.experiences[i].description, _location = responseData.experiences[i].location, _duration = responseData.experiences[i].duration, _min_capacity = responseData.experiences[i].min_capacity, _max_capacity = responseData.experiences[i].max_capacity, _lat = responseData.experiences[i].lat, _lng = responseData.experiences[i].lng, _image_url = responseData.experiences[i].cover_image.url, _status = responseData.experiences[i].status }); } } //THIS CONSTRUCTION IS TO DISPLAY ITEMS FROM REVERSE ENDED recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); var myExpListClassForRecyclerAdapter = new MyExperiencesAdapter(myExpListClassForRecycler, this); recyclerView.SetAdapter(myExpListClassForRecyclerAdapter); ImageButton back = FindViewById <ImageButton>(Resource.Id.back); back.Click += async delegate { if (Fragments.SearchFragment.searchByWordIndicator == true) { FindViewById <ProgressBar>(Resource.Id.activityIndicatorMyBookings).Visibility = ViewStates.Visible; string dbPath1 = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ormdemo.db3"); var db1 = new SQLiteConnection(dbPath1); var placesOfInterestTable = db1.Table <ORM.PlacesOfInterestTable>(); try { foreach (var item in placesOfInterestTable) { dbr1.RemovePlacesOfInterestRecord(item.Id); } } catch { } try { MovieAdapter.moviesStatic.Clear(); } catch { } //Wishlist wishlist = new Wishlist(); //await SearchByWord(Fragments.SearchFragment.searchWord); await searchFunction(Fragments.SearchFragment.searchWord); } else if (Fragments.SearchFragment.searchByWordIndicator == false) { StartActivity(typeof(MainActivity)); } }; activityIndicatorMyBookings.Visibility = ViewStates.Gone; if (myExpListClassForRecycler.Count != 0) { messageTV.Visibility = ViewStates.Gone; } else { messageTV.Text = "You have no experiences now"; } } catch { } }
private void IntializeUI(Bundle savestate) { EnableLocationDialog(); FacebookSdk.SdkInitialize(this.ApplicationContext); mProfileTracker = new MyProfileTracker(); SetContentView(Resource.Layout.home_page); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "HOME"; var navigationView = FindViewById <NavigationView>(Resource.Id.nav_views); View headerview = navigationView.InflateHeaderView(Resource.Layout.drawer_header); UserName = headerview.FindViewById <TextView>(Resource.Id.userName); UserImage = headerview.FindViewById <ImageView>(Resource.Id.userImage); ISharedPreferences prefs = this.GetSharedPreferences("MYPROFILE", FileCreationMode.Private); if (prefs.GetString("username", "") != null && prefs.GetString("profilePic", "") != null) { UserImage.Visibility = ViewStates.Gone; ProfilePictureView fbProfilePicture = headerview.FindViewById <ProfilePictureView>(Resource.Id.facebook_profile_pic); fbProfilePicture.Visibility = ViewStates.Visible; string name = prefs.GetString("username", ""); string profilePic = prefs.GetString("profilepic", ""); UserName.Text = name; fbProfilePicture.ProfileId = profilePic; } TextView userLocationView = headerview.FindViewById <TextView>(Resource.Id.userLocation); userLocationView.Click += UserLocationView_Click; drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawerLayout); var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.drawer_open, Resource.String.drawer_close); drawerLayout.AddDrawerListener(drawerToggle); drawerToggle.SyncState(); //SupportActionBar.Show(); // FindViewById<Button>(Resource.Id.button1).Click += HomePage_Click; iconList.Add(Resource.Raw.ic_bike); iconList.Add(Resource.Raw.ic_bike); iconList.Add(Resource.Raw.ic_service); iconList.Add(Resource.Raw.ic_gallery); dotslayout = FindViewById <LinearLayout>(Resource.Id.HomePageDotsContainer); imagePager = FindViewById <ViewPager>(Resource.Id.homePageImagePagerContainer); homeRView = FindViewById <RecyclerView>(Resource.Id.homePageRView); _layoutManager = new GridLayoutManager(this, 2); homeRView.SetLayoutManager(_layoutManager); RecycleHomeIconAdapter RVadapter = new RecycleHomeIconAdapter(this, iconList, iconNameList); homeRView.SetAdapter(RVadapter); RVadapter.ItemClick += RVadapter_ItemClick; imageList.Add(Resource.Raw.image1); imageList.Add(Resource.Raw.image4); imageList.Add(Resource.Raw.image2); PageImageAdapter adapter = new PageImageAdapter(this, imageList); imagePager.Adapter = adapter; imagePager.SetCurrentItem(0, true); imagePager.AddOnPageChangeListener(this); setUiPageViewController(); Bundle savestates = new Bundle(); // _bottomNavBar = BottomBar.Attach(this, bundle); _bottomNavBar = BottomBar.AttachShy((CoordinatorLayout)FindViewById(Resource.Id.homePageCoordinatorLayout), FindViewById(Resource.Id.homePageScrollingContent), savestates); _bottomNavBar.SetItems(Resource.Menu.bottomMenuBar); _bottomNavBar.SetOnMenuTabClickListener(this); navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment View itemView = inflater.Inflate(Resource.Layout.user_notification, container, false); notificationListRecycle = itemView.FindViewById <RecyclerView>(Resource.Id.notificationListRecylceView); _layoutManager = new LinearLayoutManager(this.Context); notificationListRecycle.SetLayoutManager(_layoutManager); notificationImage.Add(Resource.Raw.vendor); notificationImage.Add(Resource.Raw.vendor); notificationImage.Add(Resource.Raw.vendor); notificationImage.Add(Resource.Raw.vendor); notificationImage.Add(Resource.Raw.vendor); notificationImage.Add(Resource.Raw.vendor); notificationImage.Add(Resource.Raw.vendor); notificationImage.Add(Resource.Raw.vendor); notificationImage.Add(Resource.Raw.vendor); notificationImage.Add(Resource.Raw.vendor); notificationImage.Add(Resource.Raw.vendor); notificationDate.Add("12-jan-2017"); notificationDate.Add("12-jan-2017"); notificationDate.Add("12-jan-2017"); notificationDate.Add("12-jan-2017"); notificationDate.Add("12-jan-2017"); notificationDate.Add("12-jan-2017"); notificationDate.Add("12-jan-2017"); notificationDate.Add("12-jan-2017"); notificationDate.Add("12-jan-2017"); notificationDate.Add("12-jan-2017"); notificationDate.Add("12-jan-2017"); notificationTitle.Add("Get Free Ride"); notificationTitle.Add("Get Discount with 5 people"); notificationTitle.Add("Get Free Ride"); notificationTitle.Add("Get Discount with 5 people"); notificationTitle.Add("Get Free Ride"); notificationTitle.Add("Get Discount with 5 people"); notificationTitle.Add("Get Free Ride"); notificationTitle.Add("Get Discount with 5 people"); notificationTitle.Add("Get Free Ride"); notificationTitle.Add("Get Discount with 5 people"); notificationTitle.Add("Get Discount with 5 people"); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); notificationDiscription.Add("Ride With RoadWheels will make you feel ride in paradise explore more nature is beautifull "); NotificationListAdapter adapter = new NotificationListAdapter(this.Context, notificationImage, notificationTitle, notificationDate, notificationDiscription); notificationListRecycle.SetAdapter(adapter); adapter.ItemClick += Adapter_ItemClick; return(itemView); }
public override int[] CalculateDistanceToFinalSnap(RecyclerView.LayoutManager layoutManager, View targetView) => new[] { distanceToStart(targetView, getHorizontalHelper(layoutManager)), 0 };
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Instantiate the photo album: mPhotoAlbum = new PhotoAlbum(); // Set our view from the "main" layout resource: SetContentView(Resource.Layout.Main); interstitialAds = new InterstitialAd(this); mAdView = FindViewById <AdView>(Resource.Id.adView); var adRequest = new AdRequest.Builder().Build(); mAdView.LoadAd(adRequest); interstitialAds.AdUnitId = "ca-app-pub-1120846610061033/5377390906"; // loading test ad using adrequest interstitialAds.LoadAd(adRequest); interstitialAds.AdListener = new AdListener(this); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "BEST TIPSTARS"; SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu); SupportActionBar.SetDisplayHomeAsUpEnabled(true); drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); myfab = FindViewById <FloatingActionButton>(Resource.Id.fab); // Get our RecyclerView layout: mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); //............................................................ // Layout Manager Setup: // Use the built-in linear layout manager: mLayoutManager = new LinearLayoutManager(this); // Or use the built-in grid layout manager (two horizontal rows): // mLayoutManager = new GridLayoutManager // (this, 2, GridLayoutManager.Horizontal, false); // Plug the layout manager into the RecyclerView: mRecyclerView.SetLayoutManager(mLayoutManager); myswipeRefresh = FindViewById <SwipeRefreshLayout>(Resource.Id.refresher); myswipeRefresh.SetColorScheme(Resource.Color.Red, Resource.Color.Orange, Resource.Color.Yellow, Resource.Color.Green, Resource.Color.Blue, Resource.Color.Indigo, Resource.Color.Violet); myswipeRefresh.Refresh += MyswipeRefresh_Refresh; //............................................................ // Adapter Setup: // Create an adapter for the RecyclerView, and pass it the // data set (the photo album) to manage: mAdapter = new PhotoAlbumAdapter(mPhotoAlbum); // Register the item click handler (below) with the adapter: mAdapter.ItemClick += OnItemClick; // Plug the adapter into the RecyclerView: mRecyclerView.SetAdapter(mAdapter); navigationView.NavigationItemSelected += (sender, e) => { e.MenuItem.SetChecked(true); Intent intent = null; switch (e.MenuItem.ItemId) { case Resource.Id.nav_about: intent = new Intent(this, typeof(About)); break; case Resource.Id.nav_share: intent = new Intent(Intent.ActionSend); intent.SetType("text/plain"); intent.PutExtra(Intent.ExtraText, "https://play.google.com/store/apps/details?id=com.hamsempire.bestpredictions"); break; } if (intent != null) { StartActivity(intent); } drawerLayout.CloseDrawers(); }; myfab.Click += async delegate(object sender, EventArgs e) { myswipeRefresh.Refreshing = true; await Task.Delay(5000); myswipeRefresh.Refreshing = false; }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); viewModel = new ImageSearchViewModel(); //Setup RecyclerView adapter = new ImageAdapter(this, viewModel); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); recyclerView.SetAdapter(adapter); layoutManager = new GridLayoutManager(this, 2); recyclerView.SetLayoutManager(layoutManager); progressBar = FindViewById <ProgressBar>(Resource.Id.my_progress); progressBar.Visibility = ViewStates.Gone; var query = FindViewById <EditText>(Resource.Id.my_query); // Get our button from the layout resource, // and attach an event to it var clickButton = FindViewById <Button>(Resource.Id.my_button); clickButton.Click += async(sender, args) => { clickButton.Enabled = false; progressBar.Visibility = ViewStates.Visible; await viewModel.SearchForImagesAsync(query.Text); progressBar.Visibility = ViewStates.Gone; clickButton.Enabled = true; }; var photo = FindViewById <Button>(Resource.Id.button1); photo.Click += async(sender, args) => { await viewModel.TakePhotoAndAnalyzeAsync(); }; adapter.ItemClick += async(sender, args) => { clickButton.Enabled = false; progressBar.Visibility = ViewStates.Visible; await viewModel.AnalyzeImageAsync(viewModel.Images[args.Position].ImageLink); progressBar.Visibility = ViewStates.Gone; clickButton.Enabled = true; }; UserDialogs.Init(this); SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetHomeButtonEnabled(false); }
public override View FindSnapView(RecyclerView.LayoutManager layoutManager) => getStartView(layoutManager, getHorizontalHelper(layoutManager));
private OrientationHelper GetVerticalHelper(RecyclerView.LayoutManager layoutManager) { return(_verticalHelper ?? (_verticalHelper = OrientationHelper.CreateVerticalHelper(layoutManager))); }
private OrientationHelper GetHorizontalHelper(RecyclerView.LayoutManager layoutManager) { return(_horizontalHelper ?? (_horizontalHelper = OrientationHelper.CreateHorizontalHelper(layoutManager))); }
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 view = inflater.Inflate(Resource.Layout.look_up_in_stock_fragment, container, false); fragmentContext = Application.Context; mLayoutManager = new LinearLayoutManager(fragmentContext); relativeLayout = view.FindViewById <RelativeLayout>(Resource.Id.lookup_in_stock_list_container); progressBar = new ProgressBar(fragmentContext); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(200, 200); layoutParams.AddRule(LayoutRules.CenterInParent); relativeLayout.AddView(progressBar, layoutParams); progressBar.Visibility = ViewStates.Gone; Button btnSearch = view.FindViewById <Button>(Resource.Id.btnSearch); Button btnResearch = view.FindViewById <Button>(Resource.Id.btnResearch); layoutSearchView = view.FindViewById <LinearLayout>(Resource.Id.layoutSearchView); layoutResultView = view.FindViewById <LinearLayout>(Resource.Id.layoutResultView); serachPartNo = view.FindViewById <EditText>(Resource.Id.serachPartNo); searchBatchNo = view.FindViewById <EditText>(Resource.Id.searchBatchNo); searchName = view.FindViewById <EditText>(Resource.Id.searchName); searchSpec = view.FindViewById <EditText>(Resource.Id.searchSpec); recyclerViewResult = view.FindViewById <RecyclerView>(Resource.Id.recyclerViewSearch); recyclerViewResult.SetLayoutManager(mLayoutManager); btnSearch.Click += (Sender, e) => { if (searchItemAdapter != null) { searchItemAdapter.NotifyDataSetChanged(); } progressBar.Visibility = ViewStates.Visible; Intent searchIntent = new Intent(Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_ACTION); fragmentContext.SendBroadcast(searchIntent); }; btnResearch.Click += (Sender, e) => { layoutSearchView.Visibility = ViewStates.Visible; layoutResultView.Visibility = ViewStates.Gone; }; if (!isRegister) { IntentFilter filter = new IntentFilter(); mReceiver = new MyBoradcastReceiver(); filter.AddAction(Constants.ACTION_SOCKET_TIMEOUT); filter.AddAction(Constants.SOAP_CONNECTION_FAIL); filter.AddAction(Constants.ACTION_SEARCH_PART_BATCH_CLEAN); filter.AddAction(Constants.ACTION_SEARCH_PART_BATCH_FAILED); filter.AddAction(Constants.ACTION_SEARCH_PART_BATCH_SUCCESS); filter.AddAction(Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_ACTION); filter.AddAction(Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_CLEAN); filter.AddAction(Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_FAILED); filter.AddAction(Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_SUCCESS); filter.AddAction(Constants.ACTION_SEARCH_PART_WAREHOUSE_LIST_EMPTY); filter.AddAction(Constants.ACTION_SEARCH_PART_WAREHOUSE_SORT_COMPLETE); filter.AddAction(Constants.ACTION_SEARCH_PART_WAREHOUSE_GET_ORIGINAL_LIST); filter.AddAction("unitech.scanservice.data"); fragmentContext.RegisterReceiver(mReceiver, filter); isRegister = true; } return(view); }
private void setupMyHealthData(int page){ WebServices wbs = new WebServices (); string tokenData = Activity.Intent.GetStringExtra ("Token"); string tokenWBSRaw = wbs.getMyHealthBWRecords(tokenData,page); int totalPage = 0; Console.WriteLine ("Raw Data: {0}",tokenWBSRaw); try { var tokenWBSjson = JsonConvert.DeserializeObject<WebServices.MyHealthBodyWeightData> (tokenWBSRaw); totalPage = tokenWBSjson.W_data.total; lastPage = tokenWBSjson.W_data.last_page; Console.WriteLine("[Tab 2] Total BloodPressure: {0}",totalPage); if(totalPage != 0) { if(isRefreshing == true){ listData.Clear (); } Activity.RunOnUiThread (() => { llMHeT2ErrorLayout.Visibility = ViewStates.Gone; }); foreach(var GetData in tokenWBSjson.W_data.data) { Console.WriteLine("[Tab2] Data MDateTime: {0}",GetData.MdateTime); listData.Add(new MyHealth_BodyWeight_ListData() { mDateTime = DateTime.ParseExact(GetData.MdateTime.ToString(), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture).ToString("dd MMM. yyyy, h:mm:ss tt"), mWeight = float.Parse (GetData.WeightValue, CultureInfo.InvariantCulture.NumberFormat).ToString("0.###### kg"), mNettWeight = GetData.LeanWeight, mBMI = float.Parse (GetData.BMI, CultureInfo.InvariantCulture.NumberFormat).ToString("0.######"), mBoneMass = float.Parse (GetData.BoneValue, CultureInfo.InvariantCulture.NumberFormat).ToString("0.######"), mFat = float.Parse (GetData.FatValue, CultureInfo.InvariantCulture.NumberFormat).ToString("0.######")+" %" }); myHealthBWDateList.Add(DateTime.ParseExact(GetData.Mdatef.ToString(), "yyyy-MM-dd", CultureInfo.InvariantCulture).ToString("dd MMM. yyyy")); myHealthBWTimeList.Add(DateTime.ParseExact(GetData.Mtimef.ToString(), "HH:mm:ss", CultureInfo.InvariantCulture).ToString("h:mm:ss tt")); myHealthBWWeightList.Add(float.Parse (GetData.WeightValue, CultureInfo.InvariantCulture.NumberFormat).ToString("0.###### kg")); myHealthBWBMIList.Add(float.Parse (GetData.BMI, CultureInfo.InvariantCulture.NumberFormat).ToString("0.######")); myHealthBWFatList.Add(float.Parse (GetData.FatValue, CultureInfo.InvariantCulture.NumberFormat).ToString("0.######")+" %"); myHealthBWLeanWeightList.Add(float.Parse (GetData.LeanWeight, CultureInfo.InvariantCulture.NumberFormat).ToString("0.######")); myHealthBWBoneMassList.Add(float.Parse (GetData.BoneValue, CultureInfo.InvariantCulture.NumberFormat).ToString("0.######")); myHealthBWStatusList.Add(getBMIStatus(GetData.BMI)); } } else { Activity.RunOnUiThread (() => { llMHeT2ErrorLayout.Visibility = ViewStates.Visible; tvMHeT2ErrorStatus.Text = "Anda belum melakukan sebarang pemeriksaan berat badan di PI1M."; }); } } catch(Exception e) { Console.WriteLine ("[Tab_2] Error on inserting data: {0} ",e); string eLimit = string.Format ("{0}", e).Substring (0, 20); Activity.RunOnUiThread (() => { AlertDialog alertDialog; AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder (Activity); alertDialogBuilder .SetTitle ("Masalah") //.SetMessage (string.Format ("Maaf. Sila cuba sekali lagi ({0}...).", eLimit)) .SetMessage (string.Format ("Tiada data ditemui. Anda mungkin belum membuat sebarang pemeriksaan berat badan di PI1M. Sila hubungi Pengurus PI1M berdekatan dengan anda untuk pertanyaan.")) .SetCancelable (true) .SetPositiveButton ("OK", delegate { }); alertDialog = alertDialogBuilder.Create (); alertDialog.Show (); llMHeT2ErrorLayout.Visibility = ViewStates.Visible; tvMHeT2ErrorStatus.Text = "Anda belum melakukan sebarang pemeriksaan berat badan di PI1M."; }); } if (Activity != null) { Activity.RunOnUiThread (() => { if (page == 1) { listDataBW = new MyHealth_BodyWeight_ListDataHolderList (listData); mLayoutManager = new LinearLayoutManager (Activity); recyclerView.SetLayoutManager (mLayoutManager); recyclerAdapterBW = new MyHealth_BodyWeight_RecyclerViewAdapter (Activity, listDataBW, totalPage); recyclerView.SetAdapter (recyclerAdapterBW); recyclerAdapterBW.ItemClick += ItemClicked; } else { recyclerAdapterBW.NotifyDataSetChanged (); } }); } //return listData; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.potroseniMaterijali_Pozicija); Android.Widget.Toolbar toolbar = FindViewById <Android.Widget.Toolbar>(Resource.Id.toolbarHomePage); materijaliListView = FindViewById <RecyclerView>(Resource.Id.materijaliListView); ukupanIznosTextView = FindViewById <TextView>(Resource.Id.ukupanIznosTextView); message = FindViewById <TextView>(Resource.Id.message); prikazMaterijala = FindViewById <ScrollView>(Resource.Id.prikazMaterijala); pozicijaData = FindViewById <TextView>(Resource.Id.pozicijaData); lokacijaData = FindViewById <TextView>(Resource.Id.lokacijaData); partnerData = FindViewById <TextView>(Resource.Id.partnerData); noviMaterijalBtn = FindViewById <Button>(Resource.Id.noviMaterijalBtn); SetActionBar(toolbar); ActionBar.Title = "Popis materijala"; mLayoutManager = new LinearLayoutManager(this); materijaliListView.SetLayoutManager(mLayoutManager); message.Visibility = Android.Views.ViewStates.Gone; lokacija = localMaterijali.GetInt("lokacijaId", 0); materijalSifra = localMaterijali.GetString("sifra", null); var visitedOdradeneAnkete = localMaterijali.GetBoolean("visitedAnkete", false); noviMaterijalBtn.Click += NoviMaterijalBtn_Click; partnerData.Text = db.Query <T_KUPDOB>( "SELECT NAZIV " + "FROM T_KUPDOB " + "WHERE SIFRA = ?", localMaterijali.GetString("sifraPartnera", null)).FirstOrDefault().NAZIV; lokacijaData.Text = db.Query <DID_Lokacija>( "SELECT * " + "FROM DID_Lokacija " + "WHERE SAN_Id = ?", lokacija).FirstOrDefault().SAN_Naziv; DID_LokacijaPozicija pozicija = db.Query <DID_LokacijaPozicija>( "SELECT * " + "FROM DID_LokacijaPozicija " + "WHERE POZ_Id = ?", localMaterijali.GetInt("pozicijaId", 0)).FirstOrDefault(); pozicijaData.Text = pozicija.POZ_Broj + pozicija.POZ_BrojOznaka; radniNalog = localRadniNalozi.GetInt("id", 0); sifraSkladista = db.Query <DID_RadniNalog>( "SELECT * " + "FROM DID_RadniNalog " + "WHERE Id = ?", radniNalog).FirstOrDefault().PokretnoSkladiste; if (visitedOdradeneAnkete) { filtriranePotrosnje = db.Query <DID_AnketaMaterijali>( "SELECT mat.Id, mat.Cijena, mat.LokacijaId, TOTAL(mat.Iznos) AS Iznos, mat.RadniNalog, mat.PozicijaId, mat.MaterijalSifra, mat.MaterijalNaziv, mat.MjernaJedinica, TOTAL(mat.Kolicina) AS Kolicina " + "FROM DID_AnketaMaterijali mat " + "WHERE mat.PozicijaId = ? " + "AND mat.RadniNalog = ? " + "GROUP BY mat.MaterijalNaziv", pozicija.POZ_Id, radniNalog); } else { filtriranePotrosnje = db.Query <DID_AnketaMaterijali>( "SELECT mat.Id, mat.Cijena, mat.LokacijaId, TOTAL(mat.Iznos) AS Iznos, mat.RadniNalog, mat.PozicijaId, mat.MaterijalSifra, mat.MaterijalNaziv, mat.MjernaJedinica, TOTAL(mat.Kolicina) AS Kolicina " + "FROM DID_AnketaMaterijali mat " + "WHERE mat.PozicijaId = ? " + "AND mat.RadniNalog = ? " + "AND mat.MaterijalSifra = ? " + "GROUP BY mat.MaterijalNaziv", pozicija.POZ_Id, radniNalog, materijalSifra); } if (filtriranePotrosnje.Any()) { prikazMaterijala.Visibility = Android.Views.ViewStates.Visible; message.Visibility = Android.Views.ViewStates.Gone; mAdapter = new Adapter_PotroseniMaterijali(filtriranePotrosnje); mAdapter.ItemClick += MAdapter_ItemClick; mAdapter.ItemDelete += MAdapter_ItemDelete; materijaliListView.SetAdapter(mAdapter); foreach (var materijal in filtriranePotrosnje) { ukupanIznos += materijal.Iznos; } ukupanIznosTextView.Text = ukupanIznos.ToString("F2") + " kn"; } else { ukupanIznosTextView.Text = "00.00 kn"; prikazMaterijala.Visibility = Android.Views.ViewStates.Gone; message.Visibility = Android.Views.ViewStates.Visible; } }
//public NewsObject_RecycleAdapter mAdapter; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.UserAlert); //// Dummy Data //userAlertDisplayList = SetUpData.DummyDataForUserAlert(); // Get our RecyclerView layout: mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView_UserAlert); //............................................................ // Layout Manager Setup: // Use the built-in linear layout manager: mLayoutManager = new LinearLayoutManager(this); // Or use the built-in grid layout manager (two horizontal rows): //mLayoutManager = new GridLayoutManager // (this, 2, GridLayoutManager.Horizontal, false); // Plug the layout manager into the RecyclerView: mRecyclerView.SetLayoutManager(mLayoutManager); //............................................................ // Adapter Setup: // Create an adapter for the RecyclerView, and pass it the // data set (List<userAlert>) to manage: mAdapter = new UserAlerts_RecycleAdapter(userAlertDisplayList); //Register the item click handler(below) with the adapter: mAdapter.ItemClick += MAdapter_ItemClick; // Plug the adapter into the RecyclerView: mRecyclerView.SetAdapter(mAdapter); //----------------------------------------------------------------------------------- // ToolBar - Top of Screen (method 1) var toolbar = FindViewById <Toolbar>(Resource.Id.userAlertsActivity_top_toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.userAlertsActivity_top_toolbar_title); // Toolbar - Bottom of Screen (method 2) var toolbar_bottom = FindViewById <Toolbar>(Resource.Id.userAlertsActivity_bottom_toolbar); toolbar_bottom.Title = GetString(Resource.String.userAlertsActivity_bottom_toolbar_title); toolbar_bottom.InflateMenu(Resource.Menu.userAlertsActivity_bottomMenu); toolbar_bottom.MenuItemClick += (sender, e) => { switch (e.Item.ItemId) { case Resource.Id.userAlertsActivity_bottom_toolbar_option_personalAlerts: // call intent to start next activity Intent intent = new Intent(this, typeof(PersonalAlertsActivity)); StartActivity(intent); break; } }; // This code ONLY runs if - user selects to add an alert to a newsObject in Main Activity if (SelectedNewsObject_PassedFrom_MainActivity != null) { Log.Debug("DEBUG", "\n\n\n" + SelectedNewsObject_PassedFrom_MainActivity.ToString() + "\n\n\n"); // avoid null error if UserAlertTable doesn't exist - won't overwrite if it does DataAccessHelpers.CreateEmptyUserAlertTable(); UserAlert convertedUserAlert = DataAccessHelpers.ConvertNewsObjectToUserAlert(SelectedNewsObject_PassedFrom_MainActivity); Log.Debug("DEBUG", convertedUserAlert.ToString()); // store UserAlert in database & get its ID number - // need ID of UserAlert from DB at this mmoment for creating alarm code int userID_fromDB = DataAccessHelpers.AddNewUserAlertToDatabase(convertedUserAlert); Log.Debug("DEBUG", "UserAlertActivity says - new UserID from DB: " + userID_fromDB + "\n\n"); Log.Debug("DEBUG", "FINISHED\n\n\n"); // call SetAlarm() here ..... SetAlarm(convertedUserAlert); Log.Debug("DEBUG", "\n\n\npause for breakpoint\n\n\n"); } // This code ONLY runs if - user selects to add a Personal Alert in PersonalAlerts Activity if (SelectedUserAlert_PassedFrom_PersonalAlertsActivity != null) { Log.Debug("DEBUG", "\n\n\n" + SelectedUserAlert_PassedFrom_PersonalAlertsActivity.ToString() + "\n\n\n"); // avoid null error if UserAlertTable doesn't exist - won't overwrite if it does DataAccessHelpers.CreateEmptyUserAlertTable(); // before calling AddNewUserAlertToDatabase() make a copy of UserAlert as its corresponding // property will be set to null - use copy for SetAlarm() UserAlert tempUserAlertToSetAlarmWith = SelectedUserAlert_PassedFrom_PersonalAlertsActivity; // store UserAlert in database & get its ID number - // need ID of UserAlert from DB at this mmoment for creating alarm code int userID_fromDB = DataAccessHelpers.AddNewUserAlertToDatabase(SelectedUserAlert_PassedFrom_PersonalAlertsActivity); Log.Debug("DEBUG", "\n\n\nUserAlertActivity says - new UserID from DB: " + userID_fromDB + "\n\n\n"); // // call SetAlarm() here ..... SetAlarm(tempUserAlertToSetAlarmWith); Log.Debug("DEBUG", "\n\n\npause for breakpoint\n\n\n"); } PopulateUserAlertAdapter(); }// end OnCreate
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Inventory); //get all groups from database using (var connection = new SQLiteConnection(System.IO.Path.Combine(GlobalVariables.databasePath, "MobileSell.db"))) { var allGroups = connection.Table <Group>(); groups.AddRange(allGroups); } //fill in spinner with items spinner = FindViewById <MaterialSpinner>(Resource.Id.spinner); adapter = new ArrayAdapter <Group>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, groups); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = adapter; spinner.Background = Drawable.CreateFromXml(Resources, Resources.GetXml(Resource.Drawable.material_spinner_border)); //on activity start get all articles allArticles = DatabaseRequest.GetAllFromTable <Article>().Select(x => new ArticleViewModel { Id = x.Id, Group = x.Group, Name = x.Name, SellPrice = x.SellPrice, Quantity = x.Quantity }).ToList(); //pass all articles to the RecyclerView articlesRecyclerView = FindViewById <RecyclerView>(Resource.Id.articlesRecyclerView); articlesLayoutManager = new LinearLayoutManager(this); articlesRecyclerView.SetLayoutManager(articlesLayoutManager); articlesAdapter = new ArticlesAdapter(allArticles); articlesRecyclerView.SetAdapter(articlesAdapter); TextView totalValue = FindViewById <TextView>(Resource.Id.totalValue); //calculate total sum of all articles in RecyclerView and set it to totalValue TextView decimal totalSumAllArticles = articlesAdapter.listOfArticles.Sum(x => x.Sum); totalValue.Text = String.Format("{0:0.00}", totalSumAllArticles); //get all articles from selected group spinner.ItemSelected += (s, e) => { if (e.Position != -1) { var groupId = groups.ElementAt(e.Position).Id; //get all articles from group which is currently selected List <ArticleViewModel> articlesFromGroup = allArticles.Where(x => x.Group == groupId).ToList(); //fill in the RecyclerView with articlesFromGroup //articlesLayoutManager = new LinearLayoutManager(this); //articlesRecyclerView.SetLayoutManager(articlesLayoutManager); articlesAdapter = new ArticlesAdapter(articlesFromGroup); articlesRecyclerView.SetAdapter(articlesAdapter); //calculate total value of articles //decimal totalSum = 0; //foreach(ArticleViewModel article in articlesFromGroup) //{ // totalSum += article.Sum; //} //calculate total sum of all articles in RecyclerView and set it to totalValue TextView totalSumAllArticles = articlesAdapter.listOfArticles.Sum(x => x.Sum); totalValue.Text = String.Format("{0:0.00}", totalSumAllArticles); } else { //if no group is selected display all articles on screen //articlesLayoutManager = new LinearLayoutManager(this); //articlesRecyclerView.SetLayoutManager(articlesLayoutManager); articlesAdapter = new ArticlesAdapter(allArticles); articlesRecyclerView.SetAdapter(articlesAdapter); //calculate total sum of all articles in RecyclerView and set it to totalValue TextView totalSumAllArticles = articlesAdapter.listOfArticles.Sum(x => x.Sum); totalValue.Text = String.Format("{0:0.00}", totalSumAllArticles); } }; Button btnPrint = FindViewById <Button>(Resource.Id.btnPrint); btnPrint.Click += delegate { StartActivity(typeof(PrintingActivity)); }; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.NotificationCard, container, false); _favoritesViewModel = Stops.Setup.IoC.Container.Get <Core.ViewModels.FavoritesViewModel>(); _favoritesViewModel.Load(); Clans.Fab.FloatingActionMenu fabbutton = view.FindViewById <Clans.Fab.FloatingActionMenu>(Resource.Id.mainMapFragmentButtonFab); Clans.Fab.FloatingActionButton stop = view.FindViewById <Clans.Fab.FloatingActionButton>(Resource.Id.stop); stop.Click += (sender, e) => { var second = new Intent(Application.Context, typeof(RootStopFavoritesActivty));; StartActivity(second); fabbutton.Close(true); }; var layout = view.FindViewById <FrameLayout>(Resource.Id.notificationcardroot); var prms = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); prms.Height = MapBridge.Instance.windowHeight; layout.LayoutParameters = prms; /* * Create Recyckleview */ // mPhotoAlbum = new PhotoAlbum(); mRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView); // Plug in the linear layout manager: mLayoutManager = new LinearLayoutManager(Application.Context); mRecyclerView.SetLayoutManager(mLayoutManager); // Plug in my adapter: mAdapter = new PhotoAlbumAdapter(_favoritesViewModel.GetList()); mAdapter.ItemClick += (sender, e) => { int photoNum = e; FavoriteBridge.Instance.Trigger("FavoriteSelected", _favoritesViewModel.GetList()[photoNum]); //mAdapter.NotifyDataSetChanged(); }; mAdapter.LongClick += (object sender, int e) => { _favoritesViewModel.RemoveInList(e); _favoritesViewModel.Load(); mAdapter.UpdateList(_favoritesViewModel.GetList()); mAdapter.NotifyDataSetChanged(); }; mRecyclerView.SetAdapter(mAdapter); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.LockScreen); ThreadPool.QueueUserWorkItem(isApphealthy => { if (Checkers.IsNotificationListenerEnabled() == false || Checkers.ThisAppCanDrawOverlays() == false || Checkers.IsThisAppADeviceAdministrator() == false) { RunOnUiThread(() => { Toast.MakeText(Application.Context, "You dont have the required permissions", ToastLength.Long).Show(); Finish(); } ); } }); //Views //wallpaperView = FindViewById<ImageView>(Resource.Id.wallpaper); //unlocker = FindViewById<ImageView>(Resource.Id.unlocker); startCamera = FindViewById <Button>(Resource.Id.btnStartCamera); startDialer = FindViewById <Button>(Resource.Id.btnStartPhone); clearAll = FindViewById <Button>(Resource.Id.btnClearAllNotifications); lockscreen = FindViewById <LinearLayout>(Resource.Id.contenedorPrincipal); viewPropertyAnimator = Window.DecorView.Animate(); viewPropertyAnimator.SetListener(new LockScreenAnimationHelper(Window)); livedisplayinfo = FindViewById <TextView>(Resource.Id.livedisplayinfo); fadeoutanimation = AnimationUtils.LoadAnimation(Application.Context, Resource.Animation.abc_fade_out); fadeoutanimation.AnimationEnd += Fadeoutanimation_AnimationEnd; notificationFragment = new NotificationFragment(); musicFragment = new MusicFragment(); clockFragment = new ClockFragment(); weatherFragment = new WeatherFragment(); clearAll.Click += BtnClearAll_Click; //unlocker.Touch += Unlocker_Touch; startCamera.Click += StartCamera_Click; startDialer.Click += StartDialer_Click; lockscreen.Touch += Lockscreen_Touch; watchDog = new System.Timers.Timer { AutoReset = false }; watchDog.Elapsed += WatchdogInterval_Elapsed; halfscreenheight = Resources.DisplayMetrics.HeightPixels / 2; WallpaperPublisher.NewWallpaperIssued += Wallpaper_NewWallpaperIssued; //CatcherHelper events CatcherHelper.NotificationListSizeChanged += CatcherHelper_NotificationListSizeChanged; using (recycler = FindViewById <RecyclerView>(Resource.Id.NotificationListRecyclerView)) { using (layoutManager = new LinearLayoutManager(Application.Context)) { recycler.SetLayoutManager(layoutManager); recycler.SetAdapter(CatcherHelper.notificationAdapter); } } LoadClockFragment(); LoadNotificationFragment(); LoadConfiguration(); OnActivityStateChanged += LockScreenActivity_OnActivityStateChanged; WallpaperPublisher.CurrentWallpaperCleared += WallpaperPublisher_CurrentWallpaperCleared; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.LockScreen); Window.DecorView.SetBackgroundColor(Color.Black); ThreadPool.QueueUserWorkItem(isApphealthy => { bool canDrawOverlays = true; if (Build.VERSION.SdkInt > BuildVersionCodes.LollipopMr1) //In Lollipop and less this permission is granted at Install time. { canDrawOverlays = Checkers.ThisAppCanDrawOverlays(); } if (Checkers.IsNotificationListenerEnabled() == false || canDrawOverlays == false || Checkers.IsThisAppADeviceAdministrator() == false) { RunOnUiThread(() => Toast.MakeText(Application.Context, "You dont have the required permissions", ToastLength.Long).Show() ); Finish(); } }); //Views wallpaper = FindViewById <ImageView>(Resource.Id.wallpaper); unlocker = FindViewById <ImageView>(Resource.Id.unlocker); startCamera = FindViewById <Button>(Resource.Id.btnStartCamera); startDialer = FindViewById <Button>(Resource.Id.btnStartPhone); clearAll = FindViewById <Button>(Resource.Id.btnClearAllNotifications); lockscreen = FindViewById <LinearLayout>(Resource.Id.contenedorPrincipal); weatherandclockcontainer = FindViewById <FrameLayout>(Resource.Id.weatherandcLockplaceholder); fadeoutanimation = AnimationUtils.LoadAnimation(Application.Context, Resource.Animation.abc_fade_out); fadeoutanimation.AnimationEnd += Fadeoutanimation_AnimationEnd; notificationFragment = new NotificationFragment(); musicFragment = new MusicFragment(); clockFragment = new ClockFragment(); weatherFragment = new WeatherFragment(); clearAll.Click += BtnClearAll_Click; unlocker.Touch += Unlocker_Touch; startCamera.Click += StartCamera_Click; startDialer.Click += StartDialer_Click; lockscreen.Touch += Lockscreen_Touch; weatherandclockcontainer.LongClick += Weatherandclockcontainer_LongClick; watchDog = new System.Timers.Timer(); watchDog.AutoReset = false; watchDog.Elapsed += WatchdogInterval_Elapsed; WallpaperPublisher.NewWallpaperIssued += Wallpaper_NewWallpaperIssued; //CatcherHelper events CatcherHelper.NotificationListSizeChanged += CatcherHelper_NotificationListSizeChanged; //Load RecyclerView using (recycler = FindViewById <RecyclerView>(Resource.Id.NotificationListRecyclerView)) { using (layoutManager = new LinearLayoutManager(Application.Context)) { recycler.SetLayoutManager(layoutManager); recycler.SetAdapter(CatcherHelper.notificationAdapter); } } LoadClockFragment(); LoadNotificationFragment(); //Load User Configs. LoadConfiguration(); CheckNotificationListSize(); }
protected static OrientationHelper CreateOrientationHelper(RecyclerView.LayoutManager layoutManager) { return(layoutManager.CanScrollHorizontally() ? OrientationHelper.CreateHorizontalHelper(layoutManager) : OrientationHelper.CreateVerticalHelper(layoutManager)); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.TrainingRequestLayout); try { TextView tvwResultMsg = FindViewById <TextView>(Resource.Id.tvwMsgTrnReq); string url = Values.ApiRootAddress + "training/getTrainings?compId=" + new AppPreferences().GetValue(User.CompId); tvwResultMsg.BasicMsg(Values.LoadingMsg); dynamic json = await new DataApi().GetAsync(url); tvwResultMsg.Text = ""; if (IsJsonObject(json)) { JsonValue TrainingResults = json["Training"]; List <string> lstTrainingCode = new List <string>(); lstTrainingCode.Add("Nothing"); List <string> lstTrainingDesc = new List <string>(); lstTrainingDesc.Add("Please Select"); for (int i = 0; i < TrainingResults.Count; i++) { lstTrainingCode.Add(TrainingResults[i]["TRAININGCODE"]); lstTrainingDesc.Add(TrainingResults[i]["DESCRIPTION"]); SelectedTraining obj = new SelectedTraining(); obj.TrainingCode = TrainingResults[i]["TRAININGCODE"]; obj.Description = TrainingResults[i]["DESCRIPTION"]; obj.Duration = TrainingResults[i]["DURATION"]; obj.Type = TrainingResults[i]["TYPE"]; obj.TrainingSerialNo = TrainingResults[i]["TRNSNO"]; obj.Venue = TrainingResults[i]["VENUE"]; selectedTraining.Add(obj); } ; Spinner spnrTrainings = FindViewById <Spinner>(Resource.Id.spnrTrainingCode); ArrayAdapter <string> spinnerArrayAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, lstTrainingDesc); //Use the ArrayAdapter you've set up to populate your spinner spnrTrainings.Adapter = spinnerArrayAdapter; //optionally pre-set spinner to an index spnrTrainings.SetSelection(0); spnrTrainings.ItemSelected += async(sender, e) => { Spinner spinner = (Spinner)sender; //save the CODE and SERIALNO of training selected ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); editor.PutString("TrainingCode", lstTrainingCode[e.Position]); //var position = e.Position.Equals(0) ? 0 : e.Position - 1; if (e.Position > 0) { editor.PutInt("TrainingSerialNo", selectedTraining[e.Position - 1].TrainingSerialNo); editor.Apply(); } if (mDatasource.Count > 0) { mDatasource.Clear(); } AppPreferences appPrefs = new AppPreferences(); tvwResultMsg.BasicMsg(Values.LoadingMsg); mDatasource = await Nominees(lstTrainingCode[e.Position], appPrefs.GetValue(User.EmployeeNo), appPrefs.GetValue(User.CompId)); tvwResultMsg.Text = ""; //mDatasource = await new GetNominees().Nominees(spinner.GetItemAtPosition(e.Position).ToString()); if (mDatasource.Count == 0 && spnrTrainings.SelectedItemPosition != 0) { tvwResultMsg.ErrorMsg("No Employee To Nominate"); } else { tvwResultMsg.Text = ""; } mAdapter = new EmpDetailsAdapter(mDatasource); mAdapter.ItemClick += (s, args) => { //Toast.MakeText(this, "who's the BOSS now!", ToastLength.Short).Show(); //Toast.MakeText(this, "who's the BOSS now!" + mDatasource[position].name, ToastLength.Short).Show(); editor.PutString("SelectedName", mDatasource[args].name); editor.PutInt("NomineeEmployeeNo", mDatasource[args].number); editor.Apply(); FragmentTransaction transcation = FragmentManager.BeginTransaction(); Dialogclass ConfirmNominee = new Dialogclass(); ConfirmNominee.DialogClosed += (dlgSender, dlgEvent) => { if (dlgEvent) { mAdapter.empList.RemoveAt(args); mAdapter.NotifyItemRemoved(args); } }; ConfirmNominee.Show(transcation, "Dialog Fragment"); }; mRecyclerView = (RecyclerView)FindViewById(Resource.Id.recyclerView1); mLayoutManager = new LinearLayoutManager(this); mRecyclerView.SetLayoutManager(mLayoutManager); mRecyclerView.SetAdapter(mAdapter); if (e.Position > 0) { Toast.MakeText(this, "Training Venue: " + selectedTraining[e.Position - 1].Venue + "\r\n" + "Training Duration: " + selectedTraining[e.Position - 1].Duration, ToastLength.Short).Show(); } }; } else { tvwResultMsg.ErrorMsg((string)json); } } catch (Exception ex) { ex.Log(); } }
public override int[] CalculateDistanceToFinalSnap(RecyclerView.LayoutManager layoutManager, AView targetView) { // The -1 flips everything around so we look at the end of the view instead of the start return(CalculateDistanceToFinalSnap(layoutManager, targetView, -1)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.allocation_msg_send_allocation_status_detail_activity); context = Android.App.Application.Context; mLayoutManager = new LinearLayoutManager(context); index = int.Parse(Intent.GetStringExtra("INDEX")); string item_SFA03 = Intent.GetStringExtra("ITEM_SFA03"); string item_IMA021 = Intent.GetStringExtra("ITEM_IMA021"); string item_IMG10 = Intent.GetStringExtra("ITEM_IMG10"); string item_MOVED_QTY = Intent.GetStringExtra("ITEM_MOVED_QTY"); string item_MESS_QTY = Intent.GetStringExtra("ITEM_MESS_QTY"); string item_SFA05 = Intent.GetStringExtra("ITEM_SFA05"); string item_SFA12 = Intent.GetStringExtra("ITEM_SFA12"); string item_SFA11_NAME = Intent.GetStringExtra("ITEM_SFA11_NAME"); string item_TC_OBF013 = Intent.GetStringExtra("ITEM_TC_OBF013"); listView = FindViewById <RecyclerView>(Resource.Id.allocationstatusDetailListView); listView.SetLayoutManager(mLayoutManager); Android.App.ActionBar actionBar = ActionBar; if (actionBar != null) { actionBar.SetDisplayHomeAsUpEnabled(true); actionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_chevron_left_white_24dp); actionBar.Title = ""; } float aw1_float; if (item_IMG10 != null && item_IMG10.Length > 0) { aw1_float = float.Parse(item_IMG10); } else { aw1_float = 0; } int aw1 = (int)aw1_float; int aw2; if (item_MOVED_QTY != null && item_MOVED_QTY.Length > 0) { aw2 = int.Parse(item_MOVED_QTY); } else { aw2 = 0; } int aw3; if (item_SFA05 != null && item_SFA05.Length > 0) { aw3 = int.Parse(item_SFA05); } else { aw3 = 0; } int aw4; if (item_TC_OBF013 != null && item_TC_OBF013.Length > 0 && !item_TC_OBF013.Equals("N")) { Log.Debug(TAG, "item_TC_OBF013 = " + item_TC_OBF013); aw4 = int.Parse(item_TC_OBF013); } else { aw4 = 0; } float aw5_float; if (item_MESS_QTY != null && item_MESS_QTY.Length > 0) { aw5_float = float.Parse(item_MESS_QTY); } else { aw5_float = 0; } int aw5 = (int)aw5_float; if (aw1 > (aw3 - aw2 - aw5)) { aw1 = aw3 - aw2 - aw5; aw1 = aw1 < 0 ? 0 : aw1; } aw1 = aw1 > aw4 ? aw4 : aw1; detailList.Clear(); //item_SFA03 AllocationSendMsgDetailItem item1 = new AllocationSendMsgDetailItem(); item1.setHeader(GetString(Resource.String.allocation_send_message_to_material_status_detail_SFA03)); item1.setContent(item_SFA03); detailList.Add(item1); //item_IMA021 AllocationSendMsgDetailItem item2 = new AllocationSendMsgDetailItem(); item2.setHeader(GetString(Resource.String.allocation_send_message_to_material_status_detail_IMA021)); item2.setContent(item_IMA021); detailList.Add(item2); //item_IMG10 AllocationSendMsgDetailItem item3 = new AllocationSendMsgDetailItem(); item3.setHeader(GetString(Resource.String.allocation_send_message_to_material_status_detail_IMG10)); item3.setContent(aw1.ToString()); detailList.Add(item3); //item_MOVED_QTY AllocationSendMsgDetailItem item4 = new AllocationSendMsgDetailItem(); item4.setHeader(GetString(Resource.String.allocation_send_message_to_material_status_detail_MOVED_QTY)); item4.setContent(item_MOVED_QTY); detailList.Add(item4); //item_MESS_QTY AllocationSendMsgDetailItem item5 = new AllocationSendMsgDetailItem(); item5.setHeader(GetString(Resource.String.allocation_send_message_to_material_status_detail_MESS_QTY)); item5.setContent(item_MESS_QTY); detailList.Add(item5); //item_SFA05 AllocationSendMsgDetailItem item6 = new AllocationSendMsgDetailItem(); item6.setHeader(GetString(Resource.String.allocation_send_message_to_material_status_detail_SFA05)); item6.setContent(item_SFA05); detailList.Add(item6); //item_SFA12 AllocationSendMsgDetailItem item7 = new AllocationSendMsgDetailItem(); item7.setHeader(GetString(Resource.String.allocation_send_message_to_material_status_detail_SFA12)); item7.setContent(item_SFA12); detailList.Add(item7); //item_SFA11_NAME AllocationSendMsgDetailItem item8 = new AllocationSendMsgDetailItem(); item8.setHeader(GetString(Resource.String.allocation_send_message_to_material_status_detail_SFA11_NAME)); item8.setContent(item_SFA11_NAME); detailList.Add(item8); //item_TC_OBF013 AllocationSendMsgDetailItem item9 = new AllocationSendMsgDetailItem(); item9.setHeader(GetString(Resource.String.allocation_send_message_to_material_status_detail_TC_OBF013)); item9.setContent(aw4.ToString()); detailList.Add(item9); allocationSendMsgDetailItemAdapter = new AllocationSendMsgDetailItemAdapter(this, Resource.Layout.allocation_msg_send_allocation_status_detail_item, detailList); listView.SetAdapter(allocationSendMsgDetailItemAdapter); }
//IOHelper ioHelper; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); //-----------LOAD CHORE LIST FROM FILE---------- //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); //string filename = Path.Combine(path, "Json.txt"); ////Prepare the data source: //using (var streamReader = new StreamReader(filename)) //{ // string content = streamReader.ReadToEnd(); // choreCollection = JsonConvert.DeserializeObject<List<Chore>>(content); // System.Diagnostics.Debug.WriteLine(content); //} ////choreCollection = ioHelper.ReadFromJsonFile<List<Chore>>(this); //if (choreCollection == null) // choreCollection = new List<Chore>(); //-----------LOAD CHORE LIST FROM DB----------- //Get the dbPath var dbPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); dbPath = Path.Combine(dbPath, "do-your-job.db3"); SQLiteDatabase mydatabase = OpenOrCreateDatabase(dbPath, FileCreationMode.Private, null); //Create dbHelper DBHelper dbHelper = new DBHelper(); //Open dbConnection dbHelper.OpenConn(); //Create the table if it does not exist //dbHelper.DropHouseTable(); dbHelper.CreateHouseTable(); //check to see if Intent has an extra for my house if (Intent.HasExtra("myHouse")) { myHouse = JsonConvert.DeserializeObject <House>(Intent.GetStringExtra("myHouse")); //Update DB by adding House to the table, replacing the previous version if it exists dbHelper.AddHouse(myHouse); } //else if(I don't have a house) if (myHouse == null) { //go to the screen to select a house... //start the SelectHouseActivity var intent = new Intent(this, typeof(SelectHouseActivity)); StartActivity(intent); } //choreCollection = JsonConvert.DeserializeObject<List<Chore>>(myHouse.ListJson); if (myHouse != null) { try { choreCollection = dbHelper.GetMyChores(myHouse.HouseName); } catch { Toast.MakeText(this, "Failed to load chores from DB.", ToastLength.Long).Show(); if (choreCollection == null) { choreCollection = new List <Chore>(); } } } //-----------UPDATE THE DB AFTER DELETING A CHORE------- //check Intent for an updated choreCollection from DeleteChoreButton in ChoreInfoActivity if (Intent.HasExtra("shortenedChoreList")) { //DONE: The DB stuff should be done here instead of in the ChoreInfoActivity choreCollection = JsonConvert.DeserializeObject <List <Chore> >(Intent.GetStringExtra("shortenedChoreList")); dbHelper.AddHouse(myHouse.HouseName, JsonConvert.SerializeObject(choreCollection), myHouse.Location); } //-----------ADD NEW CHORE TO FILE------- ////Add a new element from our AddChoreActivity to the file //if (Intent.HasExtra("NewChore")) //{ // choreCollection.Add(JsonConvert.DeserializeObject<Chore>(Intent.GetStringExtra("NewChore"))); // using (var streamWriter = new StreamWriter(filename, false)) // { // streamWriter.Write(JsonConvert.SerializeObject(choreCollection)); // } // //ioHelper.WriteToJsonFile<List<Chore>>(this, choreCollection); //} //-----------ADD NEW CHORE TO DB------- if (Intent.HasExtra("NewChore")) { choreCollection.Add(JsonConvert.DeserializeObject <Chore>(Intent.GetStringExtra("NewChore"))); //Update DB by adding House to the table, replacing the previous version if it exists dbHelper.AddHouse(myHouse.HouseName, JsonConvert.SerializeObject(choreCollection), myHouse.Location); } //-----------SET UP RECYCLERVIEW AND HELPERS------ // Instantiate the adapter and pass in its data source: choreAdapter = new ChoreAdapter(choreCollection); // Set our view from the "main" layout resource: SetContentView(Resource.Layout.Main); // Get our RecyclerView layout: choreRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); //Attach the event for individual items being clicked: choreAdapter.ItemClick += OnItemClick; // Plug the adapter into the RecyclerView: choreRecyclerView.SetAdapter(choreAdapter); choreLayoutManager = new LinearLayoutManager(this); choreRecyclerView.SetLayoutManager(choreLayoutManager); //-----------BUTTONS------------------------------ Button addChoreButton = FindViewById <Button>(Resource.Id.AddChoreButton); Button selectHouseButton = FindViewById <Button>(Resource.Id.SelectHouseButton); selectHouseButton.Click += (sender, e) => { //FIXME: We should probably pass the list of houses or the dbConnection here instead of opening the dbConnection twice... //Bring up the Select Group menu var intent = new Intent(this, typeof(SelectHouseActivity)); StartActivity(intent); }; addChoreButton.Click += (sender, e) => { //Bring up the Add Chore menu var intent = new Intent(this, typeof(AddChoreActivity)); StartActivity(intent); }; void OnItemClick(object sender, int position) { var choreInfoIntent = new Intent(this, typeof(ChoreInfoActivity)); choreInfoIntent.PutExtra("index", position); choreInfoIntent.PutExtra("collection", JsonConvert.SerializeObject(choreCollection)); StartActivity(choreInfoIntent); } }
public async Task getData() { Boolean connectivity = con.connectivity(); if (connectivity) { progress = new Android.App.ProgressDialog(Activity); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetCancelable(false); progress.SetMessage("Please wait..."); progress.Show(); dynamic value = new ExpandoObject(); value.UserId = u_id; string json = JsonConvert.SerializeObject(value); try { JsonValue item = await restService.TaskInbox(Activity, json, geolocation); freq = JsonConvert.DeserializeObject <List <TaskInboxModel> >(item); dbHelper.insertdatainbox(freq); progress.Dismiss(); //if (freq.Count != 0) //{ // recyclerview_layoutmanger = new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false); // recyclerview.SetLayoutManager(recyclerview_layoutmanger); // recyclerview_adapter = new TaskInboxAdapter(Activity, freq, recyclerview, FragmentManager); // recyclerview.SetAdapter(recyclerview_adapter); //} //else //{ // LayoutParams lparams = new LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); // TextView textView = new TextView(Activity); // textView.LayoutParameters = lparams; // lparams.Gravity = GravityFlags.Center; // textView.Text = "Oops ! You haven't assigned any task yet"; // linearLayout.AddView(textView); //} //progress.Dismiss(); } catch (Exception ex) { progress.Dismiss(); } } taskdata = dbHelper.GetTaskInbox(); if (taskdata.Count != 0) { recyclerview_layoutmanger = new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false); recyclerview.SetLayoutManager(recyclerview_layoutmanger); recyclerview_adapter = new TaskInboxAdapter(Activity, taskdata, recyclerview, FragmentManager); recyclerview.SetAdapter(recyclerview_adapter); } else { LayoutParams lparams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); TextView textView = new TextView(Activity); textView.LayoutParameters = lparams; textView.Text = "Oops ! You haven't assigned any task yet"; linearLayout.AddView(textView); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.HomePage); scroll = FindViewById <ScrollView>(Resource.Id.scrollview); Linear = FindViewById <LinearLayout>(Resource.Id.stack); screenWidth = Linear.Width; screenHeight = Linear.Height; dragAbleBt = FindViewById <ImageButton>(Resource.Id.button1); dragAbleBt.SetOnTouchListener(this); chartstack = FindViewById <LinearLayout>(Resource.Id.chartstack); chartView = FindViewById <ChartView>(Resource.Id.chart); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerview); bottomNavigation = FindViewById <BottomNavigationView>(Resource.Id.navigation); bottomNavigation.SetShiftMode(false, false); //Dummy data for chart var entries = new[] { new Entry(212) { Label = "12 Jun", ValueLabel = "212", Color = SKColor.Parse("#CBB268") }, new Entry(248) { Label = "13 Jun", ValueLabel = "248", Color = SKColor.Parse("#CBB268") }, new Entry(128) { Label = "14 Jun", ValueLabel = "128", Color = SKColor.Parse("#CBB268") }, new Entry(514) { Label = "15 Jun", ValueLabel = "514", Color = SKColor.Parse("#CBB268") }, new Entry(128) { Label = "16 Jun", ValueLabel = "128", Color = SKColor.Parse("#CBB268") }, new Entry(514) { Label = "17 Jun", ValueLabel = "514", Color = SKColor.Parse("#CBB268") }, new Entry(128) { Label = "18 Jun", ValueLabel = "128", Color = SKColor.Parse("#CBB268") } }; PointChart pointChart = new PointChart() { Entries = entries, LabelTextSize = 35, PointSize = 30 }; chartView.Chart = pointChart; //assigning data to recyclerview adapter var model = new ViewModel(); foreach (var s in model.Data) { EmployeeList.Add(s); } recyclerview_layoutmanger = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false); recyclerView.SetLayoutManager(recyclerview_layoutmanger); recyclerview_adapter = new RecyclerAdapter(EmployeeList); recyclerView.SetAdapter(recyclerview_adapter); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = (View) inflater.Inflate(Resource.Layout.cardView_layout,container, false); mProgressbar = view.FindViewById<ProgressBar> (Resource.Id.progressBarhuoJing); mProgressbar.Visibility = ViewStates.Visible; mActivityGuZhangBianHao.Clear (); mGuZhangDanWei.Clear (); mNoShiShiText = view.FindViewById<TextView> (Resource.Id.txtNoShiShi); //CardView mRecyclerView = view.FindViewById<RecyclerView>(Resource.Id.recyclerView); fragmentManager1 = Activity.FragmentManager; //swipeRefresh mSwipeRefreshLayout = view.FindViewById<mSwipeRefreshlayout> (Resource.Id.swipeLayout); mSwipeRefreshLayout.SetColorScheme (Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloRedLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloPurple); mSwipeRefreshLayout.Refresh += mSwipeRefreshLayout_Refresh; //Animation shift_in = AnimationUtils.LoadAnimation (Application.Context, Resource.Animation.slide_in_bottom); mWorkerHttp = new BackgroundWorker (); mWorkerHttp.WorkerSupportsCancellation = true; mWorkerHttp.DoWork += delegate (object sender, DoWorkEventArgs e) { BackgroundWorker mworker = sender as BackgroundWorker; if (mworker.CancellationPending == true) { e.Cancel = true; } else { DateTime mWorkerBegin = DateTime.Now; myHttp (); if (((int)(DateTime.Now - mWorkerBegin).TotalMilliseconds) <= 1000) { Thread.Sleep (1000 - (int)((DateTime.Now - mWorkerBegin).TotalMilliseconds)); } } }; mWorkerHttp.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e) { if (e.Cancelled == true) { } else if (!(e.Error == null)) { } else { mProgressbar.Visibility = ViewStates.Gone; if (backgroundWorkerFlag == 1) { mNoShiShiText.Visibility = ViewStates.Invisible; mLayoutManager = new LinearLayoutManager (Application.Context); mRecyclerView.SetLayoutManager (mLayoutManager); mAdapter1 = new RecyclerAdapter (mGuZhangDanWei, mRecyclerView, 3, Application.Context, fragmentManager1); mRecyclerView.SetAdapter (mAdapter1); mRecyclerView.StartAnimation (shift_in); if (mAdapter1.ItemCount == 0) { mNoShiShiText.Visibility = ViewStates.Visible; } } else if (backgroundWorkerFlag == 0) { mNoShiShiText.Visibility = ViewStates.Visible; Toast mToast = Toast.MakeText (Application.Context, "网络异常", ToastLength.Short); mToast.Show (); } } }; if (mWorkerHttp.IsBusy != true) { mWorkerHttp.RunWorkerAsync (); } mNoShiShiText.Visibility = ViewStates.Invisible; mLayoutManager = new LinearLayoutManager (Application.Context); mRecyclerView.SetLayoutManager (mLayoutManager); mAdapter1 = new RecyclerAdapter (mGuZhangDanWeiTemp, mRecyclerView, 3, Application.Context, fragmentManager1); mRecyclerView.SetAdapter (mAdapter1); return view ; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Tutorial); _items = new List <TutorialItem>(); _items.Add(new TutorialItem() { Title = Resources.GetString(Resource.String.tutorialTitle), Text = Resources.GetString(Resource.String.tutorialDownload1), ImageResource = Resource.Drawable.download1, }); _items.Add(new TutorialItem() { Text = Resources.GetString(Resource.String.tutorialDownload2), Details = Resources.GetString(Resource.String.tutorialDownload2Details), ImageResource = Resource.Drawable.download2, }); _items.Add(new TutorialItem() { Title = Resources.GetString(Resource.String.tutorialSwitch1), Text = Resources.GetString(Resource.String.tutorialSwitch1Text), Details = Resources.GetString(Resource.String.tutorialSwitch1Details), ImageResource = Resource.Drawable.walkmode, }); _items.Add(new TutorialItem() { Text = Resources.GetString(Resource.String.tutorialSwitch2), ImageResource = Resource.Drawable.bikemode, }); _items.Add(new TutorialItem() { Title = Resources.GetString(Resource.String.tutorialCompass1), Text = Resources.GetString(Resource.String.tutorialCompass1Text), ImageResource = Resource.Drawable.compassmode, }); _items.Add(new TutorialItem() { Text = Resources.GetString(Resource.String.tutorialCompass2), ImageResource = Resource.Drawable.compassmode2, }); _items.Add(new TutorialItem() { Title = Resources.GetString(Resource.String.tutorialSearch1), Text = Resources.GetString(Resource.String.tutorialSearch1Text), ImageResource = Resource.Drawable.search, }); _items.Add(new TutorialItem() { Title = Resources.GetString(Resource.String.tutorialGetAddr1), Text = Resources.GetString(Resource.String.tutorialGetAddr1Text), ImageResource = Resource.Drawable.getaddress, }); _items.Add(new TutorialItem() { Title = Resources.GetString(Resource.String.tutorialAddFavorite1), Text = Resources.GetString(Resource.String.tutorialAddFavorite1Text), Details = Resources.GetString(Resource.String.tutorialAddFavorite1Details), ImageResource = Resource.Drawable.addFavorite, }); _items.Add(new TutorialItem() { Title = Resources.GetString(Resource.String.tutorialManageFavorite1), Text = Resources.GetString(Resource.String.tutorialManageFavorite1Text), ImageResource = Resource.Drawable.favorites, }); _items.Add(new TutorialItem() { Title = Resources.GetString(Resource.String.tutorialDirection1), Text = Resources.GetString(Resource.String.tutorialDirection1Text), Details = Resources.GetString(Resource.String.tutorialDirection1Details), ImageResource = Resource.Drawable.getDirections, }); _items.Add(new TutorialItem() { Title = Resources.GetString(Resource.String.tutorialShare1), Text = Resources.GetString(Resource.String.tutorialShare1Text), ImageResource = Resource.Drawable.shareLocation, }); _items.Add(new TutorialItem() { Text = Resources.GetString(Resource.String.tutorialShare2), ImageResource = Resource.Drawable.sharemessage, }); _tutorialListView = FindViewById <RecyclerView>(Resource.Id.TutorialList); // use this setting to improve performance if you know that changes // in content do not change the layout size of the RecyclerView _tutorialListView.HasFixedSize = true; // use a linear layout manager _layoutManager = new LinearLayoutManager(this); _tutorialListView.SetLayoutManager(_layoutManager); // specify an adapter (see also next example) mAdapter = new TutorialListAdapter(this, _items); _tutorialListView.SetAdapter(mAdapter); }
private void InitialSetup() { string mySkoolToken = setupMySkoolData (); string mySkoolRawData = getMySkoolJSONData(mySkoolToken.ToString(), 1); var mySkoolJSONed = JsonConvert.DeserializeObject<WebServices.MySkoolPetiMasukData> (mySkoolRawData); int totalPage = 0; foreach (var mySkoolPaging in mySkoolJSONed.paging) { Console.WriteLine ("[MySoal - Peti Masuk] Paging: {0}",mySkoolPaging.count); totalPage = mySkoolPaging.count; } if (totalPage != 0) { Activity.RunOnUiThread (() => { llMSkT1ErrorStatus.Visibility = ViewStates.Gone; recyclerView.Visibility = ViewStates.Visible; }); foreach (var msjsoned in mySkoolJSONed.data) { mySkoolListData.Add (new MyShop_ListData { mTitle = msjsoned.title, mContent = msjsoned.text.ToString ()//.Substring (0, 50) + "..." }); mySkoolTitleList.Add (msjsoned.title); mySkoolContentList.Add (msjsoned.content); } } else { Activity.RunOnUiThread (() => { llMSkT1ErrorStatus.Visibility = ViewStates.Visible; recyclerView.Visibility = ViewStates.Gone; tvMSkT1ErrorStatus.Text = "Tiada maklumat tersedia buat masa ini."; progressDialog.Hide(); }); } Activity.RunOnUiThread (() => { listData = new MyShop_ListDataHolderList (mySkoolListData); mLayoutManager = new LinearLayoutManager (Activity); recyclerView.SetLayoutManager (mLayoutManager); recyclerAdapter = new MyShop_RecyclerViewAdapter (Activity, listData); recyclerView.SetAdapter (recyclerAdapter); recyclerAdapter.ItemClick += ItemClicked; progressDialog.Hide(); }); }
//setup acitivity's views private void SetUpVariables() { screenWidth = Resources.DisplayMetrics.WidthPixels; nothing = FindViewById <TextView>(Resource.Id.nothing_dot); nothing.Visibility = ViewStates.Gone; progressBar = FindViewById <ProgressBar>(Resource.Id.progress_bar_dettails_of_transaction); progressBar.Visibility = ViewStates.Visible; paramDate.userMKF = MainActivity.user; linearLayout = FindViewById <LinearLayout>(Resource.Id.dot_linear_layout); var toolbar = FindViewById <Toolbar>(Resource.Id.dot_toolbar); toolbar.SetBackgroundColor(MainActivity.TOOLBAR_COLOR); back_button = FindViewById <ImageButton>(Resource.Id.dot_back_btn); back_button.SetBackgroundColor(MainActivity.TOOLBAR_COLOR); back_button.Click += Back_Button_Click; mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerview_dot); mLayoutManager = new LinearLayoutManager(this); from_btn = FindViewById <Button>(Resource.Id.from_btn_dot); to_btn = FindViewById <Button>(Resource.Id.to_btn_dot); gd_submit.SetCornerRadius(10); gd_submit.SetStroke(3, MainActivity.TEXT_COLOR); gd_submit.SetColor(MainActivity.TEXT_COLOR); gd.SetCornerRadius(10); gd.SetStroke(3, MainActivity.TEXT_COLOR); from_btn.Background = gd; to_btn.Background = gd; submit_btn = FindViewById <Button>(Resource.Id.submit_btn_dot); submit_btn.LayoutParameters = new LinearLayout.LayoutParams(screenWidth / 2, ViewGroup.LayoutParams.WrapContent); submit_btn.Background = gd_submit; submit_btn.Click += Submit_Btn_Click; to = DateTime.Now.Date; from = DateTime.Now.Date; paramDate.DateFrom = from; paramDate.DateTo = to; from_btn.Text = paramDate.DateFrom.ToString("dd/MM/yyyy"); to_btn.Text = paramDate.DateTo.ToString("dd/MM/yyyy"); from_btn.Click += delegate { from_to = 1; ShowDialog(FROM_DIALOG); }; to_btn.Click += delegate { from_to = 0; ShowDialog(TO_DIALOG); }; Task.Run(async() => { try { mItems = await MKFApp.Current.GetOperations(paramDate); this.RunOnUiThread(() => Success()); } catch (Exception exception) { Console.Write(exception); this.RunOnUiThread(() => Failed()); } }); Task.Run(() => { dot_timer = new Timer(INTERVAL); COUNTDOWN = INITIAL; dot_timer.Elapsed += Timer_Elapsed; dot_timer.Start(); }); }
private OrientationHelper getHorizontalHelper(RecyclerView.LayoutManager layoutManager) => horizontalHelper ?? (horizontalHelper = OrientationHelper.CreateHorizontalHelper(layoutManager));
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.SearchPlayers); Typeface tf = Typeface.CreateFromAsset(Assets, "fonts/Font Awesome 5 Free-Solid-900.otf"); _toolbar = FindViewById <Toolbar>(Resource.Id.tbr_searchPlayers_toolbar); _name = FindViewById <EditText>(Resource.Id.et_searchPlayers_name); _positionsSpinner = FindViewById <Spinner>(Resource.Id.spn_searchPlayers_preferedPosition); _heightRange = FindViewById <RangeSliderControl>(Resource.Id.sld_searchPlayers_heightRange); _heightRange.SetSelectedMinValue(0); _heightRange.SetSelectedMaxValue(300); _weightRange = FindViewById <RangeSliderControl>(Resource.Id.sld_searchPlayers_weightRange); _weightRange.SetSelectedMinValue(0); _weightRange.SetSelectedMaxValue(300); _ageRange = FindViewById <RangeSliderControl>(Resource.Id.sld_searchPlayers_ageRange); _ageRange.SetSelectedMinValue(_ageRange.AbsoluteMinValue); _ageRange.SetSelectedMaxValue(_ageRange.AbsoluteMaxValue); _search = FindViewById <Button>(Resource.Id.btn_searchPlayers_searchPlayers); _search.Click += Search_Click; _recyclerView = FindViewById <RecyclerView>(Resource.Id.rv_searchPlayers_players); _layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); _recyclerView.SetLayoutManager(_layoutManager); _noPlayersFound = FindViewById <TextView>(Resource.Id.tv_searchPlayers_noPlayersFound); SetSupportActionBar(_toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); _toggleFilters = FindViewById <TextView>(Resource.Id.tv_searchPlayers_toggleFilters); _toggleFilters.Click += ToggleFilters_Click; _toggleFilters.Typeface = tf; _filters = FindViewById <TableLayout>(Resource.Id.tl_searchPlayers_filters); var positions = new List <string> { Literals.AllPositions }; positions.AddRange(Enum .GetNames(typeof(Position)) .Select(r => Literals.ResourceManager.GetString(r))); _positionsSpinner.Adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, positions.ToArray()); _resetFilters = FindViewById <Button>(Resource.Id.btn_searchPlayers_resetFilters); _resetFilters.Click += ResetFilters_Click; _account = AccountStore .Create() .FindAccountsForService(GetString(Resource.String.app_name)) .FirstOrDefault(); HttpResponseMessage getPlayersHttpResponse = await RestManager.GetAvailablePlayers(_searchPlayersCritera); HttpResponseMessage getCoachClubHttpResponse = await RestManager.GetMemberClub(_account.Username); string getCoachClubResponse = await getCoachClubHttpResponse.Content.ReadAsStringAsync(); string getPlayersResponse = await getPlayersHttpResponse.Content.ReadAsStringAsync(); if (getPlayersHttpResponse.IsSuccessStatusCode && !string.IsNullOrWhiteSpace(getPlayersResponse) && getPlayersResponse != "null") { _clubDetails = JsonConvert.DeserializeObject <ClubDetails>(getCoachClubResponse); _memberDetails = JsonConvert.DeserializeObject <IEnumerable <MemberDetails> >(getPlayersResponse); if (_memberDetails.Any()) { _adapter = new PlayerAdapter(this, _memberDetails.ToArray(), _clubDetails, _account); _recyclerView.SetAdapter(_adapter); } } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); await IoC.UserInfo.setEmployee(); // Set our view from the "main" layout resource await IoC.UserInfo.setEmployee(); switch (IoC.UserInfo.Employee.PrivledgeLevel) { case "Admin": { SetContentView(Resource.Layout.RecentEvents_Admin); eventItemAdapter = new EventItemAdapter(this, Resource.Layout.RecentEvents_Admin); recipientListItemAdapter = new RecipientListItemAdapter(this, Resource.Layout.RecentEvents_Admin); break; } case "Moderator": { SetContentView(Resource.Layout.RecentEvents_Moderator); eventItemAdapter = new EventItemAdapter(this, Resource.Layout.RecentEvents_Moderator); recipientListItemAdapter = new RecipientListItemAdapter(this, Resource.Layout.RecentEvents_Moderator); break; } default: { SetContentView(Resource.Layout.RecentEvents_User); eventItemAdapter = new EventItemAdapter(this, Resource.Layout.RecentEvents_User); recipientListItemAdapter = new RecipientListItemAdapter(this, Resource.Layout.RecentEvents_User); break; } } mRecyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView); _supporttoolbar = FindViewById<Toolbar>(Resource.Id.ToolBar); _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout); _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view); ToolbarCreator toolbarCreator = new ToolbarCreator(); toolbarCreator.setupToolbar(_supporttoolbar, _drawer, _navigationview, Resource.String.recent_events, this); error = new ErrorHandler(this); if (IsPlayServicesAvailable()) { var intentRegistration = new Intent(this, typeof(RegistrationIntentService)); StartService(intentRegistration); } await RefreshView(); FindViewById(Resource.Id.loadingPanel).Visibility = ViewStates.Gone; myEventList = recipientListItemAdapter.getEventsByEmployeeID(IoC.UserInfo.EmployeeID, eventItemAdapter); myEventList = filterEvents(); sortByDate(myEventList); //Plug in the linear layout manager mLayoutManager = new LinearLayoutManager(this); mRecyclerView.SetLayoutManager(mLayoutManager); //Plug in my adapter myEventListAdapter = new EventListAdapter(myEventList); myEventListAdapter.ItemClick += OnItemClick; mRecyclerView.SetAdapter(myEventListAdapter); }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); //setToursTitle(); CalligraphyConfig.InitDefault(new CalligraphyConfig.Builder() .SetDefaultFontPath("fonts/HelveticaNeueLight") .SetFontAttrId(Resource.Attribute.fontPath) .Build()); //declaring mainLayout mainLayout = FindViewById <LinearLayout>(Resource.Id.mainLayout); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); TextView experienceTitleTV = FindViewById <TextView>(Resource.Id.experienceTitleTV); activityIndicator.Visibility = Android.Views.ViewStates.Visible; layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); Fragments.SearchFragment.searchByWordIndicator = false; string path = "fonts/HelveticaNeueLight.ttf"; Typeface tf = Typeface.CreateFromAsset(Assets, path); experienceTitleTV.Typeface = tf; var repository = new MoviesRepository(); //here we create DB dbr.CreateDB(); //here we create table dbr.CreateUsersTable(); //declaring path for RETRIEVING DATA string dbPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ormdemo.db3"); var db = new SQLiteConnection(dbPath); var user_table = db.Table <ORM.UsersDataTable>(); isLogined = false; //clearing table foreach (var item in user_table) { isLogined = true; Login.name = item.name; Login.email_ = item.email; Login.avatar = item.avatar; Login.token = item.api_token; Login.birth_date = item.birth_date; Login.gender = item.gender; Login.phone_num = item.phone_num; Login.interests = item.biography; Login.user_id = item.user_id; Login.user_country_id = item.country_id; Login.password = item.password; } //left drawer mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolbar); SetSupportActionBar(mToolBar); mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); mLeftDrawer = FindViewById <ListView>(Resource.Id.left_drawer); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Profile")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Experiences")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Map")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Wishlist")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Shopping Cart")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("My Experiences")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("Help & Contact")); leftDrawerList.Add(new Resources.LeftMenuFolder.LeftMenu("About")); ListView leftDrawerLV = FindViewById <ListView>(Resource.Id.left_drawer); leftDrawerLV.Adapter = new Resources.LeftMenuFolder.LeftMenuAdapter(this, leftDrawerList); leftDrawerLV.ItemClick += LeftDrawerLV_ItemClick; //button to open/close Left Drawer FindViewById <Button>(Resource.Id.leftDrawerBN).Click += delegate { if (mDrawerLayout.IsDrawerOpen(mLeftDrawer)) { mDrawerLayout.CloseDrawer(mLeftDrawer); } else { mDrawerLayout.OpenDrawer(mLeftDrawer); } }; //left drawer ENDED //button to show context menu FindViewById <Button>(Resource.Id.contextMenuBn).Click += MainActivity_Click; //button to show context menu ENDED var films = await repository.GetAllFilms(GettingJSON.content); //THIS CONSTRUCTION IS TO DISPLAY ITEMS FROM REVERSE List <StarWars.Api.Repository.Movie> tmpReverseList = new List <StarWars.Api.Repository.Movie>(); for (int i = films.results.Count - 1; i >= 0; i--) { tmpReverseList.Add(new StarWars.Api.Repository.Movie { id = films.results[i].id, title = films.results[i].title, description = films.results[i].description, owner_id = films.results[i].owner_id, price = films.results[i].price, min_capacity = films.results[i].min_capacity, max_capacity = films.results[i].max_capacity, location = films.results[i].location, created_at = films.results[i].created_at, updated_at = films.results[i].updated_at, price_rate = films.results[i].price_rate, duration = films.results[i].duration, duration_type = films.results[i].duration_type, video_url = films.results[i].video_url, alien_video_id = films.results[i].alien_video_id, video_source = films.results[i].video_source, has_cover = films.results[i].has_cover, status = films.results[i].status, publish_date = films.results[i].publish_date, meet_place_address = films.results[i].meet_place_address, meet_place_city = films.results[i].meet_place_city, meet_place_country = films.results[i].meet_place_country, nearby_landmarks = films.results[i].nearby_landmarks, must_have = films.results[i].must_have, instructions = films.results[i].instructions, approved = films.results[i].approved, approved_by = films.results[i].approved_by, approve_date = films.results[i].approve_date, lat = films.results[i].lat, lng = films.results[i].lng, cover_image = films.results[i].cover_image }); } var moviesAdapter = new MovieAdapter(tmpReverseList, this); //THIS CONSTRUCTION IS TO DISPLAY ITEMS FROM REVERSE ENDED if (films.results == null || films.results.Count == 0) { mainLayout.SetBackgroundResource(Resource.Drawable.NoTours); } else { recyclerView.SetAdapter(moviesAdapter); } activityIndicator.Visibility = Android.Views.ViewStates.Gone; //FindViewById<LinearLayout>(Resource.Id.mainLayout).SetBackgroundResource(Resource.Drawable.NoTours); //SupportActionBar.SetDisplayHomeAsUpEnabled(false); //SupportActionBar.SetHomeButtonEnabled(false); fragmentManager = this.FragmentManager; loginOrRegFragment = new Fragments.LoginOrRegistrationFragment(); searchFragment = new Fragments.SearchFragment(); loadingMapFragment = new Fragments.LoadingMyExperiencesAndGettingWishlistFrom_DB_ForMapFragment(); FindViewById <Button>(Resource.Id.searchBn).Click += delegate { searchFragment.Show(fragmentManager, "fragmentManager"); }; }
public override Android.Views.View OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState) { var ignored = base.OnCreateView (inflater, container, savedInstanceState); string Email = string.Empty; var view = (ViewGroup)inflater.Inflate (Resource.Layout.layout_seguimiento, null); string string_key = "41f579fc-1445-4065-ab10-c06d50e724d3"; mFrameLayoutContainer = view.FindViewById<FrameLayout> (Resource.Id.RelativeSeguimientoDetail); var trans = Activity.SupportFragmentManager.BeginTransaction (); mCurrentFragment = this; trans.Commit (); mRecyclerView = view.FindViewById<RecyclerView> (Resource.Id.RecyclerViewerSeguimiento); //Pruebas //cocoservices.tinnova.mx.COCOService cliente = new Navigation_View.cocoservices.tinnova.mx.COCOService (); //Navigation_View.cocoservices.tinnova.mx.TicketDTO[] TicketDTOList = new Navigation_View.cocoservices.tinnova.mx.TicketDTO[50]; //Produccion services_911consumidor_com.COCOService cliente = new Navigation_View.services_911consumidor_com.COCOService(); Navigation_View.services_911consumidor_com.TicketDTO[] TicketDTOList = new Navigation_View.services_911consumidor_com.TicketDTO[50]; mTickets = new List<Ticket> (); mTicketsDetails = new List<TicketDetail> (); var accounts = AccountStore.Create (view.Context).FindAccountsForService ("consumidor"); foreach (var account in accounts) { Email = account.Properties ["Email"]; } TicketDTOList = cliente.GetTicketsByUser (Email, string_key); foreach (TicketDTO value in TicketDTOList) { mTickets.Add (new Ticket { Nombre = value.Client.FirstName + value.Client.LastName, Ciudad = value.Client.AddressCity, CodigoPostal = value.Client.PostalCode, Email = value.Client.Email, Estado = value.Client.AddressState, Fecha = value.TicketDate, Nota = value.Notes, Telefono = value.Client.Phone, Tipo = value.Type.ObjId.ToString (), TicketID = value.Id.ToString (), Estatus = value.Status.Name }); foreach (TicketDetailDTO valueDetail in value.TicketDetail) { mTicketsDetails.Add (new TicketDetail { AgenteID = valueDetail.Agent.UserId, Asunto = valueDetail.Subject, Fecha = valueDetail.DetailDate, Mensaje = valueDetail.Message, StatusID = valueDetail.Status.Id, Status = valueDetail.Status.Name, TicketID = valueDetail.TIC_ID }); } } mLayoutManager = new LinearLayoutManager (view.Context); mRecyclerView.SetLayoutManager (mLayoutManager); mAdapter = new Seguimiento_Adapter (mTickets, mTicketsDetails, mRecyclerView, view.Context); mRecyclerView.SetAdapter (mAdapter); return view; }
private void InitialSetup(string tokenData, int page) { //string tokenData = Activity.Intent.GetStringExtra ("Token"); string myKomunitiRawData = GetMyKomunitiJSONData(tokenData.ToString(), page); var myKomunitiJSONed = JsonConvert.DeserializeObject<WebServices.MyKomunitiFAdminRObj> (myKomunitiRawData); int totalPage = 0; totalPage = myKomunitiJSONed.total; lastPage = myKomunitiJSONed.last_page; Console.WriteLine ("[MyKomuniti Feed] Paging: {0}",totalPage); if (totalPage != 0) { if(isRefreshing == true){ myKomunitiListdata.Clear (); } Activity.RunOnUiThread (() => { llMKkT1ErrorStatus.Visibility = ViewStates.Gone; recyclerView.Visibility = ViewStates.Visible; }); foreach (var msjsoned in myKomunitiJSONed.data) { myKomunitiListdata.Add (new MyKomuniti_ListData { mTitle = msjsoned.title, mContent = msjsoned.content.ToString ()//.Substring (0, 50) + "..." }); myKomunitiTitleList.Add (msjsoned.title); myKomunitiContentList.Add (msjsoned.content); } } else { Activity.RunOnUiThread (() => { llMKkT1ErrorStatus.Visibility = ViewStates.Visible; recyclerView.Visibility = ViewStates.Gone; tvMKkT1ErrorStatus.Text = "Tiada maklumat tersedia buat masa ini."; progressDialog.Hide(); }); } if (Activity != null) { Activity.RunOnUiThread (() => { if (page == 1) { listData = new MyKomuniti_ListDataHolderList (myKomunitiListdata); mLayoutManager = new LinearLayoutManager (Activity); recyclerView.SetLayoutManager (mLayoutManager); recyclerAdapter = new MyKomuniti_RecyclerViewAdapter (Activity, listData, totalPage); recyclerView.SetAdapter (recyclerAdapter); recyclerAdapter.ItemClick += ItemClicked; progressDialog.Hide (); if (isRefreshing == true) { Toast.MakeText (Activity, "Data terkini telah dimuatkan..", ToastLength.Short).Show (); } } else { recyclerAdapter.NotifyDataSetChanged (); } }); } }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); recyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView); activityIndicator = FindViewById<ProgressBar>(Resource.Id.activityIndicator); activityIndicator.Visibility = Android.Views.ViewStates.Visible; layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); var repository = new MoviesRepository(); var films = await repository.GetAllFilms(); var moviesAdapter = new MovieAdapter(films.results); recyclerView.SetAdapter(moviesAdapter); activityIndicator.Visibility = Android.Views.ViewStates.Gone; SupportActionBar.SetDisplayHomeAsUpEnabled(false); SupportActionBar.SetHomeButtonEnabled(false); }