Exemplo n.º 1
0
 public void OnReceiveValue(Java.Lang.Object value)
 {
     if (value != null && value.ToString() != _nowPlaying)
     {
         Toast.MakeText(Android.App.Application.Context, value.ToString(), ToastLength.Short).Show();// you will get the value "100
     }
     _nowPlaying = value.ToString();
 }
        public void OnResponse(Java.Lang.Object response)
        {
            Log.Debug("Tag", response.ToString());

            try
            {
                var    result  = JsonConvert.DeserializeObject <ResponseMessage>(response.ToString());
                string message = result.message;

                string status = result.status;

                if (status.Contains("1"))
                {
                    try
                    {
                        JSONObject obj            = result.data;
                        string     partymaster_id = obj.GetString("partymasterid");
                        string     user_id        = obj.GetString("user_id");
                        string     user_fullname  = obj.GetString("user_name");
                        string     user_email     = obj.GetString("user_email");
                        string     user_phone     = obj.GetString("user_phone");
                        string     password       = obj.GetString("user_password");

                        Session_management       sessionManagement = new Session_management(this.Context);
                        ISharedPreferencesEditor editor            = this.Context.GetSharedPreferences(BaseURL.MyPrefreance, FileCreationMode.Private).Edit();
                        editor.PutString(BaseURL.KEY_MOBILE, user_phone);
                        editor.PutString(BaseURL.KEY_PASSWORD, password);
                        editor.Apply();
                        sessionManagement.createLoginSession(partymaster_id, user_id, user_email, user_fullname, user_phone, password);
                        Intent intent = new Intent(Context, typeof(MainActivity));
                        StartActivity(intent);

                        Edit_profile_fragment fm = new Edit_profile_fragment();

                        Android.Support.V4.App.FragmentManager fragmentManager = FragmentManager;
                        fragmentManager.BeginTransaction().Replace(Resource.Id.contentPanel, fm).AddToBackStack(null).Commit();

                        Toast.MakeText(Context, message, ToastLength.Short).Show();
                    }
                    catch (Java.Lang.Exception e)
                    {
                    }


                    Toast.MakeText(this.Context, "" + message, ToastLength.Short).Show();
                }
                else
                {
                    Toast.MakeText(this.Context, "" + message, ToastLength.Short).Show();
                }
            }
            catch (JSONException e)
            {
                e.PrintStackTrace();
            }
        }
        public void Accept(Java.Lang.Object newLayoutInfo)  // Object will be WindowLayoutInfo
        {
            Log.Info(TAG, "===LayoutStateChangeCallback.Accept");
            Log.Info(TAG, newLayoutInfo.ToString());

            splitLayout.UpdateWindowLayout(newLayoutInfo as WindowLayoutInfo);
        }
 /// <summary>
 /// Here we are trying to get a callback from a WiseJ WebMethod, but its not working. result is always null.
 /// https://wisej.com/support/question/forcing-form-toolbutton-click-with-javascript#sabai-entity-content-9216
 /// </summary>
 /// <param name="result"></param>
 public void OnReceiveValue(Java.Lang.Object result)
 {
     if (result.ToString() == "False")
     {
         JavaSystem.Exit(0);
     }
 }
 public void OnSuccess(Java.Lang.Object result)
 {
     ImageService.Instance.LoadUrl(result.ToString())
     .Retry(3, 200)
     .DownSample(100, 100)
     .Into(secprofimg);
 }
        public void OnSuccess(Java.Lang.Object result)
        {
            try
            {
                FireBaseStorageActionArgs fireBaseStorageActionArgs = new FireBaseStorageActionArgs();
                switch (result.Class.CanonicalName)
                {
                case "android.net.Uri.StringUri":
                    var fileURL = result.ToString();
                    fireBaseStorageActionArgs.ReturnType      = FirebaseReturnType.StringURL;
                    fireBaseStorageActionArgs.LocalPictureURL = fileURL;
                    FirebaseActionCompleted(this, fireBaseStorageActionArgs);
                    break;

                case "byte[]":
                    break;

                default:
                    if (result.Class.CanonicalName.ToLower().Contains("string".ToLower()))
                    {
                    }
                    break;
                }
            }
            catch (System.Exception ex)
            {
                var msg = ex.Message + "\n" + ex.StackTrace;
                System.Diagnostics.Debug.WriteLine(msg);
            }
        }
    //object.image.getUrl()
    public string Evaluate(Object obj, string call) {
        if (!call.Contains(".")) { //"object"
            CarpaccioLogger.d(TAG, "call " + call + " on " + obj.GetType().Name);
            return obj.ToString();
        }
	    string function = call.Substring(call.IndexOf('.') + 1); //image.getUrl(); or //image
	    string callToGetObject;
	    if (function.Contains(".")) {
		    callToGetObject = function.Substring(0, function.IndexOf('.')); //image
	    } else {
		    callToGetObject = function; //image
	    }
	    string realCallToGetObject = GetFunctionName(callToGetObject);
	    Object newObject = CarpaccioHelper.callFunction(obj, realCallToGetObject);
	        
	    if (newObject != null) {
		    CarpaccioLogger.d(TAG, "call " + realCallToGetObject + " return =" + newObject.GetType().Name);

		    if (newObject is Java.Lang.String) {
			    return (string) newObject;
		    }
		    if (newObject is Java.Lang.Number) {
			    return String.ValueOf(newObject);
		    }
		    return Evaluate(newObject, function);
	    }
	    CarpaccioLogger.d(TAG, "call " + realCallToGetObject + " return = NULL");

	    return null;
    }
 void IValueCallback.OnReceiveValue(Java.Lang.Object value)
 {
     ResultObject = value;
     if (ResultObject.ToString() == "null")
     {
         ResultObject = ObjectType.None;
     }
 }
 public int CompareTo(Java.Lang.Object obj)
 {
     if (obj is Question)
     {
         return(this.questionIndex - (obj as Question).questionIndex);
     }
     return(this.ToString().CompareTo(obj.ToString()));
 }
