async void FetchSumaryFromServer(int testid) { CustomProgressDialog cpd = new CustomProgressDialog(Activity); cpd.SetCancelable(false); cpd.Show(); var apiresponse = RestService.For <ApiConnectionForTestPackage>(Utility.stapibaseUrl); var responseforsummary = await apiresponse.GetTestSummary(MainActivity1.userid + "", testid + ""); List <TestSummaryDataModel> summarylist = JsonConvert.DeserializeObject <List <TestSummaryDataModel> >(responseforsummary.Data); cpd.DismissDialog(); var intent = new Intent(Activity, typeof(TestSummary)); intent.PutExtra("path", "portal"); intent.PutExtra("testsummarylist", responseforsummary.Data); Activity.StartActivityForResult(intent, 102); Activity.OverridePendingTransition(Resource.Animation.slide_left, Resource.Animation.hold); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.TestSelection); pref = GetSharedPreferences("login", FileCreationMode.Private); edit = pref.Edit(); banned = pref.GetBoolean("banned", false); //if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) != (int)Permission.Granted) //{ // if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.WriteExternalStorage)) // { // } // else // { // ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.WriteExternalStorage }, 101); // } //} //if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted) //{ // if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.ReadExternalStorage)) // { // } // else // { // ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.ReadExternalStorage }, 102); // } //} Utility.intalizejson(); JsonConvert.DefaultSettings = () => new JsonSerializerSettings() { ContractResolver = new CamelCasePropertyNamesContractResolver(), Converters = { new StringEnumConverter() } }; toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); //For showing back button SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); toolbar.SetTitle(Resource.String.MyRequest); mRecycleView = FindViewById <RecyclerView>(Resource.Id.mytestselectionlist); mLayoutManager = new GridLayoutManager(this, 3); mRecycleView.SetLayoutManager(mLayoutManager); cp = new CustomProgressDialog(this); cp.SetCancelable(false); cp.Show(); if (Utility.IsNetworkConnected(this)) { Callapi(); } else { cp.Dismiss(); Toast.MakeText(this, "Check your internet connection", ToastLength.Short).Show(); } if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) != (int)Permission.Granted) { if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.WriteExternalStorage)) { } else { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.WriteExternalStorage }, 101); } } if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted) { if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.ReadExternalStorage)) { } else { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.ReadExternalStorage }, 102); } } // Create your application here }