예제 #1
0
        private async void Signin_Click(object sender, EventArgs e)
        {
            InputMethodManager inputManager = (InputMethodManager)GetSystemService(InputMethodService);

            inputManager.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0);
            string phonenum = mobile.Text;
            string pass     = password.Text;

            if (pass.Length > 5)
            {
                if (phonenum.Length == 10)
                {
                    mLoadingDialog.Show();
                    CabsAPI        api      = new CabsAPI();
                    SignInResponse response = await api.LoginUser(phonenum, pass);

                    if (response.Code == ResponseCode.SUCCESS)
                    {
                        mLoadingDialog.Dismiss();
                        mEditor.PutString("email", response.Data.Email);
                        mEditor.PutString("mobile", response.Data.Mobile);
                        mEditor.PutString("name", response.Data.Name);
                        mEditor.PutString("token", response.Token);
                        mEditor.PutBoolean("isLoggedIn", true);
                        mEditor.Apply();
                        StartActivity(new Intent(this, typeof(GettingStartedActivity)));
                        Finish();
                    }
                    else
                    {
                        mLoadingDialog.Dismiss();
                        Toast.MakeText(this, "Incorrect Credentials", ToastLength.Short).Show();
                        return;
                    }
                }
                else
                {
                    Toast.MakeText(this, "Phone number must be of 10 digits", ToastLength.Short).Show();
                    return;
                }
            }
            else
            {
                Toast.MakeText(this, "Password must have atleast 6 digits", ToastLength.Short).Show();
                return;
            }
        }