Exemplo n.º 10
0
        public void OnSuccess(Java.Lang.Object result)
        {
            Debug.WriteLine("SuccessListener : " + result.ToString());

            if (OnSuccessAction != null)
            {
                OnSuccessAction();
            }
        }
        public override View GetView(FlowLayout parent, int position, Java.Lang.Object s)
        {
            //throw new NotImplementedException();
            TextView tv = (TextView)_mInflater.Inflate(Resource.Layout.tag_item,
                                                       _view, false);

            tv.Text = s.ToString();// .setText(s);
            return(tv);
        }
        public void OnResponse(Java.Lang.Object response)
        {
            progressDialog.Show();
            try
            {
                JSONArray jsonArray = new JSONArray(response.ToString());
                if (jsonArray.Length() > 0)
                {
                    topSellList.Clear();
                    for (int i = 0; i < jsonArray.Length(); i++)
                    {
                        JSONObject jsonObject1   = jsonArray.GetJSONObject(i);
                        string     product_id    = jsonObject1.GetString("itemmastid");
                        string     varient_id    = jsonObject1.GetString("itemmastid");
                        string     product_name  = jsonObject1.GetString("itemid");
                        string     description   = jsonObject1.GetString("itemdesc");
                        string     pprice        = jsonObject1.GetString("selrate");
                        string     quantity      = "50";
                        string     product_image = jsonObject1.GetString("ItemImage");
                        string     mmrp          = jsonObject1.GetString("MRP");
                        string     unit          = jsonObject1.GetString("priunitvalue");
                        string     count         = "0";
                        string     totalOff      = string.Empty;
                        if ((decimal.Parse(mmrp)) > 0)
                        {
                            var savePrice = (decimal.Parse(mmrp) - decimal.Parse(pprice));
                            var per       = (savePrice / (decimal.Parse(mmrp)) * 100);
                            totalOff = System.Math.Round(per, 0).ToString();
                        }

                        int warehouseid = jsonObject1.GetString("WareHouseToId") == "" ? 0 : Convert.ToInt32(jsonObject1.GetString("WareHouseToId"));
                        int rowstate    = 0;

                        CartModel recentData = new CartModel(product_id, product_name, description, pprice, "Unit : " + " " + unit, product_image, "%" + totalOff + " " + "Off", mmrp, count, unit, warehouseid, rowstate);
                        recentData.setVarient_id(varient_id);
                        topSellList.Add(recentData);
                    }
                    topSellingAdapter = new CartAdapter(Activity, topSellList);
                    rv_top_selling.SetLayoutManager(new LinearLayoutManager(this.Activity));
                    rv_top_selling.SetAdapter(topSellingAdapter);
                    topSellingAdapter.NotifyDataSetChanged();
                }
                else
                {
                    string msg = "No Record found";
                    Toast.MakeText(Context, msg, ToastLength.Short).Show();
                }
                progressDialog.Dismiss();
            }
            catch (JSONException e)
            {
                e.PrintStackTrace();
            }
            progressDialog.Dismiss();
        }
