package com.weather.yogurt.lifequery.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by Yogurt on 16/7/7.
 */
public class Utilty {

    public static boolean parseShares(Context context,JSONObject object) {

    }

    public static boolean parseExpress(Context context,JSONObject object) {

    }

    public static boolean parseTrainTickets(Context context,JSONObject object) {

    }

    public static boolean parseTrademark(Context context,JSONObject object) {

    }

    public static boolean parseExchangeRate(Context context,JSONObject object) {

    }

    public static boolean parseAppleIMEINumber(Context context,JSONObject object) {
    }

    public static boolean parseAttractionsTicketsPrice(Context context,JSONObject object) {
    }

    public static boolean parsePerpetualCalendar(Context context,JSONObject object) {

    }

    public static boolean parseAppleSerialNumber(Context context,JSONObject object) {
    }

    public static boolean parseBankCard(Context context,JSONObject object) {
    }

    public static boolean parseZipCode(Context context,JSONObject object) {
    }

    public static boolean parseIpAddress(Context context,JSONObject object) {
    }

    public static boolean parsePhoneNumberOwnership(Context context, JSONObject object) throws JSONException {
        String errNum=object.getString("errNum");
        if (errNum.equals("0")){
            if (object.getString("retMsg").equals("success")){
                JSONObject retData=object.getJSONObject("retData");
                SharedPreferences.Editor editor= PreferenceManager.getDefaultSharedPreferences(context).edit();
                editor.putString("phone",retData.getString("phone"));
                editor.putString("prefix",retData.getString("prefix"));
                editor.putString("supplier",retData.getString("supplier"));
                editor.putString("province",retData.getString("province"));
                editor.putString("city",retData.getString("city"));
                editor.putString("suit",retData.getString("suit"));
                editor.commit();
                return true;
            }
        }else if (errNum.equals("-1")){
            return false;
        }
        return false;
    }
}

@@ -1797,326 +1797,551 @@
     
-editor.putString(%22phone%22,retData.getString(%22phone%22));%0A                editor.putString(%22prefix%22,retData.getString(%22prefix%22));%0A                editor.putString(%22supplier%22,retData.getString(%22supplier%22));%0A                editor.putString(%22province%22,retData.getString(%22province%22));%0A                editor.putString(%22city%22,
+StringBuffer stringBuffer=new StringBuffer();%0A                stringBuffer.append(%22   %E6%89%8B%E6%9C%BA%E5%8F%B7%E7%A0%81: %22).append(retData.getString(%22phone%22)).append(%22%5Cn%22)%0A                            .append(%22%E6%89%8B%E6%9C%BA%E5%8F%B7%E5%89%8D%E4%B8%83%E4%BD%8D: %22).append(retData.getString(%22prefix%22)).append(%22%5Cn%22)%0A                            .append(  %22%E6%89%8B%E6%9C%BA%E8%BF%90%E8%90%A5%E5%95%86: %22).append(retData.getString(%22supplier%22)).append(%22%5Cn%22)%0A                            .append(%22  %E6%89%8B%E6%9C%BA%E5%BD%92%E5%B1%9E%E5%9C%B0: %22).append(retData.getString(%22province%22)).append(%22%C2%B7%22).append(retData.getString(%22city%22)).append(%22%5Cn%22)%0A                            .append(%22    %E5%8D%A1%E5%8F%B7%E7%B1%BB%E5%88%AB: %22).append(
 retD
@@ -2355,20 +2355,20 @@
 String(%22
-c
+su
 it
-y
 %22));%0A   
@@ -2402,38 +2402,38 @@
 ng(%22
+re
 su
-it%22,retData.get
+lt%22,stringBuffer.to
 String(
-%22suit%22
 ));%0A

complete parse phone number method