Beispiel #1
0
    public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        View view = inflater.Inflate(Resource.Layout.LonelyRecycler, container, false);

        instance = this;
        ListView = view.FindViewById <RecyclerView>(Resource.Id.recycler);
        ListView.SetLayoutManager(new LinearLayoutManager(Application.Context));
        adapter = new QueueAdapter();
        ListView.SetAdapter(adapter);
        adapter.ItemClick     += ListView_ItemClick;
        adapter.ItemLongCLick += ListView_ItemLongCLick;
        ListView.SetItemAnimator(new DefaultItemAnimator());
        ListView.AddItemDecoration(new CurrentItemDecoration(adapter));
        ListView.AddOnItemTouchListener(this);
        ListView.ScrollChange += Scroll;

        ItemTouchHelper.Callback callback = new ItemTouchCallback(adapter, true);
        itemTouchHelper = new ItemTouchHelper(callback);
        itemTouchHelper.AttachToRecyclerView(ListView);

        ListView.ScrollToPosition(MusicPlayer.CurrentID());

        if (MusicPlayer.UseCastPlayer)
        {
            Snackbar snackBar = Snackbar.Make(ListView, "Queue management with chromecast is currently in beta, expect some bugs.", (int)ToastLength.Short);
            snackBar.View.FindViewById <TextView>(Resource.Id.snackbar_text).SetTextColor(Color.White);
            snackBar.Show();
        }
        return(view);
    }
Beispiel #2
0
    private /*async*/ void LogIn()
    {
        Snackbar snackBar = Snackbar.Make(Preferences.instance.FindViewById(Android.Resource.Id.Content), Resource.String.login_disabled, Snackbar.LengthLong);

        snackBar.View.FindViewById <TextView>(Resource.Id.snackbar_text).SetTextColor(Color.White);
        snackBar.Show();

        //GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn)
        //    .RequestIdToken(Preferences.instance.GetString(Resource.String.clientID))
        //    .RequestServerAuthCode(Preferences.instance.GetString(Resource.String.clientID))
        //    .RequestEmail()
        //    .RequestScopes(new Scope(YouTubeService.Scope.Youtube))
        //    .Build();

        //GoogleApiClient googleClient = new GoogleApiClient.Builder(Preferences.instance)
        //    .AddApi(Auth.GOOGLE_SIGN_IN_API, gso)
        //    .Build();

        //googleClient.Connect();

        //while (!googleClient.IsConnected)
        //    await Task.Delay(10);

        //Preferences.instance.StartActivityForResult(Auth.GoogleSignInApi.GetSignInIntent(googleClient), 5981);
    }
 protected void CheckForStoragePermision()
 {
     if ((int)Build.VERSION.SdkInt >= 23)
     {
         Permission permission = Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage);
         if (permission == Permission.Granted)
         {
             ClearPreviousDataOnFirstRun();
             LaunchBookshelf();
         }
         else
         {
             if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.WriteExternalStorage))
             {
                 Snackbar rationalSnackBar = Snackbar.Make(_splashScreenParent, Resource.String.allow_permission_alert, Snackbar.LengthIndefinite).SetAction("", (view) => { });
                 rationalSnackBar.Show();
             }
             RequestPermissions(new String[] { Manifest.Permission.ReadExternalStorage, Manifest.Permission.WriteExternalStorage }, STORAGE_PERMISSION_CODE);
         }
     }
     else
     {
         _counter += 1;
     }
 }
Beispiel #4
0
 public void OnComplete(Task task)
 {
     if (task.IsSuccessful == true)
     {
         if (process.IsShowing)
         {
             process.Dismiss();
         }
         Snackbar snackBar = Snackbar.Make(signupLayout, "Register Success", Snackbar.LengthShort);
         snackBar.Show();
         var uid = auth.CurrentUser.Uid;
         writeNewUser(uid, "", "", "", inputEmail.Text, "");
         inputEmail.Text    = "";
         inputPassword.Text = "";
     }
     else
     {
         if (process.IsShowing)
         {
             process.Dismiss();
         }
         Snackbar snackBar = Snackbar.Make(signupLayout, "Register failed", Snackbar.LengthShort);
         snackBar.Show();
     }
 }
