set dbname in build.gradle

This commit is contained in:
Eric House 2019-06-28 15:28:55 -07:00 committed by Eric House
parent ee9f3c36f8
commit 2d81135487
2 changed files with 6 additions and 3 deletions

View file

@ -67,6 +67,7 @@ android {
flavorDimensions "variant"//, "abi"
productFlavors {
all {
buildConfigField "String", "DB_NAME", "\"xwdb\"";
buildConfigField "String", "BUILD_INFO_NAME", "\"${BUILD_INFO_NAME}\""
buildConfigField "boolean", "IS_TAGGED_BUILD", "${CURTAG}" == '' ? "false" : "true"
resValue "string", "invite_prefix", "/and/"
@ -102,6 +103,7 @@ android {
}
xw4d {
dimension "variant"
buildConfigField "String", "DB_NAME", "\"xwddb\"";
applicationId "org.eehouse.android.xw4dbg"
manifestPlaceholders = [ FABRIC_API_KEY: "$FABRIC_API_KEY", APP_ID: applicationId, ]
resValue "string", "app_name", "CrossDbg"
@ -116,6 +118,7 @@ android {
xw4dNoSMS {
dimension "variant"
buildConfigField "String", "DB_NAME", "\"xwddb\"";
applicationId "org.eehouse.android.xw4dbg"
manifestPlaceholders = [ FABRIC_API_KEY: "$FABRIC_API_KEY", APP_ID: applicationId, ]
resValue "string", "app_name", "CrossDbg"

View file

@ -46,7 +46,7 @@ public class DBHelper extends SQLiteOpenHelper {
public static final String TABLE_NAME_INVITES = "invites";
public static final String TABLE_NAME_CHAT = "chat";
public static final String TABLE_NAME_LOGS = "logs";
private static final String DB_NAME = "xwdb";
private static final String DB_NAME = BuildConfig.DB_NAME;
private static final int DB_VERSION = 29;
public static final String GAME_NAME = "GAME_NAME";
@ -233,7 +233,7 @@ public class DBHelper extends SQLiteOpenHelper {
public DBHelper( Context context )
{
super( context, DB_NAME, null, DB_VERSION );
super( context, getDBName(), null, DB_VERSION );
m_context = context;
}
@ -263,7 +263,7 @@ public class DBHelper extends SQLiteOpenHelper {
@SuppressWarnings("fallthrough")
public void onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion )
{
Log.i( TAG, "onUpgrade: old: %d; new: %d", oldVersion, newVersion );
Log.i( TAG, "onUpgrade(%s): old: %d; new: %d", db, oldVersion, newVersion );
boolean madeSumTable = false;
boolean madeChatTable = false;