예제 #2
0
        private async void mDestinationTextBoxClicked(object sender, AdapterView.ItemClickEventArgs e)
        {
            dest = destinationSuggestionsAdapter.GetObjectAt(e.Position);
            System.Diagnostics.Debug.Write(dest);
            autoDestinationBox.Text = destinationSuggestionsAdapter.GetObjectAt(e.Position);
            if (msourceRecieved != null && dest != null)
            {
                GeoResponse mResponseGetDestlatlng = await api.GeoCodingResult(token, dest);

                dlat = mResponseGetDestlatlng.Position.Latitude;
                dlng = mResponseGetDestlatlng.Position.Longitude;
                setDestinationMarker(dest);
                mLoadingDialog.Show();
                PriceEstimateResponse mRes = await api.GetEstimate(token, slat, slng, dlat, dlng);

                mCabsEst = mRes.Estimates;
                CabRecyclerAdapterWithDestination mAdapter = new CabRecyclerAdapterWithDestination(Application.Context, mCabsEst, mActivity);
                mAdapter.ItemClick1 += Item_Click_New;
                mRecyclerView.SetAdapter(mAdapter);
                mLoadingDialog.Dismiss();
            }
        }
        protected override async void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            switch (requestCode)
            {
            case 100:

                if (resultCode == Result.Ok && data != null)
                {
                    Intent         mIntent = new Intent(this, typeof(ConfirmedCookingActivityViaSpeech));
                    IList <string> mResult = data.GetStringArrayListExtra(RecognizerIntent.ExtraResults);
                    System.Diagnostics.Debug.WriteLine(mResult[0]);
                    string           command     = mResult[0];
                    Classifier       mClassifier = new Classifier(command);
                    ClassifiedResult mResp       = mClassifier.Classify();
                    switch (mResp.Type)
                    {
                    case VoiceCommandType.BOOK_ME_CHEAPEST_CAB_FROM_X_TO_Y:
                        string recs = mResp.GetData("source");
                        if (!recs.Equals(""))
                        {
                            mSourceAddress = recs;
                        }
                        mDestinationAddress = mResp.GetData("destination");
                        error = "Booking Cheapest cab from " + mSourceAddress + "to" + mDestinationAddress;
                        speakUp();
                        mIntent.PutExtra("mSource", mSourceAddress);
                        mIntent.PutExtra("mDestination", mDestinationAddress);
                        StartActivity(mIntent);
                        break;

                    case VoiceCommandType.BOOK_TO_CUSTOM_LOCATION:
                        mDestinationAddress = mResp.GetData("location");
                        mIntent.PutExtra("mSource", mSourceAddress);
                        mIntent.PutExtra("mDestinationAddress", mDestinationAddress);
                        StartActivity(mIntent);
                        break;


                    case VoiceCommandType.BOOK_ME_A_CAB_FROM_X_TO_Y:
                    {
                        CabsAPI api         = new CabsAPI();
                        string  source      = mResp.GetData("source");
                        string  destination = mResp.GetData("destination");
                        mLoadingDialog.Show();
                        PlacesResponse mResposneSource = await api.GetPlaceLocation(source, token);

                        PlacesResponse mResponseDest = await api.GetPlaceLocation(destination, token);

                        if (mResposneSource.Code == ResponseCode.SUCCESS && mResponseDest.Code == ResponseCode.SUCCESS)
                        {
                            string             msource = mResposneSource.Location.Latitude + "," + mResposneSource.Location.Longitude;
                            string             mDest   = mResponseDest.Location.Latitude + "," + mResponseDest.Location.Longitude;
                            ReverseGeoResposne mResSrc = await api.GetReverseCodingResultlatlng(token, msource);

                            ReverseGeoResposne mResDest = await api.GetReverseCodingResultlatlng(token, mDest);

                            if (mResSrc.Code == ResponseCode.SUCCESS && mResDest.Code == ResponseCode.SUCCESS)
                            {
                                error = "Booking cab from " + source + "to" + destination;
                                speakUp();
                                mLoadingDialog.Dismiss();
                                mSourceAddress      = mResSrc.FormattedAddress;
                                mDestinationAddress = mResDest.FormattedAddress;
                                mIntent.PutExtra("mSource", mSourceAddress);
                                mIntent.PutExtra("mDestination", mDestinationAddress);
                                StartActivity(mIntent);
                            }
                            else
                            {
                                error = "Google maps error";
                                speakUp();
                                return;
                            }
                        }
                        else
                        {
                            error = "These places are not there in your notebook";
                            speakUp();
                            return;
                        }
                        break;
                    }

                    case VoiceCommandType.INVALID_COMMAND:
                        error = "Invalid Commmand Please try again";
                        speakUp();
                        break;
                    }
                }

                break;
            }
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            if (!isOnline())
            {
                mErrorDialog.Show();
            }
            else
            {
                for (int i = 0; i < 2; i++)
                {
                    mOptions[i] = new MarkerOptions();
                }
                base.OnCreate(savedInstanceState);
                SetContentView(Resource.Layout.activity_confirmed_booking);
                Drawable upArrow = Resources.GetDrawable(Resource.Drawable.abc_ic_ab_back_mtrl_am_alpha);
                upArrow.SetColorFilter(Resources.GetColor(Resource.Color.white), PorterDuff.Mode.SrcAtop);
                etaval             = Intent.GetStringExtra("eta");
                high               = Intent.GetStringExtra("high");
                low                = Intent.GetStringExtra("low");
                time               = Intent.GetStringExtra("time");
                sourcestring       = Intent.GetStringExtra("source");
                type               = Intent.GetStringExtra("type");
                deststring         = Intent.GetStringExtra("destination");
                provider           = Intent.GetStringExtra("provider");
                capacity           = Intent.GetStringExtra("capacity");
                distance           = Intent.GetStringExtra("distance");
                fare               = Intent.GetStringExtra("fare");
                mSharedPreferences = GetSharedPreferences(Constants.MY_PREF, 0);
                SupportActionBar.SetHomeAsUpIndicator(upArrow);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                token          = mSharedPreferences.GetString("token", " ");
                mLoadingDialog = new LoadingDialog(this, Resource.Drawable.main);
                mLoadingDialog.SetCancelable(false);
                Window window = mLoadingDialog.Window;
                window.SetLayout(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent);
                window.SetBackgroundDrawable(new ColorDrawable(Resources.GetColor(Resource.Color.trans)));
                SpannableString s = new SpannableString("Successfully Booked");
                typeface = Typeface.CreateFromAsset(this.Assets, "JosefinSans-SemiBold.ttf");
                s.SetSpan(new TypefaceSpan("Amaranth-Regular.ttf"), 0, s.Length(), SpanTypes.ExclusiveExclusive);
                s.SetSpan(new ForegroundColorSpan(this.Resources.GetColor(Resource.Color.title)), 0, s.Length(), SpanTypes.ExclusiveExclusive);
                this.TitleFormatted = s;
                mSource             = FindViewById <TextView>(Resource.Id.sourcetext);
                mDest      = FindViewById <TextView>(Resource.Id.destinationtext);
                eta        = FindViewById <TextView>(Resource.Id.eta);
                dist       = FindViewById <TextView>(Resource.Id.dist);
                price      = FindViewById <TextView>(Resource.Id.price);
                etatext    = FindViewById <TextView>(Resource.Id.etavalue);
                disttext   = FindViewById <TextView>(Resource.Id.distvalue);
                pricetext  = FindViewById <TextView>(Resource.Id.pricevalue);
                drivertext = FindViewById <TextView>(Resource.Id.drivername);
                cartype    = FindViewById <TextView>(Resource.Id.cartype);
                carnumber  = FindViewById <TextView>(Resource.Id.carnumber);
                mProvider  = FindViewById <ImageView>(Resource.Id.cabprovider);
                mDriver    = FindViewById <ImageView>(Resource.Id.driverimage);
                mPhone     = FindViewById <ImageView>(Resource.Id.phoneimage);
                mPhone.SetOnClickListener(this);
                mSource.SetTypeface(typeface, TypefaceStyle.Normal);
                mDest.SetTypeface(typeface, TypefaceStyle.Normal);
                eta.SetTypeface(typeface, TypefaceStyle.Normal);
                etatext.SetTypeface(typeface, TypefaceStyle.Normal);
                price.SetTypeface(typeface, TypefaceStyle.Normal);
                pricetext.SetTypeface(typeface, TypefaceStyle.Normal);
                dist.SetTypeface(typeface, TypefaceStyle.Normal);
                disttext.SetTypeface(typeface, TypefaceStyle.Normal);
                drivertext.SetTypeface(typeface, TypefaceStyle.Normal);
                cartype.SetTypeface(typeface, TypefaceStyle.Normal);
                carnumber.SetTypeface(typeface, TypefaceStyle.Normal);
                mSource.Text   = sourcestring.ToUpperInvariant();
                mDest.Text     = deststring.ToUpperInvariant();
                etatext.Text   = etaval;
                disttext.Text  = distance;
                pricetext.Text = low + "-" + high;
                if (provider.Equals("Uber", StringComparison.InvariantCultureIgnoreCase))
                {
                    mProvider.SetImageResource(Resource.Drawable.uber);
                }
                else
                {
                    mProvider.SetImageResource(Resource.Drawable.ola);
                }
                mcab = new CabsAPI();
                mLoadingDialog.Show();
                GeoResponse mResponse1 = await mcab.GeoCodingResult(token, sourcestring);

                GeoResponse mResponse2 = await mcab.GeoCodingResult(token, deststring);

                if (mResponse1.Code == ResponseCode.SUCCESS && mResponse2.Code == ResponseCode.SUCCESS)
                {
                    slat = mResponse1.Position.Latitude.ToString();
                    slng = mResponse1.Position.Longitude.ToString();
                    dlat = mResponse2.Position.Latitude.ToString();
                    dlng = mResponse2.Position.Longitude.ToString();
                    BookingDetailsResponse mResBooking = await mcab.BookCab(token, slat, slng);

                    if (mResBooking.Code == ResponseCode.SUCCESS)
                    {
                        mLoadingDialog.Dismiss();
                        if (provider.Equals("Uber", StringComparison.InvariantCultureIgnoreCase))
                        {
                            drivertext.Text = mResBooking.BookingData.DriverDetails.Name;
                            cartype.Text    = mResBooking.BookingData.VehicleDetails.Make + " " + mResBooking.BookingData.VehicleDetails.Model;
                            carnumber.Text  = mResBooking.BookingData.VehicleDetails.License_Plate;
                            ImageLoader.Instance.DisplayImage(mResBooking.BookingData.DriverDetails.Picture_Url, mDriver);
                            phonenumner = mResBooking.BookingData.DriverDetails.Phone_Number;
                        }
                        else
                        {
                            phonenumner = "8110020055";
                        }
                    }
                    else
                    {
                    }
                }
                sourcepos = new LatLng(Convert.ToDouble(slat), Convert.ToDouble(slng));
                destpos   = new LatLng(Convert.ToDouble(dlat), Convert.ToDouble(dlng));
                setupGoogleMap();
            }
        }