Beispiel #5
0
        public void OnWeatherError(WeatherException wEx)
        {
            switch (wEx.ErrorStatus)
            {
            case WeatherUtils.ErrorStatus.NetworkError:
            case WeatherUtils.ErrorStatus.NoWeather:
                // Show error message and prompt to refresh
                // Only warn once
                if (!ErrorCounter[(int)wEx.ErrorStatus])
                {
                    Snackbar snackBar = Snackbar.Make(Content as Grid, wEx.Message, SnackbarDuration.Long);
                    snackBar.SetAction(App.ResLoader.GetString("Action_Retry"), async() =>
                    {
                        await RefreshLocations();
                    });
                    snackBar.Show();
                    ErrorCounter[(int)wEx.ErrorStatus] = true;
                }
                break;

            default:
                // Show error message
                // Only warn once
                if (!ErrorCounter[(int)wEx.ErrorStatus])
                {
                    Snackbar.Make(Content as Grid, wEx.Message, SnackbarDuration.Long).Show();
                    ErrorCounter[(int)wEx.ErrorStatus] = true;
                }
                break;
            }
        }
Beispiel #6
0
        private void Render(string error)
        {
            if (string.IsNullOrEmpty(error))
            {
                if (_snackbar == null)
                {
                    return;
                }
                if (_snackbar.IsShownOrQueued)
                {
                    _snackbar.Dismiss();
                }
                return;
            }

            if (_snackbar == null)
            {
                _snackbar = Snackbar.Make(_container, error, Snackbar.LengthIndefinite);
            }
            else
            {
                _snackbar.SetText(error);
            }

            _snackbar.Show();
        }
        private void ShowMessageCenterIndicator()
        {
            IList <RichPushMessage> unreadMessages = UAirship.Shared().Inbox.UnreadMessages;

            if (unreadMessages.Count == 0 || messageCenterLastSentDate >= unreadMessages[0].SentDateMS)
            {
                return;
            }

            messageCenterLastSentDate = unreadMessages[0].SentDateMS;

            if (messageCenterSnackbar != null && messageCenterSnackbar.IsShownOrQueued)
            {
                return;
            }

            if (currentNavPosition == Resource.Id.nav_message_center)
            {
                return;
            }

            String text = Resources.GetQuantityString(Resource.Plurals.mc_indicator_text, unreadMessages.Count, unreadMessages.Count);

            messageCenterSnackbar = Snackbar.Make(FindViewById(Resource.Id.coordinatorLayout), text, MessageCenterIndicatorDurationMs)
                                    .SetActionTextColor(ContextCompat.GetColor(this, Resource.Color.color_accent))
                                    .SetAction(Resource.String.view, (View v) =>
            {
                messageCenterSnackbar.Dismiss();
                UAirship.Shared().Inbox.StartInboxActivity();
            });

            messageCenterSnackbar.Show();
        }
Beispiel #8
0
        private void UndoButton_Clicked(object sender, EventArgs e)
        {
            Snackbar snackbar = Snackbar.Make(statInputSwitcher, myViewModel.Undo(), Snackbar.LengthLong);

            snackbar.SetAction("Dismis", v => snackbar.Dismiss());
            snackbar.Show();
        }
Beispiel #9
0
 private void ShowSnack(View view, string msg)
 {
     Snackbar snackbar1 = Snackbar.Make(view, msg, Snackbar.LengthShort);
     View snackBarView = snackbar1.View;
     snackBarView.SetBackgroundColor(Color.ParseColor("#333d59"));
     snackbar1.Show();
 }
Beispiel #10
0
        internal static void ShowSnackbar(View v, int stringResource, int time)
        {
            Snackbar sb = Snackbar.Make(v, stringResource, time);

            //v.BringToFront();
            MainThread.BeginInvokeOnMainThread(() => { sb.Show(); });
        }
