Esempio n. 1
0
 private void m13519a(String str, ArrayList<ba> arrayList, int i) {
   m13512a(i, this.f9632p.getFoodCategory().getName());
   if (!(this.f9624h == null
       || this.f9624h.m13218d() == null
       || this.f9624h.m13218d().getConfigurationResponse() == null)) {
     str = this.f9624h.m13218d().getConfigurationResponse().getCityTag();
   }
   JSONObject jSONObject = new JSONObject();
   try {
     if (TextUtils.isEmpty(str)) {
       jSONObject.put("city_name", Ola.f11504u != null ? Ola.f11504u : "Bangalore");
     } else {
       jSONObject.put("city_name", str);
     }
   } catch (JSONException e) {
     e.printStackTrace();
   }
   JSONObject jSONObject2 = new JSONObject();
   try {
     jSONObject2.put(Constants.USER_ID, this.f9624h.m13209c().getUserId());
     jSONObject2.put(
         "items", JSONArrayInstrumentation.init(new Gson().m12346a((Object) arrayList)));
     jSONObject2.put("order_date", System.currentTimeMillis());
     jSONObject2.put("attributes", jSONObject);
     if (!(this.f9624h == null || this.f9624h.m13209c().getUserLocation() == null)) {
       jSONObject2.put("latitude", this.f9624h.m13209c().getUserLocation().getLatitude());
       jSONObject2.put("longitude", this.f9624h.m13209c().getUserLocation().getLongitude());
     }
   } catch (Throwable e2) {
     OLog.m13310a("Failed to form order JSON", e2);
   }
   this.f9624h.m13191a(new WeakReference(this.f9619c), jSONObject2, f9615b);
 }
Esempio n. 2
0
 public static ArrayList<String> m14901a(Context context, String str) {
   String string = PreferenceManager.getDefaultSharedPreferences(context).getString(str, null);
   ArrayList<String> arrayList = new ArrayList();
   if (string != null) {
     try {
       JSONArray init = JSONArrayInstrumentation.init(string);
       for (int i = 0; i < init.length(); i++) {
         arrayList.add(init.optString(i));
       }
     } catch (JSONException e) {
       e.printStackTrace();
     }
   }
   return arrayList;
 }
Esempio n. 3
0
 public static void m14902a(Context context, String str, ArrayList<String> arrayList) {
   Editor edit = PreferenceManager.getDefaultSharedPreferences(context).edit();
   JSONArray jSONArray = new JSONArray();
   for (int i = 0; i < arrayList.size(); i++) {
     jSONArray.put(arrayList.get(i));
   }
   if (arrayList.isEmpty()) {
     edit.putString(str, null);
   } else {
     edit.putString(
         str,
         !(jSONArray instanceof JSONArray)
             ? jSONArray.toString()
             : JSONArrayInstrumentation.toString(jSONArray));
   }
   edit.apply();
 }