// Path: src/com/zhongyun/viewer/async/AsyncUtil.java
// public class AsyncUtil {
// 	
// 	 public static <T> void doAsync(final int requestid, final Context pContext, final Callable<T> pCallable, final CallbackMessage<T> pCallback) {  
// 		 new AsyncTask<Void, Void, T>() {
// 			 private Exception mException;  
// 			protected void onPreExecute() {
// 				super.onPreExecute();  
// 			}
// 			 
// 			@Override
// 			protected T doInBackground(Void... params) {
// 				try {  
// 					T result = pCallable.call(); 
// 					return result;
// 				} catch (final Exception e) {
// 					this.mException = e;
// 				}  
// 				return null;
// 			}
// 			
// 			protected void onPostExecute(T result) {
// 				pCallback.onComplete(requestid, result);
// 				if(this.mException != null) {
// 					Log.e("Error", this.mException.toString());
// 				}
// 				super.onPostExecute(result);  
// 			}
// 		 }.execute((Void[]) null);  
// 	 }
// 	 
// }
// 
// Path: src/com/zhongyun/viewer/async/Callable.java
// public interface Callable<T> {
// 
// 	public T call() throws Exception;
// }
// 
// Path: src/com/zhongyun/viewer/async/CallbackMessage.java
// public interface CallbackMessage<T> {
// 	public void onComplete(final int requestid, final T pCallbackValue);
// }
// 
// Path: src/com/zhongyun/viewer/utils/PrefUtils.java
// public class PrefUtils {
// 	
// 	public static final String HAVE_SHOW_GUIDE = "have_show_guide";
// 
// 	public static void putBoolean(Context context, String key, boolean value){
// 		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// 		Editor editor = sp.edit();
// 		editor.putBoolean(key, value);
// 		editor.commit();
// 	}
// 	
// 	public static boolean getBoolean(Context context, String key){
// 		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// 		return sp.getBoolean(key, false);
// 	}
// 	
// 	public static void putString(Context context, String key, String value){
// 		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// 		Editor editor = sp.edit();
// 		editor.putString(key, value);
// 		editor.commit();
// 	}
// 	
// 	public static String getString(Context context, String key){
// 		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// 		return sp.getString(key, "");
// 	}
// }
// 
// Path: src/com/zhongyun/viewer/utils/StringUtils.java
// public class StringUtils {
// 
// 	// Just in case TextUtils.isEmpty() not found on certain system
// 	public static boolean isEmpty(String str){
// 		if(null == str){
// 			return true;
// 		}else if("".equals(str)){
// 			return true;
// 		}
// 		return false;
// 	}
// 	
// 	public static boolean notEmpty(String str) {
//         return (str != null && !str.equals("") && !str.equals("null") && !str.equals("　") && !str.equals(" "));
//     }
// }