Beispiel #11
0
        async void ShowGPSMessage(bool dontShowSnackBar = true)
        {
            await Task.Delay(250);              // For smother animation on startup

            if (dontShowSnackBar == false && Util.Util.isGpsPositionEnabled())
            {
                //Snackbar.Make (_snackBarView, "Hämtar de närmaste hållplatserna!", Snackbar.LengthLong).Show ();
            }
            else if (dontShowSnackBar == false)
            {
                _GPSSnackbar = Snackbar.Make(_snackBarView, "Slå på GPS:en (Lågenergi-läge används!)", Snackbar.LengthIndefinite)
                               .SetAction("GPS-inställningar", (view) => {
                    _currentLocation     = null;
                    _useLastKnowLocation = true;
                    StartActivity(new Intent(Settings.ActionLocationSourceSettings));
                });


                _GPSSnackbar.SetActionTextColor(Color.ParseColor("#2B9CF5"));

                _GPSSnackbar.Show();

                DismissSnackbar();
            }
        }
        private void ShowSnackbar(int position)
        {
            try
            {
                string undoMsg = _activity.GetString(Resource.String.undoDelet);
                string undo    = _activity.GetString(Resource.String.undo);
                //https://blog.xamarin.com/add-beautiful-material-design-with-the-android-support-design-library/
                Snackbar snackbar = Snackbar.Make(_view, undoMsg, Snackbar.LengthLong)
                                    .SetAction(undo, (v) =>
                {
                    if (_deletedCard != null)
                    {
                        _cards.Insert(position, _deletedCard);
                        _adapter.NotifyItemInserted(position);
                    }
                });

                snackbar.SetActionTextColor(Color.Yellow);

                // Button snackViewButton = dd.View.FindViewById<Button>(Resource.Id.snackbar_action);
                TextView snackViewText = snackbar.View.FindViewById <TextView>(Resource.Id.snackbar_text);
                //snackViewText.Gravity = GravityFlags.Center;
                snackViewText.SetTextColor(Color.White);
                snackbar.Show();
            }
            catch (Exception ex)
            {
                Log.Error("CartItemTouchHelperCallback ", ex.Message);
            }
        }
Beispiel #13
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            ((MainMenuView)Activity).Title = ViewModel.PierLocation;
            ShowBackButton = true;
            var    view        = base.OnCreateView(inflater, container, savedInstanceState);
            Button clearButton = view.FindViewById <Button>(Resource.Id.btnClear);
            Button retryButton = view.FindViewById <Button>(Resource.Id.btnRetry);

            clearButton.Click += (s, e) =>
            {
                //Creates the Snackbar
                Snackbar snackBar = Snackbar.Make(clearButton, "Clear", Snackbar.LengthShort).SetAction("OK", (v) =>
                {
                });

                //Show the snackbar
                snackBar.Show();
            };
            retryButton.Click += (s, e) =>
            {
                //Creates the Snackbar
                Snackbar snackBar = Snackbar.Make(retryButton, "No Internet Connection", Snackbar.LengthShort).SetAction("Retry", (v) =>
                {
                });

                //Show the snackbar
                snackBar.Show();
            };


            return(view);
        }
 public void Show(Snackbar snackbar, float duration)
 {
     _snackbar = snackbar;
     _snackbar.AddCallback(this);
     _snackbar.SetDuration((int)duration);
     _snackbar.Show();
 }
