Skip to content

Commit

Permalink
fixed loading notes on startup, fixed sync intervall, account switchi…
Browse files Browse the repository at this point in the history
…ng is no synchronized for better stability
  • Loading branch information
konradrenner committed May 14, 2015
1 parent bd44461 commit 228bce9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public class MainPhoneActivity extends ActionBarActivity implements SyncStatusOb

private final DrawerItemClickedListener drawerItemClickedListener = new DrawerItemClickedListener();

private List<Note> notesList = new ArrayList<Note>();

private NoteAdapter mAdapter;
private ImageButton mFabButton;
Expand Down Expand Up @@ -541,9 +540,6 @@ protected void onPostExecute(Void result) {
//handle visibility
mRecyclerView.setVisibility(View.VISIBLE);

//set data for list
mAdapter.clearNotes();
mAdapter.addNotes(notesList);
mSwipeRefreshLayout.setRefreshing(false);

super.onPostExecute(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void close() {
dbHelper.close();
}

public ActiveAccount switchAccount(String account, String rootFolder){
public synchronized ActiveAccount switchAccount(String account, String rootFolder){
open();
ContentValues values = new ContentValues();
values.put(DatabaseHelper.COLUMN_ROOT_FOLDER, rootFolder);
Expand All @@ -55,7 +55,7 @@ public ActiveAccount switchAccount(String account, String rootFolder){
return currentActive;
}

public ActiveAccount getActiveAccount() {
public synchronized ActiveAccount getActiveAccount() {
if(currentActive == null) {
open();
Cursor cursor = database.query(DatabaseHelper.TABLE_ACTIVEACCOUNT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity {

// Sync interval constants
public static final long SECONDS_PER_MINUTE = 60L;
public static final long SYNC_INTERVAL_IN_MINUTES = 60L;
public static final long SYNC_INTERVAL_IN_MINUTES = 1440L;
public static final long SYNC_INTERVAL = SYNC_INTERVAL_IN_MINUTES * SECONDS_PER_MINUTE;

public final static String KEY_ACCOUNT_NAME = "account_name";
Expand Down

0 comments on commit 228bce9

Please sign in to comment.