Skip to content

Commit 6a3575c

Browse files
#38 Spinner as feedback on initial notes load
Works now when switching to another account, but still does not work on the very first sign in.
1 parent 4baf533 commit 6a3575c

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,13 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
307307
} else if (requestCode == server_settings) {
308308
// Create new Instance with new URL and credentials
309309
db = new NoteSQLiteOpenHelper(this);
310+
adapter.removeAll();
311+
swipeRefreshLayout.setRefreshing(true);
310312
db.getNoteServerSyncHelper().addCallback(new ICallback() {
311313
@Override
312314
public void onFinish() {
313315
setListView(db.getNotes());
316+
swipeRefreshLayout.setRefreshing(false);
314317
}
315318
});
316319
db.synchronizeWithServer();
@@ -345,8 +348,6 @@ public void onNoteClick(int position, View v) {
345348
mActionMode.finish();
346349
}
347350
} else {
348-
349-
350351
Intent intent = new Intent(getApplicationContext(),
351352
NoteActivity.class);
352353

app/src/main/java/it/niedermann/owncloud/notes/android/activity/SettingsActivity.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import android.widget.Toast;
2020

2121
import it.niedermann.owncloud.notes.R;
22-
import it.niedermann.owncloud.notes.persistence.NoteSQLiteOpenHelper;
2322
import it.niedermann.owncloud.notes.util.NotesClientUtil;
2423

2524
/**
@@ -227,8 +226,8 @@ protected void onPostExecute(Boolean isValidLogin) {
227226
editor.putBoolean(SETTINGS_FIRST_RUN, false);
228227
editor.apply();
229228

230-
NoteSQLiteOpenHelper db = new NoteSQLiteOpenHelper(getApplicationContext());
231-
db.synchronizeWithServer();
229+
//NoteSQLiteOpenHelper db = new NoteSQLiteOpenHelper(getApplicationContext());
230+
//db.synchronizeWithServer();
232231

233232
final Intent data = new Intent();
234233
//FIXME send correct note back to NotesListView

app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ public void add(Note note) {
4343
notifyItemChanged(0);
4444
}
4545

46+
/**
47+
* Removes all items from the adapter.
48+
*/
49+
public void removeAll() {
50+
itemList.clear();
51+
notifyDataSetChanged();
52+
}
53+
4654
/**
4755
* Compares the given List of notes to the current internal holded notes and updates the list if necessairy
4856
* @param newNotes List of more up to date notes

0 commit comments

Comments
 (0)