mirror of
https://github.com/leanote/leanote-android.git
synced 2025-10-15 23:00:55 +00:00
fix wrong condition of local note
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package org.houxg.leamonax.model;
|
package org.houxg.leamonax.model;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.elvishew.xlog.XLog;
|
import com.elvishew.xlog.XLog;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.raizlabs.android.dbflow.annotation.Column;
|
import com.raizlabs.android.dbflow.annotation.Column;
|
||||||
@@ -193,6 +195,14 @@ public class Note extends BaseModel implements Serializable {
|
|||||||
return tagData;
|
return tagData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isTotalEmpty() {
|
||||||
|
return TextUtils.isEmpty(title) && TextUtils.isEmpty(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLocalNote() {
|
||||||
|
return TextUtils.isEmpty(noteId);
|
||||||
|
}
|
||||||
|
|
||||||
public void updateTags() {
|
public void updateTags() {
|
||||||
if (CollectionUtils.isEmpty(tagData)) {
|
if (CollectionUtils.isEmpty(tagData)) {
|
||||||
tags = "";
|
tags = "";
|
||||||
|
@@ -204,7 +204,7 @@ public class NoteService {
|
|||||||
Map<String, RequestBody> requestBodyMap = generateCommonBodyMap(modifiedNote);
|
Map<String, RequestBody> requestBodyMap = generateCommonBodyMap(modifiedNote);
|
||||||
List<MultipartBody.Part> fileBodies = handleFileBodies(modifiedNote, requestBodyMap);
|
List<MultipartBody.Part> fileBodies = handleFileBodies(modifiedNote, requestBodyMap);
|
||||||
Call<Note> call;
|
Call<Note> call;
|
||||||
if (modifiedNote.getUsn() == 0) {
|
if (modifiedNote.isLocalNote()) {
|
||||||
call = ApiProvider.getInstance().getNoteApi().add(requestBodyMap, fileBodies);
|
call = ApiProvider.getInstance().getNoteApi().add(requestBodyMap, fileBodies);
|
||||||
} else {
|
} else {
|
||||||
Note remoteNote = RetrofitUtils.excuteWithException(getNoteByServerId(modifiedNote.getNoteId()));
|
Note remoteNote = RetrofitUtils.excuteWithException(getNoteByServerId(modifiedNote.getNoteId()));
|
||||||
|
Reference in New Issue
Block a user