Beispiel #15
0
        //public override bool OnOptionsItemSelected(IMenuItem item)
        //{
        //    int id = item.ItemId;
        //    if (id == Resource.Id.action_settings)
        //    {
        //        return true;
        //    }

        //    return base.OnOptionsItemSelected(item);
        //}



        void renderSnackBar(string message)
        {
            var      contentMainView = FindViewById <RelativeLayout>(Resource.Id.main_View);
            Snackbar snackbar        = Snackbar.Make(contentMainView, message, Snackbar.LengthLong);

            snackbar.Show();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            locationManager = (LocationManager)GetSystemService(Context.LocationService);
            SetContentView(Resource.Layout.activity_location);
            location_TxtView_Header      = FindViewById <TextView>(Resource.Id.location_TxtView_Header);
            location_TxtView_Header.Text = "تعیین موقعیت";
            location_Button_SetLocation  = FindViewById <Button>(Resource.Id.location_Button_SetLocation);
            MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.Locatin_Fragment_map);
            MapIsActive Isactive    = new MapIsActive(this);

            location_Button_SetLocation.Click += delegate {
                //تعیین موقعیت توسط گوگل
                locationManager.RequestLocationUpdates(LocationManager.GpsProvider, 1000, 1, this);
                mapFragment.GetMapAsync(this);
            };


            Criteria locationCriteria = new Criteria();

            locationCriteria.Accuracy         = Accuracy.Coarse;
            locationCriteria.PowerRequirement = Power.Medium;


            var locationProvider = locationManager.GetBestProvider(locationCriteria, true);

            if (locationProvider != null)
            {
                locationManager.RequestLocationUpdates(locationProvider, 2000, 1, this);
                if (Isactive.IsGooglePlayServicesInstalled())
                {
                    mapFragment.GetMapAsync(this);
                }
                else
                {
                    Snackbar snackBar = Snackbar.Make(location_Button_SetLocation, "اجرای سرویس گوگل پلی به مشکل خورده است", Snackbar.LengthIndefinite).SetAction("تایید", (v) =>
                    {
                        Finish();
                    });

                    //set  action button text color
                    snackBar.SetActionTextColor(Android.Graphics.Color.Green);

                    snackBar.Show();
                }
            }
            else
            {
                // Log.Info(tag, "No location providers available");
                Snackbar snackBar = Snackbar.Make(location_Button_SetLocation, "مکان باب دستگاه مکانی را پیدا نکرد", Snackbar.LengthIndefinite).SetAction("تایید", (v) =>
                {
                    Finish();
                });

                //set  action button text color
                snackBar.SetActionTextColor(Android.Graphics.Color.Green);

                snackBar.Show();
            }
        }
Beispiel #17
0
            protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params)
            {
                WebReference.BasicHttpBinding_IService1 MyClient = new WebReference.BasicHttpBinding_IService1();
                try
                {
                    WebReference.TB emp      = new WebReference.TB();
                    string          deviceid = Android.Provider.Settings.Secure.GetString(Application.Context.ContentResolver, Android.Provider.Settings.Secure.AndroidId);
                    emp = MyClient.GetListDevice(deviceid);

                    dt = emp.table;


                    recyclelist.Clear();
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            recyclelist.Add(new GetSet(dt.Rows[i][0].ToString(), dt.Rows[i][1].ToString()));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Snackbar snackbar = Snackbar.Make(findViewById(Android.Resource.Id.Content), "Error Connection", Snackbar.LengthLong);
                    snackbar.Show();
                }
                return(null);
            }
Beispiel #18
0
 public void OnClick(View v)
 {
     if (v.Id == Resource.Id.login_btn_forgot_password)
     {
         //StartActivity(new Android.Content.Intent(this, typeof(ForgotPass)));
         //Finish();
     }
     else if (v.Id == Resource.Id.login_btn_sign_up)
     {
         StartActivity(new Android.Content.Intent(this, typeof(SignUp)));
         Finish();
     }
     else if (v.Id == Resource.Id.login_btn_login)
     {
         if (input_login.Text == "" || input_password.Text == "")
         {
             Snackbar SnackBar = Snackbar.Make(act_main, "Input login and password", Snackbar.LengthShort);
             SnackBar.Show();
         }
         else
         {
             WebRequest request = WebRequest.Create("http://192.168.56.1/WebApplication1/Home/Auth");
             request.Method = "POST";
             string data      = "input_login="******"&input_password="******"application/x-www-form-urlencoded";
             request.ContentLength = byteArray.Length;
             using (System.IO.Stream dataStream = request.GetRequestStream())
             {
                 dataStream.Write(byteArray, 0, byteArray.Length);
             }
             WebResponse response    = request.GetResponse();
             string      json_string = "";
             using (System.IO.Stream stream = response.GetResponseStream())
             {
                 using (StreamReader reader = new StreamReader(stream))
                 {
                     json_string += reader.ReadToEnd();
                 }
             }
             //my_Free_Tournament = JsonConvert.DeserializeObject<My_Free_Tournament>(json_string);
             response.Close();
             int result = Convert.ToInt32(json_string);
             if (result > 0)
             {
                 if (Sessions.startsession(json_string))
                 {
                     StartActivity(new Android.Content.Intent(this, typeof(MainActivity)));
                     Finish();
                 }
             }
             else
             {
                 Snackbar SnackBar1 = Snackbar.Make(act_main, "Uncorrected login or password " + result, Snackbar.LengthShort);
                 SnackBar1.Show();
             }
         }
     }
 }
