public ActionBarDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource) : base(host, drawerLayout, openedResource, closedResource) { _activity = host; _openedResource = openedResource; _closedResource = closedResource; }
public HelpsAppCompatDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource) : base(host, drawerLayout, openedResource, closedResource) { _HostActivity = host; _OpenedResource = openedResource; _ClosedResource = closedResource; }
public NavigationDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource) : base(host, drawerLayout, openedResource, closedResource) { mHostActivity = host; mOpenedResource = openedResource; mClosedResource = closedResource; }
public MyDrawerToggle(AppCompatActivity host, DrawerLayout drawerLayout, int openedResource, int closedResource,ISharedPreferences pref) : base(host, drawerLayout, openedResource, closedResource) { _mHostActivity = host; _mOpenedResource = openedResource; _mClosedResource = closedResource; _pref = pref; }
public static void SetSupportActionBarWithNavigationClick(this AppCompatActivity activity, Toolbar toolbar, bool displayHomeAsUpEnabled = false) { activity.SetSupportActionBar(toolbar); toolbar.NavigationClick += (_, _) => activity.OnBackPressed(); if (displayHomeAsUpEnabled) { activity.SupportActionBar.SetDisplayHomeAsUpEnabled(true); } }
void SetupUserInterface() { activity = this.Context as AppCompatActivity; view = activity.LayoutInflater.Inflate(Resource.Layout.CameraLayout, this, false); cameraType = CameraFacing.Back; textureView = view.FindViewById <TextureView>(Resource.Id.textureView); textureView.SurfaceTextureListener = this; }
public JointsViewAdapter(AppCompatActivity currentContext, SupportFragment fragment, List <SpoolJoints> lsObjs, DateTime dWeld) { _ins = this; this._lsObjs = lsObjs; _currentContext = currentContext; _fragment = fragment; mFragmentContainer = currentContext.FindViewById <FrameLayout>(Resource.Id.fragmentContainer); _dWeld = dWeld; }
public MyArrayAdapter(Context context, AppCompatActivity activity, List <string> names, List <string> dates, List <string> prices, List <bool> flags) : base(context, Resource.Layout.CustomArrayAdapterLayout, names) { _activity = activity; _flags = flags; _names = names; _dates = dates; _prices = prices; }
public ExtraMenuActions(AppCompatActivity currentContext, SupportFragment fragment, FrameLayout mFragmentContainer, int iProjectId, string cTransmittal, int iDrwgSrl) { _currentContext = currentContext; _fragment = fragment; _mFragmentContainer = mFragmentContainer; _iDrwgSrl = iDrwgSrl; _iProjectId = iProjectId; _cTransmittal = cTransmittal; }
public static void SetSupportActionBar(this AppCompatActivity activity, int?titleRes = null) { if (titleRes != null) { activity.SupportActionBar.SetTitle(titleRes.Value); } activity.SupportActionBar.SetDisplayHomeAsUpEnabled(true); activity.SupportActionBar.SetDisplayShowHomeEnabled(true); }
public Dialog Build(AppCompatActivity activity, AlertConfig config) { return(new AppCompatAlertDialog.Builder(activity, config.AndroidStyleId ?? 0) .SetCancelable(false) .SetMessage(config.Message) .SetTitle(config.Title) .SetPositiveButton(config.OkText, (o, e) => config.OnAction?.Invoke()) .Create()); }
public SamplePagerAdapter(Activity context, ViewPager mViewPager) : base() { items.Add(Monitorizacion.empresaSevilla); items.Add(Monitorizacion.empresaLiege); this.context = (AppCompatActivity)context; updateListadosMonitorizacion(); _mViewPager = mViewPager; this._mViewPager.AddOnPageChangeListener(this); }
public SpoolsCardViewAdapter(AppCompatActivity currentContext, SupportFragment fragment, List <Spools> lsObjs, npcc_types.inf_assignment_type assignment_Type) { _ins = this; this._lsObjs = lsObjs; _currentContext = currentContext; _fragment = fragment; _assignment_Type = assignment_Type; mFragmentContainer = currentContext.FindViewById <FrameLayout>(Resource.Id.fragmentContainer); }
/// <summary> /// Finds the view best suited to contain a Snackbar, within the view hierarchy of an Activity. /// </summary> /// <param name="appCompatActivity">The Activity to look for the view within.</param> protected virtual View FindSnackbarContainerView(AppCompatActivity appCompatActivity) { if (MessagingServiceCore.ViewManager.SnackbarContainers.TryGetValue(appCompatActivity, out var snackbarContainer)) { return(snackbarContainer); } return(appCompatActivity.Window.DecorView.Find(v => v is CoordinatorLayout).FirstOrDefault() ?? appCompatActivity.Window.DecorView); }
public static void DisplayToolbar(this AppCompatActivity activity) { var toolbar = activity.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); activity.SetSupportActionBar(toolbar); activity.SupportActionBar.SetDisplayHomeAsUpEnabled(true); activity.SupportActionBar.SetDisplayShowHomeEnabled(true); }
public static Task <int> StartActionModeAsync(this AppCompatActivity appCompatActivity, int menuResId) { var taskCompletionSource = new TaskCompletionSource <int>(); var actionModeCallback = new SupportActionModeCallback(menuResId, taskCompletionSource); appCompatActivity.StartSupportActionMode(actionModeCallback); return(taskCompletionSource.Task); }
public ToolbarHandler(AppCompatActivity host, V7Toolbar toolbar, bool hasNavigation = true) { host.SetSupportActionBar(toolbar); host.SupportActionBar.SetDisplayHomeAsUpEnabled(true); if (hasNavigation) { host.SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_title_menu); } }
public static void RaisePermissionsIfRequested(AppCompatActivity activity) { var resultReceiver = (ResultReceiver)activity.Intent.GetParcelableExtra(PermissionsHelper.KeyResultsReceiver); var permissions = activity.Intent.GetStringArrayExtra(PermissionsHelper.KeyPermissions); var requestCode = activity.Intent.GetIntExtra(PermissionsHelper.KeyRequestCode, 0); ActivityCompat.RequestPermissions(activity, permissions, requestCode); }
public static void HandleRequestPermissionsResult(AppCompatActivity activity, int requestCode, string[] permissions, Permission[] grantResults) { var permissionState = permissions.Select((t, i) => new PermissionState(t, grantResults[i] == (int)Permission.Granted)).ToList(); var tcs = _requestResultTasks[activity]; _requestResultTasks.Remove(activity); tcs.SetResult(permissionState); }
public MapFragmentView(AppCompatActivity activity) { m_activity = activity; initMapFragment(); /* * We use a button in this example to control the route calculation */ initCreateRouteButton(); }
public FragmentManager(AppCompatActivity host) { Fragment1 = new Fragment1(); Fragment2 = new Fragment2(); Fragment3 = new Fragment3(); mHost = host; mFragmentTrans = mHost.SupportFragmentManager.BeginTransaction(); CurrentFragment = Fragment1; }
public void hideKeyBoard(AppCompatActivity activity) { InputMethodManager inputManager = (InputMethodManager)activity.GetSystemService(Context.InputMethodService); var currentFocus = activity.CurrentFocus; if (currentFocus != null) { inputManager.HideSoftInputFromWindow(currentFocus.WindowToken, HideSoftInputFlags.None); } }
public GoogleApiClient GetGoogleApiClient(AppCompatActivity activity, GoogleApiClient.IOnConnectionFailedListener listener) { this.activity = activity; mGoogleApiClient = new GoogleApiClient.Builder(Application.Context) .EnableAutoManage(this.activity, listener) .AddApi(Auth.GOOGLE_SIGN_IN_API, GetGoogleSignInOptions()) .Build(); return(mGoogleApiClient); }
public static void NavigateToAndClearStack(this AppCompatActivity activity, Type type) { var intent = new Intent(activity, type); intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask); activity.StartActivity(intent); activity.Finish(); }
public static AppCompatAlertDialog.Builder Build(AppCompatActivity activity, ConfirmConfig config) { return(new AppCompatAlertDialog .Builder(activity) .SetCancelable(false) .SetMessage(config.Message) .SetTitle(config.Title) .SetPositiveButton(config.OkText, (s, a) => config.OnConfirm(true)) .SetNegativeButton(config.CancelText, (s, a) => config.OnConfirm(false))); }
public Dialog Build(AppCompatActivity activity, ConfirmConfig config) { return(new AppCompatAlertDialog.Builder(activity, config.AndroidStyleId ?? 0) .SetCancelable(false) .SetMessage(config.Message) .SetTitle(config.Title) .SetPositiveButton(config.OkText, (s, a) => config.OnAction(true)) .SetNegativeButton(config.CancelText, (s, a) => config.OnAction(false)) .Create()); }
// private string savedir; // private string savefilename; public TmsDownloadManager(AppCompatActivity activity) { downloadManager = (DownloadManager)activity.GetSystemService(Context.DownloadService); this.activity = activity; activity.RegisterReceiver(CreateDownloadReceiver(), new IntentFilter(DownloadManager.ActionDownloadComplete)); // savedir =Android.OS. Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads).AbsolutePath; }
void ListSongs(string displayPath, string path) { AppCompatActivity act = (AppCompatActivity)Activity; act.SupportActionBar.SetHomeButtonEnabled(true); act.SupportActionBar.SetDisplayHomeAsUpEnabled(true); act.SupportActionBar.Title = displayPath; MainActivity.instance.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, FolderTracks.NewInstance(path, displayPath)).AddToBackStack(null).Commit(); }
public static void CreateBluredView(this View v, View toCapture, AppCompatActivity activity) { Bitmap bitmap = CaptureView(toCapture); if (bitmap != null) { BlurBitmapWithRenderscript(RenderScript.Create(activity), bitmap); } SetBackgroundOnView(v, bitmap, activity); }
private static void SetBackgroundOnView(View view, Bitmap bitmap, AppCompatActivity activity) { Drawable d = null; if (bitmap != null) { d = RoundedBitmapDrawableFactory.Create(activity.Resources, bitmap); ((RoundedBitmapDrawable)d).CornerRadius = 10; } view.Background = d; }
public UpcAlert(AppCompatActivity act, Handler handler) { m_mpAlertMedia = new Dictionary <AlertType, int>(); m_act = act; m_handler = handler; Task <SoundPool> tsp = LoadEffects(act.Assets); tsp.Wait(); m_sp = tsp.Result; }
private void SwapFragment(int containerId, AppCompatActivity activity, Fragment fragment, bool addTobackStack) { var transaction = activity.SupportFragmentManager.BeginTransaction(); if (addTobackStack) { transaction.AddToBackStack(null); } transaction.Replace(containerId, fragment).Commit(); activity.SupportFragmentManager.ExecutePendingTransactions(); }
protected virtual IDisposable ToastAppCompat(AppCompatActivity activity, ToastConfig cfg) { Snackbar snackBar = null; activity.SafeRunOnUi(() => { var view = activity.Window.DecorView.RootView.FindViewById(Android.Resource.Id.Content); var msg = this.GetSnackbarText(cfg); snackBar = Snackbar.Make( view, msg, (int)cfg.Duration.TotalMilliseconds ); if (cfg.BackgroundColor != null) { snackBar.View.SetBackgroundColor(cfg.BackgroundColor.Value.ToNative()); } if (cfg.Position == ToastPosition.Top) { // watch for this to change in future support lib versions var layoutParams = snackBar.View.LayoutParameters as FrameLayout.LayoutParams; if (layoutParams != null) { layoutParams.Gravity = GravityFlags.Top; layoutParams.SetMargins(0, 80, 0, 0); snackBar.View.LayoutParameters = layoutParams; } } if (cfg.Action != null) { snackBar.SetAction(cfg.Action.Text, x => { cfg.Action?.Action?.Invoke(); snackBar.Dismiss(); }); var color = cfg.Action.TextColor; if (color != null) { snackBar.SetActionTextColor(color.Value.ToNative()); } } snackBar.Show(); }); return(new DisposableAction(() => { if (snackBar.IsShown) { activity.SafeRunOnUi(snackBar.Dismiss); } })); }
void RemoveFragment() { activity = this.Context as AppCompatActivity; var unityFragment = activity.SupportFragmentManager.FindFragmentByTag(FragmentName); if (unityFragment != null) { activity.SupportFragmentManager.BeginTransaction().Remove(unityFragment).Commit(); } }
private static View CreateARGBStatusBarView(AppCompatActivity activity, int r, int g, int b, int alpha) { // 绘制一个和状态栏一样高的矩形 View statusBarView = new View(activity); LinearLayout.LayoutParams @params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, GetStatusBarHeight(activity)); statusBarView.LayoutParameters = @params; statusBarView.SetBackgroundColor(Color.Argb(alpha, r, g, b)); statusBarView.Id = TRANSLUCENT_VIEW_ID; return(statusBarView); }
public ChatActionBarDrawerToggle (AppCompatActivity host, DrawerLayout drawerLayout, Android.Support.V7.Widget.Toolbar toolbar, int openedResource, int closedResource) : base(host, drawerLayout,toolbar,openedResource,closedResource) { mHostActivity = host; this.drawerLayout = drawerLayout; mOpenedResource = openedResource; mClosedResource = closedResource; }
public NavigationDrawerHandler(AppCompatActivity host, NavigationView navView, DrawerLayout drawerLayout, int? selectedResource) { mHostActivity = host; mDrawerLayout = drawerLayout; mNavView = navView; if (mNavView != null && mDrawerLayout != null) { setupDrawerContent(mNavView); } if (selectedResource.HasValue && selectedResource.Value > 0) { mSelectedResource = selectedResource.Value; mNavView.Menu.FindItem(selectedResource.Value).SetChecked(true); } }
public EditDataAdapter(AppCompatActivity activity, ViewPager pager, FloatingActionButton finish, ProgressBar progress, IMenuItem prev = null, IMenuItem next = null) : base(activity.SupportFragmentManager) { Activity = activity; Pager = pager; Finish = finish; Progress = progress; Items = new List<EditFragment>(); Finish.Click += (s, e) => NextPage(); Pager.Adapter = this; Progress.Progress = 1; SetNextButton(next); SetPreviousButton(prev); }
public LandingPagerAdapter (Android.Support.V4.App.FragmentManager fm, AppCompatActivity activity) : base(fm) { _activity = activity; Init(); }
public void Include(AppCompatActivity act) { act.Title = act.Title + ""; }
public ActivityModule(AppCompatActivity activity) { this.activity = activity; }
public SignUpAdapter(AppCompatActivity activity, ViewPager pager, FloatingActionButton finish, ProgressBar progress) : base(activity, pager, finish, progress) { }
public void setupToolbar(Toolbar _supporttoolbar, DrawerLayout _drawer, NavigationView _navigationview, int titleID, AppCompatActivity context) { ViewContext = context; _supporttoolbar.SetTitle(titleID); context.SetSupportActionBar(_supporttoolbar); _supporttoolbar.SetNavigationIcon(Resource.Drawable.ic_menu_white_24dp); context.SupportActionBar.SetDisplayHomeAsUpEnabled(false); ErrorHandler error = new ErrorHandler(context); _navigationview.NavigationItemSelected += (sender, e) => { switch (e.MenuItem.ItemId) { case Resource.Id.nav_recentEvents: { _drawer.CloseDrawer(GravityCompat.Start); var intent = new Intent(context, typeof(RecentEventsActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_createEvent: { _drawer.CloseDrawer(GravityCompat.Start); var intent = new Intent(context, typeof(EventCreationActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_deleteEvent: { _drawer.CloseDrawer(GravityCompat.Start); //switch to calendar view var intent = new Intent(context, typeof(EventDeletionActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_calendar: { _drawer.CloseDrawer(GravityCompat.Start); //switch to calendar view var intent = new Intent(context, typeof(CalendarViewActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_createEmployee: { _drawer.CloseDrawer(GravityCompat.Start); //switch to createEmployee view var intent = new Intent(context, typeof(CreateEmployeeActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_overtime: { _drawer.CloseDrawer(GravityCompat.Start); //switch to overtime view var intent = new Intent(context, typeof(OvertimeActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_filter: { _drawer.CloseDrawer(GravityCompat.Start); spawnFilterDialog(); } break; case Resource.Id.logoutitem: { _drawer.CloseDrawer(GravityCompat.Start); OnLogoutClicked(); var intent = new Intent(context, typeof(LoginActivity)); context.StartActivity(intent); } break; } }; }
public static ActivityComponent GetComponent(AppCompatActivity activity) { var application = (MainApplication)activity.ApplicationContext; return application.appComponent .Plus(new ActivityModule(activity)); }