예제 #5
0
        private async void Signupbtn_Click(object sender, EventArgs e)
        {
            string             nametext, mobiletext, emailtext, passtext, cnfpasstext;
            InputMethodManager inputManager = (InputMethodManager)GetSystemService(InputMethodService);

            inputManager.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0);
            nametext    = name.Text;
            mobiletext  = mobile.Text;
            emailtext   = email.Text;
            passtext    = password.Text;
            cnfpasstext = conpass.Text;
            if (!checkEmpty(nametext, "Name"))
            {
                return;
            }
            else if (!checkEmpty(mobiletext, "Phone number"))
            {
                return;
            }
            else if (!checkEmpty(emailtext, "Email"))
            {
                return;
            }
            else if (!checkEmpty(passtext, "Password"))
            {
                return;
            }
            else if (!checkEmpty(cnfpasstext, "Confirm Password"))
            {
                return;
            }
            else
            {
                if (isNameVaid(nametext) && isMobileValid(mobiletext) && isEmailValid(emailtext) && areTermsAccepted() && isPassValid(passtext) && checkPassValidity(passtext, cnfpasstext))
                {
                    mLoadingDialog.Show();
                    CabsAPI        api      = new CabsAPI();
                    SignupResponse response = await api.RegisterUser(nametext, emailtext, mobiletext, passtext);

                    if (response.Code == Utils.ResponseCode.SUCCESS)
                    {
                        mLoadingDialog.Dismiss();
                        mEditor.PutString("email", emailtext);
                        mEditor.PutString("mobile", mobiletext);
                        mEditor.PutString("name", nametext);
                        mEditor.PutString("token", response.Token);
                        mEditor.PutBoolean("isLoggedIn", true);
                        mEditor.Apply();
                        mTextToSpeech = new TextToSpeech(this, this, "com.google.android.tts");
                        //  new TextToSpeech(con, this, "com.google.android.tts");
                        lang = Java.Util.Locale.Default;
                        //setting language , pitch and speed rate to the voice
                        mTextToSpeech.SetLanguage(lang);
                        mTextToSpeech.SetPitch(1f);
                        mTextToSpeech.SetSpeechRate(1f);
                        mContext = signupbtn.Context;
                        mTextToSpeech.Speak(mSucLog, QueueMode.Flush, null, null);
                        StartActivity(new Intent(this, typeof(NavigationActivity)));

                        Finish();
                    }
                    else if (response.Code == Utils.ResponseCode.MYSQL_DUPLICATES)
                    {
                        mLoadingDialog.Dismiss();
                        Toast.MakeText(this, "User with same number is already present", ToastLength.Short).Show();
                        mobile.Text = "";
                    }
                    else
                    {
                        mLoadingDialog.Dismiss();
                        Toast.MakeText(this, "Server Error Try Again!", ToastLength.Short).Show();
                    }
                }
            }
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            if (!isOnline())
            {
                mErrorDialog.Show();
            }
            else
            {
                SetContentView(Resource.Layout.activity_confirm_details);
                Drawable upArrow = Resources.GetDrawable(Resource.Drawable.abc_ic_ab_back_mtrl_am_alpha);
                upArrow.SetColorFilter(Resources.GetColor(Resource.Color.white), PorterDuff.Mode.SrcAtop);
                eta                = Intent.GetStringExtra("eta");
                high               = Intent.GetStringExtra("high");
                low                = Intent.GetStringExtra("low");
                time               = Intent.GetStringExtra("time");
                sourcestring       = Intent.GetStringExtra("source");
                type               = Intent.GetStringExtra("type");
                deststring         = Intent.GetStringExtra("destination");
                provider           = Intent.GetStringExtra("provider");
                capacity           = Intent.GetStringExtra("capacity");
                distance           = Intent.GetStringExtra("distance");
                fare               = Intent.GetStringExtra("fare");
                mSharedPreferences = GetSharedPreferences(Constants.MY_PREF, 0);
                SupportActionBar.SetHomeAsUpIndicator(upArrow);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                token          = mSharedPreferences.GetString("token", " ");
                mLoadingDialog = new LoadingDialog(this, Resource.Drawable.main);
                mLoadingDialog.SetCancelable(false);
                Window window = mLoadingDialog.Window;
                window.SetLayout(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent);
                window.SetBackgroundDrawable(new ColorDrawable(Resources.GetColor(Resource.Color.trans)));
                SpannableString s = new SpannableString("Confirm Booking");
                typeface = Typeface.CreateFromAsset(this.Assets, "JosefinSans-SemiBold.ttf");
                s.SetSpan(new TypefaceSpan("Amaranth-Regular.ttf"), 0, s.Length(), SpanTypes.ExclusiveExclusive);
                s.SetSpan(new ForegroundColorSpan(this.Resources.GetColor(Resource.Color.title)), 0, s.Length(), SpanTypes.ExclusiveExclusive);
                this.TitleFormatted = s;
                mCardView           = FindViewById <CardView>(Resource.Id.mapsviewcard);
                mConfirmButton      = FindViewById <Button>(Resource.Id.btn_request);
                if (provider.Equals("ola", StringComparison.InvariantCultureIgnoreCase))
                {
                    mConfirmButton.SetBackgroundColor(Resources.GetColor(Resource.Color.greenola));
                    mConfirmButton.SetTextColor(Resources.GetColor(Resource.Color.black));
                }
                else
                {
                    mConfirmButton.SetBackgroundColor(Resources.GetColor(Resource.Color.black));
                }
                mSource    = FindViewById <TextView>(Resource.Id.sourcetext);
                mDest      = FindViewById <TextView>(Resource.Id.destinationtext);
                etaText    = FindViewById <TextView>(Resource.Id.etatext);
                etaValue   = FindViewById <TextView>(Resource.Id.etavalue);
                distText   = FindViewById <TextView>(Resource.Id.disttext);
                distValue  = FindViewById <TextView>(Resource.Id.distvalue);
                priceText  = FindViewById <TextView>(Resource.Id.pricetext);
                priceVlaue = FindViewById <TextView>(Resource.Id.pricevalue);
                timeText   = FindViewById <TextView>(Resource.Id.timetext);
                timeValue  = FindViewById <TextView>(Resource.Id.timevalue);
                mConfirmButton.SetTypeface(typeface, TypefaceStyle.Normal);
                mSource.SetTypeface(typeface, TypefaceStyle.Normal);
                mDest.SetTypeface(typeface, TypefaceStyle.Normal);
                etaText.SetTypeface(typeface, TypefaceStyle.Normal);
                etaValue.SetTypeface(typeface, TypefaceStyle.Normal);
                distText.SetTypeface(typeface, TypefaceStyle.Normal);
                distValue.SetTypeface(typeface, TypefaceStyle.Normal);
                priceText.SetTypeface(typeface, TypefaceStyle.Normal);
                priceVlaue.SetTypeface(typeface, TypefaceStyle.Normal);
                timeText.SetTypeface(typeface, TypefaceStyle.Normal);
                timeValue.SetTypeface(typeface, TypefaceStyle.Normal);
                mSource.Text        = sourcestring;
                mDest.Text          = deststring;
                etaValue.Text       = eta;
                distValue.Text      = distance;
                priceVlaue.Text     = low + "-" + high;
                timeValue.Text      = time;
                mConfirmButton.Text = "REQUEST " + type;
                sourcestring        = mSource.Text;
                deststring          = mDest.Text;
                CabsAPI api = new CabsAPI();
                mLoadingDialog.Show();
                GeoResponse mResponse1 = await api.GeoCodingResult(token, sourcestring);

                GeoResponse mResponse2 = await api.GeoCodingResult(token, deststring);

                if (mResponse1.Code == ResponseCode.SUCCESS && mResponse2.Code == ResponseCode.SUCCESS)
                {
                    mLoadingDialog.Dismiss();
                    slat = mResponse1.Position.Latitude.ToString();
                    slng = mResponse1.Position.Longitude.ToString();
                    dlat = mResponse2.Position.Latitude.ToString();
                    dlng = mResponse2.Position.Longitude.ToString();
                }
                sourcepos = new LatLng(Convert.ToDouble(slat), Convert.ToDouble(slng));
                destpos   = new LatLng(Convert.ToDouble(dlat), Convert.ToDouble(dlng));
                mConfirmButton.SetOnClickListener(this);
                setupGoogleMap();
            }
        }
