Skip to content

Commit

Permalink
- Attachment support
Browse files Browse the repository at this point in the history
 - Attachment preview for tablets
 - Bugfixing
  • Loading branch information
konradrenner committed May 2, 2016
1 parent 179c38f commit e4e2071
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "org.kore.kolabnotes.android"
minSdkVersion 16
targetSdkVersion 23
versionCode 67
versionName "2.0.1"
versionCode 68
versionName "2.0.2"

//Running test
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ public class DatabaseHelper extends SQLiteOpenHelper {
+ COLUMN_ROOT_FOLDER + " )" +
"VALUES ('local','Notes');";

private static final String INIT_ACCOUNTS = "insert into "
+ TABLE_ACCOUNTS +
"(" + COLUMN_ACCOUNT + ", "
+ COLUMN_ROOT_FOLDER + " )" +
"VALUES ('local','Notes');";

private final Context context;

public DatabaseHelper(Context context) {
Expand All @@ -161,6 +167,9 @@ public void onCreate(SQLiteDatabase database) {
database.execSQL(CREATE_ATTACHMENT);
database.execSQL(CREATE_ACTIVEACCOUNT);
database.execSQL(INIT_ACTIVEACCOUNT);

database.execSQL(CREATE_ACCOUNTS);
database.execSQL(INIT_ACCOUNTS);
}

@Override
Expand All @@ -184,19 +193,23 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(CREATE_ATTACHMENT);
}
if(oldVersion < 7){
db.execSQL(CREATE_ACCOUNTS);
final ActiveAccountRepository activeAccountRepository = new ActiveAccountRepository(context);
activeAccountRepository.insertAccount(db, "local", "Notes");
createAccountsTable(db);
}
}

private void createAccountsTable(SQLiteDatabase db) {
db.execSQL(CREATE_ACCOUNTS);
final ActiveAccountRepository activeAccountRepository = new ActiveAccountRepository(context);
activeAccountRepository.insertAccount(db, "local", "Notes");

final AccountManager accountManager = AccountManager.get(context);
final Account[] accounts = accountManager.getAccounts();
final AccountManager accountManager = AccountManager.get(context);
final Account[] accounts = accountManager.getAccounts();

for(Account account : accounts){
String email = accountManager.getUserData(account, AuthenticatorActivity.KEY_EMAIL);
String rootFolder = accountManager.getUserData(account,AuthenticatorActivity.KEY_ROOT_FOLDER);
for(Account account : accounts){
String email = accountManager.getUserData(account, AuthenticatorActivity.KEY_EMAIL);
String rootFolder = accountManager.getUserData(account,AuthenticatorActivity.KEY_ROOT_FOLDER);

activeAccountRepository.insertAccount(db, email, rootFolder);
}
activeAccountRepository.insertAccount(db, email, rootFolder);
}
}

Expand Down

0 comments on commit e4e2071

Please sign in to comment.