fix add notebook but title is empty

This commit is contained in:
xingxing
2017-02-14 22:47:05 +08:00
committed by houxg
parent f3e5de1d5f
commit 6874a131fb
3 changed files with 10 additions and 2 deletions

View File

@@ -35,6 +35,7 @@ import org.houxg.leamonax.model.User;
import org.houxg.leamonax.service.AccountService;
import org.houxg.leamonax.service.NotebookService;
import org.houxg.leamonax.utils.DisplayUtils;
import org.houxg.leamonax.utils.ToastUtils;
import org.houxg.leamonax.widget.AlphabetDrawable;
import org.houxg.leamonax.widget.TriangleView;
@@ -297,8 +298,13 @@ public class Navigation {
.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
addNotebook(mEdit.getText().toString(), parentNotebookId);
String newName = mEdit.getText().toString();
if (TextUtils.isEmpty(newName)) {
ToastUtils.show(mActivity, R.string.notebook_name_cant_be_empty);
} else {
dialog.dismiss();
addNotebook(newName, parentNotebookId);
}
}
})
.show();

View File

@@ -106,4 +106,5 @@
<string name="leanote">蚂蚁笔记</string>
<string name="conflict_occurs">糟糕,笔记冲突</string>
<string name="host_example">登录接口地址将会是:\n%s/api/auth/login</string>
<string name="notebook_name_cant_be_empty">笔记本名称不能为空</string>
</resources>

View File

@@ -108,5 +108,6 @@
<string name="generate_random_note">Generate random note</string>
<string name="conflict_occurs">Oops! Conflicts occurs</string>
<string name="host_example">For example, login api will be:\n%s/api/auth/login</string>
<string name="notebook_name_cant_be_empty">Notebook\'s name can\'t be empty</string>
</resources>