public void StartWizard(Activity context, bool force)
            {
                var settings = context.GetSharedPreferences(WhiteLabelConfig.BUILD_VARIANT.ToLower(), FileCreationMode.Private);

                if (force || !settings.Contains("editor_help"))
                {
                    var  dialog = new Android.Support.V7.App.AlertDialog.Builder(context);
                    View di     = context.LayoutInflater.Inflate(Resource.Layout.EditorWizard, null);
                    thisview = di;

                    di.FindViewById(Resource.Id.theroot).Visibility   = ViewStates.Visible;
                    di.FindViewById <Button>(Resource.Id.ok).Click   += EditorWizard_Click1;
                    di.FindViewById <Button>(Resource.Id.next).Click += EditorWizard_Click;
                    di.FindViewById <Button>(Resource.Id.skip).Click += EditorWizard_Click1;

                    var mAdapter = new WizardPagerAdapter();

                    mPager = di.FindViewById <ViewPager>(Resource.Id.pager);
                    mPager.OffscreenPageLimit = 4;
                    //mPager.SetOnPageChangeListener(this);

                    mPager.Adapter       = mAdapter;
                    mPager.PageSelected += MPager_PageSelected;

                    var indicator = di.FindViewById <CirclePageIndicator>(Resource.Id.indicator);
                    indicator.SetViewPager(mPager);
                    indicator.SetSnap(true);

                    dialog.SetView(di)
                    .SetCancelable(true);

                    var editor = settings.Edit();
                    editor.PutBoolean("editor_help", true);
                    editor.Commit();
                    thedialog = dialog.Show();

                    Picasso.With(context).Load(Resource.Drawable.edit_page1).Fit().CenterInside().NoFade().Into(thedialog.FindViewById <ImageView>(Resource.Id.editpage1));
                    Picasso.With(context).Load(Resource.Drawable.edit_page2).Fit().CenterInside().NoFade().Into(thedialog.FindViewById <ImageView>(Resource.Id.editpage2));
                    Picasso.With(context).Load(Resource.Drawable.edit_page3).Fit().CenterInside().NoFade().Into(thedialog.FindViewById <ImageView>(Resource.Id.editpage3));
                }
            }
Esempio n. 2
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);

            base.OnCreate(savedInstanceState);
            //SetContentView(Resource.Layout.FirstRun);
            SetContentView(Resource.Layout.ConnectionChecklist);

            //BranchAndroid.Init(this, Resources.GetString(Resource.String.BRANCHKEY), this);

            IsPlayServicesAvailable();

            var allprefs = GetSharedPreferences(WhiteLabelConfig.BUILD_VARIANT.ToLower(), FileCreationMode.Private);


            if (WhiteLabelConfig.LOCAL_SERVER)
            {
                Uri connectionuri = new Uri($"{WhiteLabelConfig.SERVER}:{WhiteLabelConfig.PORT}");
                Bootlegger.BootleggerClient.StartWithLocal(connectionuri);
            }

            var firstrun = true;

            var prefs = allprefs.GetBoolean("firstrun", false);

            firstrun = prefs;

            //detect wanting to go straight to uploads
            if (Intent.Extras != null && Intent.Extras.ContainsKey("upload"))
            {
                (Application as BootleggerApp).ReturnState = new BootleggerApp.ApplicationReturnState()
                {
                    ReturnsTo = BootleggerApp.ReturnType.OPEN_UPLOAD, Payload = Intent.Extras.GetString("eventid")
                };
                firstrun = true;
            }

            if (Intent.Extras != null && Intent.Extras.ContainsKey("advert"))
            {
                (Application as BootleggerApp).ADVERT = Intent.Extras.GetString("advert");
                firstrun = true;
            }
            else
            {
                (Application as BootleggerApp).ADVERT = "";
            }

            //detect login intent:
            //Console.WriteLine(Intent.Data?.Scheme);
            //Console.WriteLine(Intent.Data?.Host);

            if (Intent.Data != null && Intent.Data.Scheme == WhiteLabelConfig.DATASCHEME && Intent.Data.Host != "open")
            {
                var url = Intent.Data;

                if (!url.QueryParameterNames.Contains("eventid"))
                {
                    var session = url.Query;
                    session = session.TrimEnd('=');

                    //(Application as BootleggerApp).loginsession = HttpUtility.UrlEncode(session);

                    (Application as BootleggerApp).ReturnState.Session = HttpUtility.UrlEncode(session);
                    var returnstate = (Application as BootleggerApp).ReturnState;
                    //(Application as BootleggerApp).ReturnState = new BootleggerApp.ApplicationReturnState() { ReturnsTo = BootleggerApp.ReturnType.SIGN_IN_ONLY, Session = HttpUtility.UrlEncode(session) };

                    firstrun = true;
                }
                else
                {
                    //if its a create new shoot connect:
                    var eventid = url.GetQueryParameter("eventid");
                    (Application as BootleggerApp).ReturnState = new BootleggerApp.ApplicationReturnState()
                    {
                        ReturnsTo = BootleggerApp.ReturnType.OPEN_SHOOT, Payload = eventid
                    };
                }
            }

            //edit invite:
            if (Intent.Data != null && Intent.Data.Host == WhiteLabelConfig.SERVERHOST && Intent.Data.PathSegments.Contains("watch"))
            {
                var editid = Intent.Data.PathSegments.Last();
                (Application as BootleggerApp).ReturnState = new BootleggerApp.ApplicationReturnState()
                {
                    ReturnsTo = BootleggerApp.ReturnType.OPEN_EDIT, Payload = editid
                };
            }

            string state = Android.OS.Environment.ExternalStorageState;

            if (state != Android.OS.Environment.MediaMounted)
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.SetMessage(Resource.String.nostorageavail);
                builder.SetNeutralButton(Android.Resource.String.Ok, new EventHandler <DialogClickEventArgs>((o, q) =>
                {
                    Finish();
                }));
                builder.SetCancelable(false);
                builder.Show();
            }
            else
            {
                (Application as BootleggerApp).Start();
                Bootlegger.BootleggerClient.OnSessionLost += Comms_OnSessionLost;

                //check for firstrun:
                if (!firstrun && Bootlegger.BootleggerClient.CurrentUser == null && WhiteLabelConfig.ONBOARDING)
                {
                    FindViewById(Resource.Id.theroot).Visibility   = ViewStates.Visible;
                    FindViewById <Button>(Resource.Id.skip).Click += SplashActivity_Click;
                    FindViewById <Button>(Resource.Id.ok).Click   += OkActivity_Click;
                    FindViewById <Button>(Resource.Id.next).Click += NextActivity_Click;
                    var       mAdapter = new WizardPagerAdapter();
                    ViewPager mPager   = FindViewById <ViewPager>(Resource.Id.pager);
                    mPager.OffscreenPageLimit = 4;
                    //mPager.SetOnPageChangeListener(this);

                    mPager.Adapter       = mAdapter;
                    mPager.PageSelected += MPager_PageSelected;
                }
                else
                {
                    //StartActivity(typeof(Login));
                }
            }
        }