import com.zhongyun.viewer.async.AsyncUtil;
import com.zhongyun.viewer.async.Callable;
import com.zhongyun.viewer.async.CallbackMessage;
import com.zhongyun.viewer.http.JsonReturnCode;
import com.zhongyun.viewer.http.JsonSerializer;
import com.zhongyun.viewer.http.UserHttpApi;
import com.zhongyun.viewer.http.bean.JsonReturn;
import com.zhongyun.viewer.utils.PrefUtils;
import com.zhongyun.viewer.utils.StringUtils;
import android.content.Context;
import android.os.Handler;
import android.util.Log;
/*
 * Copyright (C) 2015 iChano incorporation's Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.zhongyun.viewer.login;



public class UserLoginHandler implements Callable<String>, CallbackMessage<String>{
	
	public static final int THIRD_LOGIN = 1;
	Context context;
	int request;
	Handler handler;
	String email,pwd;
	int cidFlag;
	boolean isResigter = false;
	private UserInfo mUserInfo;
	public static final int LOGIN_SUCCESS = 0;
	public static final int LOGIN_FAIL = 1;
	
	public UserLoginHandler(Context context, Handler handler){
		this.context = context;
		this.handler = handler;
		mUserInfo = UserInfo.getUserInfo(context.getApplicationContext());
	}
	
	public void setRequestValue(String email,String pwd){
		this.email = email;
		this.pwd= pwd;
	}
	
	public void doThing(int request){
		this.request = request;
		AsyncUtil.doAsync(request, context, this, this);
	}
	
	@Override
	public void onComplete(int requestid, String pCallbackValue) {
// Path: src/com/zhongyun/viewer/async/AsyncUtil.java
// public class AsyncUtil {
// 	
// 	 public static <T> void doAsync(final int requestid, final Context pContext, final Callable<T> pCallable, final CallbackMessage<T> pCallback) {  
// 		 new AsyncTask<Void, Void, T>() {
// 			 private Exception mException;  
// 			protected void onPreExecute() {
// 				super.onPreExecute();  
// 			}
// 			 
// 			@Override
// 			protected T doInBackground(Void... params) {
// 				try {  
// 					T result = pCallable.call(); 
// 					return result;
// 				} catch (final Exception e) {
// 					this.mException = e;
// 				}  
// 				return null;
// 			}
// 			
// 			protected void onPostExecute(T result) {
// 				pCallback.onComplete(requestid, result);
// 				if(this.mException != null) {
// 					Log.e("Error", this.mException.toString());
// 				}
// 				super.onPostExecute(result);  
// 			}
// 		 }.execute((Void[]) null);  
// 	 }
// 	 
// }
// 
// Path: src/com/zhongyun/viewer/async/Callable.java
// public interface Callable<T> {
// 
// 	public T call() throws Exception;
// }
// 
// Path: src/com/zhongyun/viewer/async/CallbackMessage.java
// public interface CallbackMessage<T> {
// 	public void onComplete(final int requestid, final T pCallbackValue);
// }
// 
// Path: src/com/zhongyun/viewer/utils/PrefUtils.java
// public class PrefUtils {
// 	
// 	public static final String HAVE_SHOW_GUIDE = "have_show_guide";
// 
// 	public static void putBoolean(Context context, String key, boolean value){
// 		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// 		Editor editor = sp.edit();
// 		editor.putBoolean(key, value);
// 		editor.commit();
// 	}
// 	
// 	public static boolean getBoolean(Context context, String key){
// 		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// 		return sp.getBoolean(key, false);
// 	}
// 	
// 	public static void putString(Context context, String key, String value){
// 		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// 		Editor editor = sp.edit();
// 		editor.putString(key, value);
// 		editor.commit();
// 	}
// 	
// 	public static String getString(Context context, String key){
// 		SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
// 		return sp.getString(key, "");
// 	}
// }
// 
// Path: src/com/zhongyun/viewer/utils/StringUtils.java
// public class StringUtils {
// 
// 	// Just in case TextUtils.isEmpty() not found on certain system
// 	public static boolean isEmpty(String str){
// 		if(null == str){
// 			return true;
// 		}else if("".equals(str)){
// 			return true;
// 		}
// 		return false;
// 	}
// 	
// 	public static boolean notEmpty(String str) {
//         return (str != null && !str.equals("") && !str.equals("null") && !str.equals("　") && !str.equals(" "));
//     }
// }


// Path: src/com/zhongyun/viewer/login/UserLoginHandler.java
import com.zhongyun.viewer.async.AsyncUtil;
import com.zhongyun.viewer.async.Callable;
import com.zhongyun.viewer.async.CallbackMessage;
import com.zhongyun.viewer.http.JsonReturnCode;
import com.zhongyun.viewer.http.JsonSerializer;
import com.zhongyun.viewer.http.UserHttpApi;
import com.zhongyun.viewer.http.bean.JsonReturn;
import com.zhongyun.viewer.utils.PrefUtils;
import com.zhongyun.viewer.utils.StringUtils;
import android.content.Context;
import android.os.Handler;
import android.util.Log;

/*
 * Copyright (C) 2015 iChano incorporation's Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.zhongyun.viewer.login;



public class UserLoginHandler implements Callable<String>, CallbackMessage<String>{
	
	public static final int THIRD_LOGIN = 1;
	Context context;
	int request;
	Handler handler;
	String email,pwd;
	int cidFlag;
	boolean isResigter = false;
	private UserInfo mUserInfo;
	public static final int LOGIN_SUCCESS = 0;
	public static final int LOGIN_FAIL = 1;
	
	public UserLoginHandler(Context context, Handler handler){
		this.context = context;
		this.handler = handler;
		mUserInfo = UserInfo.getUserInfo(context.getApplicationContext());
	}
	
	public void setRequestValue(String email,String pwd){
		this.email = email;
		this.pwd= pwd;
	}
	
	public void doThing(int request){
		this.request = request;
		AsyncUtil.doAsync(request, context, this, this);
	}
	
	@Override
	public void onComplete(int requestid, String pCallbackValue) {
		if (StringUtils.isEmpty(pCallbackValue)) {