Improve notes insertion
This commit is contained in:
parent
ab0f5b0a47
commit
7b14ef39b4
|
@ -61,6 +61,7 @@ import org.mian.gitnex.helpers.AppDatabaseSettings;
|
|||
import org.mian.gitnex.helpers.Constants;
|
||||
import org.mian.gitnex.helpers.Markdown;
|
||||
import org.mian.gitnex.helpers.SnackBar;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.helpers.attachments.AttachmentUtils;
|
||||
import org.mian.gitnex.helpers.attachments.AttachmentsModel;
|
||||
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
||||
|
@ -232,8 +233,12 @@ public class CreateIssueActivity extends BaseActivity
|
|||
},
|
||||
250));
|
||||
|
||||
fetchNotes();
|
||||
dialogNotes = materialAlertDialogBuilder.show();
|
||||
if (notesApi.getCount() > 0) {
|
||||
fetchNotes();
|
||||
dialogNotes = materialAlertDialogBuilder.show();
|
||||
} else {
|
||||
Toasty.warning(ctx, getResources().getString(R.string.noNotes));
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchNotes() {
|
||||
|
|
|
@ -35,6 +35,10 @@ public class NotesApi extends BaseApi {
|
|||
return notesDao.fetchAllNotes();
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return notesDao.getCount();
|
||||
}
|
||||
|
||||
public Notes fetchNoteById(int noteId) {
|
||||
return notesDao.fetchNoteById(noteId);
|
||||
}
|
||||
|
|
|
@ -33,4 +33,7 @@ public interface NotesDao {
|
|||
|
||||
@Query("DELETE FROM Notes WHERE noteId = :noteId")
|
||||
void deleteNote(int noteId);
|
||||
|
||||
@Query("SELECT COUNT(noteId) FROM Notes")
|
||||
Integer getCount();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:padding="@dimen/dimen16dp">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
|
|
|
@ -854,6 +854,7 @@
|
|||
</plurals>
|
||||
<string name="notesAllDeletionMessage">This will delete all of your notes. This action cannot be undone.</string>
|
||||
<string name="insertNote">Insert a Note</string>
|
||||
<string name="noNotes">No notes found</string>
|
||||
|
||||
<!-- timeline -->
|
||||
<string name="commitsText">commit</string>
|
||||
|
|
Loading…
Reference in New Issue