Skip to content

Commit

Permalink
Update version and close database properly
Browse files Browse the repository at this point in the history
  • Loading branch information
markwinter committed Sep 7, 2014
1 parent 21e519b commit d8eca5e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="im.tox.antox"
android:versionCode="30"
android:versionName="0.12.2" >
android:versionCode="31"
android:versionName="0.12.3" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public void onClickRegisterAccount(View view) {
// Add user to DB
UserDB db = new UserDB(this);
db.addUser(account, "");
db.close();

// Create a tox data file
String ID = "";
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/im/tox/antox/activities/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void onClickLogin(View view) {
if(db.login(account)) {
/* Set that we're logged in and active user's details*/
String[] details = db.getUserDetails(account);
db.close();
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("loggedin", true);
Expand All @@ -93,8 +94,6 @@ public void onClickLogin(View view) {
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}

db.close();
}
}

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/im/tox/antox/data/UserDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ public boolean login(String username) {
cursor.moveToFirst();
int count = cursor.getInt(0);
cursor.close();
db.close();

if(count > 0)
return true;

return false;


}

public String[] getUserDetails(String username) {
Expand Down

0 comments on commit d8eca5e

Please sign in to comment.