예제 #7
0
        private async void init(View view)
        {
            if (!isOnline())
            {
                mErrorDialog.Show();
            }
            else
            {
                mLoadingDialog = new LoadingDialog(navigationActivity, Resource.Drawable.main);
                mLoadingDialog.SetCancelable(false);
                Window window = mLoadingDialog.Window;
                mCabsApi = new CabsAPI();
                window.SetLayout(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent);
                window.SetBackgroundDrawable(new ColorDrawable(Resources.GetColor(Resource.Color.trans)));
                phone              = view.FindViewById <TextView>(Resource.Id.phonetobeset);
                phonetext          = view.FindViewById <TextView>(Resource.Id.disp1);
                email              = view.FindViewById <TextView>(Resource.Id.emailtobeset);
                emailtext          = view.FindViewById <TextView>(Resource.Id.disp2);
                invite             = view.FindViewById <TextView>(Resource.Id.inv);
                contosomoney       = view.FindViewById <TextView>(Resource.Id.contosomoney);
                moneyamnt          = view.FindViewById <TextView>(Resource.Id.price);
                mbutton            = view.FindViewById <Button>(Resource.Id.logout);
                dispcontact        = view.FindViewById <TextView>(Resource.Id.dispcontact);
                mIdtext1           = view.FindViewById <TextView>(Resource.Id.idtext1);
                mIdtext2           = view.FindViewById <TextView>(Resource.Id.idtext2);
                mAddAccount        = view.FindViewById <Button>(Resource.Id.addAcount);
                mLinear1           = view.FindViewById <LinearLayout>(Resource.Id.linear1);
                mLinear2           = view.FindViewById <LinearLayout>(Resource.Id.linear2);
                mLinearempty       = view.FindViewById <LinearLayout>(Resource.Id.whenempty);
                mSharedPreferences = Activity.GetSharedPreferences(Constants.MY_PREF, 0);
                namerec            = mSharedPreferences.GetString("name", " ");
                mobilerec          = mSharedPreferences.GetString("mobile", " ");
                emailrec           = mSharedPreferences.GetString("email", " ");
                token              = mSharedPreferences.GetString("token", " ");
                email.Text         = emailrec;
                phone.Text         = mobilerec;
                namerec           += " ";
                if (!mSharedPreferences.GetBoolean("hasAccounts", false))
                {
                    mLinear1.Visibility     = ViewStates.Visible;
                    mLinear2.Visibility     = ViewStates.Visible;
                    mIdtext1.Text           = "Not Authorized";
                    mIdtext2.Text           = "Not Authorized";
                    mLinearempty.Visibility = ViewStates.Gone;
                }
                else
                {
                    mLinearempty.Visibility = ViewStates.Gone;
                    mLinear2.Visibility     = ViewStates.Visible;
                    mLinear1.Visibility     = ViewStates.Visible;
                    mLoadingDialog.Show();
                    mIdtext2.Text = "Not Authorized";
                    mIdtext1.Text = "Not Authorized";
                    UserResponse mRes = await mCabsApi.GetProfile(token);

                    System.Diagnostics.Debug.WriteLine("In profile resp code " + mRes.Code);
                    if (mRes.Code == ResponseCode.SUCCESS)
                    {
                        mLoadingDialog.Dismiss();
                        mIdtext1.Text = mRes.User.Accounts.Count > 0 ? "Connected" : "Not Authorized";
                    }
                }
                SpannableString s = new SpannableString(namerec.Substring(0, namerec.IndexOf(' ')));
                typeface = Typeface.CreateFromAsset(navigationActivity.Assets, "JosefinSans-SemiBold.ttf");
                s.SetSpan(new TypefaceSpan("Amaranth-Regular.ttf"), 0, s.Length(), SpanTypes.ExclusiveExclusive);
                s.SetSpan(new ForegroundColorSpan(navigationActivity.Resources.GetColor(Resource.Color.title)), 0, s.Length(), SpanTypes.ExclusiveExclusive);
                navigationActivity.TitleFormatted = s;
                phone.SetTypeface(typeface, TypefaceStyle.Normal);
                phonetext.SetTypeface(typeface, TypefaceStyle.Normal);
                email.SetTypeface(typeface, TypefaceStyle.Normal);
                emailtext.SetTypeface(typeface, TypefaceStyle.Normal);
                invite.SetTypeface(typeface, TypefaceStyle.Normal);
                mbutton.SetTypeface(typeface, TypefaceStyle.Normal);
                contosomoney.SetTypeface(typeface, TypefaceStyle.Normal);
                dispcontact.SetTypeface(typeface, TypefaceStyle.Normal);
                mAddAccount.SetTypeface(typeface, TypefaceStyle.Normal);
                mAddAccount.SetOnClickListener(this);
                invite.SetOnClickListener(this);
                mbutton.SetOnClickListener(this);
            }
        }