Beispiel #19
0
 public void OnComplete(Task task)
 {
     if (task.IsSuccessful == true)
     {
         Snackbar snackbar = Snackbar.Make(activity_dashboard, "Password ha sido cambiada", Snackbar.LengthShort);
         snackbar.Show();
     }
 }
        public void ShowAlert(string _message)
        {
            Activity activity = CrossCurrentActivity.Current.Activity;

            Android.Views.View activityRootView = activity.FindViewById(Android.Resource.Id.Content);
            snackbar = Snackbar.Make(activityRootView, _message, Snackbar.LengthLong);
            snackbar.Show();
        }
 public void OnComplete(Task task)
 {
     if (task.IsSuccessful == true)
     {
         Snackbar sbardb = Snackbar.Make(relativeashboard, "Password has been changed", Snackbar.LengthShort);
         sbardb.Show();
     }
 }
        internal static void ShowSnackBar(Context context, View view, string sText, int iSnackbarLength)
        {
            Snackbar bar = Snackbar.Make(view, sText, iSnackbarLength);

            bar.View.SetBackgroundColor(new Android.Graphics.Color(ContextCompat.GetColor(context, Resource.Color.primary_dark)));

            bar.Show();
        }
Beispiel #23
0
 public void OnComplete(Task task)
 {
     if (task.IsSuccessful == true)
     {
         Snackbar snackbar = Snackbar.Make(activity_dashboard, "Heslo bolo zmenené", Snackbar.LengthShort);
         snackbar.Show();
     }
 }
Beispiel #24
0
        private void ShowSnack(string msg)
        {
            Snackbar snackbar1    = Snackbar.Make(FindViewById(Android.Resource.Id.Content), msg, Snackbar.LengthShort);
            View     snackBarView = snackbar1.View;

            snackBarView.SetBackgroundColor(Color.ParseColor("#333d59"));
            snackbar1.Show();
        }
Beispiel #25
0
        internal static void ShowSnackbar(View v, int stringResource, int time, Android.Graphics.Color color)
        {
            Snackbar sb = Snackbar.Make(v, stringResource, time);

            //v.BringToFront();
            sb.View.SetBackgroundColor(color);
            MainThread.BeginInvokeOnMainThread(() => { sb.Show(); });
        }
Beispiel #26
0
 public void OnComplete(Task task)
 {
     if (task.IsSuccessful == true)
     {
         Snackbar s = Snackbar.Make(activity_dashboard, "Password has been changed!", Snackbar.LengthShort);
         s.Show();
     }
 }
 public void SnackBarMessage(string Message)
 {
     Application.SynchronizationContext.Post(_ =>
     {
         Snackbar snackbar = Snackbar.Make(rootView, Message, Snackbar.LengthLong);
         snackbar.Show();
     }, null);
 }
Beispiel #28
0
        public void ShowErrorFromFragment(string errorMessage)
        {
            Snackbar s = Snackbar.Make(Window.DecorView.RootView, errorMessage, Snackbar.LengthIndefinite).SetAction("Ok", (v) =>
            {
            });

            s.Show();
        }
        private void ToggleSnackbar(SnackbarColor color, string message)
        {
            this.color   = color;
            this.message = (MarkupString)message;

            snackbar.Show();
            StateHasChanged();
        }
 private void ShowLoadingMessage()
 {
     this.RunOnUiThread(() =>
     {
         mLoadingMessageSnackbar = Snackbar.Make(FindViewById(Android.Resource.Id.Content), "Searching for invoices...", Snackbar.LengthIndefinite);
         mLoadingMessageSnackbar.View.SetBackgroundColor(Color.DarkGray);
         mLoadingMessageSnackbar.Show();
     });
 }