protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
                                                      .CacheInMemory(false)
                                                      .ShowImageOnLoading(Resource.Drawable.main)
                                                      .ResetViewBeforeLoading(false)
                                                      .CacheOnDisk(false).Build();
            ImageLoaderConfiguration imagaeLoaderConfigurtaion = new ImageLoaderConfiguration.Builder(ApplicationContext)
                                                                 .DefaultDisplayImageOptions(displayImageOptions)
                                                                 .Build();

            ImageLoader.Instance.Init(imagaeLoaderConfigurtaion);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_navigation);
            mTts     = new TextToSpeech(this, this, "com.google.android.tts");
            mToolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolbar);
            if (Intent.GetStringExtra("source") != null)
            {
                mSourceAddress = Intent.GetStringExtra("source");
            }
            typeface       = Typeface.CreateFromAsset(this.Assets, "JosefinSans-SemiBold.ttf");
            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)));
            mSharedPreference      = GetSharedPreferences(Constants.MY_PREF, 0);
            mDrawerLayout          = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            mActionBarDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, Resource.String.openD, Resource.String.closedD);
            mDrawerLayout.AddDrawerListener(mActionBarDrawerToggle);
            mActionBarDrawerToggle.SyncState();
            mNavigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            mNavigationView.ItemIconTintList = null;
            mNavigationView.SetNavigationItemSelectedListener(this);
            View headerLayout = mNavigationView.GetHeaderView(0);

            mTextView = headerLayout.FindViewById <TextView>(Resource.Id.nametodisplay);
            mTextView.SetTypeface(typeface, TypefaceStyle.Normal);
            mTextView.Text = mSharedPreference.GetString("name", " ");
            if (bundle == null)
            {
                mFragment = new MapViewFragment(this);
                FragmentManager.BeginTransaction().Replace(Resource.Id.nav_frame, mFragment).Commit();
            }
            // handle deep link here
            var x = Intent;

            System.Diagnostics.Debug.WriteLine(x.Action);
            var nmLocaiton = "NO MEETING DATA FOUND";

            if (Intent.ActionView.Equals(x.Action))
            {
                var uri = x.Data;
                nmLocaiton = uri.GetQueryParameter("nmlocation");
            }
            System.Diagnostics.Debug.Write("Deep Link: " + nmLocaiton);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            if (!isOnline())
            {
                mErrorDialog.Show();
                return;
            }
            SetContentView(Resource.Layout.activity_get_started);
            mLocationManager = GetSystemService(LocationService) as LocationManager;
            mTts             = new TextToSpeech(this, this, "com.google.android.tts");
            speech           = SpeechRecognizer.CreateSpeechRecognizer(this);
            speech.SetRecognitionListener(this);
            Criteria mLocationServiceCriteria = new Criteria
            {
                Accuracy         = Accuracy.Coarse,
                PowerRequirement = Power.Medium
            };
            IList <string> acceptableLocationProviders = mLocationManager.GetProviders(mLocationServiceCriteria, true);

            if (acceptableLocationProviders.Any())
            {
                mLocationProvider = acceptableLocationProviders.First();
            }
            else
            {
                mLocationProvider = string.Empty;
            }
            mSharedPreference = GetSharedPreferences(Constants.MY_PREF, 0);
            token             = mSharedPreference.GetString("token", " ");
            mEditor           = mSharedPreference.Edit();
            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("Contoso Cabs");

            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;
            mGetStarted         = FindViewById <Button>(Resource.Id.btnGetStarted);
            mUri      = FindViewById <Button>(Resource.Id.btnuri);
            mSpeak    = FindViewById <ImageView>(Resource.Id.imagespeech);
            mTextView = FindViewById <TextView>(Resource.Id.bookText);
            mTextView.SetTypeface(typeface, TypefaceStyle.Normal);
            mGetStarted.SetTypeface(typeface, TypefaceStyle.Normal);
            mGetStarted.SetOnClickListener(this);
            mUri.SetOnClickListener(this);
            mSpeak.SetOnClickListener(this);
        }
Пример #3
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.activity_signup);
     SupportActionBar.SetDisplayHomeAsUpEnabled(true);
     mErrorDialog = new ErrorDialog(this);
     mErrorDialog.SetCancelable(false);
     if (!isOnline())
     {
         mErrorDialog.Show();
     }
     else
     {
         name           = FindViewById <EditText>(Resource.Id.siname);
         conpass        = FindViewById <EditText>(Resource.Id.siconpass);
         password       = FindViewById <EditText>(Resource.Id.sipass);
         mobile         = FindViewById <EditText>(Resource.Id.simobile);
         email          = FindViewById <EditText>(Resource.Id.siemail);
         signupbtn      = FindViewById <Button>(Resource.Id.signupbtn);
         terms          = FindViewById <CheckBox>(Resource.Id.term1);
         pleaseEnter    = FindViewById <TextView>(Resource.Id.textView1);
         nmbrverify     = FindViewById <TextView>(Resource.Id.nmbrverified);
         tandc          = FindViewById <TextView>(Resource.Id.term2);
         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("SignUp");
         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;
         mSharedPreferences  = GetSharedPreferences(Constants.MY_PREF, 0);
         mEditor             = mSharedPreferences.Edit();
         pleaseEnter.SetTypeface(typeface, TypefaceStyle.Normal);
         nmbrverify.SetTypeface(typeface, TypefaceStyle.Normal);
         tandc.SetTypeface(typeface, TypefaceStyle.Normal);
         signupbtn.SetTypeface(typeface, TypefaceStyle.Normal);
         signupbtn.Click += Signupbtn_Click;
         tandc.Click     += Tandc_Click;
     }
 }
        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();
            }
        }
        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();
            }
        }
Пример #6
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);
            }
        }
Пример #7
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();
            }
        }