예제 #8
0
        public async void init(View rootView)
        {
            if (!isOnline())
            {
                mErrorDialog.Show();
                return;
            }
            api            = new CabsAPI();
            mLoadingDialog = new LoadingDialog(mActivity, Resource.Drawable.main);
            mLoadingDialog.SetCancelable(false);
            Window window = mLoadingDialog.Window;

            window.SetLayout(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent);
            window.SetBackgroundDrawable(new ColorDrawable(Resources.GetColor(Resource.Color.trans)));
            SpannableString s = new SpannableString("Home");

            typeface = Typeface.CreateFromAsset(mActivity.Assets, "JosefinSans-SemiBold.ttf");
            s.SetSpan(new TypefaceSpan("Amaranth-Regular.ttf"), 0, s.Length(), SpanTypes.ExclusiveExclusive);
            s.SetSpan(new ForegroundColorSpan(this.Resources.GetColor(Resource.Color.title)), 0, s.Length(), SpanTypes.ExclusiveExclusive);
            mActivity.TitleFormatted = s;
            mSharedPreference        = mActivity.GetSharedPreferences(Constants.MY_PREF, 0);
            token = mSharedPreference.GetString("token", " ");
            if (mActivity.Intent.GetStringExtra("source") != null)
            {
                msourceRecieved = mActivity.Intent.GetStringExtra("source");
            }
            else
            {
                msourceRecieved = mSharedPreference.GetString("source", "1,ISB Rd,Gachibowli");
            }
            autoSourceBox                 = rootView.FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.sourceauto);
            autoSourceBox.Text            = msourceRecieved;
            sourceSuggestionsAdapter      = new SearchSuggestionsAdapter(mActivity);
            autoSourceBox.Adapter         = sourceSuggestionsAdapter;
            destinationSuggestionsAdapter = new SearchSuggestionsAdapter(mActivity);
            autoSourceBox.ItemClick      += mSourceTextBoxClicked;
            autoDestinationBox            = rootView.FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.destinationauto);
            autoDestinationBox.Adapter    = destinationSuggestionsAdapter;
            autoDestinationBox.ItemClick += mDestinationTextBoxClicked;
            mLoadingDialog.Show();
            mRecyclerView = rootView.FindViewById <RecyclerView>(Resource.Id.cabrecycler);
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(Application.Context);

            mRecyclerView.SetLayoutManager(linearLayoutManager);
            mRecyclerView.AddItemDecoration(new VerticalSpaceItemDecoration(VERTICAL_ITEM_SPACE));
            LayoutInflater inflater    = (LayoutInflater)Activity.GetSystemService(Context.LayoutInflaterService);
            View           Childlayout = inflater.Inflate(Resource.Layout.fragment_google_maps, null);

            if (msourceRecieved != null)
            {
                GeoResponse mResponseGetSourcelatlng = await api.GeoCodingResult(token, msourceRecieved);

                slat         = mResponseGetSourcelatlng.Position.Latitude;
                slng         = mResponseGetSourcelatlng.Position.Longitude;
                hasSourceSet = false;
                setSourceMarker(msourceRecieved);
            }
            CabsResponse response = await api.GetNearbyCabs(slat, slng, Constants.AUTH_TOKEN);

            if (response.Code == ResponseCode.SUCCESS)
            {
                mCabs               = response.Cabs;
                mAdapter            = new CabRecyclerAdapter(Application.Context, mCabs, mActivity);
                mAdapter.ItemClick += OnItemClick;
                mRecyclerView.SetAdapter(mAdapter);
                mLoadingDialog.Dismiss();
            }
        }
    //デバイスから睡眠データを取得する
    IEnumerator GetSleepData(int dataCount, Action <List <string> > onGetCSVPathList, Action <List <string> > onGetCSVNameList)
    {
        //スリープしないように設定
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        //データが存在すれば以下の処理を実行
        Debug.Log("データ取得コマンド");
        CsvHeaderSet(); //GET前に必ず実行する

        //データ取得開始
        LoadingDialog.Show("本体から睡眠データを取得しています。\n" + 0 + "/" + dataCount + "件");
        bool          isSuccess    = false;
        bool          isFailed     = false;
        List <string> filePathList = new List <string>(); //CSVの添付パスリスト
        List <string> fileNameList = new List <string>(); //CSVのファイル名リスト

        BluetoothManager.Instance.SendCommandId(
            3,
            (string data) =>
        {
            //エラー時
            Debug.Log("GetData:failed:" + data);
            isFailed = true;
        },
            (bool success) =>
        {
            Debug.Log("GetData:commandWrite:" + success);
            if (!success)
            {
                isFailed = true;
            }
        },
            (string data) =>
        {
            Debug.Log("GetData:commandResponse:" + data);
            var j        = Json.Deserialize(data) as Dictionary <string, object>;
            bool success = Convert.ToBoolean(j["KEY2"]);
            if (!success)
            {
                isFailed = true;
            }
        },
            (string data) =>
        {
            //データ取得情報
            var json             = Json.Deserialize(data) as Dictionary <string, object>;
            int currentDataCount = Convert.ToInt32(json["KEY1"]);       //現在の取得カウント(例:1件取得完了したら1で返される)
            bool isExistNextData = Convert.ToBoolean(json["KEY2"]);     //TRUEなら次のデータがある
            bool isEndData       = Convert.ToBoolean(json["KEY3"]);     //TRUEなら次のデータはな(Unity側でアプリ処理を行ってから、5秒以内にデータ取得完了応答を返す)
            string csvFilePath   = (string)json["KEY4"];                //CSVのパスの添付パス。dataフォルダ以下のパスが返される(例:/1122334455:66/yyyyMMdd/tmp01.csv)
            csvFilePath          = csvFilePath.Substring(1);            //先頭のスラッシュを取り除く
            string csvFileName   = (string)json["KEY5"];                //CSVのファイル名。最終的にUnity側でDB登録時にリネームしてもらうファイル名(例:20180624182431.csv)
            filePathList.Add(csvFilePath);
            fileNameList.Add(csvFileName);
            LoadingDialog.ChangeMessage("本体から睡眠データを取得しています。\n" + currentDataCount + "/" + dataCount + "件");
            if (isEndData)
            {
                //最後のデータを取得完了すれば
                isSuccess = true;
            }
        });
        yield return(new WaitUntil(() =>
        {
            return isSuccess || isFailed;
        }));

        //スリープ設置解除
        Screen.sleepTimeout = SleepTimeout.SystemSetting;
        LoadingDialog.Dismiss();
        onGetCSVPathList(filePathList.Count > 0 ? filePathList : null);
        onGetCSVNameList(fileNameList.Count > 0 ? fileNameList : null);
        Debug.Log("Return Get Data");
    }