Exemplo n.º 13
0
 public void OnReceiveValue(Java.Lang.Object value)
 {
     if (value != null)
     {
         callback(value.ToString());
     }
     else
     {
         callback(null);
     }
 }
        public void OnSuccess(Java.Lang.Object result)
        {
            imgurl = result.ToString();

            Console.WriteLine("imgurl = " + imgurl);


            ImageService.Instance.LoadUrl(imgurl)
            .Retry(3, 200)
            .DownSample(100, 100)
            .Into(secprofimg);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Invokes when EvaluateJavascript gets called
        /// </summary>
        /// <param name="result"></param>
        public async void OnReceiveValue(Java.Lang.Object result)
        {
            try
            {
                var json       = result as Java.Lang.String;
                var str        = result.ToString();
                var jsonObject = Newtonsoft.Json.JsonConvert.DeserializeObject <JsonReturn>(str);
                if (jsonObject != null && !jsonObject.loaded && webview2 == null)
                {
                    await LoadPDF();
                }
                else
                {
                    if (webview2 == null)
                    {
                        mainLayout.RemoveView(webview);
                        webview2 = webview;
                        webview2.SetBackgroundColor(Color.White);
                        webview2.Settings.JavaScriptEnabled = true;
                        webview2.Settings.SetPluginState(WebSettings.PluginState.On);

                        int height = (int)Android.Util.TypedValue.ApplyDimension(Android.Util.ComplexUnitType.Dip, Convert.ToInt32(jsonObject.result), this.Resources.DisplayMetrics);

                        mainLayout.AddView(webview2, new LinearLayout.LayoutParams(1354, height));
                        await Task.Delay(TimeSpan.FromSeconds(2));
                        await CheckIfPDFRendered();
                    }
                    else if (jsonObject.loaded)
                    {
                        if (!check)
                        {
                            check = true;
                            await CheckIfPDFRendered();

                            return;
                        }

                        var image = webview2.ToImage();
                        image.SaveAndAddToGallery(Android.OS.Environment.DirectoryDownloads, Guid.NewGuid().ToString() + ".jpeg", this);
                        Toast.MakeText(this, "Image created added to library", ToastLength.Short).Show();
                    }
                    else
                    {
                        await Task.Delay(TimeSpan.FromSeconds(1));
                        await CheckIfPDFRendered();
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debugger.Log(0, "re", ex.ToString());
            }
        }
Exemplo n.º 16
0
        protected override void OnPostExecute(Java.Lang.Object result)
        {
            if (type.Equals("login"))
            {
                if (!result.Equals("login unsuccessfull"))
                {
                    Intent intent = new Intent(cont, typeof(mainUser));
                    intent.PutExtra("uname", result.ToString());


                    cont.StartActivity(intent);
                }
                else
                {
                    alert1.SetMessage(result.ToString());
                    alert1.Show();
                }
            }


            if (type.Equals("reg"))
            {
                if (result.Equals("insert successfull"))
                {
                    alert1.SetMessage(result.ToString());

                    alert1.SetButton("ok", (c, ev) =>
                    {
                        cont.StartActivity(new Intent(cont, typeof(login)));
                    });
                    alert1.Show();
                }
                else
                {
                    alert1.SetMessage(result.ToString());
                    alert1.Show();
                }
            }
        }
Exemplo n.º 17
0
        public void OnComplete(Java.Lang.Object p0)
        {
            Console.WriteLine(p0.ToString());
            _tv.Text = p0.ToString();

            switch (_loginType)
            {
            case LoginType.Login:
                try
                {
                    var json1  = new JSONObject(p0.ToString());
                    var openid = json1.GetString("openid");
                    var token  = json1.GetString("access_token");
                    var time   = json1.GetString("expires_in");
                    _tencent.OpenId = openid;
                    _tencent.SetAccessToken(token, time);
                }
                catch (JSONException e)
                {
                    e.PrintStackTrace();
                }

                var userInfo = new UserInfo(this, _tencent.QQToken);
                _loginType = LoginType.UserInfo;
                userInfo.GetUserInfo(this);
                break;

            case LoginType.UserInfo:
                var json2 = new JSONObject(p0.ToString());
                break;

            case LoginType.None:
            default:
                break;
            }
        }
Exemplo n.º 18
0
        protected override void OnPostExecute(Object jsonData)
        {
            base.OnPostExecute(jsonData);

            pd.Dismiss();


            if (jsonData == null)
            {
                Toast.MakeText(c, "UnSuccessful,No Data retrieved", ToastLength.Short).Show();
            }
            else
            {
                //PARSER
                new DataParser(c, jsonData.ToString(), lv).Execute();
            }
        }
Exemplo n.º 19
0
        //Override OnPostExecute Methid
        protected override void OnPostExecute(Java.Lang.Object result)
        {
            base.OnPostExecute(result);

            //Dismiss progress dialog
            mProgressDialog.Dismiss();

            //Check if @param result is null
            if (result == null)
            {
                Toast.MakeText(mContext, "Failed fetching data. Try again!\n" + result, ToastLength.Short).Show();
            }
            else
            {
                //Data Parser
                new EstatesAdapter(mContext, result.ToString(), mRecyclerView).Execute();
            }
        }
Exemplo n.º 20
0
        protected override void OnPostExecute(Java.Lang.Object result)
        {
            progressDialog.Dismiss();
            if (result == null)
            {
                return;
            }
            string json = result.ToString();

            //ShowDialog("Server Response",json);
            //Log.e("LOG", "progressDialog.dismiss();");
            try
            {
                JSONObject jsonObject = new JSONObject(json);
                JSONArray  jsonArray  = jsonObject.GetJSONArray("server_response");
                JSONObject jo         = jsonArray.GetJSONObject(0);
                string     code       = jo.GetString("code");
                string     message    = jo.GetString("message");
                // Log.e("LOG", "code: " + code);
                //Log.e("LOG", "message: " + message);
                if (code.Equals("reg_true"))
                {
                    ShowDialog("Registration Success", message, code);
                }
                else if (code.Equals("reg_false"))
                {
                    ShowDialog("Registration Failed", message, code);
                }
                else if (code.Equals("login_true"))
                {
                    Intent i = new Intent(activity, typeof(WelcomeUser));
                    i.PutExtra("message", message);
                    activity.StartActivity(i);
                }
                else if (code.Equals("login_false"))
                {
                    ShowDialog("Login Failed", message, code);
                }
            }
            catch (JSONException e)
            {
                // e.printStackTrace();
            }
        }
Exemplo n.º 21
0
        public bool OnPreferenceChange(Preference preference, Java.Lang.Object newValue)
        {
            string stringValue = newValue.ToString();

            if (Utils.ObjectUtility.CheckInherit(preference.GetType(), typeof(ListPreference)))
            {
                ListPreference listPreference = (ListPreference)preference;
                int            index          = listPreference.FindIndexOfValue(stringValue);

                // Set the summary to reflect the new value.
                preference.Summary = index >= 0 ? listPreference.GetEntries()[index] : null;
            }
            else if (Utils.ObjectUtility.CheckInherit(preference.GetType(), typeof(RingtonePreference)))
            {
                if (Android.Text.TextUtils.IsEmpty(stringValue))
                {
                    // Empty values correspond to 'silent' (no ringtone).
                    preference.SetSummary(Resource.String.pref_ringtone_silent);
                }
                else
                {
                    Ringtone ringtone = RingtoneManager.GetRingtone(preference.Context, Android.Net.Uri.Parse(stringValue));

                    if (ringtone == null)
                    {
                        // Clear the summary if there was a lookup error.
                        preference.Summary = null;
                    }
                    else
                    {
                        // Set the summary to reflect the new ringtone display name.
                        string name = ringtone.GetTitle(preference.Context);
                        preference.Summary = name;
                    }
                }
            }
            else
            {
                preference.Summary = stringValue;
            }

            return(true);
        }
Exemplo n.º 22
0
        public void OnSuccess(Java.Lang.Object result)
        {
            if (result is QuerySnapshot)
            {
                var snapshot = (QuerySnapshot)result;

                //while (!snapshot.IsEmpty)
                //{
                //    snapshot = (QuerySnapshot)result;
                //}

                if (!snapshot.IsEmpty)
                {
                    var documents = snapshot.Documents;

                    listOfUser.Clear();

                    foreach (DocumentSnapshot item in documents)
                    {
                        User user = new User();
                        user.ID       = item.Id;
                        user.Fullname = item.Get("fullname").ToString();
                        user.Email    = item.Get("email") != null?item.Get("email").ToString() : "";

                        user.password = item.Get("password") != null?item.Get("password").ToString() : "";

                        user.imagepath = item.Get("profileimage") != null?item.Get("profileimage").ToString() : "";

                        listOfUser.Add(user);
                    }
                }
                return;
            }

            else
            {
                url = result.ToString();
                return;
            }
        }
Exemplo n.º 23
0
 public void OnSuccess(Java.Lang.Object result)
 {
     imageurls.Add(result.ToString());
 }
 public RequestBuilder GetPreloadRequestBuilder(Java.Lang.Object p0)
 {
     return(GlideImageLoader.GetPreLoadRequestBuilder(ActivityContext, p0.ToString(), ImageStyle.CenterCrop));
 }
Exemplo n.º 25
0
        /**
         * @param v value to convert as string
         * @return Value as object depends on the type
         */
        private Java.Lang.Object convertValue(Java.Lang.Object v)
        {
            if (v == null)
            {
                return(null);
            }
            switch (type)
            {
            case TYPE.INTEGER:
            {
                return(Integer.ParseInt(v.ToString()));
            }

            case TYPE.FLOAT:
            {
                return(Float.ParseFloat(v.ToString()));
            }

            case TYPE.DIMEN:
            {
                return(convertDimenToPixel(v.ToString()));
            }

            case TYPE.COLOR:
            {
                return(convertColor(v.ToString()));
            }

            case TYPE.BOOLEAN:
            {
                string value = v.ToString();
                if (value.Equals("t"))        //.equalsIgnoreCase("t"))
                {
                    return(true);
                }
                else if (value.Equals("f"))        //equalsIgnoreCase("f"))
                {
                    return(false);
                }
                else if (value.Equals("true"))        //equalsIgnoreCase("true"))
                {
                    return(true);
                }
                else if (value.Equals("false"))        //equalsIgnoreCase("false"))
                {
                    return(false);
                }
                return(Integer.ParseInt(value) == 1);
            }

            case TYPE.BASE64:
            {
                try
                {
                    //InputStream stream = new ByteArrayInputStream(Base64.Decode(v.ToString(), Base64.Default));
                    Stream stream = new MemoryStream(Base64.Decode(v.ToString(), Base64.Default));
                    return(BitmapFactory.DecodeStream(stream));
                }
                catch (Java.Lang.Exception e)
                {
                    return(null);
                }
            }

            case TYPE.DRAWABLE:
            {
                JSONObject drawableProperties = (JSONObject)v;

                GradientDrawable gd = new GradientDrawable();

                if (drawableProperties != null)
                {
                    try { gd.SetColor(convertColor(drawableProperties.GetString("COLOR"))); } catch (JSONException e) { }
                    if (drawableProperties.Has("CORNER"))
                    {
                        string cornerValues = null;
                        try
                        {
                            cornerValues = drawableProperties.GetString("CORNER");
                        }
                        catch (JSONException e) { }
                        if (!TextUtils.IsEmpty(cornerValues))
                        {
                            if (cornerValues.Contains("|"))
                            {
                                float[] corners = new float[8];
                                Arrays.Fill(corners, 0);
                                string[] values = cornerValues.Split('\\');        //(.Split("\\|");
                                int      count  = Java.Lang.Math.Min(values.Length, corners.Length);
                                for (int i = 0; i < count; i++)
                                {
                                    try
                                    {
                                        corners[i] = convertDimenToPixel(values[i]);
                                    }
                                    catch (Java.Lang.Exception e)
                                    {
                                        corners[i] = 0f;
                                    }
                                }
                                gd.SetCornerRadii(corners);
                            }
                            else
                            {
                                try
                                {
                                    gd.SetCornerRadius(convertDimenToPixel(cornerValues));
                                }
                                catch (Java.Lang.Exception e)
                                {
                                    gd.SetCornerRadius(0f);
                                }
                            }
                        }
                    }
                    int strokeColor = 0x00FFFFFF;
                    int strokeSize  = 0;
                    if (drawableProperties.Has("STROKECOLOR"))
                    {
                        try { strokeColor = convertColor(drawableProperties.GetString("STROKECOLOR")); } catch (JSONException e) { }
                    }
                    if (drawableProperties.Has("STROKESIZE"))
                    {
                        try { strokeSize = (int)convertDimenToPixel(drawableProperties.GetString("STROKESIZE")); } catch (JSONException e) { }
                    }
                    //gd.SetStroke(strokeSize, strokeColor);
                    gd.SetStroke(strokeSize, new Color(strokeColor));
                }

                return(gd);
            }
            }
            return(v);
        }
Exemplo n.º 26
0
 public string getValueString()
 {
     return(value.ToString());
     //return string.class.cast(value);
 }
Exemplo n.º 27
0
        protected override void OnPostExecute(Java.Lang.Object obj)
        {
            base.OnPostExecute(obj.ToString());

            pro.Cancel();
        }
Exemplo n.º 28
0
        //public virtual unsafe Model.ModelLoaderLoadData BuildLoadData(Java.Lang.Object model, int width, int height, Load.Options options)

        //{

        //    return BuildLoadData(model?.ToString(), width, height, options);

        //}



        public virtual unsafe bool Handles(Java.Lang.Object model)

        {
            return(Handles(model?.ToString()));
        }
Exemplo n.º 29
0
 private bool CheckObjExists(Object obj)
 {
     return(obj == null || obj.ToString().Equals("") || obj.ToString().Trim().Equals("null"));
 }
Exemplo n.º 30
0
 public RequestBuilder GetPreloadRequestBuilder(Object p0)
 {
     return(FullGlideRequestBuilder.Load(p0.ToString()));
 }
Exemplo n.º 31
0
 public void OnSuccess(Java.Lang.Object p0, int p1)
 {
     var aaa = p0.ToString();
     var bb  = p1;
 }