@ -13,6 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License .
* /
/ *
* 主 要 功 能 : 实 现 GTASK 的 登 录 操 作 , 进 行 GTASK 任 务 的 创 建 , 创 建 任 务 列 表 , 从 网 络 上 获 取 任 务 和 任 务 列 表 的 内 容
* 主 要 使 用 类 或 技 术 : accountManager JSONObject HttpParams authToken Gid
* /
package net.micode.notes.gtask.remote ;
@ -60,7 +64,6 @@ import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater ;
import java.util.zip.InflaterInputStream ;
< < < < < < < HEAD
//标明了这个类的名字
public class GTaskClient {
private static final String TAG = GTaskClient . class . getSimpleName ( ) ; //私有化一个用于日志输出的标签常量
@ -95,40 +98,6 @@ public class GTaskClient {
//GTaskClient 类的一个私有构造方法,使用 private 关键字修饰,表示只能在类内部调用
private GTaskClient ( ) {
mHttpClient = null ; //初始化为null
= = = = = = =
public class GTaskClient {
private static final String TAG = GTaskClient . class . getSimpleName ( ) ;
private static final String GTASK_URL = "https://mail.google.com/tasks/" ;
private static final String GTASK_GET_URL = "https://mail.google.com/tasks/ig" ;
private static final String GTASK_POST_URL = "https://mail.google.com/tasks/r/ig" ;
private static GTaskClient mInstance = null ;
private DefaultHttpClient mHttpClient ;
private String mGetUrl ;
private String mPostUrl ;
private long mClientVersion ;
private boolean mLoggedin ;
private long mLastLoginTime ;
private int mActionId ;
private Account mAccount ;
private JSONArray mUpdateArray ;
private GTaskClient ( ) {
mHttpClient = null ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
mGetUrl = GTASK_GET_URL ;
mPostUrl = GTASK_POST_URL ;
mClientVersion = - 1 ;
@ -139,7 +108,6 @@ public class GTaskClient {
mUpdateArray = null ;
}
< < < < < < < HEAD
//用来获取的实例化对象
public static synchronized GTaskClient getInstance ( ) { //使用 public 关键字修饰,表示可以从任何地方访问
if ( mInstance = = null ) { //首先判断 mInstance 是否为 null, 即判断是否已经存在单例实例
@ -258,121 +226,11 @@ public class GTaskClient {
//尝试登陆Gtask, 这只是一个预先判断令牌是否是有效以及是否能登上GTask的方法,而不是具体实现登陆的方法
= = = = = = =
public static synchronized GTaskClient getInstance ( ) {
if ( mInstance = = null ) {
mInstance = new GTaskClient ( ) ;
}
return mInstance ;
}
public boolean login ( Activity activity ) {
// we suppose that the cookie would expire after 5 minutes
// then we need to re-login
final long interval = 1000 * 60 * 5 ;
if ( mLastLoginTime + interval < System . currentTimeMillis ( ) ) {
mLoggedin = false ;
}
// need to re-login after account switch
if ( mLoggedin
& & ! TextUtils . equals ( getSyncAccount ( ) . name , NotesPreferenceActivity
. getSyncAccountName ( activity ) ) ) {
mLoggedin = false ;
}
if ( mLoggedin ) {
Log . d ( TAG , "already logged in" ) ;
return true ;
}
mLastLoginTime = System . currentTimeMillis ( ) ;
String authToken = loginGoogleAccount ( activity , false ) ;
if ( authToken = = null ) {
Log . e ( TAG , "login google account failed" ) ;
return false ;
}
// login with custom domain if necessary
if ( ! ( mAccount . name . toLowerCase ( ) . endsWith ( "gmail.com" ) | | mAccount . name . toLowerCase ( )
. endsWith ( "googlemail.com" ) ) ) {
StringBuilder url = new StringBuilder ( GTASK_URL ) . append ( "a/" ) ;
int index = mAccount . name . indexOf ( '@' ) + 1 ;
String suffix = mAccount . name . substring ( index ) ;
url . append ( suffix + "/" ) ;
mGetUrl = url . toString ( ) + "ig" ;
mPostUrl = url . toString ( ) + "r/ig" ;
if ( tryToLoginGtask ( activity , authToken ) ) {
mLoggedin = true ;
}
}
// try to login with google official url
if ( ! mLoggedin ) {
mGetUrl = GTASK_GET_URL ;
mPostUrl = GTASK_POST_URL ;
if ( ! tryToLoginGtask ( activity , authToken ) ) {
return false ;
}
}
mLoggedin = true ;
return true ;
}
private String loginGoogleAccount ( Activity activity , boolean invalidateToken ) {
String authToken ;
AccountManager accountManager = AccountManager . get ( activity ) ;
Account [ ] accounts = accountManager . getAccountsByType ( "com.google" ) ;
if ( accounts . length = = 0 ) {
Log . e ( TAG , "there is no available google account" ) ;
return null ;
}
String accountName = NotesPreferenceActivity . getSyncAccountName ( activity ) ;
Account account = null ;
for ( Account a : accounts ) {
if ( a . name . equals ( accountName ) ) {
account = a ;
break ;
}
}
if ( account ! = null ) {
mAccount = account ;
} else {
Log . e ( TAG , "unable to get an account with the same name in the settings" ) ;
return null ;
}
// get the token now
AccountManagerFuture < Bundle > accountManagerFuture = accountManager . getAuthToken ( account ,
"goanna_mobile" , null , activity , null , null ) ;
try {
Bundle authTokenBundle = accountManagerFuture . getResult ( ) ;
authToken = authTokenBundle . getString ( AccountManager . KEY_AUTHTOKEN ) ;
if ( invalidateToken ) {
accountManager . invalidateAuthToken ( "com.google" , authToken ) ;
loginGoogleAccount ( activity , false ) ;
}
} catch ( Exception e ) {
Log . e ( TAG , "get auth token failed" ) ;
authToken = null ;
}
return authToken ;
}
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
private boolean tryToLoginGtask ( Activity activity , String authToken ) {
if ( ! loginGtask ( authToken ) ) {
// maybe the auth token is out of date, now let's invalidate the
// token and try again
< < < < < < < HEAD
//删除过一个无效的authToken, 申请一个新的后再次尝试登陆
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
authToken = loginGoogleAccount ( activity , true ) ;
if ( authToken = = null ) {
Log . e ( TAG , "login google account failed" ) ;
@ -387,7 +245,6 @@ public class GTaskClient {
return true ;
}
< < < < < < < HEAD
//实现登录GTask的具体操作
private boolean loginGtask ( String authToken ) {
int timeoutConnection = 10000 ;
@ -397,22 +254,11 @@ public class GTaskClient {
HttpConnectionParams . setSoTimeout ( httpParameters , timeoutSocket ) ; //设置设置端口超时时间
mHttpClient = new DefaultHttpClient ( httpParameters ) ;
BasicCookieStore localBasicCookieStore = new BasicCookieStore ( ) ; //设置本地cookie
= = = = = = =
private boolean loginGtask ( String authToken ) {
int timeoutConnection = 10000 ;
int timeoutSocket = 15000 ;
HttpParams httpParameters = new BasicHttpParams ( ) ;
HttpConnectionParams . setConnectionTimeout ( httpParameters , timeoutConnection ) ;
HttpConnectionParams . setSoTimeout ( httpParameters , timeoutSocket ) ;
mHttpClient = new DefaultHttpClient ( httpParameters ) ;
BasicCookieStore localBasicCookieStore = new BasicCookieStore ( ) ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
mHttpClient . setCookieStore ( localBasicCookieStore ) ;
HttpProtocolParams . setUseExpectContinue ( mHttpClient . getParams ( ) , false ) ;
// login gtask
try {
< < < < < < < HEAD
String loginUrl = mGetUrl + "?auth=" + authToken ; //设置登录的url
HttpGet httpGet = new HttpGet ( loginUrl ) ; //通过登录的uri实例化网页上资源的查找
HttpResponse response = null ;
@ -423,17 +269,6 @@ public class GTaskClient {
List < Cookie > cookies = mHttpClient . getCookieStore ( ) . getCookies ( ) ;
boolean hasAuthCookie = false ;
for ( Cookie cookie : cookies ) { //看如果存有“GTL”, 则说明有验证成功的有效的cookie
= = = = = = =
String loginUrl = mGetUrl + "?auth=" + authToken ;
HttpGet httpGet = new HttpGet ( loginUrl ) ;
HttpResponse response = null ;
response = mHttpClient . execute ( httpGet ) ;
// get the cookie now
List < Cookie > cookies = mHttpClient . getCookieStore ( ) . getCookies ( ) ;
boolean hasAuthCookie = false ;
for ( Cookie cookie : cookies ) {
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
if ( cookie . getName ( ) . contains ( "GTL" ) ) {
hasAuthCookie = true ;
}
@ -443,21 +278,14 @@ public class GTaskClient {
}
// get the client version
< < < < < < < HEAD
//获取client的内容
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
String resString = getResponseContent ( response . getEntity ( ) ) ;
String jsBegin = "_setup(" ;
String jsEnd = ")}</script>" ;
int begin = resString . indexOf ( jsBegin ) ;
int end = resString . lastIndexOf ( jsEnd ) ;
String jsString = null ;
< < < < < < < HEAD
if ( begin ! = - 1 & & end ! = - 1 & & begin < end ) { //if循环用来在返回的Content中截取从_setup(开始到)}</script>中间的字符串内容, 也就是gtask_url的内容
= = = = = = =
if ( begin ! = - 1 & & end ! = - 1 & & begin < end ) {
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
jsString = resString . substring ( begin + jsBegin . length ( ) , end ) ;
}
JSONObject js = new JSONObject ( jsString ) ;
@ -479,15 +307,11 @@ public class GTaskClient {
return mActionId + + ;
}
< < < < < < < HEAD
//实例化创建一个用于向网络传输数据的对象
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
private HttpPost createHttpPost ( ) {
HttpPost httpPost = new HttpPost ( mPostUrl ) ;
httpPost . setHeader ( "Content-Type" , "application/x-www-form-urlencoded;charset=utf-8" ) ;
httpPost . setHeader ( "AT" , "1" ) ;
< < < < < < < HEAD
return httpPost ; //返回一个空的httpPost实例化对象
}
@ -495,39 +319,21 @@ public class GTaskClient {
private String getResponseContent ( HttpEntity entity ) throws IOException {
String contentEncoding = null ;
if ( entity . getContentEncoding ( ) ! = null ) { //使用getContentEncoding()获取网络上的资源和数据
= = = = = = =
return httpPost ;
}
private String getResponseContent ( HttpEntity entity ) throws IOException {
String contentEncoding = null ;
if ( entity . getContentEncoding ( ) ! = null ) {
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
contentEncoding = entity . getContentEncoding ( ) . getValue ( ) ;
Log . d ( TAG , "encoding: " + contentEncoding ) ;
}
InputStream input = entity . getContent ( ) ;
< < < < < < < HEAD
if ( contentEncoding ! = null & & contentEncoding . equalsIgnoreCase ( "gzip" ) ) { //GZIP是使用DEFLATE进行压缩数据的另一个压缩库
input = new GZIPInputStream ( entity . getContent ( ) ) ;
} else if ( contentEncoding ! = null & & contentEncoding . equalsIgnoreCase ( "deflate" ) ) { //DEFLATE是一个无专利的压缩算法, 它可以实现无损数据压缩
= = = = = = =
if ( contentEncoding ! = null & & contentEncoding . equalsIgnoreCase ( "gzip" ) ) {
input = new GZIPInputStream ( entity . getContent ( ) ) ;
} else if ( contentEncoding ! = null & & contentEncoding . equalsIgnoreCase ( "deflate" ) ) {
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
Inflater inflater = new Inflater ( true ) ;
input = new InflaterInputStream ( entity . getContent ( ) , inflater ) ;
}
try {
InputStreamReader isr = new InputStreamReader ( input ) ;
< < < < < < < HEAD
BufferedReader br = new BufferedReader ( isr ) ; //是一个包装类,它可以包装字符流,将字符流放入缓存里,先把字符读到缓存里,到缓存满了时候,再读入内存,是为了提供读的效率而设计的
= = = = = = =
BufferedReader br = new BufferedReader ( isr ) ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
StringBuilder sb = new StringBuilder ( ) ;
while ( true ) {
@ -542,21 +348,15 @@ public class GTaskClient {
}
}
< < < < < < < HEAD
//通过JSON发送请求
//请求的具体内容在json的实例化对象js中然后传入
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
private JSONObject postRequest ( JSONObject js ) throws NetworkFailureException {
if ( ! mLoggedin ) {
Log . e ( TAG , "please login first" ) ;
throw new ActionFailureException ( "not logged in" ) ;
}
< < < < < < < HEAD
//实例化一个httpPost的对象用来向服务器传输数据, 在这里就是发送请求, 而请求的内容在js里
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
HttpPost httpPost = createHttpPost ( ) ;
try {
LinkedList < BasicNameValuePair > list = new LinkedList < BasicNameValuePair > ( ) ;
@ -565,10 +365,7 @@ public class GTaskClient {
httpPost . setEntity ( entity ) ;
// execute the post
< < < < < < < HEAD
//执行这个请求
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
HttpResponse response = mHttpClient . execute ( httpPost ) ;
String jsString = getResponseContent ( response . getEntity ( ) ) ;
return new JSONObject ( jsString ) ;
@ -592,7 +389,6 @@ public class GTaskClient {
}
}
< < < < < < < HEAD
//创建单个任务
//传入参数是一个.gtask.data.Task包里Task类的对象
public void createTask ( Task task ) throws NetworkFailureException {
@ -600,12 +396,6 @@ public class GTaskClient {
try {
JSONObject jsPost = new JSONObject ( ) ; //利用json获取Task里的内容,并且创建相应的jsPost
= = = = = = =
public void createTask ( Task task ) throws NetworkFailureException {
commitUpdate ( ) ;
try {
JSONObject jsPost = new JSONObject ( ) ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
JSONArray actionList = new JSONArray ( ) ;
// action_list
@ -619,11 +409,7 @@ public class GTaskClient {
JSONObject jsResponse = postRequest ( jsPost ) ;
JSONObject jsResult = ( JSONObject ) jsResponse . getJSONArray (
GTaskStringUtils . GTASK_JSON_RESULTS ) . get ( 0 ) ;
< < < < < < < HEAD
task . setGid ( jsResult . getString ( GTaskStringUtils . GTASK_JSON_NEW_ID ) ) ; //使用task.setGid设置task的new_ID
= = = = = = =
task . setGid ( jsResult . getString ( GTaskStringUtils . GTASK_JSON_NEW_ID ) ) ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
} catch ( JSONException e ) {
Log . e ( TAG , e . toString ( ) ) ;
@ -632,10 +418,7 @@ public class GTaskClient {
}
}
< < < < < < < HEAD
//创建一个任务列表
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
public void createTaskList ( TaskList tasklist ) throws NetworkFailureException {
commitUpdate ( ) ;
try {
@ -662,7 +445,6 @@ public class GTaskClient {
}
}
< < < < < < < HEAD
//同步更新操作
public void commitUpdate ( ) throws NetworkFailureException {
if ( mUpdateArray ! = null ) {
@ -671,24 +453,11 @@ public class GTaskClient {
// action_list
jsPost . put ( GTaskStringUtils . GTASK_JSON_ACTION_LIST , mUpdateArray ) ; //使用jsPost.put, Put的信息包括UpdateArray和ClientVersion
= = = = = = =
public void commitUpdate ( ) throws NetworkFailureException {
if ( mUpdateArray ! = null ) {
try {
JSONObject jsPost = new JSONObject ( ) ;
// action_list
jsPost . put ( GTaskStringUtils . GTASK_JSON_ACTION_LIST , mUpdateArray ) ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
// client_version
jsPost . put ( GTaskStringUtils . GTASK_JSON_CLIENT_VERSION , mClientVersion ) ;
< < < < < < < HEAD
postRequest ( jsPost ) ; //使用postRequest发送这个jspost,进行处理
= = = = = = =
postRequest ( jsPost ) ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
mUpdateArray = null ;
} catch ( JSONException e ) {
Log . e ( TAG , e . toString ( ) ) ;
@ -698,20 +467,13 @@ public class GTaskClient {
}
}
< < < < < < < HEAD
//添加更新的事项
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
public void addUpdateNode ( Node node ) throws NetworkFailureException {
if ( node ! = null ) {
// too many update items may result in an error
// set max to 10 items
if ( mUpdateArray ! = null & & mUpdateArray . length ( ) > 10 ) {
< < < < < < < HEAD
commitUpdate ( ) ; //调用commitUpdate()来提交更新
= = = = = = =
commitUpdate ( ) ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
}
if ( mUpdateArray = = null )
@ -720,10 +482,7 @@ public class GTaskClient {
}
}
< < < < < < < HEAD
//用来移动任务,它通过构建 JSON 对象和发送 POST 请求来实现任务的移动操作
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
public void moveTask ( Task task , TaskList preParent , TaskList curParent )
throws NetworkFailureException {
commitUpdate ( ) ;
@ -733,11 +492,8 @@ public class GTaskClient {
JSONObject action = new JSONObject ( ) ;
// action_list
< < < < < < < HEAD
//type——移动类型, ID——操作的 ID, GTASK_JSON_ID——要移动的任务的 ID
//SOURCE_LIST——要移动任务的原始父任务列表的 ID, DEST_PARENT——要移动任务的新父任务列表的 ID
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
action . put ( GTaskStringUtils . GTASK_JSON_ACTION_TYPE ,
GTaskStringUtils . GTASK_JSON_ACTION_TYPE_MOVE ) ;
action . put ( GTaskStringUtils . GTASK_JSON_ACTION_ID , getActionId ( ) ) ;
@ -745,27 +501,17 @@ public class GTaskClient {
if ( preParent = = curParent & & task . getPriorSibling ( ) ! = null ) {
// put prioring_sibing_id only if moving within the tasklist and
// it is not the first one
< < < < < < < HEAD
//设置优先级ID, 只有当移动是发生在文件中
action . put ( GTaskStringUtils . GTASK_JSON_PRIOR_SIBLING_ID , task . getPriorSibling ( ) ) ;
}
action . put ( GTaskStringUtils . GTASK_JSON_SOURCE_LIST , preParent . getGid ( ) ) ; //设置移动前所属列表
action . put ( GTaskStringUtils . GTASK_JSON_DEST_PARENT , curParent . getGid ( ) ) ; //设置当前所属列表
= = = = = = =
action . put ( GTaskStringUtils . GTASK_JSON_PRIOR_SIBLING_ID , task . getPriorSibling ( ) ) ;
}
action . put ( GTaskStringUtils . GTASK_JSON_SOURCE_LIST , preParent . getGid ( ) ) ;
action . put ( GTaskStringUtils . GTASK_JSON_DEST_PARENT , curParent . getGid ( ) ) ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
if ( preParent ! = curParent ) {
// put the dest_list only if moving between tasklists
action . put ( GTaskStringUtils . GTASK_JSON_DEST_LIST , curParent . getGid ( ) ) ;
}
actionList . put ( action ) ;
< < < < < < < HEAD
//最后将ACTION_LIST加入到jsPost中
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
jsPost . put ( GTaskStringUtils . GTASK_JSON_ACTION_LIST , actionList ) ;
// client_version
@ -780,7 +526,6 @@ public class GTaskClient {
}
}
< < < < < < < HEAD
//用来删除节点,它通过构建 JSON 对象和发送 POST 请求来实现节点的删除操作
public void deleteNode ( Node node ) throws NetworkFailureException {
commitUpdate ( ) ; // 提交更新操作
@ -858,84 +603,11 @@ public class GTaskClient {
JSONObject jsPost = new JSONObject ( ) ; //创建一个新的 JSONObject jsPost 用于存储 POST 请求的数据。
JSONArray actionList = new JSONArray ( ) ; //创建一个新的 JSONArray actionList 用于存列表。
JSONObject action = new JSONObject ( ) ; //创建一个新的 JSONObject action 用于表示单个操作。
= = = = = = =
public void deleteNode ( Node node ) throws NetworkFailureException {
commitUpdate ( ) ;
try {
JSONObject jsPost = new JSONObject ( ) ;
JSONArray actionList = new JSONArray ( ) ;
// action_list
node . setDeleted ( true ) ;
actionList . put ( node . getUpdateAction ( getActionId ( ) ) ) ;
jsPost . put ( GTaskStringUtils . GTASK_JSON_ACTION_LIST , actionList ) ;
// client_version
jsPost . put ( GTaskStringUtils . GTASK_JSON_CLIENT_VERSION , mClientVersion ) ;
postRequest ( jsPost ) ;
mUpdateArray = null ;
} catch ( JSONException e ) {
Log . e ( TAG , e . toString ( ) ) ;
e . printStackTrace ( ) ;
throw new ActionFailureException ( "delete node: handing jsonobject failed" ) ;
}
}
public JSONArray getTaskLists ( ) throws NetworkFailureException {
if ( ! mLoggedin ) {
Log . e ( TAG , "please login first" ) ;
throw new ActionFailureException ( "not logged in" ) ;
}
try {
HttpGet httpGet = new HttpGet ( mGetUrl ) ;
HttpResponse response = null ;
response = mHttpClient . execute ( httpGet ) ;
// get the task list
String resString = getResponseContent ( response . getEntity ( ) ) ;
String jsBegin = "_setup(" ;
String jsEnd = ")}</script>" ;
int begin = resString . indexOf ( jsBegin ) ;
int end = resString . lastIndexOf ( jsEnd ) ;
String jsString = null ;
if ( begin ! = - 1 & & end ! = - 1 & & begin < end ) {
jsString = resString . substring ( begin + jsBegin . length ( ) , end ) ;
}
JSONObject js = new JSONObject ( jsString ) ;
return js . getJSONObject ( "t" ) . getJSONArray ( GTaskStringUtils . GTASK_JSON_LISTS ) ;
} catch ( ClientProtocolException e ) {
Log . e ( TAG , e . toString ( ) ) ;
e . printStackTrace ( ) ;
throw new NetworkFailureException ( "gettasklists: httpget failed" ) ;
} catch ( IOException e ) {
Log . e ( TAG , e . toString ( ) ) ;
e . printStackTrace ( ) ;
throw new NetworkFailureException ( "gettasklists: httpget failed" ) ;
} catch ( JSONException e ) {
Log . e ( TAG , e . toString ( ) ) ;
e . printStackTrace ( ) ;
throw new ActionFailureException ( "get task lists: handing jasonobject failed" ) ;
}
}
public JSONArray getTaskList ( String listGid ) throws NetworkFailureException {
commitUpdate ( ) ;
try {
JSONObject jsPost = new JSONObject ( ) ;
JSONArray actionList = new JSONArray ( ) ;
JSONObject action = new JSONObject ( ) ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
// action_list
action . put ( GTaskStringUtils . GTASK_JSON_ACTION_TYPE ,
GTaskStringUtils . GTASK_JSON_ACTION_TYPE_GETALL ) ;
< < < < < < < HEAD
action . put ( GTaskStringUtils . GTASK_JSON_ACTION_ID , getActionId ( ) ) ; //这里设置为传入的listGid
= = = = = = =
action . put ( GTaskStringUtils . GTASK_JSON_ACTION_ID , getActionId ( ) ) ;
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
action . put ( GTaskStringUtils . GTASK_JSON_LIST_ID , listGid ) ;
action . put ( GTaskStringUtils . GTASK_JSON_GET_DELETED , false ) ;
actionList . put ( action ) ;
@ -953,18 +625,12 @@ public class GTaskClient {
}
}
< < < < < < < HEAD
//用于获取同步账户信息
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
public Account getSyncAccount ( ) {
return mAccount ;
}
< < < < < < < HEAD
//重置更新内容
= = = = = = =
> > > > > > > 3 a7a23b9d2717a31b97b2a5c6deed09784b90564
public void resetUpdateArray ( ) {
mUpdateArray = null ;
}